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

Home » Public Forums » archive » Re: BAR_PLOT restricted to 60 element ARRAY??
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: BAR_PLOT restricted to 60 element ARRAY?? [message #44664 is a reply to message #44663] Fri, 08 July 2005 02:22 Go to previous messageGo to previous message
Ben Panter is currently offline  Ben Panter
Messages: 102
Registered: July 2003
Senior Member
liko2@o2.pl wrote:
> I cant change data because Its very important to me to see how much
> space ist between each bar... I should use PLOTS then, but Im beginer
> in IDL...
>

OK. I'm pretty sure there are more elegant ways to do this, but for for
a five minute coffee break solution try this:

IDL> ;make some sample data longer than 80 elements
IDL> x=findgen(80)
IDL> y=hanning(80)
% Compiled module: HANNING.
IDL> ;Make the initial plot
IDL> plot, x, y, psym=10
IDL> ;find midpoints for x ordinate of line
IDL> midpt=x[0:78]+0.5*(x[1:79]-x[0:78])
IDL> ;draw the lines
IDL> for i=0,78 do plots, [midpt[i],midpt[i]], $
IDL> [!y.crange[0],max([y[i],y[i+1]])]

Where $ indicates the expression rolls over to the next line and
!y.crange is the bottom of the y-axis. The max(...) bit makes sure that
you get the full height of the bin.

To make your code flexible, change the 78,79,80 to variations of
num_bars=N_ELEMENTS(x)

HTH,

Ben

--
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Ben Panter, Garching, Germany
email via www.benpanter.co.uk
[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
Previous Topic: shading in contour plots
Next Topic: Re: Windows IDL DLM with Cygwin

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

Current Time: Sat Oct 11 06:10:53 PDT 2025

Total time taken to generate the page: 0.00249 seconds