graphinglib.Rectangle.from_center#
- classmethod Rectangle.from_center(x: float, y: float, width: float, height: float, fill: bool | Inherit = Inherit, fill_color: str | Inherit = Inherit, edge_color: str | Inherit = Inherit, line_width: float | Inherit = Inherit, line_style: str | Inherit = Inherit, fill_alpha: float | Inherit = Inherit) Self[source]#
Creates a
Rectanglefrom its center point, width and height.- Parameters:
- xfloat
The x coordinate of the center point.
- yfloat
The y coordinate of the center point.
- widthfloat
The width of the
Rectangle.- heightfloat
The height of the
Rectangle.- fillbool, optional
Whether the rectangle should be filled or not. Default depends on the
figure_styleconfiguration.- fill_colorstr, optional
The color of the rectangle’s fill. Default depends on the
figure_styleconfiguration.- edge_colorstr, optional
The color of the rectangle’s edge. Default depends on the
figure_styleconfiguration.- line_widthfloat, optional
The width of the line. Typical range is
0.5to4. Default depends on thefigure_styleconfiguration.- line_stylestr, optional
The style of the line. Values include
"-","--","-.",":","solid","dashed","dashdot", and"dotted". Default depends on thefigure_styleconfiguration.- fill_alphafloat, optional
The alpha value of the fill. Range is
0(transparent) to1(opaque). Default depends on thefigure_styleconfiguration.
Notes
Color parameters accept Matplotlib color formats: named colors (
"blue"), short color strings ("b"), hex strings ("#0000ff"), grayscale strings ("0.5"), and RGB/RGBA tuples with values between0and1((0, 0, 1)or(0, 0, 1, 0.5)).