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

Home » Public Forums » archive » Bar plotting in IDL
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Bar plotting in IDL [message #87263] Wed, 22 January 2014 06:57 Go to previous message
atmospheric physics is currently offline  atmospheric physics
Messages: 121
Registered: June 2010
Senior Member
Hello,

I wanted to make a bar plot in IDL and attempted the following lines with some synthetic data:
-------------------------------
PRO Bar_test

xnos=[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21, 22,23,24,25, $
26,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46, 47,48, $
49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68, 69,70, $
71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90, 91,92, $
93,94,95,96,97,98,99,100]
ydata=[14,2,1,0,3,10,1,0,3,4,4,5,!VALUES.F_NAN,1,13,13,8,3,3 ,1,1,0,0,0, $
0,2,2,0,2,3,1,0,1,1,0,1,2,6,2,7,5,2,3,0,6,1,1,3,3,4,0,2,5,3, 5,6, $
10,0,9,6,7,!VALUES.F_NAN,7,!VALUES.F_NAN,!VALUES.F_NAN, $
7,!VALUES.F_NAN,7,13,12,9,3,2,0,0,3,4,!VALUES.F_NAN,2,2,3, $
5,!VALUES.F_NAN,1,3,3,!VALUES.F_NAN,1,2,5,5,4,2,2,4,4,12, $
!VALUES.F_NAN,90]

Filename='test.ps'

cgPS_Open,Filename

cgDisplay,1200,1000

xtickv=[0,5,10,15,20,25,30,35,40,45,50,55,60,65,70,75,80,85, 90,95,100]

cgPlot,xnos,ydata,XTicks=20,XTickV=xtickv, $
Position=[0.1,0.5,0.9,0.9],/NoData

cgBarPlot,ydata,BARCOORDS=xnos,XStyle=1, $
XTitle=xtitle4,YTitle=ytitle4,Font=-1, $
YRange=[0,100],XRange=[0,100], $
colors=['cornflower blue'],/Overplot

cgPS_Close

cgPS2Raster,Filename,/PNG, Width=1000

END
------------------------

I get the error as below:

(1) CGAXIS -> Keyword array parameter XTICKNAME must have from 1 to 60 elements.

(2) I get the figure with bars but I don't see my xnos or x-axis labels are matching with my xnos. For example, the last value of ydata is 90 and the bar for this value is shown at an xnos=94.

My understanding for using bar plot may be wrong!!! Can anyone help me resolve the issues I am facing?

Thanks in advance ...
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Plotting points in fainter color on an IDL plot
Next Topic: binning a point clouds in the xy plane

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

Current Time: Wed Oct 08 14:11:22 PDT 2025

Total time taken to generate the page: 0.00520 seconds