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

Home » Public Forums » archive » multi-color (time-series) line plot
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
multi-color (time-series) line plot [message #77070] Tue, 02 August 2011 02:01 Go to next message
Teddy Allen is currently offline  Teddy Allen
Messages: 13
Registered: October 2010
Junior Member
Dear group,
I have a very simple question that I am having trouble resolving
(maybe because it is almost 2am)...I have a time series of 500
points. I would like to plot a line plot that has 0:299 in red and
300:499 in blue. Basically, I would like a continuous time series line
plot that changes color at a specific location.

p = plot(rainall, xrange=[0,299],color='red')
p1 = plot(rainall, xrange=[300,499],color='blue',/over)

The above does not seem to work and I have played around with the
xrange option in addition to the xstyle option. Any hints for this
elementary request?
thank you,
teddy
Re: multi-color (time-series) line plot [message #77143 is a reply to message #77070] Wed, 03 August 2011 15:37 Go to previous message
Mark Piper is currently offline  Mark Piper
Messages: 198
Registered: December 2009
Senior Member
On 8/2/2011 3:01 AM, Teddy Allen wrote:
> Dear group,
> I have a very simple question that I am having trouble resolving
> (maybe because it is almost 2am)...I have a time series of 500
> points. I would like to plot a line plot that has 0:299 in red and
> 300:499 in blue. Basically, I would like a continuous time series line
> plot that changes color at a specific location.
>
> p = plot(rainall, xrange=[0,299],color='red')
> p1 = plot(rainall, xrange=[300,499],color='blue',/over)
>
> The above does not seem to work and I have played around with the
> xrange option in addition to the xstyle option. Any hints for this
> elementary request?
> thank you,
> teddy

Hi Teddy,

Please try this:

enso = read_binary(file_which('elnino.dat'), data_type=4) ; 500 elts
time = findgen(n_elements(enso))
p_red = plot(time[0:299], enso[0:299], color='red')
p_blue = plot(time[300:*], enso[300:*], color='blue', /overplot)

I had to introduce the "x" parameter to make this work correctly.

mp
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Segregating data in bimodal distribution
Next Topic: Re: iPlot Axes Colour

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

Current Time: Fri Oct 10 11:17:33 PDT 2025

Total time taken to generate the page: 0.72258 seconds