Skip to content
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

Text going outside subplot with multiple axes #4027

Closed
diogolr opened this issue Jan 22, 2015 · 6 comments
Closed

Text going outside subplot with multiple axes #4027

diogolr opened this issue Jan 22, 2015 · 6 comments
Labels
status: needs clarification Issues that need more information to resolve.

Comments

@diogolr
Copy link

diogolr commented Jan 22, 2015

image

System:

  • Windows 7
  • Qt 5.4.0
  • Python 3.4.2
  • PyQt 5.4
  • Matplotlib 1.4.2

Any idea?

What I'm doing...

  1. Configuring multiple axes with twiny
  2. Configuring the axes color, ticks, patch.set_visible( False )...
  3. Plotting some stuff on the axes previously configured
  4. Putting some text on the first created axe
  5. Catching the scroll event and using event.step times a factor with set_ylim of the axes
  6. Redrawing the canvas
@tacaswell
Copy link
Member

With out code, there is really nothing we can do to help you. Can you put together a minimal working example that shows the problem? My guess is that you are not keeping your y-axis in sync or have turned clipping off on you text objects.

This question might be better suited from the user maling list as well.

@tacaswell tacaswell added this to the unassigned milestone Jan 22, 2015
@tacaswell tacaswell added the status: needs clarification Issues that need more information to resolve. label Jan 22, 2015
@vgm64
Copy link

vgm64 commented Feb 5, 2015

I happened to run into the same issue today. Python 2.7.8, Matplotlib 1.4.0, MacOS 10.9.5. MWE below.

from pylab import *
f, (ax1, ax2) = subplots(2, 1)
ax2.text(20, 150, "If this appears on the top subplot, something's amiss...")
ax2.scatter([20, 40], [20, 80])
show()

image

@WeatherGod
Copy link
Member

ok, so what you want is clipping? Could you try adding "clip_on=True" as an
argument to the ax2.text() call?

On Thu, Feb 5, 2015 at 4:40 PM, Michael Woods notifications@github.com
wrote:

I happened to run into the same issue today. Python 2.7.8, Matplotlib
1.4.0, MacOS 10.9.5. MWE below.

from pylab import *
f, (ax1, ax2) = subplots(2, 1)
ax2.text(20, 150, "If this appears on the top subplot, something's amiss...")
ax2.scatter([20, 40], [20, 80])
show()

[image: image]
https://cloud.githubusercontent.com/assets/1680851/6069792/24874756-ad3c-11e4-9eb9-f7117332b9a2.png


Reply to this email directly or view it on GitHub
#4027 (comment)
.

@vgm64
Copy link

vgm64 commented Feb 6, 2015

You're quite right. That solves it. I included clip_on in my fontdict instead of as a kwarg when testing. Thanks.

from pylab import *
f, (ax1, ax2) = subplots(2, 1)
ax2.text(20, 150, "Using tools the way they were meant to be used.", clip_on=True)
ax2.scatter([20, 40], [20, 80])
show()

@WeatherGod
Copy link
Member

That option needs to be better documented, I think. Glad that worked!
On Feb 5, 2015 9:35 PM, "Michael Woods" notifications@github.com wrote:

You're quite right. That solves it. I included clip_on in my fontdict
instead of as a kwarg when testing. Thanks.

from pylab import *
f, (ax1, ax2) = subplots(2, 1)
ax2.text(20, 150, "Using tools the way they were meant to be used.", clip_on=True)
ax2.scatter([20, 40], [20, 80])
show()


Reply to this email directly or view it on GitHub
#4027 (comment)
.

@diogolr
Copy link
Author

diogolr commented Feb 24, 2015

The clip_on flag also works for me! Thank you very much.

@diogolr diogolr closed this as completed Feb 24, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: needs clarification Issues that need more information to resolve.
Projects
None yet
Development

No branches or pull requests

4 participants