Skip to content

Code Reference

starplot.PlotStyle

Defines all the styling properties for a plot

base class-attribute instance-attribute

base: PlotBaseStyle = PlotBaseStyle(font_name='Inter', text_stroke_width=4)

Default base styles for undefined style properties. This is a way to apply some styles to everything in the plot, unless a style explicitly sets one of these values.

axes class-attribute instance-attribute

axes: AxesStyle = AxesStyle()

Styling for the axes of the plot, which is where the map is plotted.

figure class-attribute instance-attribute

Styling for the figure of the plot, which is the surrounding region outside the axes.

This area can include: title, legend (if plotted 'outside'), and padding between the axes (map region) and edge of image.

title class-attribute instance-attribute

title: TitleStyle = TitleStyle(
    font_size=85,
    font_weight=FontWeight.BOLD,
    stroke_width=0,
    zorder=ZOrder.LAYER_5,
    anchor_point=AnchorPoint.BOTTOM_CENTER,
    padding_bottom=24,
)

Styling for the title of the plot

table class-attribute instance-attribute

table: TableStyle = TableStyle(
    header=LabelStyle(
        font_size=32,
        zorder=ZOrder.LAYER_5,
        stroke_width=0,
        font_weight=FontWeight.BOLD,
        anchor_point=AnchorPoint.BOTTOM_CENTER,
    ),
    cell=LabelStyle(
        font_size=32,
        stroke_width=0,
        zorder=ZOrder.LAYER_5,
        anchor_point=AnchorPoint.BOTTOM_CENTER,
    ),
    padding_top=24,
)

Styling for the data table of the plot, which is always plotted below the axes. Currently, this is only available in optic plots.

star class-attribute instance-attribute

star: ObjectStyle = ObjectStyle(
    marker=MarkerStyle(zorder=ZOrder.LAYER_3 + 1, size=20, stroke=None),
    label=LabelStyle(
        font_size=40,
        font_weight=FontWeight.BOLD,
        zorder=ZOrder.LAYER_3 + 2,
        offset_x="auto",
        offset_y="auto",
    ),
)

Styling for stars

bayer_labels class-attribute instance-attribute

bayer_labels: LabelStyle = LabelStyle(
    font_size=36,
    font_weight=FontWeight.LIGHT,
    font_name="GFS Didot",
    zorder=ZOrder.LAYER_4,
    anchor_point=AnchorPoint.TOP_LEFT,
    offset_x="auto",
    offset_y="auto",
)

Styling for Bayer labels of stars

flamsteed_labels class-attribute instance-attribute

flamsteed_labels: LabelStyle = LabelStyle(
    font_size=26,
    font_weight=FontWeight.LIGHT,
    zorder=ZOrder.LAYER_4,
    anchor_point=AnchorPoint.BOTTOM_LEFT,
    offset_x="auto",
    offset_y="auto",
)

Styling for Flamsteed number labels of stars

planets class-attribute instance-attribute

planets: ObjectStyle = ObjectStyle(
    marker=MarkerStyle(
        symbol="circle", size=28, zorder=ZOrder.LAYER_3, opacity=1
    ),
    label=LabelStyle(
        font_size=32,
        font_weight=FontWeight.BOLD,
        offset_x="auto",
        offset_y="auto",
    ),
)

Styling for planets

moon class-attribute instance-attribute

moon: ObjectStyle = ObjectStyle(
    marker=MarkerStyle(
        symbol="circle",
        size=50,
        fill="#c8c8c8",
        opacity=1,
        zorder=ZOrder.LAYER_4,
    ),
    label=LabelStyle(
        font_size=32,
        font_weight=FontWeight.BOLD,
        offset_x="auto",
        offset_y="auto",
    ),
)

Styling for the moon

sun class-attribute instance-attribute

sun: ObjectStyle = ObjectStyle(
    marker=MarkerStyle(
        symbol="star_8", size=80, fill="#000", zorder=ZOrder.LAYER_4 - 100
    ),
    label=LabelStyle(font_size=32, font_weight=FontWeight.BOLD),
)

Styling for the Sun

dso_open_cluster class-attribute instance-attribute

dso_open_cluster: ObjectStyle = ObjectStyle(
    marker=MarkerStyle(
        symbol="circle",
        dash_array=DashArray.DOTTED,
        dash_capstyle=CapStyle.ROUND,
        stroke_width=2,
        zorder=ZOrder.LAYER_3 - 1,
    ),
    label=LabelStyle(offset_x="auto", offset_y="auto"),
)

Styling for open star clusters

dso_association_stars class-attribute instance-attribute

dso_association_stars: ObjectStyle = ObjectStyle(
    marker=MarkerStyle(
        symbol="circle",
        dash_array=DashArray.DOTTED,
        dash_capstyle=CapStyle.ROUND,
        stroke_width=2,
        zorder=ZOrder.LAYER_3 - 1,
    ),
    label=LabelStyle(offset_x="auto", offset_y="auto"),
)

Styling for associations of stars

dso_globular_cluster class-attribute instance-attribute

dso_globular_cluster: ObjectStyle = ObjectStyle(
    marker=MarkerStyle(
        symbol="circle_cross",
        fill="#555",
        opacity=0.8,
        stroke_width=1.2,
        zorder=ZOrder.LAYER_3 - 1,
    ),
    label=LabelStyle(offset_x="auto", offset_y="auto"),
)

Styling for globular star clusters

dso_galaxy class-attribute instance-attribute

dso_galaxy: ObjectStyle = ObjectStyle(
    marker=MarkerStyle(symbol="ellipse", zorder=ZOrder.LAYER_3 - 1),
    label=LabelStyle(offset_x="auto", offset_y="auto"),
)

Styling for galaxies

dso_nebula class-attribute instance-attribute

dso_nebula: ObjectStyle = ObjectStyle(
    marker=MarkerStyle(symbol="square", zorder=ZOrder.LAYER_3 - 1),
    label=LabelStyle(offset_x="auto", offset_y="auto"),
)

Styling for nebulas

dso_planetary_nebula class-attribute instance-attribute

dso_planetary_nebula: ObjectStyle = ObjectStyle(
    marker=MarkerStyle(
        symbol="circle_crosshair",
        stroke_width=1.6,
        size=26,
        zorder=ZOrder.LAYER_3 - 1,
    ),
    label=LabelStyle(offset_x="auto", offset_y="auto"),
)

Styling for planetary nebulas

dso_double_star class-attribute instance-attribute

dso_double_star: ObjectStyle = ObjectStyle(
    marker=MarkerStyle(symbol="circle_line", zorder=ZOrder.LAYER_3 - 1),
    label=LabelStyle(offset_x=1, offset_y=-1),
)

Styling for double stars

dso_dark_nebula class-attribute instance-attribute

dso_dark_nebula: ObjectStyle = ObjectStyle(
    marker=MarkerStyle(symbol="square", fill="#000", zorder=ZOrder.LAYER_3 - 1),
    label=LabelStyle(),
)

Styling for dark nebulas

dso_supernova_remnant class-attribute instance-attribute

dso_supernova_remnant: ObjectStyle = ObjectStyle(
    marker=MarkerStyle(symbol="square", fill="#000", zorder=ZOrder.LAYER_3 - 1),
    label=LabelStyle(),
)

Styling for supernova remnants

dso_nova_star class-attribute instance-attribute

dso_nova_star: ObjectStyle = ObjectStyle(
    marker=MarkerStyle(symbol="square", fill="#000", zorder=ZOrder.LAYER_3 - 1),
    label=LabelStyle(),
)

Styling for nova stars

dso_nonexistant class-attribute instance-attribute

dso_nonexistant: ObjectStyle = ObjectStyle(
    marker=MarkerStyle(symbol="square", fill="#000", zorder=ZOrder.LAYER_3 - 1),
    label=LabelStyle(),
)

Styling for 'nonexistent' (as designated by OpenNGC) deep sky objects

dso_unknown class-attribute instance-attribute

dso_unknown: ObjectStyle = ObjectStyle(
    marker=MarkerStyle(symbol="square", fill="#000", zorder=ZOrder.LAYER_3 - 1),
    label=LabelStyle(),
)

Styling for 'unknown' (as designated by OpenNGC) types of deep sky objects

dso_duplicate class-attribute instance-attribute

dso_duplicate: ObjectStyle = ObjectStyle(
    marker=MarkerStyle(symbol="square", fill="#000", zorder=ZOrder.LAYER_3 - 1),
    label=LabelStyle(),
)

Styling for 'duplicate record' (as designated by OpenNGC) types of deep sky objects

constellation_lines class-attribute instance-attribute

constellation_lines: LineStyle = LineStyle(
    stroke="#c8c8c8", width=5, zorder=ZOrder.LAYER_3
)

Styling for constellation lines

constellation_borders class-attribute instance-attribute

constellation_borders: LineStyle = LineStyle(
    stroke="#000",
    width=2.5,
    dash_array=(3, 6),
    opacity=0.5,
    zorder=ZOrder.LAYER_3,
)

Styling for constellation borders

constellation_labels class-attribute instance-attribute

constellation_labels: LabelStyle = LabelStyle(
    font_size=40,
    zorder=ZOrder.LAYER_3,
    anchor_point=AnchorPoint.CENTER,
    stroke_width=0,
)

Styling for constellation labels

milky_way class-attribute instance-attribute

milky_way: PolygonStyle = PolygonStyle(
    fill="#d9d9d9", opacity=0.36, stroke_width=0, zorder=ZOrder.LAYER_1
)

Styling for the Milky Way

legend class-attribute instance-attribute

Styling for legend

gridlines class-attribute instance-attribute

gridlines: PathStyle = PathStyle(
    line=LineStyle(
        stroke="#888",
        width=1,
        dash_array=DashArray.SOLID,
        opacity=0.6,
        zorder=ZOrder.LAYER_2,
    ),
    label=LabelStyle(
        font_size=32,
        fill="#000",
        opacity=1,
        anchor_point=AnchorPoint.BOTTOM_CENTER,
        stroke_width=0,
        zorder=ZOrder.LAYER_5 + 1000,
    ),
)

Styling for gridlines and their labels

ecliptic class-attribute instance-attribute

ecliptic: PathStyle = PathStyle(
    line=LineStyle(
        stroke="#777",
        width=3,
        dash_array=(2, 6),
        cap_style=CapStyle.ROUND,
        opacity=1,
        zorder=ZOrder.LAYER_3 - 1,
    ),
    label=LabelStyle(
        font_size=30,
        fill="#777",
        opacity=1,
        stroke_width=8,
        stroke="#000",
        zorder=ZOrder.LAYER_3,
    ),
)

Styling for the Ecliptic

celestial_equator class-attribute instance-attribute

celestial_equator: PathStyle = PathStyle(
    line=LineStyle(
        stroke="#999",
        width=4,
        dash_array=DashArray.DASHED_DOTS,
        cap_style=CapStyle.ROUND,
        zorder=ZOrder.LAYER_3,
    ),
    label=LabelStyle(
        font_size=30,
        fill="#999",
        stroke_width=8,
        stroke="#000",
        zorder=ZOrder.LAYER_3,
    ),
)

Styling for the Celestial Equator

galactic_equator class-attribute instance-attribute

galactic_equator: PathStyle = PathStyle(
    line=LineStyle(
        stroke="#999",
        width=4,
        dash_array=DashArray.SOLID,
        opacity=0.8,
        zorder=ZOrder.LAYER_3,
    ),
    label=LabelStyle(
        font_size=30,
        fill="#7c7c7c",
        opacity=1,
        stroke_width=8,
        stroke="#000",
        zorder=ZOrder.LAYER_3,
    ),
)

Styling for the Galactic Equator

horizon class-attribute instance-attribute

horizon: PathStyle = PathStyle(
    line=LineStyle(
        stroke="#fff",
        width=135,
        dash_array=DashArray.SOLID,
        cap_style=CapStyle.ROUND,
        opacity=1,
        zorder=ZOrder.LAYER_5,
    ),
    label=LabelStyle(
        anchor_point=AnchorPoint.CENTER,
        fill="#000",
        font_size=98,
        font_weight=FontWeight.BOLD,
        stroke_width=0,
        zorder=ZOrder.LAYER_5,
    ),
)

Styling for the horizon

ground class-attribute instance-attribute

ground: PolygonStyle = PolygonStyle(fill='#000', zorder=10000)

Styling for the ground (only applies to horizon plots)

zenith class-attribute instance-attribute

zenith: ObjectStyle = ObjectStyle(
    marker=MarkerStyle(symbol="triangle", size=24, fill="#000", opacity=0.8),
    label=LabelStyle(font_size=14, font_weight=FontWeight.BOLD),
)

Styling for the zenith marker

optic_fov class-attribute instance-attribute

optic_fov: PolygonStyle = PolygonStyle(
    fill=None, stroke="red", dash_array=(2, 3), stroke_width=3, zorder=-1000
)

Styling for optic fields of view

arrow class-attribute instance-attribute

arrow: ArrowStyle = ArrowStyle(
    fill="hsl(0, 99%, 31%)",
    stroke="#ff0019",
    stroke_width=2,
    zorder=ZOrder.LAYER_4,
)

Styling for arrows

tissot class-attribute instance-attribute

tissot: PolygonStyle = PolygonStyle(fill='#2e62ae', stroke_width=0)

line class-attribute instance-attribute

line: PathStyle = PathStyle()

Default styling for lines

polygon class-attribute instance-attribute

Default styling for polygons

circle class-attribute instance-attribute

Default styling for circles

ellipse class-attribute instance-attribute

Default styling for ellipses

rectangle class-attribute instance-attribute

rectangle: PolygonStyle = PolygonStyle()

Default styling for rectangles

marker class-attribute instance-attribute

Default styling for markers

text class-attribute instance-attribute

Default styling for text

get_dso_style

get_dso_style(dso_type: DsoType)

Returns the style for a DSO type

load_from_file staticmethod

load_from_file(filename: str) -> PlotStyle

Load a style from a YAML file. The returned style is an extension of the default PlotStyle (see [PlotStyle.extend][starplot.styles.PlotStyle.extend]), so you only need to define properties you want to override from the default.

Parameters:

Name Type Description Default
filename str

Filename of style file

required

Returns:

Name Type Description
PlotStyle PlotStyle

A new instance of a PlotStyle

dump_to_file

dump_to_file(filename: str) -> None

Save the style to a YAML file. ALL style properties will be written to the file.

Parameters:

Name Type Description Default
filename str

Filename of style file

required

extend

extend(*args, **kwargs) -> PlotStyle

Adds one or more dicts of style overrides to the style and returns a new instance with those overrides.

Styles are added in sequential order, so if the first style arg has a property that is also in the last style arg, then the resulting style will have the value from the last style (similar to how CSS works).

Example Usage

Create an extension of the default style with the light blue color scheme, map optimizations, and change the constellation line color to red:

new_style = PlotStyle().extend(
    styles.extensions.BLUE_LIGHT,
    styles.extensions.MAP,
    {
        "constellation": {"line": {"color": "#e12d2d"}},
    },
)

Parameters:

Name Type Description Default
args

One or more dicts of styles to add

()

Returns:

Name Type Description
PlotStyle PlotStyle

A new instance of a PlotStyle


starplot.styles.PlotBaseStyle

Default base styles for all child styles that have these values set to None / null

This is a way to apply some styles to everything in the plot, unless a style specifically sets one of these values.

For example, if all object label styles have font_name = None then the base font name will be used.

font_family class-attribute instance-attribute

font_family: str = 'sans-serif'

Font family (e.g. 'monospace', 'sans-serif', 'serif', etc) to use if a style's font family is set to None

font_name class-attribute instance-attribute

font_name: str = 'Inter'

Name of the base font to use if a style's font is set to None

text_stroke class-attribute instance-attribute

text_stroke: Color | None = None

Color of border (also known as 'halos' in map design) around text if a style's value is set to None

text_stroke_width class-attribute instance-attribute

text_stroke_width: float = 0

Width of border (also known as 'halos' in map design) around text, in pixels

starplot.styles.AxesStyle

Styling for the axes of the plot, which is where the map is plotted.

background class-attribute instance-attribute

background: PolygonStyle = PolygonStyle(
    stroke_width=0, stroke="#000", fill="#fff"
)

Background of the axes. This will always be plotted at the lowest Z-order.

border class-attribute instance-attribute

border: LineStyle | None = LineStyle(width=2, stroke='#000')

Border drawn immediately outside the axes clip path (the entire stroke sits outside the clip path -- none of it overlaps the plot content). If None, no border is drawn.

If the plot also has gridline labels, then the gridline labels are plotted just outside the axes border, in the axes "frame" region.

starplot.styles.FigureStyle

background class-attribute instance-attribute

background: PolygonStyle = PolygonStyle(
    stroke_width=0, stroke="#000", fill="#fff"
)

Background of the figure (the area surrounding the axes)

padding class-attribute instance-attribute

padding: int = 0

Padding between the axes and edge of figure

starplot.styles.ObjectStyle

Defines the style for a sky object (e.g. star, DSO)

label class-attribute instance-attribute

Style for the object's label (see LabelStyle)

marker class-attribute instance-attribute

Style for the object's marker (see MarkerStyle)

starplot.styles.PathStyle

Defines the style for a path (e.g. constellation lines)

label class-attribute instance-attribute

Style for the path's label (see LabelStyle)

line class-attribute instance-attribute

line: LineStyle = LineStyle()

Style for the line (see LineStyle)

starplot.styles.LegendStyle

Defines the style for the map legend.

background class-attribute instance-attribute

background: PolygonStyle = PolygonStyle(
    stroke_width=1.0, stroke="#c5c5c5", fill="#fff"
)

Background of the legend

border_radius class-attribute instance-attribute

border_radius: float = 8.0

Border radius of legend background element

label_padding class-attribute instance-attribute

label_padding: float = 36

Padding between legend labels

labels class-attribute instance-attribute

labels: LabelStyle = LabelStyle(font_size=36, font_weight=FontWeight.NORMAL)

Style for the legend's labels (see LabelStyle)

location class-attribute instance-attribute

location: Literal[
    "inside_top_left",
    "inside_top_right",
    "inside_bottom_right",
    "inside_bottom_left",
    "outside_top_left",
    "outside_top_right",
    "outside_bottom_right",
    "outside_bottom_left",
] = "inside_top_right"

Location of the legend, relative to the map area (inside or outside)

margin_x class-attribute instance-attribute

margin_x: float = 24

Horizontal margin (empty space) between legend and its anchor position.

margin_y class-attribute instance-attribute

margin_y: float = 24

Vertical margin (empty space) between legend and its anchor position.

padding_x class-attribute instance-attribute

padding_x: float = 64

Horizontal padding between the legend's border and its content.

padding_y class-attribute instance-attribute

padding_y: float = 32

Vertical padding between the legend's border and its content.

symbol_padding class-attribute instance-attribute

symbol_padding: float = 32

Padding between each symbol and its label

symbol_size class-attribute instance-attribute

symbol_size: int = 32

Size of symbols in the legend, in pixels

title class-attribute instance-attribute

title: LabelStyle = LabelStyle(font_size=56, font_weight=FontWeight.BOLD)

Style for the legend's labels (see LabelStyle)

zorder class-attribute instance-attribute

zorder: int = ZOrder.LAYER_5

Zorder of the legend

starplot.styles.MarkerStyle

Styling properties for markers.

dash_array class-attribute instance-attribute

dash_array: (
    Literal["solid", "dashed", "dashdot", "dotted"] | tuple[int, ...] | None
) = None

Dash style of the marker's stroke. Can be a predefined string option (e.g. "dashed") or a tuple stroke dasharray.

dash_capstyle class-attribute instance-attribute

dash_capstyle: Literal['square', 'butt', 'round'] = 'square'

Style of dash endpoints

fill class-attribute instance-attribute

fill: Color | GradientStyle | None = Color('#000')

Fill color of the marker

This can be a single color (e.g. #7abfff) or a GradientStyle that defines a gradient. For example:

GradientStyle(
    stops=(
        (0.0, "#7abfff"),
        (0.2, "#7abfff"),
        (0.9, "#568feb"),
        (1.0, "#3f7ee3"),  # the last stop should always be at 1.0
    ),
)

There are a few predefined gradients available as style extensions.

opacity class-attribute instance-attribute

opacity: float = Field(default=1.0, ge=0, le=1)

Opacity (transparency) of the marker (0 to 1)

size class-attribute instance-attribute

size: float = 24

Size of marker in pixels

stroke class-attribute instance-attribute

stroke: Color | None = Color('#000')

Stroke color of marker. Can be a hex, rgb, hsl, or word string.

stroke_width class-attribute instance-attribute

stroke_width: float = 1

Stroke width of marker, in pixels.

symbol class-attribute instance-attribute

symbol: Literal[
    "plus",
    "circle",
    "square",
    "star",
    "diamond",
    "triangle",
    "circle_cross",
    "circle_crosshair",
    "circle_line",
    "comet",
    "star_4",
    "star_8",
    "ellipse",
    "satellite",
] = "circle"

Symbol for marker.

zorder class-attribute instance-attribute

zorder: int = ZOrder.LAYER_2

Zorder of marker

starplot.styles.PolygonStyle

Styling properties for polygons.

dash_array class-attribute instance-attribute

dash_array: (
    Literal["solid", "dashed", "dashdot", "dotted"] | tuple[int, ...] | None
) = "solid"

Dash style of the polygon's stroke. Can be a predefined string option (e.g. "dashed") or a tuple stroke dasharray.

dash_capstyle class-attribute instance-attribute

dash_capstyle: Literal['butt', 'square', 'round'] = 'round'

Style of dash endpoints. Matters even for a closed ring's dashes: a zero-length dash (as used for a dotted dash_array, e.g. (0, 5)) is only visible with a round cap -- square/butt caps render it as nothing.

fill class-attribute instance-attribute

fill: Color | GradientStyle | None = Color('#c2c2c2')

Fill color of the polygon

This can either be a single color (e.g. #7abfff) or a GradientStyle that defines a gradient. For example:

GradientStyle(
    stops=(
        (0.0, "#7abfff"),
        (0.2, "#7abfff"),
        (0.9, "#568feb"),
        (1.0, "#3f7ee3"),  # the last stop should always be at 1.0
    ),
)

There are a few predefined gradients available as style extensions.

opacity class-attribute instance-attribute

opacity: float = Field(default=1.0, ge=0, le=1)

Opacity (transparency) of the polygon (0 to 1)

stroke class-attribute instance-attribute

stroke: Color | None = Color('#000')

Edge color of the polygon

stroke_width class-attribute instance-attribute

stroke_width: float = 1

Width of the polygon's edge in pixels

zorder class-attribute instance-attribute

zorder: int = ZOrder.LAYER_3

Zorder of the polygon

starplot.styles.LineStyle

Styling properties for lines.

cap_style class-attribute instance-attribute

cap_style: Literal['butt', 'square', 'round'] = 'square'

Style of line/dash endpoints

dash_array class-attribute instance-attribute

dash_array: (
    Literal["solid", "dashed", "dashdot", "dotted"] | tuple[int, ...] | None
) = "solid"

Dash style of the line's stroke. Can be a predefined string option (e.g. "dashed") or a tuple stroke dasharray.

opacity class-attribute instance-attribute

opacity: float = Field(default=1.0, ge=0, le=1)

Opacity (transparency) of the line (0 to 1)

stroke class-attribute instance-attribute

stroke: Color | None = Color('#000')

Color of the line. Can be a hex, rgb, hsl, or word string.

width class-attribute instance-attribute

width: float = 2

Width of line in pixels

zorder class-attribute instance-attribute

zorder: int = ZOrder.LAYER_2

Zorder of the line

starplot.styles.LabelStyle

Styling properties for a label.

anchor_point class-attribute instance-attribute

anchor_point: Literal[
    "center",
    "left_center",
    "right_center",
    "top_left",
    "top_right",
    "top_center",
    "bottom_left",
    "bottom_right",
    "bottom_center",
] = "bottom_right"

Anchor point of label

fill class-attribute instance-attribute

fill: Color = Color('#000')

Font's color

font_family class-attribute instance-attribute

font_family: str | None = None

Font family (e.g. 'monospace', 'sans-serif', 'serif', etc). If None, then the plot's base.font_family will be used.

font_name class-attribute instance-attribute

font_name: str | None = None

Name of the font to use. If None, then the plot's base.font_name will be used.

font_size class-attribute instance-attribute

font_size: float = 24

Font size of the label, in pixels

font_style class-attribute instance-attribute

font_style: Literal['normal', 'italic', 'oblique'] = 'normal'

Style of the label (e.g. normal, italic, etc)

font_weight class-attribute instance-attribute

font_weight: Literal[100, 200, 300, 400, 500, 600, 700, 800, 900] = 400

Font weight (e.g. normal, bold, ultra bold, etc)

offset_x class-attribute instance-attribute

offset_x: float | int | Literal['auto'] = 0

Horizontal offset of the label, in pixels. Negative values supported.

Auto Mode: If the label is plotted as part of a marker (e.g. stars, via marker(), etc), then you can also specify the offset as "auto" which will calculate the offset automatically based on the marker's size and place the label just outside the marker (avoiding overlapping). To enable "auto" mode you have to specify BOTH offsets (x and y) as "auto."

offset_y class-attribute instance-attribute

offset_y: float | int | Literal['auto'] = 0

Vertical offset of the label, in pixels. Negative values supported.

Auto Mode: If the label is plotted as part of a marker (e.g. stars, via marker(), etc), then you can also specify the offset as "auto" which will calculate the offset automatically based on the marker's size and place the label just outside the marker (avoiding overlapping). To enable "auto" mode you have to specify BOTH offsets (x and y) as "auto."

opacity class-attribute instance-attribute

opacity: float = Field(default=1.0, ge=0, le=1)

Opacity (transparency) of the label (0 to 1)

stroke class-attribute instance-attribute

stroke: Color | None = None

Color of border (also known as 'halos') around the text. If None, then the plot's base.text_stroke will be used.

stroke_width class-attribute instance-attribute

stroke_width: float | None = None

Width of border (also known as 'halos') around the text, in pixels. If None, then the plot's base.text_stroke_width will be used.

zorder class-attribute instance-attribute

zorder: int = ZOrder.LAYER_4

Zorder of the label

resolved_font_family

resolved_font_family(base: PlotBaseStyle | None = None) -> str | None

Returns font_family, falling back to base.font_family if it's None.

resolved_font_name

resolved_font_name(base: PlotBaseStyle | None = None) -> str | None

Returns font_name, falling back to base.font_name if it's None.

resolved_stroke

resolved_stroke(base: PlotBaseStyle | None = None) -> Color | None

Returns stroke, falling back to base.text_stroke if it's None.

resolved_stroke_width

resolved_stroke_width(base: PlotBaseStyle | None = None) -> float | None

Returns stroke_width, falling back to base.text_stroke_width if it's None.

starplot.styles.ArrowStyle

body_width class-attribute instance-attribute

body_width: float = 10

Width of the arrow's body, in pixels

cap_style class-attribute instance-attribute

cap_style: Literal['butt', 'square', 'round'] = 'butt'

Cap style of the arrow

dash_array class-attribute instance-attribute

dash_array: (
    Literal["solid", "dashed", "dashdot", "dotted"] | tuple[int, ...] | None
) = "solid"

Dash style of the polygon's stroke. Can be a predefined string option (e.g. "dashed") or a tuple stroke dasharray.

dash_capstyle class-attribute instance-attribute

dash_capstyle: Literal['butt', 'square', 'round'] = 'round'

Style of dash endpoints. Matters even for a closed ring's dashes: a zero-length dash (as used for a dotted dash_array, e.g. (0, 5)) is only visible with a round cap -- square/butt caps render it as nothing.

fill class-attribute instance-attribute

fill: Color | GradientStyle | None = Color('#c2c2c2')

Fill color of the polygon

This can either be a single color (e.g. #7abfff) or a GradientStyle that defines a gradient. For example:

GradientStyle(
    stops=(
        (0.0, "#7abfff"),
        (0.2, "#7abfff"),
        (0.9, "#568feb"),
        (1.0, "#3f7ee3"),  # the last stop should always be at 1.0
    ),
)

There are a few predefined gradients available as style extensions.

head_height class-attribute instance-attribute

head_height: float = 70

Height of the arrow's head, in pixels

head_width class-attribute instance-attribute

head_width: float = 30

Width of the arrow's head, in pixels

join_style class-attribute instance-attribute

join_style: Literal['mitre', 'bevel', 'round'] = 'mitre'

Join style of the arrow

opacity class-attribute instance-attribute

opacity: float = Field(default=1.0, ge=0, le=1)

Opacity (transparency) of the polygon (0 to 1)

stroke class-attribute instance-attribute

stroke: Color | None = Color('#000')

Edge color of the polygon

stroke_width class-attribute instance-attribute

stroke_width: float = 1

Width of the polygon's edge in pixels

zorder class-attribute instance-attribute

zorder: int = ZOrder.LAYER_3

Zorder of the polygon

starplot.styles.TitleStyle

anchor_point class-attribute instance-attribute

anchor_point: Literal[
    "center",
    "left_center",
    "right_center",
    "top_left",
    "top_right",
    "top_center",
    "bottom_left",
    "bottom_right",
    "bottom_center",
] = "bottom_right"

Anchor point of label

fill class-attribute instance-attribute

fill: Color = Color('#000')

Font's color

font_family class-attribute instance-attribute

font_family: str | None = None

Font family (e.g. 'monospace', 'sans-serif', 'serif', etc). If None, then the plot's base.font_family will be used.

font_name class-attribute instance-attribute

font_name: str | None = None

Name of the font to use. If None, then the plot's base.font_name will be used.

font_size class-attribute instance-attribute

font_size: float = 24

Font size of the label, in pixels

font_style class-attribute instance-attribute

font_style: Literal['normal', 'italic', 'oblique'] = 'normal'

Style of the label (e.g. normal, italic, etc)

font_weight class-attribute instance-attribute

font_weight: Literal[100, 200, 300, 400, 500, 600, 700, 800, 900] = 400

Font weight (e.g. normal, bold, ultra bold, etc)

offset_x class-attribute instance-attribute

offset_x: float | int | Literal['auto'] = 0

Horizontal offset of the label, in pixels. Negative values supported.

Auto Mode: If the label is plotted as part of a marker (e.g. stars, via marker(), etc), then you can also specify the offset as "auto" which will calculate the offset automatically based on the marker's size and place the label just outside the marker (avoiding overlapping). To enable "auto" mode you have to specify BOTH offsets (x and y) as "auto."

offset_y class-attribute instance-attribute

offset_y: float | int | Literal['auto'] = 0

Vertical offset of the label, in pixels. Negative values supported.

Auto Mode: If the label is plotted as part of a marker (e.g. stars, via marker(), etc), then you can also specify the offset as "auto" which will calculate the offset automatically based on the marker's size and place the label just outside the marker (avoiding overlapping). To enable "auto" mode you have to specify BOTH offsets (x and y) as "auto."

opacity class-attribute instance-attribute

opacity: float = Field(default=1.0, ge=0, le=1)

Opacity (transparency) of the label (0 to 1)

padding_bottom class-attribute instance-attribute

padding_bottom: float = 20

Padding between bottom of title and the axes

stroke class-attribute instance-attribute

stroke: Color | None = None

Color of border (also known as 'halos') around the text. If None, then the plot's base.text_stroke will be used.

stroke_width class-attribute instance-attribute

stroke_width: float | None = None

Width of border (also known as 'halos') around the text, in pixels. If None, then the plot's base.text_stroke_width will be used.

zorder class-attribute instance-attribute

zorder: int = ZOrder.LAYER_4

Zorder of the label

resolved_font_family

resolved_font_family(base: PlotBaseStyle | None = None) -> str | None

Returns font_family, falling back to base.font_family if it's None.

resolved_font_name

resolved_font_name(base: PlotBaseStyle | None = None) -> str | None

Returns font_name, falling back to base.font_name if it's None.

resolved_stroke

resolved_stroke(base: PlotBaseStyle | None = None) -> Color | None

Returns stroke, falling back to base.text_stroke if it's None.

resolved_stroke_width

resolved_stroke_width(base: PlotBaseStyle | None = None) -> float | None

Returns stroke_width, falling back to base.text_stroke_width if it's None.

starplot.styles.TableStyle

Defines the style for a table of data

alignment class-attribute instance-attribute

alignment: Literal['left', 'right', 'center'] = 'center'

Horizontal alignment of the table, relative to the axes region

border class-attribute instance-attribute

border: LineStyle = LineStyle(stroke='#c5c5c5', width=1)

Style for the table's grid lines and outer border

cell class-attribute instance-attribute

Style for the table's cell text

header class-attribute instance-attribute

header: LabelStyle = LabelStyle(font_weight=FontWeight.BOLD)

Style for the table's header row text

padding_top class-attribute instance-attribute

padding_top: int = 40

Padding above the table, in pixels. Creates space between the axes and the table.

starplot.styles.GradientStyle

Styling properties for a gradient fill.

stops instance-attribute

stops: tuple[tuple[float, Color], ...]

The gradient's color stops, as a tuple of (offset, color) pairs. The last stop's offset must always be 1.0.

Example:

(
    (0.0, "#7abfff"),
    (0.2, "#7abfff"),
    (0.9, "#568feb"),
    (1.0, "#3f7ee3"),
)

type class-attribute instance-attribute

type: Literal['linear', 'radial'] = 'radial'

Type / direction of the gradient.