Repository: sunpy/sunpy

Issue:
Reproduce the "Where is STEREO?" plot in SunPy
### Describe the feature

The STEREO webpage has a handy figure showing where STEREO and other spacecraft are: https://stereo-ssc.nascom.nasa.gov/where.shtml . Given the existing examples in the SunPy gallery it seems that this should be reproducible using SunPy.

### Proposed solution

The solution would use a mix of existing examples that use the ability to get locations of spacecraft and planets.


Discussion:
Wow, they sure are cramming a bunch of stuff into that figure now!
Whoever works on this, `sunpy.coordinates.get_horizons_coord()` will be your friend
Part of the reason that I am interested in this is that getting the code to run that generated the STEREO webpage plot was, sorry _continues_ to be a real pain due to IDL-related issues. My bet is the SunPy-based version of this figure would be easier to generate and maintain.
https://solar-mach.github.io/ does a good job of this already. Would be a good example gallery tho.
Yes, as @Cadair pointed out, **solarmach** should do what you want, or at least give you a good starting point doing this task in python using sunpy. The code of the python package can be found at https://github.com/jgieseler/solarmach

But it's definitely a good idea to put this functionality into a sunpy example and/or make solarmach an affiliated sunpy package.
The sunpy affiliated package process is documented here: https://sunpy.org/project/affiliated#open-review-process I would love to see you submit solar-mach :smile: 

Open an issue with [this template](https://github.com/sunpy/sunpy.org/issues/new?assignees=Cadair&labels=Affiliated+Package+Review&template=new_affiliated_package.md) to submit it when you are ready.
Yes, I know, it's on the agenda! But so many other things to do. 🙈 And the testing needs to be done correctly. 😬
Hey, I've written a small code for this, can you check? 

```
import matplotlib.pyplot as plt
from astropy.time import Time
import datetime
from sunpy.coordinates import get_body_heliographic_stonyhurst

today = datetime.datetime.now()
obstime = Time(today)

from sunpy.coordinates.ephemeris import get_horizons_coord
aia = get_horizons_coord('STEREO-A', obstime)

planet_list = ['mars', 'sun', 'earth']
planet_coord = [get_body_heliographic_stonyhurst(
    this_planet, time=obstime) for this_planet in planet_list]
planet_list.append('STEREO-A')
planet_coord.append(aia)

fig = plt.figure()
ax = fig.add_subplot(projection='polar')
for this_planet, this_coord in zip(planet_list, planet_coord):
    ax.plot(this_coord.lon.to('rad'), this_coord.radius, 'o', label=this_planet)
ax.legend()
plt.show()
```
![image](https://user-images.githubusercontent.com/64737847/217342589-0fb46754-f677-4381-b06a-b94294199f2d.png)




Resolving patch:
diff --git a/examples/units_and_coordinates/ParkerSolarProbe_trajectory.py b/examples/units_and_coordinates/ParkerSolarProbe_trajectory.py
new file mode 100644
--- /dev/null
+++ b/examples/units_and_coordinates/ParkerSolarProbe_trajectory.py
@@ -0,0 +1,77 @@
+"""
+===================================================
+Obtaining a spacecraft trajectory from JPL Horizons
+===================================================
+
+This example shows how to obtain the trajectory of a spacecraft from JPL Horizons
+and plot it relative to other bodies in the solar system.
+
+JPL `Horizons <https://ssd.jpl.nasa.gov/horizons/>`__ can return the locations of
+planets and minor bodies (e.g., asteroids) in the solar system, and it can also
+return the location of a variety of major spacecraft.
+
+You will need `astroquery <https://astroquery.readthedocs.io/>`__ installed.
+"""
+
+import matplotlib.pyplot as plt
+
+import astropy.units as u
+
+from sunpy.coordinates import get_body_heliographic_stonyhurst, get_horizons_coord
+from sunpy.time import parse_time
+
+##############################################################################
+# We use :func:`~sunpy.coordinates.get_horizons_coord` to query JPL Horizons
+# for the trajectory of Parker Solar Probe (PSP).  Let's request 50 days on
+# either side of PSP's 14th closest approach to the Sun.
+
+perihelion_14 = parse_time('2022-12-11 13:16')
+psp = get_horizons_coord('Parker Solar Probe',
+                         {'start': perihelion_14 - 50 * u.day,
+                          'stop': perihelion_14 + 50 * u.day,
+                          'step': '180m'})
+
+##############################################################################
+# We also obtain the location of Earth at PSP perihelion.  We could query
+# JPL Horizons again, but :func:`~sunpy.coordinates.get_body_heliographic_stonyhurst` returns
+# a comparably accurate location using the Astropy ephemeris.
+
+earth = get_body_heliographic_stonyhurst('Earth', perihelion_14)
+
+##############################################################################
+# For the purposes of plotting on a Matplotlib polar plot, we create a short
+# convenience function to extract the necessary values in the appropriate units.
+
+
+def coord_to_polar(coord):
+    return coord.lon.to_value('rad'), coord.radius.to_value('AU')
+
+##############################################################################
+# Finally, we plot the trajectory on a polar plot.  Be aware that the
+# orientation of the Stonyhurst heliographic coordinate system rotates
+# over time such that the Earth is always at zero longitude.
+# Accordingly, when we directly plot the trajectory, it does not appear
+# as a simple ellipse because each trajectory point has a different
+# observation time and thus a different orientation of the coordinate
+# system.  To see the elliptical orbit, the trajectory can be
+# transformed to the coordinate frame of Earth at the single time of
+# PSP perihelion (``earth``), so that the trajectory is represented in
+# a non-rotating coordinate frame.
+
+
+fig = plt.figure()
+ax = fig.add_subplot(projection='polar')
+ax.plot(0, 0, 'o', label='Sun', color='orange')
+ax.plot(*coord_to_polar(earth), 'o', label='Earth', color='blue')
+ax.plot(*coord_to_polar(psp),
+        label='PSP (as seen from Earth)', color='purple')
+ax.plot(*coord_to_polar(psp.transform_to(earth)),
+        label='PSP (non-rotating frame)', color='purple', linestyle='dashed')
+ax.set_title('Stonyhurst heliographic coordinates')
+ax.legend(loc='upper center')
+
+plt.show()
+
+##############################################################################
+# There are other tools that enable a similar style of figure.
+# `solarmach <https://github.com/jgieseler/solarmach#usage>`__ is one such example.


Test patch: