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

Function polar

lib/matplotlib/pyplot.py:2834–2868  ·  view source on GitHub ↗

Make a polar plot. call signature:: polar(theta, r, [fmt], **kwargs) This is a convenience wrapper around `.pyplot.plot`. It ensures that the current Axes is polar (or creates one if needed) and then passes all parameters to ``.pyplot.plot``. .. note:: When

(*args, **kwargs)

Source from the content-addressed store, hash-verified

2832
2833
2834def polar(*args, **kwargs) -> list[Line2D]:
2835 """
2836 Make a polar plot.
2837
2838 call signature::
2839
2840 polar(theta, r, [fmt], **kwargs)
2841
2842 This is a convenience wrapper around `.pyplot.plot`. It ensures that the
2843 current Axes is polar (or creates one if needed) and then passes all parameters
2844 to ``.pyplot.plot``.
2845
2846 .. note::
2847 When making polar plots using the :ref:`pyplot API <pyplot_interface>`,
2848 ``polar()`` should typically be the first command because that makes sure
2849 a polar Axes is created. Using other commands such as ``plt.title()``
2850 before this can lead to the implicit creation of a rectangular Axes, in which
2851 case a subsequent ``polar()`` call will fail.
2852 """
2853 # If an axis already exists, check if it has a polar projection
2854 if gcf().get_axes():
2855 ax = gca()
2856 if not isinstance(ax, PolarAxes):
2857 _api.warn_deprecated(
2858 "3.10",
2859 message="There exists a non-polar current Axes. Therefore, the "
2860 "resulting plot from 'polar()' is non-polar. You likely "
2861 "should call 'polar()' before any other pyplot plotting "
2862 "commands. "
2863 "Support for this scenario is deprecated in %(since)s and "
2864 "will raise an error in %(removal)s"
2865 )
2866 else:
2867 ax = axes(projection="polar")
2868 return ax.plot(*args, **kwargs)
2869
2870
2871# If rcParams['backend_fallback'] is true, and an interactive backend is

Callers

nothing calls this directly

Calls 4

gcfFunction · 0.85
gcaFunction · 0.85
axesFunction · 0.85
plotMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…