Thanks to visit codestin.com
Credit goes to github.com

Skip to content

polar axes labels error with small radial range #680

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 2 commits into from
Feb 27, 2012

Conversation

mdboom
Copy link
Member

@mdboom mdboom commented Jan 23, 2012

Hey there. When you run this example: http://matplotlib.sourceforge.net/examples/pylab_examples/polar_demo.html

and replace "ax.set_rmax(3.0)" with "ax.set_rmin(2.91); ax.set_rmax(3.01)" the r-axis labels move off of the axis.

Full example below (with the figsize changed to show where the labels go:
import matplotlib
import numpy as np
from matplotlib.pyplot import figure, show, rc, grid

radar green, solid grid lines

rc('grid', color='#316931', linewidth=1, linestyle='-')
rc('xtick', labelsize=15)
rc('ytick', labelsize=15)

force square figure and square axes looks better for polar, IMO

width, height = matplotlib.rcParams['figure.figsize']

size = min(width, height)

make a square figure

fig = figure(figsize=(6, 4))
ax = fig.add_axes([0.1, 0.1, 0.8, 0.8], polar=True, axisbg='#d5de9c')

r = np.arange(0, 3.0, 0.01)
theta = 2_np.pi_r
ax.plot(theta, r, color='#ee8d18', lw=3)
ax.set_rmin(2.91)
ax.set_rmax(3.01)
grid(True)

ax.set_title("And there was much rejoicing!", fontsize=20)
show()

@ghost ghost assigned mdboom Jan 17, 2012
@ubuntujenkins
Copy link

When it gets fixed it would be great if I can patch/update my current install so I can complete my university work. Even if I have to manually edit some files. Thanks

…dding heuristic broke down and sent the rlabels way off of the plot axes. The new approach is to not have rpad, but to change the alignment of the rlabels depending on the quadrant of the plot. This seems to work quite well, but is perhaps slightly backward incompatible.
@mdboom
Copy link
Member

mdboom commented Jan 23, 2012

A possible solution is on my polar-rpad branch. Can you confirm that it resolves the issue for you?

@phobson
Copy link
Member Author

phobson commented Jan 23, 2012

Michael,

Just got back from vacation and work is hectic. I'll try to test this
out on a VM later tonight.

Thanks for the hard work on this.
-paul

On Mon, Jan 23, 2012 at 8:51 AM, Michael Droettboom
[email protected]
wrote:

A possible solution is on my polar-rpad branch.  Can you confirm that it resolves the issue for you?


Reply to this email directly or view it on GitHub:
#680 (comment)

@ubuntujenkins
Copy link

Hello thanks for working so quick, I have had my head down working sorry for the late reply. I have tested the code by replacing my current lib/matplotlib/projections/polar.py file with the suggested one. My graph works perfectly with the labels nice and close to the radial lines. Its fixed, thanks very much.

If you want me to test it any other way let me know, if you could provide specific instructions as its a while since I have used git.

Thanks again.

@jdh2358
Copy link
Collaborator

jdh2358 commented Feb 26, 2012

Mike, this has caused some movement in the location of the ticklabels and so is causing a few tests to fail for me. If you are happy with the new locations, you can just update the baseline images

@mdboom
Copy link
Member

mdboom commented Feb 27, 2012

I've got hundreds of failures right now since upgrading to a new version of freetype -- I think if the failures look ok to you, that's good enough for me.

@jdh2358
Copy link
Collaborator

jdh2358 commented Feb 27, 2012

OK, I just submitted some new baseline images as a PR on mdboom#8

Is this in general the best way for me to contribute to a PR you initiated?

@mdboom
Copy link
Member

mdboom commented Feb 27, 2012

Thanks! Yes, that works. For really small things (which this isn't) just commenting on the lines in the PR is useful, too.

jdh2358 added a commit that referenced this pull request Feb 27, 2012
polar axes labels error with small radial range
@jdh2358 jdh2358 merged commit eb95530 into matplotlib:v1.1.x Feb 27, 2012
@mdboom mdboom deleted the polar-rpad branch March 3, 2015 18:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants