Skip to content

Styling Framework

Starplot has a styling framework that lets you fully customize the appearance of your plots. The framework consists of a bunch of Pydantic models that represent different things you can style (e.g. markers, lines, labels, etc). Since they're based on Pydantic models, this means you can define new styles through Python code, a JSON, or even a YAML file.

Basic Usage

When you create a plot, you can optionally pass in an instance of a PlotStyle. This instance represents ALL the styling properties to use for the plot.

Using styles is usually a 3-step process:

  1. Create a PlotStyle instance

  2. Extend or override properties

  3. Apply the style to the plot

Example:

from starplot import MapPlot
from starplot.styles import PlotStyle, extensions

# Step 1: create a style
style = PlotStyle()

# Step 2: extend the style with a few built-in extensions
style = style.extend(
    extensions.BLUE_LIGHT,
    extensions.MAP,
)

# Step 3: apply the style in a new map plot
mp = MapPlot(
    ra_min=4,
    ra_max=8,
    dec_min=0,
    dec_max=20,
    style=style,
)

The sections below go into more detail around these steps.

Creating a Style

Creating a style is simple:

from starplot.styles import PlotStyle

style = PlotStyle()

After creating the style, you can modify properties of the style directly:

style.star.marker.color = "red"
style.star.label.font_size = 20

This works well when you only want to change a couple properties, but for more complex styling it's easier to use PlotStyle's extend method which is explained in the next section.

Extending a Style

Once you have an instance of a PlotStyle, then you can customize it with the PlotStyle's extend method. This method takes in one or more args of dictionaries and applies them to the original style in sequential order. In other words, when extending a PlotStyle, you only have to define style properties that you want to override from the current style — similar to how Cascading Style Sheets (CSS) work.

Starplot has a few built-in extensions for applying color schemes and optimizing different plot types. But, you can also easily create your own extensions.

Basic Example

Here's a simple example of extending a style to use a different font for Bayer labels of stars:

from starplot import PlotStyle

style = PlotStyle().extend(
    {
        "bayer_labels": {
            "font_name": "GFS Didot",
            "font_size": 10
        }
    }
)
Alternatively, you can do this:
style = PlotStyle()
style.bayer_labels.font_name = "GFS Didot"
style.bayer_labels.font_size = 10

More Complex Example

The method above works well for overriding a few style properties, but if you want to create a more complex style then it's probably easier to define it in a YAML file and use PlotStyle's load_from_file static method.

Example:

# style.yml

# make the Milky Way gray
milky_way:
  alpha: 0.36
  color: '#888'

# change the color of star labels to blue and
# and change their symbol from dots to stars
star:
  label:
    font_color: '#0e69b8'
  marker:
    symbol: star

# make nebulas green and their markers diamonds
dso_nebula:
  marker:
    color: green
    symbol: diamond

Then, to use your new style:

from starplot import PlotStyle, MapPlot

style = PlotStyle.load_from_file("style.yml")

p = MapPlot(
    ra_min=4,
    ra_max=8,
    dec_min=0,
    dec_max=20,
    style=style,
)

Built-in Style Extensions

Starplot has a bunch of built-in style extensions (all imported from starplot.styles.extensions):

  • Color Schemes
    • GRAYSCALE - Optimized for printing in grayscale (details)
    • GRAYSCALE_DARK - Like GRAYSCALE, but inverted (white stars, black background) (details)
    • BLUE_LIGHT - Light and bright colors (details)
    • BLUE_MEDIUM - Medium brightness bluish gray colors (details)
    • BLUE_DARK - Dark "Starplot blue" colors (details)
    • ANTIQUE - Antique map inspired colors (details)
    • NORD - Nord-inspired colors (details)
  • Plot types
    • OPTIC - Basic styling tailored for optic plots (details)
    • MAP - Basic styling tailored for map plots (details)

Overriding Styles When Plotting

After you create a plot instance and start plotting stuff (e.g. stars, DSOs, etc), then you may want to override the plot's style sometimes. For example, you may want to plot the brightest stars with one style and the dimmer stars with a different style (see the example map of Sagittarius which uses different markers for brighter stars). Luckily, Starplot provides two easy ways to do this:

  1. Via style kwarg

    All plotting calls have an optional style kwarg that lets you pass in a dictionary of any styles you want to override for that plotting call. For example, here's how you can plot bright stars with a different marker and color than the plot's style:
    p.stars(
        mag=3,
        style={
            "marker": {
                "symbol": "star",
                "color": "red",
            }
        }
    )
    
  2. Via style__* kwargs

    When you only want to override one or two style properties, it can be tedious to create a dictionary, so Starplot also lets you specify overrides through keyword arguments that start with style__ and separate each level by __. For example, we could re-write the previous example like this:

    p.stars(
        mag=3,
        style__marker__symbol="star",
        style__marker__color="red",
    )
    

When overriding styles like this, you only have to define style properties you want to override. Other properties will be inherited from the plot's style.


Code Reference

starplot.PlotStyle

Defines the styling for a plot

background_color class-attribute instance-attribute

background_color: ColorStr = ColorStr('#fff')

Background color of the map region

bayer_labels class-attribute instance-attribute

bayer_labels: LabelStyle = LabelStyle(
    font_size=7, font_weight=LIGHT, zorder=1, anchor_point=TOP_LEFT
)

Styling for Bayer labels of stars

border_bg_color class-attribute instance-attribute

border_bg_color: ColorStr = ColorStr('#fff')

border_font_color class-attribute instance-attribute

border_font_color: ColorStr = ColorStr('#000')

border_font_size class-attribute instance-attribute

border_font_size: int = 18

border_font_weight class-attribute instance-attribute

border_font_weight: FontWeightEnum = BOLD

border_line_color class-attribute instance-attribute

border_line_color: ColorStr = ColorStr('#000')

celestial_equator class-attribute instance-attribute

celestial_equator: PathStyle = PathStyle(
    line=LineStyle(
        color="#999", width=2, style=DASHED_DOTS, alpha=0.65, zorder=-20
    ),
    label=LabelStyle(
        font_size=6,
        font_color="#999",
        font_weight=LIGHT,
        font_alpha=0.65,
        zorder=-20,
    ),
)

Styling for the Celestial Equator

constellation class-attribute instance-attribute

constellation: PathStyle = PathStyle(
    line=LineStyle(color="#c8c8c8"),
    label=LabelStyle(
        font_size=7, font_weight=LIGHT, zorder=400, anchor_point=TOP_RIGHT
    ),
)

Styling for constellation lines and labels (only applies to map plots)

constellation_borders class-attribute instance-attribute

constellation_borders: LineStyle = LineStyle(
    color="#000", width=2, style=DASHED, alpha=0.2, zorder=-100
)

Styling for constellation borders (only applies to map plots)

dso_association_stars class-attribute instance-attribute

dso_association_stars: ObjectStyle = ObjectStyle(
    marker=MarkerStyle(symbol=CIRCLE, size=6, fill=FULL),
    label=LabelStyle(font_size=6, font_weight=LIGHT),
)

Styling for associations of stars

dso_dark_nebula class-attribute instance-attribute

dso_dark_nebula: ObjectStyle = ObjectStyle(
    marker=MarkerStyle(symbol=SQUARE, size=6, fill=TOP, color="#000"),
    label=LabelStyle(font_size=6),
)

Styling for dark nebulas

dso_double_star class-attribute instance-attribute

dso_double_star: ObjectStyle = ObjectStyle(
    marker=MarkerStyle(symbol=CIRCLE, size=6, fill=TOP),
    label=LabelStyle(font_size=6),
)

Styling for double stars

dso_duplicate class-attribute instance-attribute

dso_duplicate: ObjectStyle = ObjectStyle(
    marker=MarkerStyle(symbol=SQUARE, size=6, fill=TOP, color="#000"),
    label=LabelStyle(font_size=6),
)

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

dso_galaxy class-attribute instance-attribute

dso_galaxy: ObjectStyle = ObjectStyle(
    marker=MarkerStyle(symbol=CIRCLE, size=6, fill=FULL),
    label=LabelStyle(font_size=6),
)

Styling for galaxies

dso_globular_cluster class-attribute instance-attribute

dso_globular_cluster: ObjectStyle = ObjectStyle(
    marker=MarkerStyle(
        symbol=CIRCLE, size=6, fill=FULL, color="#555", alpha=0.8
    ),
    label=LabelStyle(font_size=6),
)

Styling for globular star clusters

dso_hii_ionized_region class-attribute instance-attribute

dso_hii_ionized_region: ObjectStyle = ObjectStyle(
    marker=MarkerStyle(symbol=SQUARE, size=6, fill=TOP, color="#000"),
    label=LabelStyle(font_size=6),
)

Styling for HII Ionized regions

dso_nebula class-attribute instance-attribute

dso_nebula: ObjectStyle = ObjectStyle(
    marker=MarkerStyle(symbol=SQUARE, size=6, fill=FULL),
    label=LabelStyle(font_size=6),
)

Styling for nebulas

dso_nonexistant class-attribute instance-attribute

dso_nonexistant: ObjectStyle = ObjectStyle(
    marker=MarkerStyle(symbol=SQUARE, size=6, fill=TOP, color="#000"),
    label=LabelStyle(font_size=6),
)

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

dso_nova_star class-attribute instance-attribute

dso_nova_star: ObjectStyle = ObjectStyle(
    marker=MarkerStyle(symbol=SQUARE, size=6, fill=TOP, color="#000"),
    label=LabelStyle(font_size=6),
)

Styling for nova stars

dso_open_cluster class-attribute instance-attribute

dso_open_cluster: ObjectStyle = ObjectStyle(
    marker=MarkerStyle(symbol=CIRCLE, size=6, fill=FULL),
    label=LabelStyle(font_size=6, font_weight=LIGHT),
)

Styling for open star clusters

dso_supernova_remnant class-attribute instance-attribute

dso_supernova_remnant: ObjectStyle = ObjectStyle(
    marker=MarkerStyle(symbol=SQUARE, size=6, fill=TOP, color="#000"),
    label=LabelStyle(font_size=6),
)

Styling for supernova remnants

dso_unknown class-attribute instance-attribute

dso_unknown: ObjectStyle = ObjectStyle(
    marker=MarkerStyle(symbol=SQUARE, size=6, fill=TOP, color="#000"),
    label=LabelStyle(font_size=6),
)

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

ecliptic class-attribute instance-attribute

ecliptic: PathStyle = PathStyle(
    line=LineStyle(
        color="#777",
        width=2,
        style=DOTTED,
        dash_capstyle=ROUND,
        alpha=0.8,
        zorder=-20,
    ),
    label=LabelStyle(
        font_size=6,
        font_color="#777",
        font_weight=LIGHT,
        font_alpha=1,
        zorder=-20,
    ),
)

Styling for the Ecliptic

figure_background_color class-attribute instance-attribute

figure_background_color: ColorStr = ColorStr('#fff')

gridlines class-attribute instance-attribute

gridlines: PathStyle = PathStyle(
    line=LineStyle(color="#888", width=1, style=SOLID, alpha=0.8, zorder=-1000),
    label=LabelStyle(
        font_size=9,
        font_color="#000",
        font_weight=LIGHT,
        font_alpha=1,
        anchor_point=BOTTOM_CENTER,
    ),
)

Styling for gridlines (including Right Ascension / Declination labels). Only applies to map plots.

info_text class-attribute instance-attribute

info_text: LabelStyle = LabelStyle(
    font_size=10,
    zorder=1,
    font_family="monospace",
    line_spacing=2,
    anchor_point=BOTTOM_CENTER,
)

Styling for info text (only applies to zenith and optic plots)

legend class-attribute instance-attribute

Styling for legend

milky_way class-attribute instance-attribute

milky_way: PolygonStyle = PolygonStyle(
    color="#d9d9d9", alpha=0.36, edge_width=0, zorder=-1000
)

Styling for the Milky Way (only applies to map plots)

moon class-attribute instance-attribute

moon: ObjectStyle = ObjectStyle(
    marker=MarkerStyle(
        symbol=CIRCLE, size=14, fill=FULL, color="#c8c8c8", alpha=1, zorder=100
    ),
    label=LabelStyle(font_size=8, font_weight=BOLD),
)

Styling for the moon

planets class-attribute instance-attribute

planets: ObjectStyle = ObjectStyle(
    marker=MarkerStyle(symbol=CIRCLE, size=4, fill=LEFT),
    label=LabelStyle(font_size=8, font_weight=BOLD),
)

Styling for planets

star class-attribute instance-attribute

star: ObjectStyle = ObjectStyle(
    marker=MarkerStyle(fill=FULL, zorder=1, size=20, edge_color=None),
    label=LabelStyle(font_size=9, font_weight=BOLD, zorder=400),
)

Styling for stars (see ObjectStyle)

sun class-attribute instance-attribute

sun: ObjectStyle = ObjectStyle(
    marker=MarkerStyle(symbol=SUN, size=14, fill=FULL, color="#000", zorder=90),
    label=LabelStyle(font_size=8, font_weight=BOLD),
)

Styling for the Sun

text_border_width class-attribute instance-attribute

text_border_width: int = 2

text_offset_x class-attribute instance-attribute

text_offset_x: float = 0.005

text_offset_y class-attribute instance-attribute

text_offset_y: float = 0.005

title class-attribute instance-attribute

title: LabelStyle = LabelStyle(
    font_size=20,
    font_weight=BOLD,
    zorder=1,
    line_spacing=48,
    anchor_point=BOTTOM_CENTER,
)

Styling for info text (only applies to zenith and optic plots)

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:

  • filename (str) –

    Filename of style file

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:

  • args

    One or more dicts of styles to add

Returns:

  • PlotStyle ( PlotStyle ) –

    A new instance of a PlotStyle

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), so you only need to define properties you want to override from the default.

Parameters:

  • filename (str) –

    Filename of style file

Returns:

  • PlotStyle ( PlotStyle ) –

    A new instance of a PlotStyle


starplot.styles.MarkerStyle

Styling properties for markers.

Example Usage

Creates a style for a red triangle marker:

m = MarkerStyle(
    color="#b13737",
    symbol="triangle",
    size=8,
    fill="full",
    alpha=1.0,
    zorder=100,
)

alpha class-attribute instance-attribute

alpha: float = 1.0

Alpha value (controls transparency)

color class-attribute instance-attribute

color: Optional[ColorStr] = ColorStr('#000')

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

edge_color class-attribute instance-attribute

edge_color: Optional[ColorStr] = ColorStr('#000')

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

fill class-attribute instance-attribute

Fill style of marker

size class-attribute instance-attribute

size: int = 4

Relative size of marker

symbol class-attribute instance-attribute

Symbol for marker

zorder class-attribute instance-attribute

zorder: int = -1

Zorder of marker

starplot.styles.LineStyle

Styling properties for lines.

Example Usage

Creates a style for a dashed green line:

ls = LineStyle(
    width=2,
    color="#6ba832",
    style="dashed",
    alpha=0.2,
    zorder=-10,
)

alpha class-attribute instance-attribute

alpha: float = 1.0

Alpha value (controls transparency)

color class-attribute instance-attribute

color: ColorStr = ColorStr('#000')

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

dash_capstyle class-attribute instance-attribute

dash_capstyle: DashCapStyleEnum = PROJECTING

Style of dash endpoints

style class-attribute instance-attribute

Style of the line (e.g. solid, dashed, etc).

width class-attribute instance-attribute

width: float = 2

Width of line

zorder class-attribute instance-attribute

zorder: int = -1

Zorder of the line

starplot.styles.PolygonStyle

Styling properties for polygons.

Example Usage

Creates a style for a partially transparent blue polygon:

ps = PolygonStyle(
        color="#d9d9d9",
        alpha=0.36,
        edge_width=0,
        zorder=-10000,
)

alpha class-attribute instance-attribute

alpha: float = 1.0

Alpha value (controls transparency)

color class-attribute instance-attribute

color: Optional[ColorStr] = None

If specified, this will be the fill color AND edge color of the polygon

edge_color class-attribute instance-attribute

edge_color: Optional[ColorStr] = None

Edge color of the polygon

edge_width class-attribute instance-attribute

edge_width: int = 1

Width of the polygon's edge

fill_color class-attribute instance-attribute

fill_color: Optional[ColorStr] = None

Fill color of the polygon

line_style class-attribute instance-attribute

line_style: LineStyleEnum = SOLID

Edge line style

zorder class-attribute instance-attribute

zorder: int = -1

Zorder of the polygon

starplot.styles.LabelStyle

Styling properties for a label.

Example Usage

Creates a style for a bold blue label:

ls = LabelStyle(
        font_color="blue",
        font_weight="bold",
        zorder=1,
)

anchor_point class-attribute instance-attribute

anchor_point: AnchorPointEnum = BOTTOM_RIGHT

Anchor point of label

font_alpha class-attribute instance-attribute

font_alpha: float = 1

Font's alpha (transparency)

font_color class-attribute instance-attribute

font_color: ColorStr = ColorStr('#000')

Font's color

font_family class-attribute instance-attribute

font_family: Optional[str] = None

Font family (e.g. 'monospace', 'sans-serif', 'serif', etc)

font_name class-attribute instance-attribute

font_name: Optional[str] = None

Name of the font to use

font_size class-attribute instance-attribute

font_size: int = 8

Relative font size of the label

font_style class-attribute instance-attribute

font_style: FontStyleEnum = NORMAL

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

font_weight class-attribute instance-attribute

font_weight: FontWeightEnum = NORMAL

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

line_spacing class-attribute instance-attribute

line_spacing: Optional[int] = None

Spacing between lines of text

offset_x class-attribute instance-attribute

offset_x: int = 0

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

offset_y class-attribute instance-attribute

offset_y: int = 0

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

zorder class-attribute instance-attribute

zorder: int = 101

Zorder of the label


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. Only applies to map plots.

background_alpha class-attribute instance-attribute

background_alpha: float = 1.0

Background's alpha (transparency)

background_color class-attribute instance-attribute

background_color: ColorStr = ColorStr('#fff')

Background color of the legend box

border_padding class-attribute instance-attribute

border_padding: float = 1.28

Padding around legend border

expand class-attribute instance-attribute

expand: bool = False

If True, the legend will be expanded to fit the full width of the map

font_color class-attribute instance-attribute

font_color: ColorStr = ColorStr('#000')

Font color for legend labels

font_size class-attribute instance-attribute

font_size: int = 9

Relative font size of the legend labels

label_padding class-attribute instance-attribute

label_padding: float = 1.6

Padding between legend labels

location class-attribute instance-attribute

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

num_columns class-attribute instance-attribute

num_columns: int = 8

Number of columns in the legend

symbol_padding class-attribute instance-attribute

symbol_padding: float = 0.2

Padding between each symbol and its label

symbol_size class-attribute instance-attribute

symbol_size: int = 16

Relative size of symbols in the legend

zorder class-attribute instance-attribute

zorder: int = 2000

Zorder of the legend


starplot.styles.FillStyleEnum

Constants that represent the possible fill styles for markers.

BOTTOM class-attribute instance-attribute

BOTTOM = 'bottom'

Fill the bottom half

FULL class-attribute instance-attribute

FULL = 'full'

Fill the marker completely

LEFT class-attribute instance-attribute

LEFT = 'left'

Fill the left half of the marker

NONE class-attribute instance-attribute

NONE = 'none'

Do not fill the marker. It'll still have an edge, but the inside will be transparent.

RIGHT class-attribute instance-attribute

RIGHT = 'right'

Fill the right half of the marker

TOP class-attribute instance-attribute

TOP = 'top'

Fill the top half

starplot.styles.FontStyleEnum

ITALIC class-attribute instance-attribute

ITALIC = 'italic'

NORMAL class-attribute instance-attribute

NORMAL = 'normal'

OBLIQUE class-attribute instance-attribute

OBLIQUE = 'oblique'

starplot.styles.FontWeightEnum

Options for font weight.

BOLD class-attribute instance-attribute

BOLD = 'bold'

HEAVY class-attribute instance-attribute

HEAVY = 'heavy'

LIGHT class-attribute instance-attribute

LIGHT = 'light'

NORMAL class-attribute instance-attribute

NORMAL = 'normal'

ULTRA_BOLD class-attribute instance-attribute

ULTRA_BOLD = 'ultrabold'

ULTRA_LIGHT class-attribute instance-attribute

ULTRA_LIGHT = 'ultralight'

starplot.styles.LineStyleEnum

DASHED class-attribute instance-attribute

DASHED = 'dashed'

DASHED_DOTS class-attribute instance-attribute

DASHED_DOTS = 'dashdot'

DOTTED class-attribute instance-attribute

DOTTED = 'dotted'

SOLID class-attribute instance-attribute

SOLID = 'solid'

starplot.styles.MarkerSymbolEnum

Options for marker symbols

CIRCLE class-attribute instance-attribute

CIRCLE = 'circle'

CIRCLE_CROSS class-attribute instance-attribute

CIRCLE_CROSS = 'circle_cross'

CIRCLE_DOTTED_EDGE class-attribute instance-attribute

CIRCLE_DOTTED_EDGE = 'circle_dotted_edge'

CIRCLE_PLUS class-attribute instance-attribute

CIRCLE_PLUS = 'circle_plus'

COMET class-attribute instance-attribute

COMET = 'comet'

DIAMOND class-attribute instance-attribute

DIAMOND = 'diamond'

POINT class-attribute instance-attribute

POINT = 'point'

·

SQUARE class-attribute instance-attribute

SQUARE = 'square'

SQUARE_STRIPES_DIAGONAL class-attribute instance-attribute

SQUARE_STRIPES_DIAGONAL = 'square_stripes_diagonal'

STAR class-attribute instance-attribute

STAR = 'star'

STAR_8 class-attribute instance-attribute

STAR_8 = 'star_8'

SUN class-attribute instance-attribute

SUN = 'sun'

TRIANGLE class-attribute instance-attribute

TRIANGLE = 'triangle'

as_matplot

as_matplot() -> str

Returns the matplotlib value of this marker

starplot.styles.LegendLocationEnum

Options for the location of the map legend

INSIDE_BOTTOM class-attribute instance-attribute

INSIDE_BOTTOM = 'lower center'

INSIDE_BOTTOM_LEFT class-attribute instance-attribute

INSIDE_BOTTOM_LEFT = 'lower left'

INSIDE_BOTTOM_RIGHT class-attribute instance-attribute

INSIDE_BOTTOM_RIGHT = 'lower right'

INSIDE_TOP class-attribute instance-attribute

INSIDE_TOP = 'upper center'

INSIDE_TOP_LEFT class-attribute instance-attribute

INSIDE_TOP_LEFT = 'upper left'

INSIDE_TOP_RIGHT class-attribute instance-attribute

INSIDE_TOP_RIGHT = 'upper right'

OUTSIDE_BOTTOM class-attribute instance-attribute

OUTSIDE_BOTTOM = 'outside lower center'

OUTSIDE_TOP class-attribute instance-attribute

OUTSIDE_TOP = 'outside upper center'

starplot.styles.AnchorPointEnum

Options for the anchor point of labels

BOTTOM_CENTER class-attribute instance-attribute

BOTTOM_CENTER = 'bottom center'

BOTTOM_LEFT class-attribute instance-attribute

BOTTOM_LEFT = 'bottom left'

BOTTOM_RIGHT class-attribute instance-attribute

BOTTOM_RIGHT = 'bottom right'

TOP_CENTER class-attribute instance-attribute

TOP_CENTER = 'top center'

TOP_LEFT class-attribute instance-attribute

TOP_LEFT = 'top left'

TOP_RIGHT class-attribute instance-attribute

TOP_RIGHT = 'top right'

as_matplot

as_matplot() -> dict

Style Extensions

  • Color Schemes
    • GRAYSCALE - Optimized for printing in grayscale (details)
    • GRAYSCALE_DARK - Like GRAYSCALE, but inverted (white stars, black background) (details)
    • BLUE_LIGHT - Light and bright colors (details)
    • BLUE_MEDIUM - Medium brightness bluish gray colors (details)
    • BLUE_DARK - Dark "Starplot blue" colors (details)
    • ANTIQUE - Antique map inspired colors (details)
    • NORD - Nord-inspired colors (details)
  • Plot types
    • OPTIC - Basic styling tailored for optic plots (details)
    • MAP - Basic styling tailored for map plots (details)

GRAYSCALE

Optimized for printing in grayscale

Source
background_color: '#fff'
border_bg_color: '#fff'
border_font_color: '#000'
border_line_color: '#000'
title:
  font_color: '#000'
celestial_equator:
  label:
    font_color: '#999'
  line:
    color: '#999'
constellation:
  line:
    color: '#c8c8c8'
dso_double_star:
  marker:
    color: '#000'
dso_galaxy:
  marker:
    color: '#000'
    alpha: 0.6
    symbol: diamond
    fill: top
dso_nebula:
  marker:
    color: '#000'
    alpha: 0.28
dso_open_cluster:
  marker:
    color: null
    edge_color: '#000'
    fill: none
    alpha: 0.8
ecliptic:
  label:
    font_color: '#777'
  line:
    color: '#777'
milky_way:
  alpha: 0.28
  color: '#d9d9d9'
  edge_width: 0
planets:
  marker:
    color: '#000'
    fill: left
sun:
  marker:
    color: '#000'
    edge_color: '#000'

legend:
  background_color: '#fff'

GRAYSCALE_DARK

Like GRAYSCALE, but inverted (white stars, black background)

Source
background_color: hsl(136, 0%, 10%)
figure_background_color: hsl(136, 0%, 100%)
border_bg_color: hsl(136, 0%, 20%)
border_font_color: hsl(136, 0%, 0%)
border_line_color: hsl(136, 0%, 97%)
title:
  font_color: hsl(136, 0%, 0%)
info_text:
  font_color: hsl(136, 0%, 0%)
star:
  label:
    font_color: hsl(136, 0%, 97%)
  marker:
    color: hsl(136, 0%, 97%)
sun:
  label:
    font_color: hsl(136, 0%, 97%)
  marker:
    color: hsl(136, 0%, 97%)
    edge_color: hsl(136, 0%, 97%)
bayer_labels:
  font_color: hsl(136, 0%, 77%)
celestial_equator:
  label:
    font_color: '#999'
  line:
    color: '#999'
constellation:
  label:
    font_color: hsl(136, 0%, 77%)
  line:
    color: hsl(136, 0%, 42%)
constellation_borders:
  color: hsl(136, 0%, 42%)
  alpha: 0.5
dso_double_star:
  label:
    font_color: hsl(136, 0%, 97%)
  marker:
    color: 'hsl(136, 0%, 97%)'
dso_galaxy:
  label:
    font_color: hsl(136, 0%, 97%)
  marker:
    color: 'hsl(136, 0%, 97%)'
    alpha: 0.8
    symbol: diamond
    fill: top
dso_nebula:
  label:
    font_color: hsl(136, 0%, 97%)
  marker:
    color: 'hsl(136, 0%, 97%)'
    alpha: 0.28
dso_open_cluster:
  label:
    font_color: hsl(136, 0%, 97%)
  marker:
    edge_color: 'hsl(136, 0%, 97%)'
    fill: none
    alpha: 0.8
dso_association_stars:
  label:
    font_color: hsl(136, 0%, 97%)
  marker:
    edge_color: 'hsl(136, 0%, 97%)'
    fill: none
    alpha: 0.8
ecliptic:
  label:
    font_color: '#777'
  line:
    color: '#777'
milky_way:
  alpha: 0.1
  color: hsl(136, 0%, 62%)
  edge_width: 0
planets:
  label:
    font_color: hsl(136, 0%, 97%)
  marker:
    color: hsl(136, 0%, 97%)
    fill: bottom
    edge_color: hsl(136, 0%, 97%)
moon:
  label:
    font_color: hsl(136, 0%, 97%)
gridlines:
  label:
    font_color: hsl(136, 0%, 0%)
legend:
  background_color: hsl(136, 0%, 64%)

BLUE_LIGHT

Light and bright colors

Source
background_color: '#fff'
border_bg_color: '#b5cbe3'
border_font_color: '#2f4358'
border_line_color: '#2f4358'
title:
  font_color: '#2f4358'
celestial_equator:
  label:
    font_color: '#2d5ec2'
  line:
    color: '#2d5ec2'
constellation:
  label:
    font_color: '#c5c5c5'
  line:
    alpha: 0.3
    color: '#6ba832'
    width: 3
dso_double_star:
  marker:
    alpha: 0.6
dso_galaxy:
  marker:
    alpha: 0.5
    color: hsl(18, 68%, 75%)
    edge_color: hsl(18, 68%, 40%)
dso_nebula:
  marker:
    alpha: 0.5
    color: hsl(91, 53%, 75%)
    edge_color: hsl(91, 53%, 40%)
dso_open_cluster:
  marker:
    alpha: 0.3
    color: '#fffb68'
    edge_color: '#989400'
dso_association_stars:
  marker:
    alpha: 0.3
    color: '#fffb68'
    edge_color: '#989400'
ecliptic:
  label:
    font_color: '#e33b3b'
  line:
    color: '#e33b3b'
milky_way:
  alpha: 0.16
  color: '#94c5e3'
  edge_width: 0
planets:
  marker:
    alpha: 0.4
    color: '#f89d00'
    fill: full

legend:
  background_color: '#fff'

BLUE_MEDIUM

Medium brightness bluish gray colors

Source
background_color: '#f1f6ff'
figure_background_color: '#fff'
border_bg_color: '#7997b9'
border_font_color: '#f1f6ff'
border_line_color: '#2f4358'
title:
  font_color: '#f1f6ff'
bayer_labels:
  font_alpha: 0.8
  font_color: '#000'
celestial_equator:
  label:
    font_color: '#2d5ec2'
  line:
    color: '#2d5ec2'
    alpha: 0.6
constellation:
  label:
    font_size: 7
    font_weight: light
  line:
    alpha: 0.23
    color: '#6ba832'
    width: 3
ecliptic:
  label:
    font_color: '#e33b3b'
  line:
    color: '#e33b3b'
    alpha: 0.6
planets:
  marker:
    alpha: 0.4
    color: '#f89d00'
    fill: full
milky_way:
  alpha: 0.14
  color: '#94c5e3'
  edge_width: 0
gridlines:
  label:
    font_alpha: 0.8
    font_color: '#2f4358'
    font_size: 8
    font_weight: light
  line:
    alpha: 0.6
    color: '#888'
    style: solid
    width: 1
sun:
  marker:
    color: '#ffd22e'
    edge_color: 'hsl(47, 100%, 29%)'

# DSOs
dso_double_star:
  marker:
    alpha: 0.6
dso_galaxy:
  marker:
    alpha: 0.45
    color: '#D99CBA'
    edge_color: '#b15d87'
dso_nebula:
  marker:
    alpha: 0.56
    color: hsl(91, 62%, 82%)
    edge_color: hsl(91, 53%, 40%)
dso_open_cluster:
  marker:
    alpha: 0.4
    color: '#fffb68'
    edge_color: '#989400'
dso_association_stars:
  marker:
    alpha: 0.4
    color: '#fffb68'
    edge_color: '#989400'
dso_globular_cluster:
  marker:
    alpha: 0.8
    color: '#c7c7c7'
    edge_color: '#444'

legend:
  background_color: '#f1f6ff'

BLUE_DARK

Dark bluish gray colors

Source
background_color: hsl(209, 50%, 24%)
figure_background_color: hsl(209, 43%, 15%)
border_bg_color: hsl(209, 50%, 20%)
border_font_color: hsl(209, 56%, 86%)
border_line_color: hsl(209, 38%, 50%)
title:
  font_color: hsl(209, 56%, 86%)
bayer_labels:
  font_alpha: 0.8
  font_color: hsl(209, 53%, 82%)
celestial_equator:
  label:
    font_color: hsl(209, 30%, 80%)
  line:
    color: hsl(209, 30%, 80%)
ecliptic:
  label:
    font_color: hsl(209, 30%, 80%)
  line:
    width: 1.6
    color: hsl(209, 30%, 80%)
constellation:
  label:
    font_alpha: 0.37
    font_color: hsl(209, 23%, 80%)
    font_weight: light
  line:
    alpha: 0.36
    color: hsl(209, 23%, 76%)

constellation_borders:
  width: 2
  color: hsl(209, 50%, 74%)

dso_double_star:
  label:
    font_color: hsl(209, 23%, 72%)
  marker:
    alpha: 0.8
    color: '#88c0d0'
    edge_color: '#88c0d0'
dso_galaxy:
  label:
    font_color: hsl(209, 23%, 72%)
  marker:
    alpha: 0.16
    color: hsl(209, 20%, 75%)
    edge_color: hsl(209, 20%, 90%)
    zorder: -600
dso_nebula:
  label:
    font_color: hsl(209, 23%, 72%)
  marker:
    alpha: 0.46
    color: hsl(209, 50%, 78%)
    edge_color: hsl(209, 50%, 20%)
    zorder: -500
dso_open_cluster:
  label:
    font_color: hsl(209, 23%, 72%)
  marker:
    size: 10
    alpha: 0.52
    fill: none
    edge_color: hsl(209, 50%, 92%)
    zorder: -500
dso_association_stars:
  label:
    font_color: hsl(209, 23%, 72%)
  marker:
    alpha: 0.52
    fill: none
    edge_color: hsl(209, 50%, 92%)
    zorder: -500
dso_globular_cluster:
  label:
    font_color: hsl(209, 23%, 72%)
  marker:
    alpha: 0.68
    size: 10
    symbol: circle_plus
    color: hsl(209, 50%, 92%)
    edge_color: null
    zorder: 100

info_text:
  font_color: hsl(209, 53%, 90%)

gridlines:
  label:
    font_alpha: 1
    font_color: hsl(209, 53%, 94%)
    font_weight: light
  line:
    alpha: 0.7
    color: hsl(209, 53%, 37%)
    style: solid
    width: 1
milky_way:
  alpha: 0.26
  color: hsl(209, 50%, 54%)
  edge_width: 0
planets:
  label:
    font_color: hsl(209, 20%, 80%)
  marker:
    alpha: 0.8
    color: hsl(209, 20%, 78%)
    fill: full
moon:
  label:
    font_color: '#f2f2f2'
    font_alpha: 0.8
  marker:
    color: '#e9e9e9'
star:
  label:
    font_color: hsl(209, 23%, 84%)
    font_weight: bold
  marker:
    color: hsl(209, 50%, 94%)
    size: 25
sun:
  label:
    font_color: hsl(209, 23%, 80%)
    font_size: 9
    font_weight: bold
  marker:
    color: hsl(209, 50%, 94%)
    edge_color: hsl(209, 50%, 94%)
    size: 25

legend:
  background_color: hsl(209, 50%, 26%)
  background_alpha: 1.0
  font_color: hsl(209, 50%, 88%)

ANTIQUE

Antique map inspired colors

Source
# Yellow Sat - hsl(49, 92%, 77%)
# Yellow unsat - hsl(48, 80%, 92%)
# blue - hsl(188, 35%, 76%)
# blue gray - hsl(225, 25%, 88%)
# green - hsl(71, 58%, 76%)
# red - hsl(26, 93%, 82%)

background_color: hsl(48, 80%, 96%)
figure_background_color: hsl(60, 9%, 29%)
border_bg_color: hsl(60, 3%, 32%)
border_font_color: hsl(60, 20%, 93%)
border_line_color: hsl(60, 20%, 53%)
title:
  font_color: hsl(60, 20%, 93%)
bayer_labels:
  font_alpha: 0.74
  font_color: '#000'
celestial_equator:
  label:
    font_color: hsl(188, 35%, 56%)
  line:
    color: hsl(188, 35%, 76%)
    alpha: 0.62
constellation:
  label:
    font_size: 10
    font_weight: light
    font_color: hsl(60, 3%, 52%)
    font_alpha: 0.36
    font_name: "serif"
  line:
    alpha: 0.2
    color: hsl(48, 80%, 14%)
    width: 1.46
constellation_borders:
  color: hsl(37, 33%, 40%)
  alpha: 0.44
  width: 1.2
  zorder: -500
ecliptic:
  label:
    font_color: hsl(26, 63%, 52%)
  line:
    color: hsl(26, 93%, 82%)
    alpha: 0.6
milky_way:
  alpha: 0.14
  color: hsl(48, 40%, 70%)
  edge_width: 0
gridlines:
  label:
    font_alpha: 0.8
    font_color: hsl(60, 3%, 92%)
    font_size: 8
    font_weight: light
  line:
    alpha: 0.6
    color: hsl(68, 11%, 71%)
    style: solid
    width: 1
star:
  marker:
    color: hsl(60, 12%, 32%)
  label:
    font_color: hsl(60, 3%, 42%)
planets:
  marker:
    size: 8
    symbol: circle
    alpha: 0.68
    fill: full
    color: hsl(26, 93%, 82%)
    edge_color: hsl(26, 93%, 52%)
  label:
    font_size: 7
    font_color: hsl(60, 3%, 42%)
sun:
  label:
    font_color: hsl(60, 3%, 42%)
  marker:
    color: hsl(60, 12%, 32%)
    edge_color: hsl(60, 12%, 32%)
moon:
  label:
    font_color: hsl(60, 3%, 42%)
  marker:
    color: hsl(48, 80%, 96%)
    edge_color: hsl(60, 12%, 32%)

# DSOs
dso_double_star:
  marker:
    alpha: 0.6
dso_galaxy:
  marker:
    alpha: 0.42
    color: hsl(26, 93%, 82%)
    edge_color:  hsl(26, 93%, 32%)
dso_nebula:
  marker:
    alpha: 0.52
    color: hsl(71, 58%, 76%)
    edge_color: hsl(71, 58%, 36%)
dso_open_cluster:
  marker:
    alpha: 0.52
    color: hsl(49, 92%, 77%)
    edge_color: hsl(49, 92%, 27%)
dso_association_stars:
  marker:
    alpha: 0.52
    color: hsl(49, 92%, 77%)
    edge_color: hsl(49, 92%, 27%)
dso_globular_cluster:
  marker:
    alpha: 0.5
    color: hsl(60, 53%, 76%)
    edge_color: hsl(60, 3%, 32%)

legend:
  background_color: hsl(48, 50%, 98%)

NORD

Nord inspired colors

Source
background_color: '#4c566a'
bayer_labels:
  font_alpha: 0.8
  font_color: '#85c9de'
border_bg_color: '#2e3440'
border_font_color: '#a3be8c'
border_line_color: '#a3be8c'
title:
  font_color: '#a3be8c'
celestial_equator:
  label:
    font_color: '#77A67F'
  line:
    color: '#77A67F'
constellation:
  label:
    font_alpha: 0.6
    font_color: rgb(230, 204, 147)
    font_size: 7
    font_weight: light
  line:
    alpha: 0.36
    color: rgb(230, 204, 147)
    width: 2

dso_double_star:
  marker:
    alpha: 0.8
    color: '#88c0d0'
    edge_color: '#88c0d0'
dso_galaxy:
  marker:
    alpha: 0.6
    color: '#D99CBA'
    edge_color: '#bd5187'
dso_nebula:
  marker:
    alpha: 0.32
    color: '#9CD9BB'
    edge_color: '#52896e'
dso_open_cluster:
  marker:
    alpha: 0.32
    color: '#d8d99c'
    edge_color: '#9d9f3c'
dso_association_stars:
  marker:
    alpha: 0.32
    color: '#d8d99c'
    edge_color: '#9d9f3c'
dso_globular_cluster:
  marker:
    alpha: 0.5
    color: '#c7c7c7'
    edge_color: '#444'

ecliptic:
  label:
    font_color: '#D99CBA'
  line:
    color: '#D99CBA'
gridlines:
  label:
    font_alpha: 0.8
    font_color: '#c2d2f3'
    font_size: 8
    font_weight: light
  line:
    alpha: 0.8
    color: '#888'
    style: solid
    width: 1
milky_way:
  alpha: 0.14
  color: '#95a3bf'
  edge_width: 0
planets:
  label:
    font_color: '#D99CCF'
  marker:
    alpha: 0.8
    color: '#D99CCF'
    fill: full
moon:
  label:
    font_color: '#f2f2f2'
    font_alpha: 0.8
  marker:
    color: '#e9e9e9'
star:
  label:
    font_color: '#88c0d0'
    font_size: 9
    font_weight: bold
  marker:
    color: '#88c0d0'
sun:
  label:
    font_color: '#88c0d0'
    font_size: 9
    font_weight: bold
  marker:
    color: '#88c0d0'
    edge_color: '#88c0d0'
moon:
  label:
    font_color: '#88c0d0'
    font_size: 9
    font_weight: bold
  marker:
    color: '#88c0d0'

legend:
  background_color: '#515e76'
  background_alpha: 1.0
  font_color: '#d5e0f5'

OPTIC

Basic styling tailored for optic plots

Source
star:
  label:
    font_size: 15
  marker:
    size: 16
bayer_labels:
  font_size: 15
planets:
  marker:
    size: 11
legend:
  location: "lower center"
ecliptic:
  label:
    font_size: 15
celestial_equator:
  label:
    font_size: 15

MAP

Basic styling tailored for map plots

Source
constellation:
  label:
    font_alpha: 0.82
    font_size: 10
  line:
    width: 2.36
star:
  label:
    font_size: 11