%matplotlib inline
import matplotlib
import matplotlib.pyplot as plt
import brewer2mpl
brewer2mpl.print_all_maps()
Sequential Blues : {3, 4, 5, 6, 7, 8, 9} BuGn : {3, 4, 5, 6, 7, 8, 9} BuPu : {3, 4, 5, 6, 7, 8, 9} GnBu : {3, 4, 5, 6, 7, 8, 9} Greens : {3, 4, 5, 6, 7, 8, 9} Greys : {3, 4, 5, 6, 7, 8, 9} OrRd : {3, 4, 5, 6, 7, 8, 9} Oranges : {3, 4, 5, 6, 7, 8, 9} PuBu : {3, 4, 5, 6, 7, 8, 9} PuBuGn : {3, 4, 5, 6, 7, 8, 9} PuRd : {3, 4, 5, 6, 7, 8, 9} Purples : {3, 4, 5, 6, 7, 8, 9} RdPu : {3, 4, 5, 6, 7, 8, 9} Reds : {3, 4, 5, 6, 7, 8, 9} YlGn : {3, 4, 5, 6, 7, 8, 9} YlGnBu : {3, 4, 5, 6, 7, 8, 9} YlOrBr : {3, 4, 5, 6, 7, 8, 9} YlOrRd : {3, 4, 5, 6, 7, 8, 9} Diverging BrBG : {3, 4, 5, 6, 7, 8, 9, 10, 11} PRGn : {3, 4, 5, 6, 7, 8, 9, 10, 11} PiYG : {3, 4, 5, 6, 7, 8, 9, 10, 11} PuOr : {3, 4, 5, 6, 7, 8, 9, 10, 11} RdBu : {3, 4, 5, 6, 7, 8, 9, 10, 11} RdGy : {3, 4, 5, 6, 7, 8, 9, 10, 11} RdYlBu : {3, 4, 5, 6, 7, 8, 9, 10, 11} RdYlGn : {3, 4, 5, 6, 7, 8, 9, 10, 11} Spectral : {3, 4, 5, 6, 7, 8, 9, 10, 11} Qualitative Accent : {3, 4, 5, 6, 7, 8} Dark2 : {3, 4, 5, 6, 7, 8} Paired : {3, 4, 5, 6, 7, 8, 9, 10, 11, 12} Pastel1 : {3, 4, 5, 6, 7, 8, 9} Pastel2 : {3, 4, 5, 6, 7, 8} Set1 : {3, 4, 5, 6, 7, 8, 9} Set2 : {3, 4, 5, 6, 7, 8} Set3 : {3, 4, 5, 6, 7, 8, 9, 10, 11, 12}
bmap = brewer2mpl.get_map('Greens', 'sequential', 5)
colors = bmap.mpl_colors
plt.plot([0,1,2,3,4], [1,2,1,2,1], marker = 'o', c=colors)
[<matplotlib.lines.Line2D at 0x10ba3e550>]
<matplotlib.figure.Figure at 0x10b326890>
plt.scatter([0,1,2,3,4], [1,2,1,2,1], s=150, marker = 'o', c=colors)
<matplotlib.collections.PathCollection at 0x10c113d10>
plt.scatter?
matplotlib.backends?
%pylab
Using matplotlib backend: agg Populating the interactive namespace from numpy and matplotlib
import numpy as np
x = np.arange(10)
y = np.sin(x)
pyplot.plot(x, y)
[<matplotlib.lines.Line2D at 0x1092c5310>]
You can modify the linestyle
pyplot.plot(x, y, linestyle = '--')
[<matplotlib.lines.Line2D at 0x10929b0d0>]
You can modify the symbol
pyplot.plot(x, y, marker = 'o')
[<matplotlib.lines.Line2D at 0x1092bf910>]
You can modify the color
pyplot.plot(x, y, color = 'salmon')
[<matplotlib.lines.Line2D at 0x10b49e690>]
Label your plot
pyplot.xlabel('x')
pyplot.ylabel('sin(x)')
pyplot.title('Sine curve')
<matplotlib.text.Text at 0x1098fec50>
fig = pyplot.figure()
ax = fig.add_subplot(1, 1, 1)
ax.plot(x, y, marker = 's', linestyle = ':', color = 'lime')
ax.set_xlabel('x')
ax.set_ylabel('sin(x)')
<matplotlib.text.Text at 0x10b4b3310>