2
$\begingroup$
auburnSS=Sunset[Entity["City", {"Auburn", "Alabama", "UnitedStates"}], 
 DateRange[DateObject[{2019, 1, 1}], DateObject[{2019, 12, 31}]]]

I'm trying to make a plot of this, to no avail (tried ListPlot and DateListPlot). I'm guessing maybe I shouldn't be using EventSeries?

I'm trying to get a plot like this:

enter image description here

Instead of this:

enter image description here

Also please feel free critique my post formatting (I'm new at this).

$\endgroup$
3
  • $\begingroup$ The event series is fine; the issue is that the values are dates which don't map well to the vertical scale. $\endgroup$ Apr 25, 2019 at 1:47
  • 1
    $\begingroup$ wolfram.com/language/12/core-visualization/… might be of interest to you. $\endgroup$ Apr 25, 2019 at 1:51
  • $\begingroup$ Your post formatting is good. To get better answers you might want to edit your question and add information about the data points you want to plot. What do the x-y scales mean on the plot you want to get? What (x,y) coordinates do you want for, say, the first sunset on Tue 1 Jan 2019 16:47 CDT? $\endgroup$
    – LouisB
    Apr 25, 2019 at 3:00

1 Answer 1

2
$\begingroup$

Here is how it works: You collect the sunset times for every day of the year (mySunsetList). Then you get a list of the start times of each day (beginningDays) by setting the hour and minute to zero in each element of the mySunsetList. (You could also do this by merely getting the days of the year... no hour, no minute.)

Then form a list of pairs {beginningDays, mySunsetList-beginningDays}. Then DateListPlot this combined list.

The result is minutes into the day, but if necessary you could convert this to time of day (hours and minutes).

mySunsetList = 
  Sunset@({Entity[
        "City", 
  {"Auburn", "Alabama", "UnitedStates"}], #} & /@ 
     DateRange[DateObject[{2019, 1, 1}], 
     DateObject[{2019, 12, 30}]]);
 beginningDays = (ReplacePart[DateObject[#], 
    {{1, 4} -> 0, {1, 5} -> 0}] & /@ mySunsetList);
DateListPlot[
 Transpose[
 {beginningDays, mySunsetList - beginningDays}],
 Filling->Axis,
PlotLabel -> 
 Text[Style["Sunset time in Auburn (minutes into day)", 18]]]

enter image description here

Try: TargetUnits -> "Hours",

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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