Skip to content

set_rgrids() in a polar plot cannot set ticklabel size #17463

Open
@AgilentGCMS

Description

@AgilentGCMS

Bug report

In a polar plot, I want to set the sizes of the r and theta ticklabels. While setting the theta ticklabel size works with the method set_thetagrids, setting the r ticklabel size with set_rgrids does not work.

As an aside, I find it confusing that some functions for setting theta parameters require arguments in radians (e.g., set_thetalim), while others require arguments in degrees (e.g., set_thetagrids).

Code snippet

from matplotlib import pyplot as plt
import numpy as np

fig = plt.figure()
ax = plt.axes(polar=True)
ax.set_thetalim(0., np.pi/4.)
ax.set_rlim(0., 2.)

# set the size of theta ticklabels (works)
thetatick_locs = np.linspace(0.,45.,4)
thetatick_labels = [u'%i\u00b0'%np.round(x) for x in thetatick_locs]
ax.set_thetagrids(thetatick_locs, thetatick_labels, fontsize=16)

# set the size of r ticklabels (does not work)
rtick_locs = np.arange(0.5,2.0,0.7)
rtick_labels = ['%.1f'%r for r in rtick_locs]
ax.set_rgrids(rtick_locs, rtick_labels, fontsize=16)

plt.show()

Actual outcome
See figure

Expected outcome
I expect to be able to set the font properties of r ticklabels. Other settings, such as trying to set the font weight, does not work either.

Matplotlib version

  • Operating system: Macos 10.15.4 (Catalina)
  • Matplotlib version: 3.2.1 (installed via macports)
  • Matplotlib backend: Qt5Agg
  • Python version: 3.8.2 (installed via macports)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions