multi-color (time-series) line plot [message #77070] |
Tue, 02 August 2011 02:01  |
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  |
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
|
|
|