Hasan writes:
> I removed the Window keyword and added cgWindow but it seems I am
> missing something else. if you copy and past the following code and
> see the results, please, you can see what I mean.
Well, a couple of things. AL_LEGEND requires a WINDOW
keyword, instead of an ADDCMD keyword to add the command
to the graphics window. But the biggest problem is that
you didn't set the Y range of your data on your first plot.
Since you are overploting your other data sets, the first
plot you create must have a range that is large enough
to accommodate all the rest of the data you want to put on
it. In this case, I also made the range large enough so I
could easily fit the legend onto the plot.
y1=[576.000,687.000,416.000,325.000,271.000]
y2=[665.000,702.000,527.000,493.000,433.000]
y3=[2333.00,2409.00,2168.00,1791.00,1583.00]
y4=[225.000,371.000,149.000,168.000,60.0000]
y5=[863.000,912.000,590.000,652.000,695.000]
y6=[546.000,539.000,336.000,322.000,275.000]
y7=[1431.00,1523.00,1001.00,914.000,892.000]
x=[-12,-8,0,5,10]
cgwindow
cgplot,x,y1/10000,LineStyle=0,CHARSIZE =1,color='black', xtickv=x,$
xticks=n_elements(x)-1,XTITLE='Class 1',YTITLE='Values', $
Title='Differernt calsses values',yrange=[0.,3250.]/10000, /ADDCMD
cgplot,x,y2/10000,LineStyle=0,color='green',/overplot,/ADDCM D
cgplot,x,y3/10000,LineStyle=0, color='red',/overplot,/ADDCMD
cgplot,x,y4/10000,LineStyle=0, color='orange',/overplot,/ADDCMD
cgplot,x,y5/10000,LineStyle=0, color='magenta',/overplot,/ADDCMD
cgplot,x,y6/10000,LineStyle=0, color='cyan',/overplot,/ADDCMD
cgplot,x,y7/10000,LineStyle=0, color='blue',/overplot,/ADDCMD
al_legend,LineStyle=0,$
['class1','class2','class3','class4','class5','class6','clas s7']$
,color=
['black','green','red','orange','magenta','cyan','blue'],Pos ition=[0.2,$
0.85], /Normal,CHarSIZE=0.8, /WINDOW
END
This works correctly. :-)
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
|