I've got a working code that prints graphs to a postscript file, but I can't seem to get a legend to work. I have the whole set_plot, 'ps' stuff at the top of the code, so that should be running fine. But I can't seem to get a legend to appear. The plot is first set up early in the code:
plot, [0, 90], [0,1], TITLE= 'run'+rnid, ystyle=8, XTITLE= 'Latitude', /nodata, position=[ .2,.2, .75,.9]
axis, yaxis = 0, yrange= [0,1], /save, ytitle = 'Ethylene Strength (K)'
and then the first set of data is plotted on it:
if AvgEth LT GenDo AND AvgEth GT Gen125Do then begin
plots, btstruc.latitude(rnscan(j)), diff, col=240, psym=1
endif else if AvgEth LT Gen125Do AND AvgEth GT Gen150Do then begin
plots, btstruc.latitude(rnscan(j)), diff, col=220, psym=1
endif else if AvgEth LT Gen150Do AND AvgEth GT Gen175Do then begin
plots, btstruc.latitude(rnscan(j)), diff, col=200, psym=1
endif else if AvgEth LT Gen175Do AND AvgEth GT Gen2Do then begin
plots, btstruc.latitude(rnscan(j)), diff, col=170, psym=1
endif else if AvgEth LT Gen2Do then begin
plots, btstruc.latitude(rnscan(j)), diff, col=130, psym=1
endif
And then we make another Y axis, and plot that data on it:
axis, yaxis=1, yrange=[0,3E-7], ytitle='CO Concentration(ppv)', /save
grun=where(strucCo.run EQ rnid)
oplot, strucCO.latitude(grun), StrucCO.Species(minpos,grun)
oplot, [!x.crange(0), !x.crange[1]], [avgCO, avgCO], linestyle = 5
I've also got a map, not in postscript, that needs a legend. This is what the code looks like thus far for this part:
set_plot, 'x'
map_set, /NOERASE
map_continents
lat = btstruc.latitude(rnscan(j))
lon = btstruc.longitude(rnscan(j))
if AvgEth LT GenDo AND AvgEth GT Gen125Do then begin
plots, lon, lat, col=250, psym=1
endif else if AvgEth LT Gen125Do AND AvgEth GT Gen150Do then begin
plots, lon, lat, col=220, psym=1
endif else if AvgEth LT Gen150Do AND AvgEth GT Gen175Do then begin
plots, lon, lat, col= 200, psym=1
endif else if AvgEth LT Gen175Do AND AvgEth GT Gen2Do then begin
plots, lon, lat, col=170, psym=1
endif else if AvgEth LT Gen2Do then begin
plots, lon, lat, col=130, psym=1
endif
It doesn't seem like there is just a basic legend command. Or if there is, everything has to be in the format of p1=plot(x, y, etc.), and leg=legend(blah) but that style doesn't seem to want to print to postscript.
Thanks for helping out a newbie!
|