Hi David,
Yes, Your solution worked. Need to read about the bytscl. Thanks you very much.
Lim
On Thursday, December 5, 2013 5:22:48 PM UTC-5, Lim wrote:
> Dear all,
>
> I was wondering if someone could help me with a problem using one color bar for multiple plots with different ranges of colors. My example bellow produces two panels and one color bar. However the color bar does not match both panels but only the first one (I1 values).
>
> For I1 and I2, I need to do:
>
> 100-200=red
>
> 201-300=orange
>
> 301-400=yellow
>
> 401-500=green
>
> 501-600=blue
>
>
>
> therefore, using a color table from 0 to 600, the second panel should not have any blue color.
>
>
>
> I will appreciate any assistance.
>
>
>
> Thanks,
>
> Lim
>
> ==============
>
> pro mci
>
>
>
> X1=[2, 4, 5, 6, 7, 8]
>
> Y1=[20, 40, 45, 30, 10, 5]
>
> I1=[100,200,300,400,500,600]
>
>
>
> X2=[3, 4.5, 5.5, 6.5, 7.5, 8.5]
>
> Y2=[22, 25, 30, 33, 20, 8]
>
> I2=[150,175,250,280,290,450]
>
>
>
> cgLoadCT, 33, /reverse
>
> nelmspix=n_elements(X1)
>
> colors = cgScaleVector(Findgen(N_Elements(I1)), min(I1), max(I1))
>
> clr = Value_Locate(colors, I1)
>
> clr = Byte(Round(cgScaleVector(clr, 0, 255)))
>
>
>
> cgWindow
>
> pos1=[0.1,0.1,0.45,0.75]
>
> pos2=[0.55,0.1,0.9,0.75]
>
> ;graph 1
>
> cgPlot, X1, Y1, /Nodata, Xtitle='X', Ytitle='Y', position=pos1,/NoErase,/AddCMD
>
> cgPlotS, X1, Y1, Psym=16,symsize=2,color=clr,/AddCMD
>
> ;graph 2
>
> cgplot,X2,Y2, /Nodata, Xtitle='X', Ytitle='Y', position=pos2,/NoErase, /AddCMD
>
> cgPlotS, X2, Y2,Psym=16,symsize=2,color=clr,/AddCMD
>
> ;the colorbar
>
> cgColorbar, Divisions=5, Format='(I3)', Range=[100,600],/AddCMD , TLOCATION='Top', Title='I'
>
>
>
> End
>
> ==============
|