comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Errorbar plot with max-min boundaries and bar plot with !P.Multi
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: Errorbar plot with max-min boundaries and bar plot with !P.Multi [message #86719 is a reply to message #86715] Fri, 29 November 2013 08:45 Go to previous messageGo to previous message
atmospheric physics is currently offline  atmospheric physics
Messages: 121
Registered: June 2010
Senior Member
Hello,

I have rectified the positioning by correcting the defined positions 1 & 2.

position1 = [0.15, 0.40, 0.95, 0.90]
position2 = [0.15, 0.10, 0.95, 0.30]

I see 'sky blue' color applied to the background for the error-estimate plot. I want the area covering lower_error and high_error be represented in 'sky blue' color. What is going wrong? I don't see any extreme standard deviations in my data (i.e., the standard deviations are always less than corresponding mean values). I have replaced the lines for box / bar plot to make as line plot.

I have changed the statements in the code as below:

!P.Multi=[0,1,2]

; Draw the first plot
cgPlot, xtime, var_data, Title=title, XTitle=xtitle, YTitle=ytitle1, $
XStyle=8, Position=position1,/NoData, YRange=[0,900], $
XRange=[86.0, 88.0], YStyle=1

; Fill in the error estimates
cgColorFill, [xtime, Reverse(xtime), xtime[0]], $
[high_error, Reverse(low_error), high_error[0]], $
Color=colors[1], Position=position1

; 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, $
YTitle=ytitle2, XTitle=xtitle, XRange=[86.0,88.0], YRange=[0,100]

; Clean up.
!P.Multi = 0

Please suggest...

Thanks in advance.


On Friday, November 29, 2013 3:54:21 PM UTC+1, David Fanning wrote:
> Madhavan Bomidi writes:
>
>
>
>> I was attempting to make 2 plots in 1 column using !P.Multi=[0,1,2]. My intention was to obtain: (1) top panel plot - Error estimation plot with mean, standard deviation as background and min-max as boundaries for a time-series data of a variable, (2) below panel plot - Bar plot showing the frequency of observations respectively at each time-step corresponding to the above plot. I started using the examples of colored line plots (for two row plotting), Error-estimate
>
> plot (for top panel plot), and Bar plot without errorbars (for below panel plot).
>
>>
>
>> I made the following code, which is resulting in crazy errors and the plots are exchanging their positions (i.e., top panel <-> below panel). I got an error for bar plot as "CgAxis - Keyword array parameter XTICKNAME must have from 1 to 60 elements". I don't have any clue where I am actually going wrong, probably I have not understood properly the Coyote's library graphic routines. Can someone provide me assistance to achieve my desired plot?
>
>
>
> When you are doing multiple plots with the *system variable* !P.MULTI
>
> you can get into all kinds of problems when things don't go as they are
>
> suppose to. In particular, if you have errors in your code, and you are
>
> not using an error handler that restores !P.MULTI to its "normal" value,
>
> then plots will jump around, etc. Remember, !P.MULTI is a *SYSTEM
>
> VARIABLE*. It is *always* in effect in EVERY program you write!
>
>
>
> I would take out the CLOSE, /ALL statement at the beginning of your code
>
> (which marks you as a novice programmer, by the way) and replace it with
>
> an error handler that looks like this:
>
>
>
> Catch, theError
>
> IF theError NE 0 THEN BEGIN
>
> Catch, /Cancel
>
> void = cgErrorMsg()
>
> !P.Multi=0
>
> RETURN
>
> ENDIF
>
>
>
> That should solve the plots "jumping around" problem. :-)
>
>
>
> The "XTICKNAME must have from 1 to 60 elements" problem comes from a
>
> limitation in IDL in which you can have no more that 59 labels on an
>
> axis. cgBoxPlot tried to label each "box" it draws, so I presume you
>
> have more than 60 of them.
>
>
>
> If you have a LOT of boxes, it probably makes more sense to display them
>
> differently than using a box plot. If you really need a box plot, you
>
> could try creating your axes, then *overplotting* your boxes less than
>
> 60 at a time. I think I would prefer the first solution. Maybe using
>
> just a line instead of a box to indicate the usual values.
>
>
>
> 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.")
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: shapefile not in lat/lon
Next Topic: VERT_COLORS Problem

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 17:12:23 PDT 2025

Total time taken to generate the page: 0.00422 seconds