You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: doc/source/visualization.rst
+62
Original file line number
Diff line number
Diff line change
@@ -531,3 +531,65 @@ be colored differently.
531
531
532
532
@savefigradviz.pngwidth=6in
533
533
radviz(data, 'Name')
534
+
535
+
.. _visualization.colormaps:
536
+
537
+
Colormaps
538
+
~~~~~~~~~
539
+
540
+
A potential issue when plotting a large number of columns is that it can be difficult to distinguish some series due to repetition in the default colors. To remedy this, DataFrame plotting supports the use of the ``colormap=`` argument, which accepts either a Matplotlib `colormap <http://matplotlib.org/api/cm_api.html>`__ or a string that is a name of a colormap registered with Matplotlib. A visualization of the default matplotlib colormaps is available `here <http://wiki.scipy.org/Cookbook/Matplotlib/Show_colormaps>`__.
541
+
542
+
As matplotlib does not directly support colormaps for line-based plots, the colors are selected based on an even spacing determined by the number of columns in the DataFrame. There is no consideration made for background color, so some colormaps will produce lines that are not easily visible.
543
+
544
+
To use the jet colormap, we can simply pass ``'jet'`` to ``colormap=``
545
+
546
+
.. ipython:: python
547
+
548
+
df = DataFrame(randn(1000, 10), index=ts.index)
549
+
df = df.cumsum()
550
+
551
+
plt.figure()
552
+
553
+
@savefigjet.pngwidth=6in
554
+
df.plot(colormap='jet')
555
+
556
+
or we can pass the colormap itself
557
+
558
+
.. ipython:: python
559
+
560
+
from matplotlib import cm
561
+
562
+
plt.figure()
563
+
564
+
@savefigjet_cm.pngwidth=6in
565
+
df.plot(colormap=cm.jet)
566
+
567
+
Colormaps can also be used other plot types, like bar charts:
0 commit comments