<blockquote>
  <p>Does the sun have a vertical movment?</p>
</blockquote>

<h2>Sure it does!</h2>

<p>People who follow solar system bodies with the highest accuracy, including NASA's JPL, use the solar system barycenter (center of mass) for the origin of the plane of the ecliptic.</p>

<p>Since the big planets (Jupiter et al.) have some inclination, they pull the Sun up and down out of the plane of the Ecliptic by tens of thousands of kilometers. It's a small fraction of it's 600,000 kilometer radius, but it certainly happens.</p>

<p>You can see the data from the <a href="https://ssd.jpl.nasa.gov/horizons.cgi" rel="nofollow noreferrer">JPL Horizons</a> website, or if you like Python, you can get virtually the same numbers by running the <a href="https://rhodesmill.org/skyfield/" rel="nofollow noreferrer">Skyfield</a> package.</p>

<p>From Horizions I downloaded the position of the Sun and the four major planets of the solar system in 10 day steps from the years 1900 to 2100. Below I plot the three components X, Y and Z in the J2000.0 Solar system barycentric coordinates using the ecliptic as the reference frame. The black line is the motion of the Sun, and the color lines are for the four planets, but I have multiplied each by the the mass of the planet divided by the Mass of the Sun.</p>

<p>In the second plot, I added the four together, and you can see that together they mirror the motion of the Sun. </p>

<p>The last two show the movement of the Sun in 3D (two views). Note that the vertical scale is much smaller than the horizontal scale. </p>

<hr>

<p>Horizons setup:</p>

<p><img src="https://i.sstatic.net/CJHyh.png" alt="enter image description here"></p>

<p><img src="https://i.sstatic.net/Ysp17.png" alt="enter image description here"></p>

<p><strong>below:</strong> Black thick line: motion of the Sun in barycentric coordinates in the J2000.0 X, Y and Z directions, relative to the ecliptic. Four thinner color lines: motions of the four largest planets, each weighted by its mass relative to the Sun's mass. Short period lines are Jupiter and Saturn with Jupiter the largest amplitude, long periods are Uranus and Neptune, with Neptune the largest amplitude.</p>

<p><img src="https://i.sstatic.net/Syq7T.png" alt="enter image description here"></p>

<p><strong>below:</strong> Black thick line: motion of the Sun in barycentric coordinates in the J2000.0 X, Y and Z directions, relative to the ecliptic. Thin red line: sum of the motions of the four largest planets, each weighted by its mass relative to the Sun's mass.</p>

<p><img src="https://i.sstatic.net/nC5R0.png" alt="enter image description here"></p>

<p><strong>below:</strong> Two views  of the 3D motion of the Sun in barycentric coordinates between the years 1900 and 2100. Units are kilometers, and note that the scales are different for each axis.</p>

<p><img src="https://i.sstatic.net/lvBX2.png" alt="enter image description here"></p>

<p><img src="https://i.sstatic.net/OS7ju.png" alt="enter image description here"></p>

<pre><code>class Body(object):
    def __init__(self, name):
        self.name = name

import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D

names = ('Sun', 'Jupiter', 'Saturn', 'Uranus', 'Neptune')

bodies = []
for name in names:
    fname = 'sun motion ' + name + ' horizons_results.txt'
    body  = Body(name)
    bodies.append(body)

    with open(fname, "r") as infile:
        lines = infile.read().splitlines() 

    iSOE = [i for i, line in enumerate(lines) if "<span class="math-container">$$SOE" in line][0]
    iEOE = [i for i, line in enumerate(lines) if "$$</span>EOE" in line][0]

    print (name, iSOE, iEOE, lines[iSOE], lines[iEOE])

    lines = [line.split(',') for line in lines[iSOE+1:iEOE]]
    JD  = np.array([float(line[0]) for line in lines])
    pos = np.array([[float(item) for item in line[2:5]] for line in lines])
    body.lines = lines
    body.JD    = JD
    body.pos   = pos.T.copy()

years = 2000 + (JD - JD[3652])/365.2564
Sun, Jupiter, Saturn, Uranus, Neptune = bodies

for body in bodies:
    body.rsun = np.sqrt(((body.pos - Sun.pos)**2).sum(axis=0))

planets = [b for b in bodies if 'sun' not in b.name.lower()]

massdict = {'Jupiter':1.898E+27, 'Saturn':5.683E+26, 'Uranus':8.681E+25,
            'Neptune':1.024E+26, 'Sun':1.989E+30}

for b in bodies:
    b.mass = massdict[b.name]

if True:
    plt.figure()
    for i, thing in enumerate(Sun.pos):
        plt.subplot(3, 1, i+1)
        plt.plot(years, thing, '-k', linewidth=1.5)
    for p in planets:
        for i, thing in enumerate(p.pos):
            plt.subplot(3, 1, i+1)
            thing = thing * (p.mass/Sun.mass)
            plt.plot(years, thing)
    plt.show()

all_four = Body('all_four')
all_four.pos = np.array([p.pos*(p.mass/Sun.mass) for p in planets]).sum(axis=0)

if True:
    plt.figure()
    for i, thing in enumerate(Sun.pos):
        plt.subplot(3, 1, i+1)
        plt.plot(years, thing, '-k', linewidth=1.5)
    for i, thing in enumerate(all_four.pos):
        plt.subplot(3, 1, i+1)
        plt.plot(years, thing, '-r')
    plt.show()

if True:    
    fig = plt.figure(figsize=[12, 10])  # [12, 10]
    ax  = fig.add_subplot(1, 1, 1, projection='3d')

    x, y, z = Sun.pos
    ax.plot(x, y, z)

    plt.show()
</code></pre>

CC BY-SA 4.0
2019-06-07T00:17:47.870Z
Very Interesting. Thank you.  The 3D figures are fine. But could you please explain the color codes as well as the vertical units in those first two of 2D graphs?
Ananda Bukkambudhi
CC BY-SA 4.0
2019-06-07T00:30:29.857Z
@AnandaBukkambudhi I'll take a look at how I can make it clearer. I purposely try not to make my plots overly "professional looking" in order to prevent people from re-using them elsewhere, but I think I can add the requested information without risk. Briefly, (until I make the edit) for the first three plots, the horizontal axis is years (1900 to 2100 as mentioned in the text) and vertical units are kilometers, the output units specified in the setup of Horizons shown in the screenshots. Thanks!
uhoh
CC BY-SA 4.0
2019-06-07T06:46:01.240Z
@AnandaBukkambudhi I've added detailed descriptions, how does it look now?
uhoh
CC BY-SA 4.0
2019-06-07T17:45:56.697Z
If the graphs are labelled in km, then the Sun's vertical movement is not "a small fraction of it's 600,000 kilometer radius", but rather larger than its radius.
Pere
CC BY-SA 4.0
2019-06-07T20:17:59.877Z
@Pere I'm associating "vertical" with the Z direction, where the amplitude is less than +/- 40,000 km, and so indeed a small fraction of 600,000 km.
uhoh
CC BY-SA 4.0
2019-06-07T20:35:23.570Z
I see. I think I missed directions.
Pere
CC BY-SA 4.0
2019-06-11T00:52:15.547Z
@Uhoh Thanks. It is much clearer now.
Ananda Bukkambudhi
CC BY-SA 4.0
2019-06-11T00:56:32.957Z
@AnandaBukkambudhi okay thanks for the feedback, feel free to query further or ask new questions!
uhoh
CC BY-SA 4.0
2019-06-06T12:13:52.907Z
2019-06-07T06:45:37.833Z
2019-06-07T06:45:37.833Z
uhoh
<p>As the Sun moves along with the planets does the sun exhibit vertical movement? That is, does it traverse in different planes?</p>

CC BY-SA 4.0
2019-06-06T05:20:46.127Z
Relative to what? The central plane of the galaxy? Or are you just concerned about the Sun's  movement relative to the centre of mass of the solar system?
PM 2Ring
CC BY-SA 4.0
2019-06-06T05:29:29.073Z
I meant to ask whether the sun also moves in the same horizontal plane as other planets always or does it have a movement in a vertical plane also?
Ananda Bukkambudhi
CC BY-SA 4.0
2019-06-06T05:34:10.617Z
Ah, ok. I think you're talking about the [ecliptic plane](https://en.wikipedia.org/wiki/Ecliptic). By definition, the Sun is always in the ecliptic plane, but that plane itself slowly precesses.
PM 2Ring
CC BY-SA 4.0
2019-06-06T05:39:52.553Z
Thank you. I will study and come back later.
Ananda Bukkambudhi
CC BY-SA 4.0
2019-06-06T11:12:55.507Z
@AnandaBukkambudhi don't believe the first comment you read! The plane of the ecliptic can have its origin in the center of the Sun, but for serious work people these days use the solar system barycenter.
uhoh
<the-sun><movement>
Does the sun have a vertical movment?
Ananda Bukkambudhi
# Does the sun have a vertical movment?

(Asked by: username_0 on 2019-06-06)

As the Sun moves along with the planets does the sun exhibit vertical movement? That is, does it traverse in different planes?

**Tags:** the-sun, movement

> **Comments:**
> **username_1**: Relative to what? The central plane of the galaxy? Or are you just concerned about the Sun's  movement relative to the centre of mass of the solar system?  
> **username_0**: I meant to ask whether the sun also moves in the same horizontal plane as other planets always or does it have a movement in a vertical plane also?  
> **username_1**: Ah, ok. I think you're talking about the [ecliptic plane](https://en.wikipedia.org/wiki/Ecliptic). By definition, the Sun is always in the ecliptic plane, but that plane itself slowly precesses.  
> **username_0**: Thank you. I will study and come back later.  
> **username_2**: @username_0 don't believe the first comment you read! The plane of the ecliptic can have its origin in the center of the Sun, but for serious work people these days use the solar system barycenter.  

---

## 1 answers

### Answer by username_2 on 2019-06-06. Score: 5

> Does the sun have a vertical movment?

## Sure it does!

People who follow solar system bodies with the highest accuracy, including NASA's JPL, use the solar system barycenter (center of mass) for the origin of the plane of the ecliptic.

Since the big planets (Jupiter et al.) have some inclination, they pull the Sun up and down out of the plane of the Ecliptic by tens of thousands of kilometers. It's a small fraction of it's 600,000 kilometer radius, but it certainly happens.

You can see the data from the [JPL Horizons](https://ssd.jpl.nasa.gov/horizons.cgi) website, or if you like Python, you can get virtually the same numbers by running the [Skyfield](https://rhodesmill.org/skyfield/) package.

From Horizions I downloaded the position of the Sun and the four major planets of the solar system in 10 day steps from the years 1900 to 2100. Below I plot the three components X, Y and Z in the J2000.0 Solar system barycentric coordinates using the ecliptic as the reference frame. The black line is the motion of the Sun, and the color lines are for the four planets, but I have multiplied each by the the mass of the planet divided by the Mass of the Sun.

In the second plot, I added the four together, and you can see that together they mirror the motion of the Sun.

The last two show the movement of the Sun in 3D (two views). Note that the vertical scale is much smaller than the horizontal scale.

---

Horizons setup:

![enter image description here](https://i.sstatic.net/CJHyh.png)

![enter image description here](https://i.sstatic.net/Ysp17.png)

**below:** Black thick line: motion of the Sun in barycentric coordinates in the J2000.0 X, Y and Z directions, relative to the ecliptic. Four thinner color lines: motions of the four largest planets, each weighted by its mass relative to the Sun's mass. Short period lines are Jupiter and Saturn with Jupiter the largest amplitude, long periods are Uranus and Neptune, with Neptune the largest amplitude.

![enter image description here](https://i.sstatic.net/Syq7T.png)

**below:** Black thick line: motion of the Sun in barycentric coordinates in the J2000.0 X, Y and Z directions, relative to the ecliptic. Thin red line: sum of the motions of the four largest planets, each weighted by its mass relative to the Sun's mass.

![enter image description here](https://i.sstatic.net/nC5R0.png)

**below:** Two views of the 3D motion of the Sun in barycentric coordinates between the years 1900 and 2100. Units are kilometers, and note that the scales are different for each axis.

![enter image description here](https://i.sstatic.net/lvBX2.png)

![enter image description here](https://i.sstatic.net/OS7ju.png)

```
class Body(object):
    def __init__(self, name):
        self.name = name

import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D

names = ('Sun', 'Jupiter', 'Saturn', 'Uranus', 'Neptune')

bodies = []
for name in names:
    fname = 'sun motion ' + name + ' horizons_results.txt'
    body  = Body(name)
    bodies.append(body)

    with open(fname, "r") as infile:
        lines = infile.read().splitlines() 

    iSOE = [i for i, line in enumerate(lines) if "$$SOE" in line][0]
    iEOE = [i for i, line in enumerate(lines) if "$$EOE" in line][0]

    print (name, iSOE, iEOE, lines[iSOE], lines[iEOE])

    lines = [line.split(',') for line in lines[iSOE+1:iEOE]]
    JD  = np.array([float(line[0]) for line in lines])
    pos = np.array([[float(item) for item in line[2:5]] for line in lines])
    body.lines = lines
    body.JD    = JD
    body.pos   = pos.T.copy()

years = 2000 + (JD - JD[3652])/365.2564
Sun, Jupiter, Saturn, Uranus, Neptune = bodies

for body in bodies:
    body.rsun = np.sqrt(((body.pos - Sun.pos)**2).sum(axis=0))

planets = [b for b in bodies if 'sun' not in b.name.lower()]

massdict = {'Jupiter':1.898E+27, 'Saturn':5.683E+26, 'Uranus':8.681E+25,
            'Neptune':1.024E+26, 'Sun':1.989E+30}

for b in bodies:
    b.mass = massdict[b.name]

if True:
    plt.figure()
    for i, thing in enumerate(Sun.pos):
        plt.subplot(3, 1, i+1)
        plt.plot(years, thing, '-k', linewidth=1.5)
    for p in planets:
        for i, thing in enumerate(p.pos):
            plt.subplot(3, 1, i+1)
            thing = thing * (p.mass/Sun.mass)
            plt.plot(years, thing)
    plt.show()

all_four = Body('all_four')
all_four.pos = np.array([p.pos*(p.mass/Sun.mass) for p in planets]).sum(axis=0)

if True:
    plt.figure()
    for i, thing in enumerate(Sun.pos):
        plt.subplot(3, 1, i+1)
        plt.plot(years, thing, '-k', linewidth=1.5)
    for i, thing in enumerate(all_four.pos):
        plt.subplot(3, 1, i+1)
        plt.plot(years, thing, '-r')
    plt.show()

if True:    
    fig = plt.figure(figsize=[12, 10])  # [12, 10]
    ax  = fig.add_subplot(1, 1, 1, projection='3d')

    x, y, z = Sun.pos
    ax.plot(x, y, z)

    plt.show()

```

> **Comments:**
> **username_0**: Very Interesting. Thank you.  The 3D figures are fine. But could you please explain the color codes as well as the vertical units in those first two of 2D graphs?  
> **username_2**: @username_0 I'll take a look at how I can make it clearer. I purposely try not to make my plots overly "professional looking" in order to prevent people from re-using them elsewhere, but I think I can add the requested information without risk. Briefly, (until I make the edit) for the first three plots, the horizontal axis is years (1900 to 2100 as mentioned in the text) and vertical units are kilometers, the output units specified in the setup of Horizons shown in the screenshots. Thanks!  
> **username_2**: @username_0 I've added detailed descriptions, how does it look now?  
> **username_3**: If the graphs are labelled in km, then the Sun's vertical movement is not "a small fraction of it's 600,000 kilometer radius", but rather larger than its radius.  
> **username_2**: @username_3 I'm associating "vertical" with the Z direction, where the amplitude is less than +/- 40,000 km, and so indeed a small fraction of 600,000 km.  
> **username_3**: I see. I think I missed directions.  
> **username_0**: @username_2 Thanks. It is much clearer now.  
> **username_2**: @username_0 okay thanks for the feedback, feel free to query further or ask new questions!  

---

