Skip to content

Commit 5b16e78

Browse files
lestevehayd
authored andcommitted
Share color cycle between left and right axes
1 parent 2b7bcee commit 5b16e78

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

pandas/tools/plotting.py

+6
Original file line numberDiff line numberDiff line change
@@ -807,6 +807,8 @@ def _maybe_right_yaxis(self, ax):
807807

808808
if (sec_true or has_sec) and not hasattr(ax, 'right_ax'):
809809
orig_ax, new_ax = ax, ax.twinx()
810+
new_ax._get_lines.color_cycle = orig_ax._get_lines.color_cycle
811+
810812
orig_ax.right_ax, new_ax.left_ax = new_ax, orig_ax
811813

812814
if len(orig_ax.get_lines()) == 0: # no data on left y
@@ -2146,6 +2148,8 @@ def on_right(i):
21462148
if on_right(0):
21472149
orig_ax = ax0
21482150
ax0 = ax0.twinx()
2151+
ax0._get_lines.color_cycle = orig_ax._get_lines.color_cycle
2152+
21492153
orig_ax.get_yaxis().set_visible(False)
21502154
orig_ax.right_ax = ax0
21512155
ax0.left_ax = orig_ax
@@ -2163,6 +2167,8 @@ def on_right(i):
21632167
if on_right(i):
21642168
orig_ax = ax
21652169
ax = ax.twinx()
2170+
ax._get_lines.color_cycle = orig_ax._get_lines.color_cycle
2171+
21662172
orig_ax.get_yaxis().set_visible(False)
21672173
axarr[i] = ax
21682174

0 commit comments

Comments
 (0)