cachai.gadgets.PolarText
- class cachai.gadgets.PolarText(radius, angle, text, center=(0, 0), pad=0.0, **kwargs)[source]
Bases:
TextInitialize a
matplotlib.text.Textinstance using polar coordinates.- Attributes
- radius
float Radius coordinate from the center.
- theta
float Angle in degrees (0° at positive x-axis, increasing counterclockwise).
- text
str Text to diplay.
- center
tuple, optional Center coordinates (x,y) (default: (0,0)).
- pad
float, optional Padding value (positive for outward displacement, negative for inward).
- radius
- Other Attributes
**kwargsKeyword arguments of
matplotlib.text.Text.
Examples
import matplotlib.pyplot as plt import cachai.gadgets as chg fig, ax = plt.subplots() ax.plot([0,0],[1,1]) polar = chg.PolarText((0,0),1,45,text='Im polar!',pad=0.5,ha='center', va='center') ax.add_artist(polar) plt.show()
Methods
- set_angle(angle)[source]
Changes the angular position of the text around the center.
- Parameters
- angle
float New angle coordinate in degrees.
- angle
- set_center(center)[source]
Moves the entire polar coordinate system to a new center point.
- Parameters
- center
tupleorarray-like New center coordinates (x,y).
- center
- set_pad(pad)[source]
Adjusts the radial padding distance between the text and its base polar position.
- Parameters
- pad
float New padding value.
- pad
- set_polar_position(radius=None, angle=None, center=None)[source]
Updates multiple polar coordinates simultaneously.
- Parameters
- radius
float New radial distance from center.
- angle
float New angular position in degrees.
- center
tupleorarray-like New center coordinates for the polar system.
- radius
- set_radius(radius)[source]
Updates the radial coordinate of the text relative to the center point.
- Parameters
- radius
float New radius coordinate.
- radius