; docformat = 'rst' ; ; NAME: ; plotHindex ; PURPOSE: ; Plot a H-index curve. ; ;+ ; :Description: ; Plot a H-index curve. ; ; :Categories: ; Bibliography ; ; :Params: ; bib: in, required, type=structure ; A structure of bibliography information. ; cit: in, required, type=intarr ; The number of citations corresponding to each entry in the bib structure. ; ; :Keywords: ; config: in, optional, type=structure/string ; Configuration structure (see bibliLoadConfig) or path to it. ; dump: in, optional, type=string, default='./bibHindex.png' ; Path to the figure file. ; ; :Examples: ; ; :Uses: ; Coyote Graphic System ; ; :Author: ; B.Carry (OCA) ; ; :History: ; Change History:: ; Written in October 2015, B. Carry (OCA) ; 2017 May - B. Carry (OCA) - Improved readability of Y-axis ;- pro plotHindex, bib, cit, dump, yLog=yLog, config=config COMPILE_OPT hidden, idl2 ;-----------------------------------------------------------------------------------------------; ;-----------------------------------------------------------------------------------------------; ;--- TAG --- I -- Initialization And Input Verification -----------------------; ;-----------------------------------------------------------------------------------------------; ;-----------------------------------------------------------------------------------------------; ;--I.1-- Verify Input Syntax ---------------------------------------------------------- if not keyword_set(bib) or not keyword_set(cit) then begin message, /IOERROR, 'Syntax error: plotHindex, bib, cit [, config=]' return endif ;--I.2-- Set Default Figure Name ------------------------------------------------------ if not keyword_set(dump) then dump='./bibHindex.eps' ;--I.3-- Test File for Writing -------------------------------------------------------- ; if not file_test(dump,/write) then begin ; message, /IOERROR, 'Output file cannot be generated: '+strtrim(dump,2) ; return ; endif ;--I.4-- Default Configuration -------------------------------------------------------- ;--I.4.1-- Sources Directory biblioPATH = ROUTINE_FILEPATH( 'plothindex' ) biblioPATH = strmid( biblioPATH, 0, strlen(biblioPATH)-14) ;--I.4.2-- Read Configuration File confDefault = biblioLoadConfig(biblioPATH+'config.ini') ;--I.4.3-- Use Default Configuration, OR, if not keyword_set(conf) then conf=confDefault else begin dimC=size(conf) ;--I.4.3/A-- Use Provided Configuration if dimC[dimC[0]+1] eq 8 then begin conf = updateStructure( confDefault, conf ) ;--I.4.3/B-- Read & Use Provided Configuration endif else begin conf = biblioLoadConfig( conf ) conf = updateStructure( confDefault, conf ) endelse endelse confTag = tag_names(conf) ;-----------------------------------------------------------------------------------------------; ;-----------------------------------------------------------------------------------------------; ;--- TAG --- II -- Prepare the Bibliography for Plotting -----------------------; ;-----------------------------------------------------------------------------------------------; ;-----------------------------------------------------------------------------------------------; ;--II.1-- Sort Entries according to Citations ------------------------------------------ nbBib=n_elements(bib) ord = reverse(sort(cit)) xArr = indgen(nbBib) ;--II.2-- Find the Value of the H-Index -------------------------------------------------- diff = cit[ord] - xArr trash = max( where(diff ge 0), pH ) hVal = xArr[pH]+1 ;--II.3-- Look'n'Feel Options ------------------------------------------------------------ set = where( strcmp(confTag,'hIndex',/fold) ) setH=set[0] set = where( strcmp(confTag,'citations',/fold) ) setC=set[0] ; xKey = yearL + 1.5 ; xLen = 1 ; yKey = max(histoAll)*0.10 ; yLen = max(histoAll)*0.08 ; yShi = max(histoAll)*0.12 plotPosition = [0.10,0.17,0.97,0.95] minCit=1 numRange = [minCit, max([5,cit])] yTickInt= 5 yMinor = 5 xRange = [0,80] if numRange[1] gt 20 then begin yTickInt= 10 yMinor = 5 endif if numRange[1] gt 100 then begin yTickInt= 20 yMinor = 5 numRange[1]=1000 endif ;-----------------------------------------------------------------------------------------------; ;-----------------------------------------------------------------------------------------------; ;--- TAG --- III -- Plot with Coyote Graphic System -----------------------; ;-----------------------------------------------------------------------------------------------; ;-----------------------------------------------------------------------------------------------; ;--III.1-- Save Current Device Status -------------------------------------------------- SetDecomposedState, 1, CurrentState=theState thisDevice = !D.Name ;--III.2-- Set Device to PS & Define Graphic Window ------------------------------------ set_plot, 'PS' cgPS_open, Filename=dump, /metric, /decomposed, /encapsulated, $ xsize=30, ysize=15, language_level=2, /quiet ;--III.3-- Set Graphics Area ----------------------------------------------------------- cgPlot, xArr, cit, /NoData, /Normal, yLog=yLog, $ position=plotPosition, $ xStyle=1, xRange=xRange, $ yStyle=1, yRange=numRange, $ xMinor=2, xTickInterval=10,$ yMinor=yMinor, yTickInterval=yTickInt, $ xTitle='Number of articles', $ yTitle='Number of citations' if numRange[1] gt 100 then begin cgPlot, /OverPlot, xRange, [1,1]*1e1, lineStyle=0, color='Light Gray' cgPlot, /OverPlot, xRange, [1,1]*1e2, lineStyle=0, color='Light Gray' endif for kX=10, xRange[1],10 do $ cgPlot, /OverPlot, kX*[1,1], numRange, lineStyle=0, color='Light Gray' ;-----------------------------------------------------------------------------------------------; ;-----------------------------------------------------------------------------------------------; ;--- TAG --- IV -- Plot with Coyote Graphic System -----------------------; ;-----------------------------------------------------------------------------------------------; ;-----------------------------------------------------------------------------------------------; ;--IV.1-- Plot the H-Index Statistics ------------------------------------------------- ; cgPlot, /OverPlot, xArr, cit[ord], thick=conf.(set).thick, line=conf.(set).line ;-TBD: make it barplot ;-TBD: Identify the reference? Carry+2008? bWidth = 1.0 for kBib=0, nbBib-1 do begin x = xArr[kBib] + [0,1,1,0,0]*bWidth y = [minCit,minCit, cit[ord[kBib]], cit[ord[kBib]],minCit] cgColorFill, x, y, color=conf.(setH).color cgPlot, /OverPlot, x, y endfor ;--IV.2-- Plot the H-Index Statistics ------------------------------------------------- ; cgPlot, /OverPlot, xArr[pH], cit[ord[pH]], psym=conf.(set).symbol, $ ; color=conf.(set).color, thick=conf.(set).thick x = xArr[pH] + [0,1,1,0,0]*bWidth y = cit[ord[pH]]* [minCit,minCit,1,1,minCit] y = [minCit,minCit,cit[ord[pH]],cit[ord[pH]],minCit] cgColorFill, x, y, color=conf.(setC).color cgPlot, /OverPlot, x, y cgText, xArr[pH]+1, cit[ord[pH]]+2, align=0., orientation=90, $ 'H-index = '+strtrim(string(hVal,format='(I)'),2) ; 'H-index = '+strtrim(string(cit[ord[pH]],format='(I)'),2) ;--IV.3-- Draw Axes Again ------------------------------------------------------------- cgPlot, xArr, cit, /NoData, /Normal, /NoErase, yLog=yLog, $ position=plotPosition, $ xStyle=1, xRange=xRange, $ yStyle=1, yRange=numRange, $ xMinor=2, xTickInterval=10,$ yMinor=yMinor, yTickInterval=yTickInt ;--VI.1-- Close PS File ----------------------------------------------------------------- cgPS_close, /png, Delete_PS=1 ;--VI.3-- Revert Device & Decomposed Mode Status --------------------------------------- set_plot, thisDevice SetDecomposedState, theState end