plotly.graph_objects.layout.shape package¶
-
class
plotly.graph_objects.layout.shape.Label(arg=None, font=None, padding=None, text=None, textangle=None, textposition=None, texttemplate=None, texttemplatefallback=None, xanchor=None, yanchor=None, **kwargs)¶ Bases:
plotly.basedatatypes.BaseLayoutHierarchyType-
property
font¶ Sets the shape label text font.
The âfontâ property is an instance of Font that may be specified as:
An instance of
plotly.graph_objects.layout.shape.label.FontA dict of string/value properties that will be passed to the Font constructor
- Returns
- Return type
-
property
padding¶ Sets padding (in px) between edge of label and edge of shape.
- The âpaddingâ property is a number and may be specified as:
An int or float in the interval [0, inf]
- Returns
- Return type
int|float
-
property
text¶ Sets the text to display with shape. It is also used for legend item if
nameis not provided.- The âtextâ property is a string and must be specified as:
A string
A number that will be converted to a string
- Returns
- Return type
-
property
textangle¶ Sets the angle at which the label text is drawn with respect to the horizontal. For lines, angle âautoâ is the same angle as the line. For all other shapes, angle âautoâ is horizontal.
The âtextangleâ property is a angle (in degrees) that may be specified as a number between -180 and 180. Numeric values outside this range are converted to the equivalent value (e.g. 270 is converted to -90).
- Returns
- Return type
int|float
-
property
textposition¶ Sets the position of the label text relative to the shape. Supported values for rectangles, circles and paths are top left, top center, top right, middle left, middle center, middle right, bottom left, bottom center, and bottom right. Supported values for lines are âstartâ, âmiddleâ, and âendâ. Default: middle center for rectangles, circles, and paths; âmiddleâ for lines.
- The âtextpositionâ property is an enumeration that may be specified as:
- One of the following enumeration values:
[âtop leftâ, âtop centerâ, âtop rightâ, âmiddle leftâ, âmiddle centerâ, âmiddle rightâ, âbottom leftâ, âbottom centerâ, âbottom rightâ, âstartâ, âmiddleâ, âendâ]
- Returns
- Return type
Any
-
property
texttemplate¶ Template string used for rendering the shapeâs label. Note that this will override
text. Variables are inserted using %{variable}, for example âx0: %{x0}â. Numbers are formatted using d3-formatâs syntax %{variable:d3-format}, for example âPrice: %{x0:$.2f}â. See https://github.com/d3/d3-format/tree/v1.4.5#d3-format for details on the formatting syntax. Dates are formatted using d3-time-formatâs syntax %{variable|d3-time-format}, for example âDay: %{x0|%m %b %Y}â. See https://github.com/d3/d3-time- format/tree/v2.2.3#locale_format for details on the date formatting syntax. A single multiplication or division operation may be applied to numeric variables, and combined with d3 number formatting, for example âLength in cm: %{x0*2.54}â, â%{slope*60:.1f} meters per second.â For log axes, variable values are given in log units. For date axes, x/y coordinate variables and center variables use datetimes, while all other variable values use values in ms. Finally, the template string has access to variablesx0,x1,y0,y1,slope,dx,dy,width,height,length,xcenter,ycenter,simpleXVariablesandsimpleYVariables. Variables that canât be found will be replaced with the specifier. For example, a template of âdata: %{x}, %{y}â will result in a value of âdata: 1, %{y}â if x is 1 and y is missing. Variables with an undefined value will be replaced with the fallback value.- The âtexttemplateâ property is a string and must be specified as:
A string
A number that will be converted to a string
- Returns
- Return type
-
property
texttemplatefallback¶ Fallback string thatâs displayed when a variable referenced in a template is missing. If the boolean value âfalseâ is passed in, the specifier with the missing variable will be displayed.
The âtexttemplatefallbackâ property accepts values of any type
- Returns
- Return type
Any
-
property
xanchor¶ Sets the labelâs horizontal position anchor This anchor binds the specified
textpositionto the âleftâ, âcenterâ or ârightâ of the label text. For example, iftextpositionis set to top right andxanchorto ârightâ then the right-most portion of the label text lines up with the right-most edge of the shape.- The âxanchorâ property is an enumeration that may be specified as:
- One of the following enumeration values:
[âautoâ, âleftâ, âcenterâ, ârightâ]
- Returns
- Return type
Any
-
property
yanchor¶ Sets the labelâs vertical position anchor This anchor binds the specified
textpositionto the âtopâ, âmiddleâ or âbottomâ of the label text. For example, iftextpositionis set to top right andyanchorto âtopâ then the top-most portion of the label text lines up with the top-most edge of the shape.- The âyanchorâ property is an enumeration that may be specified as:
- One of the following enumeration values:
[âtopâ, âmiddleâ, âbottomâ]
- Returns
- Return type
Any
-
property
-
class
plotly.graph_objects.layout.shape.Legendgrouptitle(arg=None, font=None, text=None, **kwargs)¶ Bases:
plotly.basedatatypes.BaseLayoutHierarchyType-
property
font¶ Sets this legend groupâs title font.
The âfontâ property is an instance of Font that may be specified as:
An instance of
plotly.graph_objects.layout.shape.legendgrouptitle.FontA dict of string/value properties that will be passed to the Font constructor
- Returns
- Return type
-
property
-
class
plotly.graph_objects.layout.shape.Line(arg=None, color=None, dash=None, width=None, **kwargs)¶ Bases:
plotly.basedatatypes.BaseLayoutHierarchyType-
property
color¶ Sets the line color.
- The âcolorâ property is a color and may be specified as a string in the following formats:
hex or short hex (e.g. â#d3d3d3â, â#d3dâ)
hex or short hex with alpha (e.g. â#d3d3d380â, â#d3d8â)
rgb (e.g. ârgb(255, 0, 0)â, ârgb(255 0 0)â)
rgba (e.g. ârgba(255, 0, 0, 0.5)â, ârgba(255 0 0 / 0.5)â)
hsl (e.g. âhsl(0, 100%, 50%)â, âhsl(0deg 100% 50%)â)
hsla (e.g. âhsla(0, 100%, 50%, 0.5)â, âhsla(0deg 100% 50% / 0.5)â)
hwb (e.g. âhwb(0 0% 100%)â)
lab/lch/oklab/oklch (e.g. âoklch(0.7 0.15 180)â)
color (e.g. âcolor(display-p3 1 0 0)â)
named colors (full list: https://www.w3.org/TR/css-color-4/#named-color)
Any other supported CSS 4 color format: https://www.w3.org/TR/css-color-4/
- Returns
- Return type
-
property
dash¶ Sets the dash style of lines. Set to a dash type string (âsolidâ, âdotâ, âdashâ, âlongdashâ, âdashdotâ, or âlongdashdotâ) or a dash length list in px (eg â5px,10px,2px,2pxâ).
- The âdashâ property is an enumeration that may be specified as:
- One of the following dash styles:
[âsolidâ, âdotâ, âdashâ, âlongdashâ, âdashdotâ, âlongdashdotâ]
- A string containing a dash length list in pixels or percentages
(e.g. â5px 10px 2px 2pxâ, â5, 10, 2, 2â, â10% 20% 40%â, etc.)
- Returns
- Return type
-
property
width¶ Sets the line width (in px).
- The âwidthâ property is a number and may be specified as:
An int or float in the interval [0, inf]
- Returns
- Return type
int|float
-
property
