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

Skip to content

Commit 50e0c34

Browse files
committed
Round theta ticks to the nearest degree, rather than truncating.
svn path=/trunk/matplotlib/; revision=6477
1 parent a4fc06b commit 50e0c34

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

lib/matplotlib/projections/polar.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,14 +137,14 @@ class ThetaFormatter(Formatter):
137137
def __call__(self, x, pos=None):
138138
# \u00b0 : degree symbol
139139
if rcParams['text.usetex'] and not rcParams['text.latex.unicode']:
140-
return r"$%d^\circ$" % ((x / npy.pi) * 180.0)
140+
return r"$%0.0f^\circ$" % ((x / npy.pi) * 180.0)
141141
else:
142142
# we use unicode, rather than mathtext with \circ, so
143143
# that it will work correctly with any arbitrary font
144144
# (assuming it has a degree sign), whereas $5\circ$
145145
# will only work correctly with one of the supported
146146
# math fonts (Computer Modern and STIX)
147-
return u"%d\u00b0" % ((x / npy.pi) * 180.0)
147+
return u"%0.0f\u00b0" % ((x / npy.pi) * 180.0)
148148

149149
class RadialLocator(Locator):
150150
"""

0 commit comments

Comments
 (0)