# Buggy code
def plot(self, orbit, label=None, color=None):
    """Plots state and osculating orbit in their plane."""
    if not self._frame:
        self.set_frame(*orbit.pqw())

    if (orbit, label) not in self._orbits:
        self._orbits.append((orbit, label))

    # if new attractor radius is smaller, plot it
    new_radius = max(orbit.attractor.R.to(u.km).value, orbit.r_p.to(u.km).value / 6)
    if not self._attractor_radius:
        self.set_attractor(orbit)
    elif new_radius < self._attractor_radius:
        self.set_attractor(orbit)

    lines = []

    _, positions = orbit.sample(self.num_points)
    rr = positions.get_xyz().transpose()

    # Project on OrbitPlotter frame
    # x_vec, y_vec, z_vec = self._frame
    rr_proj = rr - rr.dot(self._frame[2])[:, None] * self._frame[2]
    x = rr_proj.dot(self._frame[0])
    y = rr_proj.dot(self._frame[1])

    # Plot current position
    (l,) = self.ax.plot(
        x[0].to(u.km).value, y[0].to(u.km).value, "o", mew=0, color=color
    )
    lines.append(l)

    (l,) = self.ax.plot(x.to(u.km).value, y.to(u.km).value, "--", color=l.get_color())
    lines.append(l)

    if label:
        # This will apply the label to either the point or the osculating
        # orbit depending on the last plotted line, as they share variable
        if not self.ax.get_legend():
            size = self.ax.figure.get_size_inches() + [8, 0]
            self.ax.figure.set_size_inches(size)
        orbit.epoch.out_subfmt = "date_hm"
        label = "{} ({})".format(orbit.epoch.iso, label)

        l.set_label(label)
        self.ax.legend(bbox_to_anchor=(1.05, 1), title="Names and epochs")

    self.ax.set_xlabel("$x$ (km)")
    self.ax.set_ylabel("$y$ (km)")
    self.ax.set_aspect(1)

    return lines


# Traceback (ValueError)
/usr/local/lib/python3.6/site-packages/astropy/units/quantity.py:639: RuntimeWarning:

invalid value encountered in log

---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
/usr/local/lib/python3.6/site-packages/astropy/time/core.py in __add__(self, other)
1369             try:
-> 1370                 other = TimeDelta(other)
1371             except Exception:

/usr/local/lib/python3.6/site-packages/astropy/time/core.py in __init__(self, val, val2, format, scale, copy)
1539
-> 1540             self._init_from_vals(val, val2, format, scale, copy)
1541

/usr/local/lib/python3.6/site-packages/astropy/time/core.py in _init_from_vals(self, val, val2, format, scale, copy, precision, in_subfmt, out_subfmt)
329         self._time = self._get_time_fmt(val, val2, format, scale,
--> 330                                         precision, in_subfmt, out_subfmt)
331         self._format = self._time.name

/usr/local/lib/python3.6/site-packages/astropy/time/core.py in _get_time_fmt(self, val, val2, format, scale, precision, in_subfmt, out_subfmt)
373         else:
--> 374             raise ValueError('Input values did not match {0}'.format(err_msg))
375

ValueError: Input values did not match the format class jd

During handling of the above exception, another exception occurred:

OperandTypeError                          Traceback (most recent call last)
<ipython-input-5-f1d654cf6abc> in <module>()
2
3 op.plot(parking)
----> 4 op.plot(exit)
5
6 plt.xlim(-8000, 8000)

/usr/local/lib/python3.6/site-packages/poliastro-0.9.dev0-py3.6.egg/poliastro/plotting.py in plot(self, orbit, label, color)
152         lines = []
153
--> 154         _, positions = orbit.sample(self.num_points)
155         rr = positions.get_xyz().transpose()
156

/usr/local/lib/python3.6/site-packages/poliastro-0.9.dev0-py3.6.egg/poliastro/twobody/orbit.py in sample(self, values, function)
308                 nu_values = np.insert(nu_values, 0, self.ecc)
309
--> 310             return self.sample(nu_values, function)
311
312         elif hasattr(values, "unit") and values.unit in ('rad', 'deg'):

/usr/local/lib/python3.6/site-packages/poliastro-0.9.dev0-py3.6.egg/poliastro/twobody/orbit.py in sample(self, values, function)
311
312         elif hasattr(values, "unit") and values.unit in ('rad', 'deg'):
--> 313             values = self._generate_time_values(values)
314         return (values, self._sample(values, function))
315

/usr/local/lib/python3.6/site-packages/poliastro-0.9.dev0-py3.6.egg/poliastro/twobody/orbit.py in _generate_time_values(self, nu_vals)
324     def _generate_time_values(self, nu_vals):
325         M_vals = nu_to_M(nu_vals, self.ecc)
--> 326         time_values = self.epoch + (M_vals / self.n).decompose()
327         return time_values
328

/usr/local/lib/python3.6/site-packages/astropy/time/core.py in __add__(self, other)
1370                 other = TimeDelta(other)
1371             except Exception:
-> 1372                 raise OperandTypeError(self, other, '+')
1373
1374         # Tdelta + something is dealt with in TimeDelta, so we have

OperandTypeError: Unsupported operand type(s) for +: 'Time' and 'Quantity'

# Fixed code
def plot(self, orbit, label=None, color=None):
    """Plots state and osculating orbit in their plane."""
    if not self._frame:
        self.set_frame(*orbit.pqw())

    if (orbit, label) not in self._orbits:
        self._orbits.append((orbit, label))

    # if new attractor radius is smaller, plot it
    new_radius = max(orbit.attractor.R.to(u.km).value, orbit.r_p.to(u.km).value / 6)
    if not self._attractor_radius:
        self.set_attractor(orbit)
    elif new_radius < self._attractor_radius:
        self.set_attractor(orbit)

    lines = []

    _, positions = orbit.sample(self.num_points)
    rr = positions.get_xyz().transpose()

    # Project on OrbitPlotter frame
    # x_vec, y_vec, z_vec = self._frame
    x, y = self._project(rr)
    x0, y0 = self._project(orbit.r[None])

    # Plot current position
    (l,) = self.ax.plot(x0.to(u.km).value, y0.to(u.km).value, "o", mew=0, color=color)
    lines.append(l)

    # Plot trajectory
    (l,) = self.ax.plot(x.to(u.km).value, y.to(u.km).value, "--", color=l.get_color())
    lines.append(l)

    if label:
        # This will apply the label to either the point or the osculating
        # orbit depending on the last plotted line, as they share variable
        if not self.ax.get_legend():
            size = self.ax.figure.get_size_inches() + [8, 0]
            self.ax.figure.set_size_inches(size)
        orbit.epoch.out_subfmt = "date_hm"
        label = "{} ({})".format(orbit.epoch.iso, label)

        l.set_label(label)
        self.ax.legend(bbox_to_anchor=(1.05, 1), title="Names and epochs")

    self.ax.set_xlabel("$x$ (km)")
    self.ax.set_ylabel("$y$ (km)")
    self.ax.set_aspect(1)

    return lines