; docformat = 'rst' ; ; NAME: ; plotMap ; PURPOSE: ; CCreate an EPS figure of a map, with longitude/latitude grid, color bar, geometry deformation... ;+ ; :Description: ; Create an EPS figure of a map, with longitude/latitude grid, color bar, geometry deformation... ; ; :Categories: ; Mapping ; ; :Params: ; map: in, required, type=array ; Array to be plotted as a map ; ; :Keywords: ; mapINFO: in, optional, type=structure ; Contain mapping geometry information: ; .geo : Projection geometry code ; .lat : Projection Reference Latitude ; .long: Reference Longitude ; .rot : Projection Rotation ; ; showGrid: in, optional, type=boolean, default=0 ; Draw the grid on the map ; gridINFO: in, optional, type=structure ; Contain map grid information: ; .longSpace : Grid Latitude Spacing ; .latSpace : Grid Longitude Spacing ; .longPos : Longitude Label Position ; .latPos : Latitude Label Position ; .labelFreq : Label Frequency ; .lineStyle : Lines Style ; .lineThick : Lines Thickness ; .inLineCol : Inner Lines Color ; .exLineCol : Outer Lines Color ; ; showScale: in, optional, type=boolean, default=0 ; Plot an intensity scale next to the map ; scaleINFO: in, optional, type=structure ; Contains Color Bar Information: ; .type : Label to plot next to the color bar ; .unit : Unit label to write next to color bar ; .cutMin : Minimum Intensity to be Shown ; .cutMax : Maximum Intensity to be Shown ; .percent: Boolean to Convert Color Scale in Percent to mean value ; .ct : Color Table for the entire figure ; .ratio : Relative size of the color bar ; ; showFlexion: in, optional, type=boolean, default=0 ; Plot an intensity scale next to the map ; flexINFO: in, optional, type=structure ; Contains display information on map flexion ; .latStart : Latitude lower value ; .latEnd : Latitude upper value ; .latStep : Latitude step ; .longStart: Longitude lower value ; .longEnd : Longitude upper value ; .longStep : Longitude step ; .radius : Circle radius ; ; showLabel: in, optional, type=boolean, default=0 ; Display user-supplied label ; labelINFO: in, optional, type=structure ; Contains the printed-text parameters ; .text : String to be printed ; .clip : Boolean for clipping units (0:Data, 1:Normalized) ; .xPos : Text X position ; .yPos : Text Y position ; .alig : Text alignment [0.0 to 1.0] ; .cSiz : Font size ; .cThk : Font thickness ; .cTab : Color table used for text ; ; showData: in, optional, type=boolean, default=0 ; Plot an intensity scale next to the map ; dataINFO: in, optional, type=structure ; Contains the printed-text parameters ; .X : Points X position (data units) ; .Y : Points Y position (data units) ; .Col : Symbol color ; .Sym : Symbol code ; .Siz : Symbol Size ; .Thk : Symbol thickness ; ; showResElt: in, optional, type=boolean, default=0 ; Plot an intensity scale next to the map ; resEltINFO: in, optional, type=structure ; Contains the resolution element parameters ; .size : Size of the Resolution Element in percent of Diameter ; .xPos : Res.Elt X position (normalized) ; .yPos : Res.Elt Y position (normalized) ; .col : Symbol color ; ; nameEPS: in, optional, type=string, default='map.eps' ; Name of the figure file. ; epsINFO: in, optional, type=structure ; Contains the figure file Information: ; .size : EPS Size in cm ; .bord : Percentage occupied by map ; .cSiz : Figure Text Char Size ; .cThk : Figure Text Char Thickness ; ; showContour: in, optional, type=boolean, default=0 ; Draw the level contour on the map ; contourINFO: in, optional, type=structure ; Contains the preferences for contour display ; .level : Contour levels ; .smooth : Smoothing window (0 for non-smoothing) ; .ellipse: Ellipse eval (0: nothing, 1:compute, 2: display, 3: replace) ; .cTab : Color table ; .cVal : Color index ; .cSty : Contour Linestyle ; .cThk : Contour thickness ; ; :Uses: ; cgs, plot_flexion ; ; :Author: ; B.Carry (OCA) ; ; :History: ; Change History:: ; Original Version written in 2007, B. Carry (ESO):: ; 2007 Jan. - B.Carry (ESO) - Keyword update: use of structure ; 2007 Sep. - B.Carry (ESO) - Orthographic Projection Included ; 2007 Nov. - B.Carry (ESO) - Flexion Display via Goldberg modified routine ; 2012 Sep. - B.Carry (ESA) - Plotting extra data points ; 2016 May. - B.Carry (OCA) - Moved to cgs ; 2018 May. - B.Carry (OCA) - Corrected bug on mapINFO.long -> Now adapts to different map gridings ;- pro plotMap, map, mapINFO=mapINFO, $ showGrid=showGrid, gridINFO=gridINFO, $ showScale=showScale, scaleINFO=scaleINFO, $ showFlexion=showFlexion, flexINFO=flexINFO, $ showLabel=showLabel, labelINFO=labelINFO, $ showData=showData, dataINFO=dataINFO, $ showResElt=showResElt, resEltINFO=resEltINFO, $ showContour=showContour, contourINFO=contourINFO, $ nameEPS=nameEPS, epsINFO=epsINFO ;-----------------------------------------------------------------------------------------------; ;-----------------------------------------------------------------------------------------------; ;--- TAG --- I -- Initialization And Input Verification -----------------------; ;-----------------------------------------------------------------------------------------------; ;-----------------------------------------------------------------------------------------------; COMPILE_OPT hidden;, idl2 ;--I.1-- I/O Validity Checks ----------------------------------------------------------------- if not keyword_set(map) then begin message, /ioError, 'Syntax: plotMap, map [,/showGrid, ...]' return endif ;--I.2-- Map Projection Parameters ----------------------------------------------------------- mapDefault={geo: 'ECP', $ ;-Map Projection Geometry lat: 0., $ ;-Map Point of View Latitude long:0., $ ;-Map Point of View Longitude rot: 0. } ;-Map Point of View Rotation Angle if not keyword_set(mapINFO) then mapINFO=mapDefault else mapINFO = updateStructure(mapDefault,mapINFO) ;--I.3-- Grid Parameters --------------------------------------------------------------------- gridDefault={longSpace: 90. ,$ ;-Grid Latitude Spacing latSpace : 30. ,$ ;-Grid Longitude Spacing longPos : 15. ,$ ;-Longitude Label Position latPos : 270.,$ ;-Latitude Label Position labelFreq: 1 ,$ ;-Label Frequency lineStyle: 1 ,$ ;-Lines Style lineThick: 3. ,$ ;-Lines Thick inLineCol: 0 ,$ ;-Inner Lines Color exLineCol: 255 } ;-Outer Lines Color if not keyword_set(gridINFO) then gridINFO=gridDefault else gridINFO = updateStructure(gridDefault,gridINFO) ;--I.4-- Color Scale Parameters -------------------------------------------------------------- scaleDefault={cutmin:min( map(where(map ne 0)) ), $ ;-Min Intensity to be Shown cutmax:max( map(where(map ne 0)) ), $ ;-Min Intensity to be Shown type: 'RMS', $ ;-Type of scale value (RMS, chi2, ...) unit: '', $ ;-Unit of the values percent:0, $ ;-Boolean to Convert Color Scale in Percent to Mean Value fac: 1., $ ;-Arbitrary multiplying factor CT: 0 , $ ;-Color Table ratio:.15, $ ;-Color Bar Size nbTick:7 , $ ;-Color Scale Number of Ticks tickFMT: '(F5.1)'} ;-Color Scale Format for Tick if not keyword_set(scaleINFO) then scaleINFO=scaleDefault else scaleINFO = updateStructure(scaleDefault,scaleINFO) if not keyword_set(showScale) then scaleINFO.ratio=0. ;--I.5-- Mapping Deformation ----------------------------------------------------------------- flexDefault={latStart:-80 ,$ ;-Flexion: Latitude lower value latEnd : 80 ,$ ;-Flexion: Latitude upper value latStep : 20 ,$ ;-Flexion: Latitude step longStart: 45 ,$ ;-Flexion: Longitude lower value longEnd : 405,$ ;-Flexion: Longitude upper value longStep : 90 ,$ ;-Flexion: Longitude step Radius: 6 } ;-Flexion: Circle radius if not keyword_set(flexINFO) then flexINFO=flexDefault else flexINFO = updateStructure(flexDefault,flexINFO) ;--I.6-- Additionnal Text Display ------------------------------------------------------------ labelDefault={text: ['' ], $ ;-String to be printed clip: [1 ], $ ;-Text Clipping (0:data, 1:normalized) xPos: [.7 ], $ ;-Text X position yPos: [.1 ], $ ;-Text Y position alig: [.5 ], $ ;-Text Alignment [0.0 to 1.0] orient:[0 ],$ ;-CCW angle to horizontal (deg) cSiz: [1.3],$ ;-Character size cThk: [1. ], $ ;-Character Thickness cTab: [0 ], $ ;-Color Table for the Text cVal: [0 ] } ;-Color Index for the Text ; if not keyword_set(labelINFO) then labelINFO=labelDefault else labelINFO = updateStructure(labelDefault,labelINFO) ;--I.7-- Resolution Element Information ------------------------------------------------------ resEltDefault={size:10.,$ ;-Resolution Element percent of Diameter xpos:.05 , $ ;-Resolution Element X position ypos:.95 , $ ;-Resolution Element Y position col: 0 } ;-Resolution Element color if not keyword_set(resEltINFO) then resEltINFO=resEltDefault else resEltINFO = updateStructure(resEltDefault,resEltINFO) ;--I.8-- Figure Configuration ---------------------------------------------------------------- if not keyword_set(nameEPS) then nameEPS = 'map.eps' epsDefault={size: 15., $ ;-EPS Output Size bord:[.10,.05], $ ;-Percentage of the EPS occupied by the Map cSiz: 0.8 , $ ;-Character size cThk: 1. } ;-Character Thickness if not keyword_set(epsINFO) then epsINFO=epsDefault else epsINFO = updateStructure(epsDefault,epsINFO) ;--I.9-- Additionnal Data Sets --------------------------------------------------------------- dataDefault={x: 0, $ ;-Point X position y: 0, $ ;-Point Y position col: 'black', $ ;-Symbol color Sym: 'FilledCircle', $ ;-Symbol code Siz: 1., $ ;-Symbol size Thk: 1. } ;-Symbol Thickness if not keyword_set(dataINFO) then dataINFO=dataDefault else dataINFO = updateStructure(dataDefault,dataINFO) ;--I.10-- Additionnal Data Sets -------------------------------------------------------------- contourDefault={level: 0, $ ;-Contour levels smooth: 0, $ ;-Smoothing window (0 for non-smoothing) ellipse: 0, $ ;-Ellipse eval (0: nothing, 1:compute, 2: display, 3: replace) cTab: 0, $ ;-Color table cVal: 0, $ ;-Color index cSty: 1, $ ;-Contour Linestyle cThk: 1. } ;-Contour thickness if not keyword_set(contourINFO) then contourINFO=contourDefault else contourINFO = updateStructure(contourDefault,contourINFO) ;--I.X-- Useful Quantities ------------------------------------------------------------------ barOffset=.05 strOffset=350 ;-----------------------------------------------------------------------------------------------; ;-----------------------------------------------------------------------------------------------; ;--- TAG --- II -- Setting Up the DEVICE Display -----------------------; ;-----------------------------------------------------------------------------------------------; ;-----------------------------------------------------------------------------------------------; ;--II.1-- Orthographic Stereo Projection Dimensions ------------------------------------------ if mapINFO.geo eq 'ortho' then begin totLength=epsINFO.size ;--II.1.1-- With Color Scale if keyword_set(showScale) then begin totHeight = (1.+scaleINFO.ratio)*epsINFO.size xSize = epsINFO.size ySize = (1.+scaleINFO.ratio)*epsINFO.size epsINFO.size *=1000. xBotMap = epsINFO.size* epsINFO.bord(0) xTopMap = epsINFO.size*( 1.-epsINFO.bord(0) ) yBotMap = epsINFO.size*( epsINFO.bord(1) + scaleINFO.ratio ) yTopMap = epsINFO.size*( 1.-epsINFO.bord(1) + scaleINFO.ratio ) xLenMap=xTopMap-xBotMap yLenMap=yTopMap-yBotMap xBotBar = epsINFO.size* epsINFO.bord(0) xTopBar = epsINFO.size*( 1.-epsINFO.bord(0) ) yBotBar = epsINFO.size*( epsINFO.bord(1) + barOffset ) yTopBar = epsINFO.size*( scaleINFO.ratio-epsINFO.bord(1) + barOffset ) xLenBar=xTopBar-xBotBar yLenBar=yTopBar-yBotBar ;--II.1.2-- Without Color Scale endif else begin totHeight = epsINFO.size xSize = epsINFO.size ySize = epsINFO.size epsINFO.size *=1000. xBotMap = epsINFO.size* epsINFO.bord(0) xTopMap = epsINFO.size*( 1.-epsINFO.bord(0) ) yBotMap = epsINFO.size* epsINFO.bord(1) yTopMap = epsINFO.size*( 1.-epsINFO.bord(1) ) xLenMap=xTopMap-xBotMap yLenMap=yTopMap-yBotMap endelse endif ;--II.2-- Equidistant Cylindrical Projection Dimensions -------------------------------------- if mapINFO.geo eq 'ECP' then begin totLength=2.*epsINFO.size ;--II.2.1-- With Color Scale if keyword_set(showScale) then begin totHeight = (1.+scaleINFO.ratio)*epsINFO.size xSize = 2.*epsINFO.size ySize = (1.+scaleINFO.ratio)*epsINFO.size epsINFO.size *=1000. xBotMap = epsINFO.size* 2 * epsINFO.bord(0) xTopMap = epsINFO.size* 2 *( 1.-epsINFO.bord(0) ) yBotMap = epsINFO.size*( epsINFO.bord(1) + scaleINFO.ratio ) +250. yTopMap = epsINFO.size*( 1.-epsINFO.bord(1) + scaleINFO.ratio ) +250. xLenMap=xTopMap-xBotMap yLenMap=yTopMap-yBotMap xBotBar = epsINFO.size* epsINFO.bord(0) xTopBar = epsINFO.size*( 1.-epsINFO.bord(0) ) yBotBar = epsINFO.size*( epsINFO.bord(1) + barOffset ) yTopBar = epsINFO.size*( scaleINFO.ratio-epsINFO.bord(1) + barOffset ) xLenBar=xTopBar-xBotBar yLenBar=yTopBar-yBotBar ;--II.2.2-- Without Color Scale endif else begin totHeight=epsINFO.size xSize = 2.*epsINFO.size ySize = epsINFO.size epsINFO.size *=1000. xBotMap = epsINFO.size* 2 * epsINFO.bord(0) xTopMap = epsINFO.size* 2 *( 1.-epsINFO.bord(0) ) yBotMap = epsINFO.size* epsINFO.bord(1) ;+300 yTopMap = epsINFO.size*( 1.-epsINFO.bord(1) ) ;+300 xLenMap=xTopMap-xBotMap yLenMap=yTopMap-yBotMap endelse endif ;--II.3-- Configure PS Output Channel -------------------------------------------------------- cgPS_open, Filename=nameEPS, /metric, /decomposed, /portrait, $ xSize=xSize, ySize=ySize, language_level=2, /quiet ;-----------------------------------------------------------------------------------------------; ;-----------------------------------------------------------------------------------------------; ;--- TAG --- III -- Display the Map -----------------------; ;-----------------------------------------------------------------------------------------------; ;-----------------------------------------------------------------------------------------------; ;--III.1-- Map Reference Longitude ----------------------------------------------------------- if mapINFO.long ne 0 then begin dims=size(map) if mapINFO.geo eq 'ECP' then map = shift(map, -mapINFO.long*dims[1]/360., 0) if mapINFO.geo eq 'ortho' then map = rot(map, -mapINFO.long) endif ;--III.2-- Display the Map ------------------------------------------------------------------- mapToPrint=bytscl(map, scaleINFO.cutmin, scaleINFO.cutmax) cgImage, mapToPrint, xBotMap, yBotMap, /TV, xSize=xLenMap, ySize=yLenMap, ctIndex=scaleINFO.ct ;-----------------------------------------------------------------------------------------------; ;-----------------------------------------------------------------------------------------------; ;--- TAG --- IV -- Grid and References -----------------------; ;-----------------------------------------------------------------------------------------------; ;-----------------------------------------------------------------------------------------------; ;--IV.1-- Grid Definition -------------------------------------------------------------------- nbLat = round(180./gridINFO.latSpace) +1. nbLong= round(360./gridINFO.longSpace) +1. longArr= gridINFO.longSpace*findgen(nbLong) latArr =-90 + gridINFO.latSpace *findgen(nbLat) longNames=string( (mapINFO.long + gridINFO.longSpace*findgen(nbLong)) mod 360, format='(I3)') latNames =string(latArr, format='(I3)') longNames(0)='0' longNames(nblong-1)='360' ;--IV.2-- Grid for Orthographic Projection --------------------------------------------------- if mapINFO.geo eq 'ortho' then begin if keyword_set(showGrid) then begin ;--IV.2.1-- Set the Projection map_set, /Orthographic, mapINFO.lat, mapINFO.long, mapINFO.rot, $ /noErase, xmargin=0, ymargin=0, /noBorder, $ position=[epsINFO.bord(0), yBotMap/((1+scaleINFO.ratio)*epsINFO.size), $ 1.-epsINFO.bord(0), 1.-epsINFO.bord(1)] ;--IV.2.2-- Update Latitude Labels latNames(0)=' ' latNames(nbLat-1)=' ' ;--IV.2.3-- Define the Grid map_grid, $ ;-Grid Rendering gLineStyle=gridINFO.lineStyle, $ gLineThick=gridINFO.lineThick, $ color=gridINFO.inLinecol, $ ;-Grid Latitude Labeling lats=latArr, $ latNames=latNames, $ latLab=gridINFO.latPos+45.*mapINFO.lat/abs(mapINFO.lat), $ latAlign=0.5, $ yThick=gridINFO.lineThick, $ ;-Grid Longitude Labeling lons=longArr, $ lonNames=replicate(' ',20), $ lonLab=gridINFO.longPos, $ xThick=gridINFO.lineThick, $ ;-Label Plotting ? label=gridINFO.labelFreq, $ orientation=textOrient, $ charSize=epsINFO.cSiz, $ charThick=epsINFO.cThk ;--IV.2.4-- Longitude Labeling for kLong=0, nbLong-2 do $ cgText, (xTopMap+xBotMap)/2. + (xLenMap/2. + strOffset)*cos( (longArr[kLong]-mapINFO.long-90)*!DTOR), $ (yTopMap+yBotMap)/2. + (yLenMap/2. + strOffset)*sin( (longArr[kLong]-mapINFO.long-90)*!DTOR), $ strtrim(string(longArr[kLong], format='(I3)'),2), /DEVICE, $ alignment=.5, charsize=epsINFO.cSiz, charThick=epsINFO.cThk, $ orientation=longArr[kLong], color=gridINFO.inLinecol endif ;--IV.2.5-- Draw the Outer Ring (Equator) cgPlot, /OverPlot, /Polar, fltarr(512)+1., 2*!DPI*findgen(512)/510., $ /Device, /NoErase, $ position=[xBotMap, yBotMap, xTopMap, yTopMap], $ xStyle=5, yStyle=5, thick=gridINFO.lineThick, $ color=gridINFO.inLinecol, lineStyle=gridINFO.lineStyle endif ;print, n_elements(longArr) ;print, longNames ;--IV.4-- Equidistant Cylindrical Projection ------------------------------------------------- if mapINFO.geo eq 'ECP' and keyword_set(showGrid) then begin ;print, 'ici' if keyword_set(showScale) then xTitle=' Longitude (!Uo!N)' else xTitle='Longitude (!Uo!N)' cgPlot, [0.,360.], [-90.,90.], /Device, /NoErase, /NoData, $ position=[xBotMap, yBotMap, xTopMap, yTopMap], $ yRange=[-90.001,90.001], $ xStyle=1, xMinor=9, xThick=gridINFO.lineThick, $ yStyle=1, yMinor=3, yThick=gridINFO.lineThick, $ color=gridINFO.inLinecol, lineStyle=gridINFO.lineStyle, $ xTickS=n_elements(longArr), xTickV=longArr, xTickName=longNames, $ yTickS=n_elements(latArr), yTickV=latArr, yTickName=latNames, $ charthick=epsINFO.cThk, $ xTitle=xTitle, $ yTitle='Latitude (!Uo!N)' endif ;-----------------------------------------------------------------------------------------------; ;-----------------------------------------------------------------------------------------------; ;--- TAG --- V -- Contour Plots -----------------------; ;-----------------------------------------------------------------------------------------------; ;-----------------------------------------------------------------------------------------------; if keyword_set( showContour ) then begin for kLevel=0, nbLevel-1 do begin loadct, contourINFO.cTab(kLevel), /silent contour, map, $ min_value=min(map), max_value=max(map), $ levels=contourINFO.level(kLevel), $ /OVERPLOT, $ path_info=INFO, path_xy=XY,$ /CLOSED, /ISOTROPIC, /PATH_DATA_COORDS dims = size(map) fac = mean( [360./(dims(1)-1), 180./(dims(2)-1) ] ) nbCurve=n_elements(info) old=0 for kCurve=0, nbCurve-1 do begin ;-Contour indices in the XY table indices= [INDGEN(info(kCurve).N), 0] +old old+=info(kCurve).N xC = reform(xy(0,indices)*fac) yC = reform(xy(1,indices)*fac-90) ;-remove map edges if yC(0) eq 90. or $ yC(0) eq -90. or $ yC(1) eq 90. or $ yC(1) eq -90. then goto, nextCurve if contourINFO.smooth(kLevel) ne 0 then begin xC=smooth(xC,contourINFO.smooth(kLevel)) yC=smooth(yC,contourINFO.smooth(kLevel)) endif if contourINFO.ellipse(kLevel) ne 3 then $ oplot, xC, yC, $ color=contourINFO.cVal(kLevel), $ linestyle=contourINFO.cSty(kLevel) if contourINFO.ellipse(kLevel) ne 0 then begin pEll=mpfitellipse( xC, yC, /TILT, /QUIET, $ [ (max(xC)-min(xC))/2., $ (max(yC)-min(yC))/2., $ mean(xC), $ mean(yC), $ 0.] ) print, 'Ellipse: ', $ pEll(0), pEll(1), pEll(2), pEll(3), pEll(4)/!DTOR, $ format='(A9,4x,F5.1,2x,F5.1,4x,F5.1,2x,F5.1,4x,F6.1)' if contourINFO.ellipse(kLevel) ge 2 then begin xyEll = evalmpellipse( pEll, 51 ) oplot, xyEll(0,*), xyEll(1,*), $ color=contourINFO.cVal(kLevel), $ linestyle=contourINFO.cSty(kLevel) endif endif nextCurve: endfor endfor plot, [0.,360.], [0.,0.], /NoData, /Device, /NoErase, $ position=[xBotMap, yBotMap, xTopMap, yTopMap], $ yRange=[-90.001,90.001], $ xStyle=1, xThick=gridINFO.lineThick, $ yStyle=1, yThick=gridINFO.lineThick, $ color=0, $ xTickS=n_elements(longArr), xTickV=longArr, xTickName=longNames, xMinor=9, $ yTickS=n_elements(latArr), yTickV=latArr, yTickName=latNames, yMinor=3, $ charThick=epsINFO.cThk endif ;-----------------------------------------------------------------------------------------------; ;-----------------------------------------------------------------------------------------------; ;--- TAG --- VI -- Display Labels, Data, Flexion, Color Scale, ... -----------------------; ;-----------------------------------------------------------------------------------------------; ;-----------------------------------------------------------------------------------------------; ;--VI.1-- Display Any Additional Label ------------------------------------------------------- if keyword_Set(showLabel) then begin ;--VI.1.1-- Number of Labels to Display nbLabel = n_elements( labelINFO.text ) ;--VI.1.2-- Display Labels for kLabel=0, nbLabel-1 do begin ; print, klabel ; print, labelINFO.xPos[kLabel], labelINFO.yPos[kLabel], labelINFO.text[kLabel] ; print, 1-labelINFO.clip[kLabel] cgText, labelINFO.xPos[kLabel], labelINFO.yPos[kLabel], labelINFO.text[kLabel], $ normal=labelINFO.clip[kLabel], data=1-labelINFO.clip[kLabel], $ orientation=labelINFO.orient[kLabel], alignment=labelINFO.alig[kLabel], $ charSize=labelINFO.cSiz[kLabel], charThick=labelINFO.cThk[kLabel], $ color=labelINFO.cVal[kLabel] endfor endif ;--VI.2-- Display Any Additional Data Sets --------------------------------------------------- if keyword_Set(showData) then begin ;--VI.2.1-- Number of Data Points to Display nbData = n_elements( dataINFO.x ) ;--VI.2.1-- Draw Data Points for kData=0, nbData-1 do begin cgPlot, /OverPlot, dataINFO.x[kData], dataINFO.y[kData], $ pSym=dataINFO.sym[kData], symSize=dataINFO.siz[kData], $ color=dataINFO.col[kData], $ thick=dataINFO.Thk[kData] endfor endif ;--VI.3-- Display Projection Deformation ----------------------------------------------------- if keyword_set(showFlexion) then $ plotMapFlexion, lat, lon, projection=mapINFO.geo, flexINFO=flexINFO ;--VI.4-- Display Color Bar ------------------------------------------------------------------ if keyword_set(showScale) then begin ;--VI.4.1-- Define & Display the Color Bar colorBar= scaleINFO.cutmin+findgen(256)*(scaleINFO.cutmax-scaleINFO.cutmin)/255 colorBar = [ [colorBar],[colorBar] ] barToPrint = bytscl(colorBar, scaleINFO.cutmin, scaleINFO.cutmax) cgImage, barToPrint, xBotBar, yBotBar, /TV, xSize=xLenBar, ySize=yLenBar, ctIndex=scaleINFO.ct, /NoErase ;--VI.4.2-- Convert Scale into Percent if Requested if scaleINFO.percent eq 1 then begin meanVal= (scaleINFO.cutmin+scaleINFO.cutmax)/2. colorBar = 100*( colorBar-meanVal ) scaleINFO.cutmin = 100*( scaleINFO.cutmin-meanVal );/meanVal scaleINFO.cutmax = 100*( scaleINFO.cutmax-meanVal );/meanVal endif ;--VI.4.3-- Normalize Scale if Requested scaleINFO.cutmin *= scaleINFO.fac scaleINFO.cutmax *= scaleINFO.fac ;--VI.4.4-- Display the Color Bar Axes cgPlot, colorBar, fltarr(256), /Device, /NoErase, $ position=[xBotBar, yBotBar, xTopBar, yTopBar], $ xStyle=1, xMinor=1, xThick=gridINFO.lineThick, $ yStyle=1, yMinor=1, yThick=gridINFO.lineThick, $ color=gridINFO.inLinecol, thick=gridINFO.lineThick, $ xRange=[scaleINFO.cutmin-0.0001, scaleINFO.cutmax+0.0001], $ yRange=[0,1], $ xTickS=scaleINFO.nbTick, xTickLen=.2, xTickFormat=scaleINFO.tickFMT, $ yTickS=1, yTickLen=.2, yTickName=replicate(' ',2), $ charThick=epsINFO.cThk cgText, xBotBar-250, (yBotBar+yTopBar)/2., orient=90, strTrim(scaleINFO.type,2), /Device, align=0.5, charsize=1.5 if not strCmp(scaleINFO.unit,'') then $ cgText, xTopBar+800, yBotBar-925, strTrim(scaleINFO.unit,2), /Device, align=0, charsize=1.75 endif ;--VI.5-- Resolution Element ----------------------------------------------------------------- if keyword_Set(showResElt) then begin cgPlot, resEltINFO.xPos, resEltINFO.yPos, /Device, /NoErase, $ xStyle=5, xRange=[0.,1.], $ yStyle=5, yRange=[0.,1.], $ psym='Filled circle', $ symSize=resEltINFO.size * ( 0.5 - 2.*epsINFO.bord(0) ), $ position=[0,0,totLength*1000., totHeight*1000.] ;--X.1-- Resolution Element Creation ; ;--VI.5.1-- ; theta=2.*!DPI*findgen(40)/39 ; radius = resEltINFO.size * ( 0.5 - 2.*epsINFO.bord(0) ) ; usersym, radius*cos(theta), radius*sin(theta), /FILL, color=resEltINFO.col ; ; ;--X.2--Ploting Resolution Element ; plot, [resEltINFO.xpos], [resEltINFO.ypos], /DEVICE, /NOERASE, $ ; xst=5, yst=5, $ ; psym=8, $ ; xr=[0.,1.], yr=[0.,1.], $ ; position=[0,0,totLength*1000., totHeight*1000.] endif ;-Restore X-output cgPS_close, /png, Delete_PS=0 end