Skip to content

Commit c0151bd

Browse files
author
Chang She
committed
DOC: example for plotting on secondary y-axis
1 parent 214c24b commit c0151bd

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

doc/source/visualization.rst

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,20 @@ You may pass ``logy`` to get a log-scale Y axis.
9191
@savefig series_plot_logy.png width=4.5in
9292
ts.plot(logy=True)
9393
94+
Plotting on a Secondary Y-axis
95+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
96+
97+
To plot data on a secondary y-axis, use the ``secondary_y`` keyword:
98+
99+
.. ipython:: python
100+
101+
plt.figure()
102+
103+
df.A.plot()
104+
105+
@savefig series_plot_secondary_y.png width=4.5in
106+
df.B.plot(secondary_y=True, style='g')
107+
94108
95109
Targeting different subplots
96110
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -107,6 +121,7 @@ You can pass an ``ax`` argument to ``Series.plot`` to plot on a particular axis:
107121
@savefig series_plot_multi.png width=4.5in
108122
df['D'].plot(ax=axes[1,1]); axes[1,1].set_title('D')
109123
124+
110125
Other plotting features
111126
-----------------------
112127

0 commit comments

Comments
 (0)