Message Boards Message Boards

0
|
6700 Views
|
2 Replies
|
1 Total Likes
View groups...
Share
Share this post:

DateListPlot with two TimeSeries (e.g. Min & MaxTemperature) and Filling

I'd like to use DateListPlot to graph two TimeSeries on the same graph, filling between the two plots. For instance, if I have the following two TimeSeries:

ksyrMinMax = WeatherData["KSYR",#,{{2015,1,1},{2015,12,31},"Month"}]&/@{"MinTemperature","MaxTemperature"}

I can plot both TimeSeries on the same graph, and remove the line segments joining the points:

DateListPlot[ksyrMinMax,Joined->False]

What I'd like to do is then connect the Minimum and Maximum temperatures for each date, using the Filling option for DateListPlot, but I can't figure out the syntax.

POSTED BY: Christopher Fox
2 Replies

Thank you! That appears to have worked, and I find that very interesting since I don't understand the syntax you've used at all. I see the setting for Filling that seems to match:

{i1 -> {p1,g1},...}

...which is described as "use directive g(k) for the kth filling", but I really don't grasp how something as simple as {1->{2}} manages to extract the appropriate values from the two TimeSeries. The FullForm of a TimeSeries seems far more complicated than such simple syntax would seem able to parse.

Are there other examples of this available for reference? I'd really like to understand better HOW this works rather than just seeing that it does. :-)

And, thank you again for the prompt and accurate reply!

POSTED BY: Christopher Fox

There is an example for this in the documentation for Filling under Scope/Filling Limits that suggests how to join the two sets of data points.

DateListPlot[ksyrMinMax, Joined -> False, Filling -> {1 -> {2}}]
POSTED BY: David Reiss
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract