Skip to content

BUG: xlim on plots with shared axes (GH2960, GH3490) #7322

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 1, 2014

Conversation

rosnfeld
Copy link
Contributor

@rosnfeld rosnfeld commented Jun 3, 2014

Fixes #2960
Fixes #3490.

Summary of changes:

  • for irregular timeseries plots, considers all lines already plotted when calculating xlim
  • for plots with secondary_y axis, considers lines on both left and right axes when calculating xlim. There are tests for non-timeseries plots (always worked, but now a test to confirm this), irregular timeseries plots, and regular timeseries plots.

This does not fix #6608, which I now think is a fairly specific/rare case that could always be manually avoided by x_compat=True. I will still try and fix that, but it looks a bit uglier and I didn't want to hold back these more important changes.

@jreback jreback added this to the 0.14.1 milestone Jun 3, 2014
@jreback
Copy link
Contributor

jreback commented Jun 3, 2014

@TomAugspurger ?

@rosnfeld
Copy link
Contributor Author

I see from another PR that @TomAugspurger is travelling... is there anyone else who could take a look at this? Seems like a nice patch to have in 0.14.1.

(admittedly I am travelling also)

@jreback
Copy link
Contributor

jreback commented Jun 19, 2014

@cpcloud can you take a look?

@rosnfeld pls rebase this

@rosnfeld
Copy link
Contributor Author

Rebased. Thanks for reviving this. Looks like @sinhrks is working on similar material in #7459 and #7515.

@jreback
Copy link
Contributor

jreback commented Jun 26, 2014

cc @sinhrks can you have a look?

@@ -1598,6 +1598,9 @@ def _make_plot(self):
left, right = _get_xlim(lines)
ax.set_xlim(left, right)

def _get_existing_lines(self):
return self.ax.get_lines() if self.ax else []
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this also try to search on both right and left axes?

@rosnfeld
Copy link
Contributor Author

Good catch. I had created test_secondary_y_irregular_ts_xlim to test a secondary_y case but as written it only makes sure that a "primary" (non-secondary) axis is taken into consideration when you plot on the secondary axis, but not the other way around. I've strengthened the test and updated the code.

@jreback
Copy link
Contributor

jreback commented Jun 30, 2014

@rosnfeld pls rebase

@rosnfeld
Copy link
Contributor Author

rosnfeld commented Jul 1, 2014

Rebased.

@jreback
Copy link
Contributor

jreback commented Jul 1, 2014

one more rebase pls (i just merged bunch of plot stuff)

@rosnfeld
Copy link
Contributor Author

rosnfeld commented Jul 1, 2014

Ok, rebased again.

@jreback
Copy link
Contributor

jreback commented Jul 1, 2014

ok, ping when green

@rosnfeld
Copy link
Contributor Author

rosnfeld commented Jul 1, 2014

Travis is green on my fork but will take a while on the main pydata one I think. I am in Asia at the moment and unfortunately need to sleep. :)

@jreback
Copy link
Contributor

jreback commented Jul 1, 2014

hahha...np...thanks

@rosnfeld
Copy link
Contributor Author

rosnfeld commented Jul 1, 2014

Alright, it's green now.

jreback added a commit that referenced this pull request Jul 1, 2014
BUG: xlim on plots with shared axes (GH2960, GH3490)
@jreback jreback merged commit 87e7e27 into pandas-dev:master Jul 1, 2014
@jreback
Copy link
Contributor

jreback commented Jul 1, 2014

thanks!

@rosnfeld rosnfeld deleted the xlim_issues branch July 3, 2014 20:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
3 participants