MCPcopy Index your code
hub / github.com/matplotlib/matplotlib / test_polar_units_2

Function test_polar_units_2

lib/matplotlib/tests/test_polar.py:132–149  ·  view source on GitHub ↗
(fig_test, fig_ref)

Source from the content-addressed store, hash-verified

130
131@check_figures_equal()
132def test_polar_units_2(fig_test, fig_ref):
133 import matplotlib.testing.jpl_units as units
134 units.register()
135 xs = [30.0, 45.0, 60.0, 90.0]
136 xs_deg = [x * units.deg for x in xs]
137 ys = [1.0, 2.0, 3.0, 4.0]
138 ys_km = [y * units.km for y in ys]
139
140 plt.figure(fig_test)
141 # test {theta,r}units.
142 plt.polar(xs_deg, ys_km, thetaunits="rad", runits="km")
143 assert isinstance(plt.gca().xaxis.get_major_formatter(),
144 units.UnitDblFormatter)
145
146 ax = fig_ref.add_subplot(projection="polar")
147 ax.plot(np.deg2rad(xs), ys)
148 ax.xaxis.set_major_formatter(mpl.ticker.FuncFormatter("{:.12}".format))
149 ax.set(xlabel="rad", ylabel="km")
150
151
152@image_comparison(['polar_rmin.png'], style='default')

Callers

nothing calls this directly

Calls 8

figureMethod · 0.80
get_major_formatterMethod · 0.80
gcaMethod · 0.80
add_subplotMethod · 0.80
registerMethod · 0.45
plotMethod · 0.45
set_major_formatterMethod · 0.45
setMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…