In [3]:
%autosave 20
%matplotlib inline
import matplotlib.pyplot as plt
import numpy as np
plt.plot(range(10), 'x')
# plt.show()


Autosaving every 20 seconds
Out[3]:
[<matplotlib.lines.Line2D at 0x7f38715736a0>]

In [4]:
# %autosave 20
# %matplotlib notebook
# import matplotlib.pyplot as plt
# plt.plot(range(10), 'x')
# # plt.show()

In [6]:
plt.plot(np.arange(10)**2, 'x')


Out[6]:
[<matplotlib.lines.Line2D at 0x7f38713c3240>]

In [7]:
x = np.linspace(0, 4*np.pi, 100)
y = np.sin(x)
plt.plot(x, y)


Out[7]:
[<matplotlib.lines.Line2D at 0x7f3871149d30>]

In [8]:
plt.plot(x, 0)


---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-8-0235b681f4ec> in <module>()
----> 1 plt.plot(x, 0)

/opt/conda/lib/python3.6/site-packages/matplotlib/pyplot.py in plot(*args, **kwargs)
   3316                       mplDeprecation)
   3317     try:
-> 3318         ret = ax.plot(*args, **kwargs)
   3319     finally:
   3320         ax._hold = washold

/opt/conda/lib/python3.6/site-packages/matplotlib/__init__.py in inner(ax, *args, **kwargs)
   1890                     warnings.warn(msg % (label_namer, func.__name__),
   1891                                   RuntimeWarning, stacklevel=2)
-> 1892             return func(ax, *args, **kwargs)
   1893         pre_doc = inner.__doc__
   1894         if pre_doc is None:

/opt/conda/lib/python3.6/site-packages/matplotlib/axes/_axes.py in plot(self, *args, **kwargs)
   1404         kwargs = cbook.normalize_kwargs(kwargs, _alias_map)
   1405 
-> 1406         for line in self._get_lines(*args, **kwargs):
   1407             self.add_line(line)
   1408             lines.append(line)

/opt/conda/lib/python3.6/site-packages/matplotlib/axes/_base.py in _grab_next_args(self, *args, **kwargs)
    405                 return
    406             if len(remaining) <= 3:
--> 407                 for seg in self._plot_args(remaining, kwargs):
    408                     yield seg
    409                 return

/opt/conda/lib/python3.6/site-packages/matplotlib/axes/_base.py in _plot_args(self, tup, kwargs)
    383             x, y = index_of(tup[-1])
    384 
--> 385         x, y = self._xy_from_xy(x, y)
    386 
    387         if self.command == 'plot':

/opt/conda/lib/python3.6/site-packages/matplotlib/axes/_base.py in _xy_from_xy(self, x, y)
    242         if x.shape[0] != y.shape[0]:
    243             raise ValueError("x and y must have same first dimension, but "
--> 244                              "have shapes {} and {}".format(x.shape, y.shape))
    245         if x.ndim > 2 or y.ndim > 2:
    246             raise ValueError("x and y can be no greater than 2-D, but have "

ValueError: x and y must have same first dimension, but have shapes (100,) and (1,)

In [9]:
plt.plot(x, np.zeros_like(x))


Out[9]:
[<matplotlib.lines.Line2D at 0x7f3870ccdba8>]

In [19]:
plt.plot(x, np.sin(x), '-' )
plt.plot(x, np.cos(x), '--')
plt.plot(x, np.exp(-(x-1)**2), '-.')
plt.plot(x[::10], x[::10]/10, 'x')


Out[19]:
[<matplotlib.lines.Line2D at 0x7f38706c8b70>]

In [20]:
plt.plot(x, np.sin(x), 'r-' )
plt.plot(x, np.cos(x), 'b--')
plt.plot(x, np.exp(-(x-1)**2), 'k-.')
plt.plot(x[::10], x[::10]/10, 'mx')


Out[20]:
[<matplotlib.lines.Line2D at 0x7f38705db3c8>]

In [28]:
plt.plot(x, np.sin(x), '-', color='#0099aa' )
plt.plot(x, np.cos(x), '--', color='brown')
plt.plot(x, np.exp(-(x-1)**2), '-.', color=(0.8,0.5,1.0))
plt.plot(x[::10], x[::10]/10, 'o', color='k')
plt.xlabel(r'$\Sigma$')


Out[28]:
<matplotlib.text.Text at 0x7f3870209048>

In [ ]: