Wolfram Language

Open live version

Plot the Yearly Path of the Sun

Make a webpage that shows the yearly path of the Sun at the visitors location.


code

X
X

how it works

The Suns analemma, or yearly path in the sky, is a set of snapshots of the position of the Sun every day at the same time of day. This expression returns the {azimuth, altitude} coordinates of the Suns position in 10-day increments throughout one year:

In[1]:=
X
Out[1]=

Extract numeric values by mapping QuantityMagnitude at level 2 of that list:

In[2]:=
X
Out[2]=

From those points, make a graphic showing the Suns path throughout the year:

In[3]:=
X
Out[3]=

Format the graphic to make it more attractive and more suggestive of a view of the sky above the horizon. First find the minima and maxima of the azimuth and altitudes of the Suns path, and add 10° in each direction to widen the view slightly. Replace yMin by -5° so that the view extends 5° below the horizon:

In[4]:=
X

The Sun subtends about 0.5° in the sky. Give the Sun images the appropriate radii using Disk rather than Point, and specify the PlotRange necessary to give a wider view:

In[5]:=
X
Out[5]=

Add graphic elements to render the ground and horizon, and the sky shaded from light blue at the bottom to dark blue at the top. Add a plot label that specifies the time and location of the image. To put a color setter inline in the code, type DynamicSetting[ColorSetter[]], select that expression, and press Shift-Return to evaluate it in place. Click the resulting color setter and pick a color:

In[6]:=
X
In[7]:=
X
Out[7]=

To make the image available to everyone, deploy it to the Wolfram Cloud, adding margins around the image using Pane.

In[8]:=
X
Out[8]=

The image each visitor sees when visiting the deployed image is customized to their location.

In[9]:=
X