How can I use "MinTemperature"
, "MaxTemperature"
, and "Temperature"
properties of WeatherData
for one or more cities in one line of code?
1 Answer
Here's something you could build on. It only shows min and max temperatures. The DateListPlot
function layout is fairly simple for easy editing.
londoncoordinates = CityData["London", "Coordinates"];
londonweatherstation = WeatherData[londoncoordinates, "NearestStation"];
sydneycoordinates = CityData["Sydney", "Coordinates"];
sydneyweatherstation = WeatherData[sydneycoordinates, "NearestStation"];
DateListPlot[{
WeatherData[londonweatherstation,
"MaxTemperature", {{2011, 1, 2}, {2012, 1, 2}, "Day"}],
WeatherData[londonweatherstation,
"MinTemperature", {{2011, 1, 2}, {2012, 1, 2}, "Day"}],
WeatherData[sydneyweatherstation,
"MaxTemperature", {{2011, 1, 2}, {2012, 1, 2}, "Day"}],
WeatherData[sydneyweatherstation,
"MinTemperature", {{2011, 1, 2}, {2012, 1, 2}, "Day"}]},
Joined -> True,
PlotStyle -> {Hue[0.9, 0.6, 0.6], Hue[0.67, 0.6, 0.6],
Hue[0.9, 0.6, 0.6], Hue[0.67, 0.6, 0.6]},
Filling -> {{1 -> {{2}, Lighter[Pink]}}, {3 -> {{4}, Green}}},
AspectRatio -> 0.5, ImageSize -> 600,
FrameTicks -> {{Automatic, Automatic},
{{"Jan 2011", "Mar 2011", "May 2011", "Jul 2011", "Sep 2011",
"Nov 2011", "Jan 2012"}, Automatic}},
DateTicksFormat -> {"MonthNameShort"},
FrameLabel -> {{Style["\[Degree]C", Bold, Medium], Null}, {Null,
Null}}, RotateLabel -> False,
PlotLabel -> Row[{Style["Sydney", 22, Bold, Green]
, " ",
Style["London", 22, Bold, Lighter[Pink]]}]]
DateListPlot[WeatherData["KABQ", #, {2008, 3}], Joined -> True] & /@ {"Pressure", "Temperature", "WindSpeed"} // TableForm
$\endgroup$Read the FAQs
! 3) When you see good Q&A, vote them up byclicking the gray triangles
, because the credibility of the system is based on the reputation gained by users sharing their knowledge. ALSO, remember to accept the answer, if any, that solves your problem,by clicking the checkmark sign
` $\endgroup$Map[]
in the help files. $\endgroup$