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, 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.Font

  • A dict of string/value properties that will be passed to the Font constructor

    Supported dict properties:

    color

    family

    HTML font family - the typeface that will be applied by the web browser. The web browser will only be able to apply a font if it is available on the system which it operates. Provide multiple font families, separated by commas, to indicate the preference in which to apply fonts if they aren’t available on the system. The Chart Studio Cloud (at https://chart-studio.plotly.com or on-premise) generates images on a server, where only a select number of fonts are installed and supported. These include “Arial”, “Balto”, “Courier New”, “Droid Sans”, “Droid Serif”, “Droid Sans Mono”, “Gravitas One”, “Old Standard TT”, “Open Sans”, “Overpass”, “PT Sans Narrow”, “Raleway”, “Times New Roman”.

    lineposition

    Sets the kind of decoration line(s) with text, such as an “under”, “over” or “through” as well as combinations e.g. “under+over”, etc.

    shadow

    Sets the shape and color of the shadow behind text. “auto” places minimal shadow and applies contrast text font color. See https://developer.mozilla.org/en- US/docs/Web/CSS/text-shadow for additional options.

    size

    style

    Sets whether a font should be styled with a normal or italic face from its family.

    textcase

    Sets capitalization of text. It can be used to make text appear in all-uppercase or all- lowercase, or with each word capitalized.

    variant

    Sets the variant of the font.

    weight

    Sets the weight (or boldness) of the font.

Returns

Return type

plotly.graph_objects.layout.shape.label.Font

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 name is 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

str

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 variables x0, x1, y0, y1, slope, dx, dy, width, height, length, xcenter and ycenter.

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

str

property xanchor

Sets the label’s horizontal position anchor This anchor binds the specified textposition to the “left”, “center” or “right” of the label text. For example, if textposition is set to top right and xanchor to “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 textposition to the “top”, “middle” or “bottom” of the label text. For example, if textposition is set to top right and yanchor to “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

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.Font

  • A dict of string/value properties that will be passed to the Font constructor

    Supported dict properties:

    color

    family

    HTML font family - the typeface that will be applied by the web browser. The web browser will only be able to apply a font if it is available on the system which it operates. Provide multiple font families, separated by commas, to indicate the preference in which to apply fonts if they aren’t available on the system. The Chart Studio Cloud (at https://chart-studio.plotly.com or on-premise) generates images on a server, where only a select number of fonts are installed and supported. These include “Arial”, “Balto”, “Courier New”, “Droid Sans”, “Droid Serif”, “Droid Sans Mono”, “Gravitas One”, “Old Standard TT”, “Open Sans”, “Overpass”, “PT Sans Narrow”, “Raleway”, “Times New Roman”.

    lineposition

    Sets the kind of decoration line(s) with text, such as an “under”, “over” or “through” as well as combinations e.g. “under+over”, etc.

    shadow

    Sets the shape and color of the shadow behind text. “auto” places minimal shadow and applies contrast text font color. See https://developer.mozilla.org/en- US/docs/Web/CSS/text-shadow for additional options.

    size

    style

    Sets whether a font should be styled with a normal or italic face from its family.

    textcase

    Sets capitalization of text. It can be used to make text appear in all-uppercase or all- lowercase, or with each word capitalized.

    variant

    Sets the variant of the font.

    weight

    Sets the weight (or boldness) of the font.

Returns

Return type

plotly.graph_objects.layout.shape.legendgrouptitle.Font

property text

Sets the title of the legend group.

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

str

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 hex string (e.g. ‘#ff0000’)

  • An rgb/rgba string (e.g. ‘rgb(255,0,0)’)

  • An hsl/hsla string (e.g. ‘hsl(0,100%,50%)’)

  • An hsv/hsva string (e.g. ‘hsv(0,100%,100%)’)

  • A named CSS color:

    aliceblue, antiquewhite, aqua, aquamarine, azure, beige, bisque, black, blanchedalmond, blue, blueviolet, brown, burlywood, cadetblue, chartreuse, chocolate, coral, cornflowerblue, cornsilk, crimson, cyan, darkblue, darkcyan, darkgoldenrod, darkgray, darkgrey, darkgreen, darkkhaki, darkmagenta, darkolivegreen, darkorange, darkorchid, darkred, darksalmon, darkseagreen, darkslateblue, darkslategray, darkslategrey, darkturquoise, darkviolet, deeppink, deepskyblue, dimgray, dimgrey, dodgerblue, firebrick, floralwhite, forestgreen, fuchsia, gainsboro, ghostwhite, gold, goldenrod, gray, grey, green, greenyellow, honeydew, hotpink, indianred, indigo, ivory, khaki, lavender, lavenderblush, lawngreen, lemonchiffon, lightblue, lightcoral, lightcyan, lightgoldenrodyellow, lightgray, lightgrey, lightgreen, lightpink, lightsalmon, lightseagreen, lightskyblue, lightslategray, lightslategrey, lightsteelblue, lightyellow, lime, limegreen, linen, magenta, maroon, mediumaquamarine, mediumblue, mediumorchid, mediumpurple, mediumseagreen, mediumslateblue, mediumspringgreen, mediumturquoise, mediumvioletred, midnightblue, mintcream, mistyrose, moccasin, navajowhite, navy, oldlace, olive, olivedrab, orange, orangered, orchid, palegoldenrod, palegreen, paleturquoise, palevioletred, papayawhip, peachpuff, peru, pink, plum, powderblue, purple, red, rosybrown, royalblue, rebeccapurple, saddlebrown, salmon, sandybrown, seagreen, seashell, sienna, silver, skyblue, slateblue, slategray, slategrey, snow, springgreen, steelblue, tan, teal, thistle, tomato, turquoise, violet, wheat, white, whitesmoke, yellow, yellowgreen

Returns

Return type

str

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

str

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