Re: BAR_PLOT restricted to 60 element ARRAY?? [message #44663 is a reply to message #44661] |
Fri, 08 July 2005 04:11   |
Ben Panter
Messages: 102 Registered: July 2003
|
Senior Member |
|
|
liko2@o2.pl wrote:
> Did you try this wit array containing several exacly the same values?It
> still creates one bar for this case...
We may be talking at cross purposes, but in my tests it didn't. I can
see I was a little too cryptic with n_elements. See the program below
for what I meant.
Save and compile the program at the end of this message, and with the
same x and y as before try this:
IDL> bp_plot_barchart, x,y, title='fred'
IDL> y[10:20]=0.6
IDL> bp_plot_barchart, x,y, title='fred'
which certainly draws lines between the 11 bars of the same height.
PROGRAM:
PRO bp_plot_barchart, x, y, _extra=e
;Make the initial plot
num_bar=n_elements(x)
plot, x, y, psym=10, _extra=e
;find midpoints for x ordinate of line
midpt=x[0:num_bar-2]+0.5*(x[1:num_bar-1]-x[0:num_bar-2])
;draw the lines
for i=0,num_bar-2 do plots, [midpt[i],midpt[i]], $
[!y.crange[0],max([y[i],y[i+1]])]
END
--
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Ben Panter, Garching, Germany
email via www.benpanter.co.uk
|
|
|