Madhavan Bomidi writes:
> In my opinion, !P.Multi can just indicate how many subplots are required in the display window while you don't have any control for adjusting the width / height of each the subplots. In this case, 'position' option will be very handy. I tried to run my code by disabling the !P.Multi commands while retaining the 'position' option. This resulted in only a single plot and the other plot disappeared or not static on the display window. By keeping both the options, I could
control the width / height of each subplot and also both the subplots are static on the display window. This is what I observed. May be I am wrong but keeping both has no problem on plotting.
You are certainly welcome to do what you like and have any opinion you
want. I'm just telling you that using !P.Multi and the POSITION keyword
together will lead to head scratching and chaos sooner rather than
later. I have a bit of experience in this area. ;-)
> My plots were as per my desired one except one issue. From your graphics routines, I just wanted to show the standard deviation as a background color similar to your example plot of Error-estimate plot. I tried to check all lines in all possible ways. While my syntax looks fine and no error results while running the program, I still can't figure out why I see a complete frame of my subplot covered by the color specified for showing the error in the plot.
Yes, you need to remove the POSITION keyword from the cgColorFill
command. Then, things should work as you expect.
> Please help me solve this issue ...
Here is a sample program that doesn't use !P.Multi at all (always my
preference, given the numerous bad things that can happen when you do
use it). I believe it does what you want. I've just faked some data, but
I believe I am using most of your code.
;----------------------------------------------------------- ---------
xtime=Indgen(101) ; X-axis
var_data=cgDemoData(1) ; Variable mean values
var_std=Randomu(seed, 101)*3 ; Variable standard deviation values
high_error=var_data + var_std ; Upper error
low_error=var_data - var_std ; Lower error
var_min=low_error-5 ; Variable minimum values
var_max=high_error + 6 ; Variable maximum values
npoints=RandomU(seed, 101) *10 ; No. of points used
; Setup variables for the plot
xtitle = 'Julian Time'
ytitle1 = 'Variable'
ytitle2 = 'Counts'
title = 'Test Plot'
position1 = [0.15, 0.40, 0.95, 0.90]
position2 = [0.15, 0.10, 0.95, 0.30]
thick = (!D.Name EQ 'PS') ? 4 : 2
; Setup colors for plot
colors=['goldenrod','sky blue','blue','black']
; Setup Graphics Display
cgDisplay
; Draw the first plot
cgPlot, xtime, var_data, Title=title, XTitle=xtitle, YTitle=ytitle1, $
XStyle=8, Position=position1,/NoData, YStyle=1
; Fill in the error estimates
cgColorFill, [xtime, Reverse(xtime), xtime[0]], $
[high_error, Reverse(low_error), high_error[0]], $
Color=colors[1]
; Draw the line plot with no data
cgPlot, xtime, var_data, linestyle=0, thick=2,Color=colors[3],/OVERPLOT
cgPlot, xtime, var_min, linestyle=2, thick=2, Color=colors[2],/OVERPLOT
cgPlot, xtime, var_max, linestyle=2, thick=2, Color=colors[2],/OVERPLOT
; Draw the bottom plot without a top axis
cgPlot, xtime, npoints, PSYM=16, Color=colors[0], $
SYMSIZE=0.5,Position=position2, /NoErase, $
YTitle=ytitle2, XTitle=xtitle
END
;----------------------------------------------------------- ---------
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thue. ("Perhaps thou speakest truth.")
|