Skip to content

Commit

Permalink
DOC: describe suppression of auto tick locator adjustment #2205
Browse files Browse the repository at this point in the history
  • Loading branch information
changhiskhan committed Nov 9, 2012
1 parent aa5d9b5 commit e7f6eda
Showing 1 changed file with 46 additions and 2 deletions.
48 changes: 46 additions & 2 deletions doc/source/visualization.rst
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ To plot data on a secondary y-axis, use the ``secondary_y`` keyword:
Selective Plotting on Secondary Y-axis
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

To plot some columns in a DataFrame, give the column names to the `secondary_y`
To plot some columns in a DataFrame, give the column names to the ``secondary_y``
keyword:

.. ipython:: python
Expand All @@ -135,7 +135,7 @@ keyword:
Note that the columns plotted on the secondary y-axis is automatically marked
with "(right)" in the legend. To turn off the automatic marking, use the
`mark_right=False` keyword:
``mark_right=False`` keyword:

.. ipython:: python
Expand All @@ -145,6 +145,50 @@ with "(right)" in the legend. To turn off the automatic marking, use the
df.plot(secondary_y=['A', 'B'], mark_right=False)
Suppressing tick resolution adjustment
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Pandas includes automatically tick resolution adjustment for regular frequency
time-series data. For limited cases where pandas cannot infer the frequency
information (e.g., in an externally created ``twinx``), you can choose to
suppress this behavior for alignment purposes.

Here is the default behavior, notice how the x-axis tick labelling is performed:

.. ipython:: python
plt.figure()
@savefig ser_plot_suppress.png width=4.5in
df.A.plot()
Using the ``x_compat`` parameter, you can suppress this bevahior:

.. ipython:: python
plt.figure()
@savefig ser_plot_suppress_parm.png width=4.5in
df.A.plot(x_compat=True)
If you have more than one plot that needs to be suppressed, the ``use`` method
in ``pandas.plot_params`` can be used in a `with statement`:

.. ipython:: python
import pandas as pd
plt.figure()
@savefig ser_plot_suppress_context.png width=4.5in
with pd.plot_params.use('x_compat', True):
df.A.plot(color='r')
df.B.plot(color='g')
df.C.plot(color='b')
Targeting different subplots
~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Expand Down

0 comments on commit e7f6eda

Please sign in to comment.