@@ -123,7 +123,7 @@ To plot data on a secondary y-axis, use the ``secondary_y`` keyword:
123
123
Selective Plotting on Secondary Y-axis
124
124
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
125
125
126
- To plot some columns in a DataFrame, give the column names to the `secondary_y `
126
+ To plot some columns in a DataFrame, give the column names to the `` secondary_y ` `
127
127
keyword:
128
128
129
129
.. ipython :: python
@@ -135,7 +135,7 @@ keyword:
135
135
136
136
Note that the columns plotted on the secondary y-axis is automatically marked
137
137
with "(right)" in the legend. To turn off the automatic marking, use the
138
- `mark_right=False ` keyword:
138
+ `` mark_right=False ` ` keyword:
139
139
140
140
.. ipython :: python
141
141
@@ -145,6 +145,50 @@ with "(right)" in the legend. To turn off the automatic marking, use the
145
145
df.plot(secondary_y = [' A' , ' B' ], mark_right = False )
146
146
147
147
148
+ Suppressing tick resolution adjustment
149
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
150
+
151
+ Pandas includes automatically tick resolution adjustment for regular frequency
152
+ time-series data. For limited cases where pandas cannot infer the frequency
153
+ information (e.g., in an externally created ``twinx ``), you can choose to
154
+ suppress this behavior for alignment purposes.
155
+
156
+ Here is the default behavior, notice how the x-axis tick labelling is performed:
157
+
158
+ .. ipython :: python
159
+
160
+ plt.figure()
161
+
162
+ @savefig ser_plot_suppress.png width =4.5in
163
+ df.A.plot()
164
+
165
+
166
+ Using the ``x_compat `` parameter, you can suppress this bevahior:
167
+
168
+ .. ipython :: python
169
+
170
+ plt.figure()
171
+
172
+ @savefig ser_plot_suppress_parm.png width =4.5in
173
+ df.A.plot(x_compat = True )
174
+
175
+
176
+ If you have more than one plot that needs to be suppressed, the ``use `` method
177
+ in ``pandas.plot_params `` can be used in a `with statement `:
178
+
179
+ .. ipython :: python
180
+
181
+ import pandas as pd
182
+
183
+ plt.figure()
184
+
185
+ @savefig ser_plot_suppress_context.png width =4.5in
186
+ with pd.plot_params.use(' x_compat' , True ):
187
+ df.A.plot(color = ' r' )
188
+ df.B.plot(color = ' g' )
189
+ df.C.plot(color = ' b' )
190
+
191
+
148
192
Targeting different subplots
149
193
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
150
194
0 commit comments