Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Polar limits enhancements #4699

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 14 commits into from
Aug 21, 2017
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
ENH: Don't round degree digits when zoomed on PolarAxes.
  • Loading branch information
QuLogic committed Aug 16, 2017
commit 0b6cc581a4b4ef1b40720c61ce0b5d6cfec9b043
10 changes: 8 additions & 2 deletions 10 lib/matplotlib/projections/polar.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,15 +173,21 @@ class ThetaFormatter(Formatter):
unit of radians into degrees and adds a degree symbol.
"""
def __call__(self, x, pos=None):
vmin, vmax = self.axis.get_view_interval()
d = np.rad2deg(abs(vmax - vmin))
digits = max(-int(np.log10(d) - 1.5), 0)

if rcParams['text.usetex'] and not rcParams['text.latex.unicode']:
return r"$%0.0f^\circ$" % ((x / np.pi) * 180.0)
format_str = r"${value:0.{digits:d}f}^\circ$"
return format_str.format(value=np.rad2deg(x), digits=digits)
else:
# we use unicode, rather than mathtext with \circ, so
# that it will work correctly with any arbitrary font
# (assuming it has a degree sign), whereas $5\circ$
# will only work correctly with one of the supported
# math fonts (Computer Modern and STIX)
return "%0.0f\N{DEGREE SIGN}" % ((x / np.pi) * 180.0)
format_str = "{value:0.{digits:d}f}\N{DEGREE SIGN}"
return format_str.format(value=np.rad2deg(x), digits=digits)


class RadialLocator(Locator):
Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.