Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

Considering I have weather data for last 10 years for London, how can I make a scatter plot that will show the previous day's temperature as a function from today's temperature?

share|improve this question

1 Answer 1

up vote 7 down vote accepted

You can Partition the data into pairs of successive values. Reverse the data to make the previous day the dependent variable. Examples:

Partition[{1, 2, 3, 4, 5}, 2, 1]
(* {{1, 2}, {2, 3}, {3, 4}, {4, 5}} *)

Partition[Reverse@{1, 2, 3, 4, 5}, 2, 1]
(* {{5, 4}, {4, 3}, {3, 2}, {2, 1}} *)

Reverse /@ Partition[{1, 2, 3, 4, 5}, 2, 1]
(* {{2, 1}, {3, 2}, {4, 3}, {5, 4}} *)

Mathematica's weather data. ListPlot will plot the points.

data = WeatherData["London", "Temperature", {{2004, 1, 1}, {2013, 12, 31}, "Day"}];

ListPlot@Partition[Reverse@data["Values"], 2, 1]

Mathematica graphics

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.