FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Polar tick improvements by QuLogic · Pull Request #9068 · matplotlib/matplotlib · GitHub

Repository navigation

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .pdf  (11) .png  (13) .py  (3) .rst  (1) .svg  (12) All 5 file types selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
6 changes: 6 additions & 0 deletions doc/users/whats_new.rst
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,12 @@ negative values are simply used as labels, and the real radius is shifted by
the configured minimum. This release also allows negative radii to be used for
grids and ticks, which were previously silently ignored.

Radial ticks have been modified to be parallel to the circular grid line, and
angular ticks have been modified to be parallel to the grid line. It may also
be useful to rotate tick *labels* to match the boundary. Calling
``ax.tick_params(rotation='auto')`` will enable new behavior: radial tick
labels will be parallel to the circular grid line, and angular tick labels will
be perpendicular to the grid line (i.e., parallel to the outer boundary.)


Merge JSAnimation
Expand Down
24 changes: 22 additions & 2 deletions lib/matplotlib/axis.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ def __init__(self, axes, loc, label,
labelsize = rcParams['%s.labelsize' % name]
self._labelsize = labelsize

self._labelrotation = labelrotation
self._set_labelrotation(labelrotation)

if zorder is None:
if major:
Expand All @@ -167,6 +167,20 @@ def __init__(self, axes, loc, label,

self.update_position(loc)

def _set_labelrotation(self, labelrotation):
if isinstance(labelrotation, six.string_types):
mode = labelrotation
angle = 0
elif isinstance(labelrotation, (tuple, list)):
mode, angle = labelrotation
else:
mode = 'default'
angle = labelrotation
if mode not in ('auto', 'default'):
raise ValueError("Label rotation mode must be 'default' or "
"'auto', not '{}'.".format(mode))
self._labelrotation = (mode, angle)

def apply_tickdir(self, tickdir):
"""
Calculate self._pad and self._tickmarkers
Expand Down Expand Up @@ -331,8 +345,14 @@ def _apply_params(self, **kw):
self.tick2line.set(**tick_kw)
for k, v in six.iteritems(tick_kw):
setattr(self, '_' + k, v)

if 'labelrotation' in kw:
self._set_labelrotation(kw.pop('labelrotation'))
self.label1.set(rotation=self._labelrotation[1])
self.label2.set(rotation=self._labelrotation[1])

label_list = [k for k in six.iteritems(kw)
if k[0] in ['labelsize', 'labelcolor', 'labelrotation']]
if k[0] in ['labelsize', 'labelcolor']]
if label_list:
label_kw = {k[5:]: v for k, v in label_list}
self.label1.set(**label_kw)
Expand Down
Loading

Back | FazBrowse Home | New Git URL