Message Boards Message Boards

How do I plot just sunrise and/or sunset

Posted 8 years ago

I'm so much a beginner using Mathematica that it is a bit embarrassing to ask, and maybe this isn't even the correct place to ask, but I can't find another. Please accept any apology needed.

In the Mathematica documentation, I've found the example that plots the difference between sunrise and sunset, but I want to plot just sunrise and/or sunset, and all of the changes to that example that seemed plausible to me produce error messages.

I saw the plot I'm seeking way back in 1970, in the days of PDP10s and Calcomp plotters and before the days of Mathematica. When plotted with latitude as a parameter, the progress from one summer per year in temperate zones to two per year at the equator is attractive, where attraction is in the eye of the beholder.

POSTED BY: Keith Anderson
2 Replies

Hello David,

Wow. Thanks. And your strategy is so different from the example I was trying to adapt that I feel a little less bashful that I couldn't adapt it.

Keith

POSTED BY: Keith Anderson

Here is a way to plot the time of sunrise (in minutes after midnight) on the first of the month in 2015:

DateListPlot[
 Table[With[{time = DateList[Sunrise[{2015, i, 1}]][[4 ;;]]}, {{2015, 
     i, 1}, time[[1]] 3600 + time[[2]] 60 + time[[3]]}], {i, 1, 12}], 
 Joined -> False]

and you could do similarly for Sunset. This gives you the plot at the location where the execution takes place. To plot it at a specific location using GeoPosition:

DateListPlot[
 Table[With[{time = 
     DateList[
       Sunrise[GeoPosition[{30, -80}], {2015, i, 1}]][[4 ;;]]}, {{2015, i, 1}, 
    time[[1]] 3600 + time[[2]] 60 + time[[3]]}], {i, 1, 12}], 
 Joined -> False]

and compare two locations

DateListPlot[{Table[
   With[{time = 
      DateList[
        Sunrise[GeoPosition[{20, -80}], {2015, i, 1}]][[4 ;;]]}, {{2015, i, 1}, 
     time[[1]] 3600 + time[[2]] 60 + time[[3]]}], {i, 1, 12}],

  Table[With[{time = 
      DateList[
        Sunrise[GeoPosition[{70, -80}], {2015, i, 1}]][[4 ;;]]}, {{2015, i, 1}, 
     time[[1]] 3600 + time[[2]] 60 + time[[3]]}], {i, 1, 12}]
  }, Joined -> False]
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