Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado
Errorbar plot with max-min boundaries and bar plot with !P.Multi
Hello, 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? ; -------------------------------- PRO Test_Plot CLOSE,/ALL ; **** Input Data [80800 data points each] **** xtime=jultime ; X-axis var_data=mean_values ; Variable mean values var_std=std_values ; Variable standard deviation values high_error=var_data + var_std ; Upper error low_error=var_data - var_std ; Lower error var_min=min_values ; Variable minimum values var_max=max_values ; Variable maximum values npoints=var_count ; No. of points used ; Setup variables for the plot xtitle = 'Julian Time' ytitle1 = 'Variable' ytitle2 = 'Counts' title = 'Test Plot' position1 = [0.15, 0.15, 0.90, 0.50] position2 = [0.15, 0.52, 0.90, 0.90] thick = (!D.Name EQ 'PS') ? 4 : 2 ; Setup colors for plot cgLoadct,33,Clip=[10,245] colors=['goldenrod','sky blue','blue','black'] ; Setup Graphics Display cgDisplay ; Two plots in a column. !P.Multi=[0,1,2] ; **** First Plot ; Error estimate plot with mean, stddev, [min, max] boundaries 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 cgPlotS, xtime, var_data, linestyle=0, thick=2,Color=colors[3] cgPlotS, xtime, var_min, linestyle=2, thick=2, Color=colors[2] cgPlotS, xtime, var_max, linestyle=2, thick=2, Color=colors[2] ; **** Second plot ; Draw the bottom plot without a top axis cgBarPlot, npoints, Colors=colors[0], BarCoords=xtime,Position=position2, $ YTitle=ytitle2, XTitle=xtitle, XRange=[86.0,88.0], YRange=[0,100] ; Repair some of the damage to the axes. cgPlots, [0.15, 0.15], [0.50, 0.52], /Normal ; Fix left axis. cgPlots, [0.90, 0.90], [0.50, 0.52], /Normal ; Fix right axis. ; Clean up. !P.Multi = 0 END ; Display the plot in a graphics window. Test_Plot ; Display the plot in a resizeable graphics window. cgWindow, 'Test_Plot', WBackground='White', $ WTitle='Test Plot ; Create a PostScript file. cgPS_Open, 'test_plot.ps' Test_Plot cgPS_Close ; Create a PNG file with a width of 600 pixels. cgPS2Raster, 'test_plot.ps', /PNG, Width=600 END ; -------------------------- Thanks in advance.
Re: Errorbar plot with max-min boundaries and bar plot with !P.Multi
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.")
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.")
Madhavan Bomidi writes: > cgColorFill, [xtime, Reverse(xtime), xtime[0]], $ > [high_error, Reverse(low_error), high_error[0]], $ > Color=colors[1], Position=position1 Can you show me what your "colors" vector looks like? 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.")
I defined below: cgLoadct,33,Clip=[10,245] colors=['goldenrod','sky blue','blu7','red7','black'] Thanks. On Friday, November 29, 2013 5:49:52 PM UTC+1, David Fanning wrote: > Madhavan Bomidi writes: > > > >> cgColorFill, [xtime, Reverse(xtime), xtime[0]], $ > >> [high_error, Reverse(low_error), high_error[0]], $ > >> Color=colors[1], Position=position1 > > > > Can you show me what your "colors" vector looks like? > > > > 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.")
Madhavan Bomidi writes: > 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... OK, a couple of things. I missed before that you were using the POSITION keyword with !P.MULTI. That will throw EVERYTHING into chaos. You *really* don't want to do that! Either position things with the POSITION keyword, or let !P.MULTI do it, but don't *EVER* do both. That probably has more to do with the plots jumping around than my earlier comments. You have this line in your code: > ; Fill in the error estimates > cgColorFill, [xtime, Reverse(xtime), xtime[0]], $ > [high_error, Reverse(low_error), high_error[0]], $ > Color=colors[1], Position=position1 But, I don't see any variables named "high_error" or "low_error". Maybe you want "var_max" and "var_min" in here? I can't be sure, because I don't have data to play with, but I would make sure you have the variables you are using in your code. :-) I don't see anything wrong with your colors, except I see no reason for this command: cgLoadct,33,Clip=[10,245] Cheers, David 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.")
Hello David, If you see my stating post on this issue, you can clearly see the data variables defined with 'high_error' and 'low_error'. I have just changed the intermediate plotting steps basing on your suggestions during the course of interaction in this post. 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. 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. Please help me solve this issue ... Thanks in advance On Friday, November 29, 2013 10:50:44 PM UTC+5:30, David Fanning wrote: > Madhavan Bomidi writes: > > > >> 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... > > > > OK, a couple of things. I missed before that you were using the POSITION > > keyword with !P.MULTI. That will throw EVERYTHING into chaos. You > > *really* don't want to do that! Either position things with the POSITION > > keyword, or let !P.MULTI do it, but don't *EVER* do both. That probably > > has more to do with the plots jumping around than my earlier comments. > > > > You have this line in your code: > > > >> ; Fill in the error estimates > >> cgColorFill, [xtime, Reverse(xtime), xtime[0]], $ > >> [high_error, Reverse(low_error), high_error[0]], $ > >> Color=colors[1], Position=position1 > > > > But, I don't see any variables named "high_error" or "low_error". Maybe > > you want "var_max" and "var_min" in here? I can't be sure, because I > > don't have data to play with, but I would make sure you have the > > variables you are using in your code. :-) > > > > I don't see anything wrong with your colors, except I see no reason for > > this command: > > > > cgLoadct,33,Clip=[10,245] > > > > Cheers, > > > > David > > > > 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.")
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.")
Thank you. Now the code works fine! How can I include legend into my top panel plot (error estimate plot)? Thanks in advance. On Saturday, November 30, 2013 1:02:55 AM UTC+1, David Fanning wrote: > 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.")
Madhavan Bomidi writes: > How can I include legend into my top panel plot (error estimate plot)? http://www.idlcoyote.com/cg_tips/al_legend.php 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.")
I want the legend in the top panel plot only for my example program above. I tried placing the AL_LEGEND command but could not succeed. Thanks in advance. On Sunday, December 1, 2013 1:39:01 AM UTC+1, David Fanning wrote: > Madhavan Bomidi writes: > > > >> How can I include legend into my top panel plot (error estimate plot)? > > > > http://www.idlcoyote.com/cg_tips/al_legend.php > > > > 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.")
Madhavan Bomidi writes: > I want the legend in the top panel plot only for my example program above. I tried placing the AL_LEGEND command but could not succeed. Well, sorry to hear that. Did something in particular happen that you want to share with us? 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.")
On Sunday, December 1, 2013 2:43:14 PM UTC-5, Madhavan Bomidi wrote: > I want the legend in the top panel plot only for my example program above. I tried placing the AL_LEGEND command but could not succeed. If you want to people to help you, you need to give more information. What was the AL_LEGEND command you supplied? What do you mean that you "could not succeed"? Did you get an error message? Did the legend not appear at all? Did it appear in the wrong place? --Wayne
As per the suggestion by David, I applied the following command from his example: al_Legend, ['VAR_STDEV', 'VAR_MEAN', 'VAR_MIN', 'VAR_MAX'], PSym=[0,0,0,0], $ LineStyle=[0,0,2,2], Color=['sky blue','black','blue','blue'], $ Position=[5,115], /Window I can't see any legend appearing in my top-panel plot or any where in the display window. Now can anyone tell me what I am wrong? Am I defining the position wrong? Thanks... On Sunday, December 1, 2013 8:55:40 PM UTC+1, wlandsman wrote: > On Sunday, December 1, 2013 2:43:14 PM UTC-5, Madhavan Bomidi wrote: > >> I want the legend in the top panel plot only for my example program above. I tried placing the AL_LEGEND command but could not succeed. > > > > If you want to people to help you, you need to give more information. What was the AL_LEGEND command you supplied? What do you mean that you "could not succeed"? Did you get an error message? Did the legend not appear at all? Did it appear in the wrong place? > > > > --Wayne
Madhavan Bomidi writes: > As per the suggestion by David, I applied the following command from his example: > > al_Legend, ['VAR_STDEV', 'VAR_MEAN', 'VAR_MIN', 'VAR_MAX'], PSym=[0,0,0,0], $ > LineStyle=[0,0,2,2], Color=['sky blue','black','blue','blue'], $ > Position=[5,115], /Window > > I can't see any legend appearing in my top-panel plot or any where in the display window. > > Now can anyone tell me what I am wrong? Am I defining the position wrong? Well, I'm thinking you probably want to read the documentation in the file for what these keywords mean. You certainly don't need the Window keyword, because you are using a resizeable graphics window. And, it is exceedingly doubtful that the data coordinates [5, 115] apply to your particular plot. Since we don't have the data, we can't tell you what these numbers should be. You will have to look at your plot. :-) 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.")
Thanks. I figured out the legend placing by using 'al_legend'. I am seeing another issue in terms of XTICKS. While I am using my XRange=[242.1, 242.5], I see the ticks starting from 242.2 till 242.5. Is there a way I can indicate my XTICK values that I am interested on my X-axis? Or am I forgetting some keyword? date_label = LABEL_DATE(DATE_FORMAT = ['%H:%I']) cgPlot, xtime, rhum_mean, Title=title, XTitle=xtitle, YTitle=ytitle1, $ XStyle=1, Position=position1,/NoData, YStyle=1, $ YRange=[0,100], XRange=[242.1, 242.5],linestyle=0, thick=2, $ XTICKFORMAT = 'LABEL_DATE' Thanks. On Sunday, December 1, 2013 9:17:38 PM UTC+1, David Fanning wrote: > Madhavan Bomidi writes: > > > >> As per the suggestion by David, I applied the following command from his example: > >> > >> al_Legend, ['VAR_STDEV', 'VAR_MEAN', 'VAR_MIN', 'VAR_MAX'], PSym=[0,0,0,0], $ > >> LineStyle=[0,0,2,2], Color=['sky blue','black','blue','blue'], $ > >> Position=[5,115], /Window > >> > >> I can't see any legend appearing in my top-panel plot or any where in the display window. > >> > >> Now can anyone tell me what I am wrong? Am I defining the position wrong? > > > > Well, I'm thinking you probably want to read the documentation in the > > file for what these keywords mean. You certainly don't need the Window > > keyword, because you are using a resizeable graphics window. And, it is > > exceedingly doubtful that the data coordinates [5, 115] apply to your > > particular plot. Since we don't have the data, we can't tell you what > > these numbers should be. You will have to look at your plot. :-) > > > > 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.")
Madhavan Bomidi writes: > I am seeing another issue in terms of XTICKS. While I am using my XRange=[242.1, 242.5], I see the ticks starting from 242.2 till 242.5. Is there a way I can indicate my XTICK values that I am interested on my X-axis? Or am I forgetting some keyword? > > date_label = LABEL_DATE(DATE_FORMAT = ['%H:%I']) > > cgPlot, xtime, rhum_mean, Title=title, XTitle=xtitle, YTitle=ytitle1, $ > XStyle=1, Position=position1,/NoData, YStyle=1, $ > YRange=[0,100], XRange=[242.1, 242.5],linestyle=0, thick=2, $ > XTICKFORMAT = 'LABEL_DATE' > > Thanks. The cgPlot command is a wrapper for the Plot procedure in IDL. Any keywords available for the Plot procedure can be used. To directly specify where you want tick marks placed, for example, you can use the XTICKV keyword. 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.")