Dear all,
I am trying to display the following data on a single plot.
xdata_area = [10, 20, 30, 40, 50]
xdata_vol = [112, 224, 336, 448, 560]
ydata = [20, 40, 60, 80, 100]
Note that the y-values for both are the same. I would like to have a
graph with two x-axes, with different ranges and the plots in two
different colors. Following is the code I wrote-it can be copy pasted
and run. I shall point out my troubles after that:
;############## CODE BEGIN ################
Pro multi_plot
;this code will try to display two plots on the same chart in
different colors with different x axes
xdata_area = [10, 20, 30, 40, 50]
xdata_vol = [112, 224, 336, 448, 560]
ydata = [20, 40, 60, 80, 100]
xMax_area = MAX(xData_area, MIN=xMin_area)
xMax_vol = MAX(xData_vol, MIN=xMin_vol)
ymax = min(ydata, min = ymin)
DEVICE, DECOMPOSED=0 & !P.FONT = 0 & loadct, 39
!p.background=255
!p.color=0
WINDOW, 2, XSIZE = 900, YSIZE = 500, TITLE = 'Elevation - Area -
Capacity Curve'
wset, 2
!P.MULTI = [0, 1,1,2]
plot, xdata_area , ydata , $
thick = 2, $
XRANGE = [xMin_area,xMax_area] , YRANGE = [yMin,yMax],$
XTITLE='Area in Million sq metres', YTITLE = 'Elevation in Metres',$
charsize=1.1, ystyle=1, $
subtitle='Elevation-Area Curve',$
XSTYLE = 8, color = 80
AXIS, XAXIS=1,XRANGE = [ceil(xMax_vol/100.)* 100,floor(xMin_vol/
100.)*100], $
XTITLE='Capacity in Million cubic metres', XCHARSIZE = 1.1, xstyle
= 1
;The value of XRANGE has been defined that it rounds to the nearest
hundred
;above and below the extreme values.
plot , xdata_vol,ydata ,thick=2, color = 220,XSTYLE = 1, YSTYLE = 1,$
XRANGE = [ceil(xMax_vol/100.)* 100,floor(xMin_vol/100.)*100] , YRANGE
= [yMin,yMax]
end
;############## END OF CODE ###################
Please note that I have deliberately put the XSTYLE and YSTYLE
variables(in the second plot command) equal to 1 to point out my
problem. Now, I expected the axes from the two plots to sit together
and the plots to be marked properly. Instead, the axes do not sit
together. I have uploaded my output here:
http://link.imgshare.us/8cjE4Y
I would appreciate your kind consideration. My queries are:
a] Where did I go wrong as a consequence of which the axes do not
coincide?
b] What do I do to plot just the curves (NOT the axes) in color?
c] What do I do to have the caption at the top of the graph display
properly?
Regards,
Gaurav
|