; docformat = 'rst' ; ; NAME: ; plotAuthorPosition ; PURPOSE: ; Plot a histogram of author position among co-authors. ; ;+ ; :Description: ; Plot a histogram of author position among co-authors. ; ; :Categories: ; Bibliography ; ; :Params: ; author: in, required, type=string ; An author's name ; bib: in, required, type=structure ; A structure of bibliography information. ; ; :Keywords: ; config: in, optional, type=structure/string ; Configuration structure (see bibliLoadConfig) or path to it. ; dump: in, optional, type=string, default='./bibHistoAuthor.png' ; Path to the figure file. ; ; :Examples: ; ; :Uses: ; ; :Author: ; B.Carry (OCA) ; ; :History: ; Change History:: ; Written in October 2015, B. Carry (OCA) ;- pro plotAuthorPosition, author, bib, dump, config=config ;-----------------------------------------------------------------------------------------------; ;-----------------------------------------------------------------------------------------------; ;--- TAG --- I -- Initialization And Input Verification -----------------------; ;-----------------------------------------------------------------------------------------------; ;-----------------------------------------------------------------------------------------------; COMPILE_OPT hidden, idl2 ;--I.1-- Verify Input Syntax ---------------------------------------------------------- if not keyword_set(bib) or not keyword_set(author) then begin message, /IOERROR, 'Syntax error: plotAuthorPosition, author, bib [, dump, config=]' return endif nbBib = n_elements(bib) ;--I.2-- Set Default Figure Name ------------------------------------------------------ if not keyword_set(dump) then dump='./bibHistoAuthor.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( 'plotauthorposition' ) biblioPATH = strmid( biblioPATH, 0, strlen(biblioPATH)-22) ;--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-- Build Position Histogram array ----------------------------------------------- nbBin = 20 histo = intarr(nbBin+1) histo2= intarr(nbBin+1) xArr = indgen(nbBin) ;--II.2-- Prepare the Author's Name for Search ------------------------------------------ autLen = strlen(author) ;--II.3-- Find the Value of the H-Index -------------------------------------------------- pos=0 for kBib=0, nbBib-1 do begin pAut = where( strcmp( author, (*bib[kBib].authors), /fold, autLen) ) if pAut[0] eq -1 then begin print, 'WTF!!' endif nbAuthor = n_elements( *bib[kBib].authors ) frac = (pAut[0]*1.)*nbBin/nbAuthor frac2= (pAut[0]+1.)*nbBin/nbAuthor print, bib[kBib].id, frac, frac2, pAut[0], nbAuthor, format='(A-30,1x, I3,1x,I3,1x,I3,1x,I3)' histo2[frac]++ histo[frac:frac2]++ if frac2 gt frac then nn = ceil(frac2-frac) else nn=1 pos=[pos,frac+indgen(nn)] endfor pos=pos[1:nbBib] ; cgHistoPlot, pos, nBins=nbBin ;stop print, '' print, histo cgplot, xarr, histo, psym=10 cgplot, xarr, histo2, psym=10, /over, color='blue' ;-do some quartiles analysis ; top 25%... 50 75 stop ;--II.3-- Look'n'Feel Options ------------------------------------------------------------ set = where( strcmp(confTag,'hIndex',/fold) ) set=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.08,0.17,0.92,0.95] ;-----------------------------------------------------------------------------------------------; ;-----------------------------------------------------------------------------------------------; ;--- 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, histo, /NoData, /NORMAL, $ position=plotPosition, $ xStyle=1, xRange=[0,nbBin-1], xminor=2, $ yStyle=1, $ xTitle='Position in co-authors (%)', $ yTitle='Number of citations' ;-----------------------------------------------------------------------------------------------; ;-----------------------------------------------------------------------------------------------; ;--- TAG --- IV -- Plot with Coyote Graphic System -----------------------; ;-----------------------------------------------------------------------------------------------; ;-----------------------------------------------------------------------------------------------; ;--IV.1-- Plot the H-Index Statistics ------------------------------------------------- ;--VI.1-- Close PS File ----------------------------------------------------------------- cgPS_close, /png, Delete_PS=1 ;--VI.3-- Revert Device & Decomposed Mode Status --------------------------------------- set_plot, thisDevice SetDecomposedState, theState end