Skip to content

starplot.ZenithPlot

Zenith plots show the whole sky as seen from a specific time and place. They're also sometimes called "star charts" but that name is used for many different types of star maps, so Starplot uses the more specific name "Zenith plot" (which reflects the fact that the zenith is in the center of the chart).

These plots use a stereographic projection, calculated by Skyfield.

starplot.ZenithPlot(lat=None, lon=None, dt=None, limiting_magnitude=6.0, limiting_magnitude_labels=2.1, include_info_text=False, ephemeris='de421_2001.bsp', style=ZENITH_BASE, resolution=2048, hide_colliding_labels=True, adjust_text=False, rasterize_stars=False, *args, **kwargs)

Creates a new zenith plot.

Parameters:

  • lat (float, default: None ) –

    Latitude of observer's location

  • lon (float, default: None ) –

    Longitude of observer's location

  • dt (datetime, default: None ) –

    Date/time of observation (must be timezone-aware). Default = current UTC time.

  • limiting_magnitude (float, default: 6.0 ) –

    Limiting magnitude of stars to plot

  • limiting_magnitude_labels (float, default: 2.1 ) –

    Limiting magnitude of stars to label on the plot

  • include_info_text (bool, default: False ) –

    If True, then the plot will include the time/location

  • ephemeris (str, default: 'de421_2001.bsp' ) –

    Ephemeris to use for calculating planet positions (see Skyfield's documentation for details)

  • style (PlotStyle, default: ZENITH_BASE ) –

    Styling for the plot (colors, sizes, fonts, etc)

  • resolution (int, default: 2048 ) –

    Size (in pixels) of largest dimension of the map

  • hide_colliding_labels (bool, default: True ) –

    If True, then labels will not be plotted if they collide with another existing label

  • adjust_text (bool, default: False ) –

    If True, then the labels will be adjusted to avoid overlapping

  • rasterize_stars (bool, default: False ) –

    If True, then the stars will be rasterized when plotted, which can speed up exporting to SVG and reduce the file size but with a loss of image quality

Returns:

  • ZenithPlot

    A new instance of a ZenithPlot

adjust_labels()

Adjust all the labels to avoid overlapping.

close_fig()

Closes the underlying matplotlib figure.

draw_reticle(ra, dec, size=6, color='red')

Plots a basic reticle on the map.

Parameters:

  • ra (float) –

    Right ascension of the reticle's center

  • dec (float) –

    Declination of the reticle's center

  • size (int, default: 6 ) –

    Relative size of the reticle

  • color (str, default: 'red' ) –

    Color of the reticle (Matplotlib format)

export(filename, format='png', padding=0, **kwargs)

Exports the plot to an image file.

Parameters:

  • filename (str) –

    Filename of exported file

  • format (str, default: 'png' ) –

    Format of file: "png" or "svg"

  • padding (float, default: 0 ) –

    Padding (in inches) around the image

  • **kwargs

    Any keyword arguments to pass through to matplotlib's savefig method

plot_circle(center, radius_degrees, style, num_pts=100)

Plots a circle

Parameters:

  • center (tuple) –

    Center of circle (ra, dec)

  • radius_degrees (float) –

    Radius of circle (degrees)

  • style (PolygonStyle) –

    Style of circle

  • num_pts (int, default: 100 ) –

    Number of points to calculate for the circle polygon

plot_ellipse(center, height_degrees, width_degrees, style, angle=0, num_pts=100)

Plots an ellipse

Parameters:

  • center (tuple) –

    Center of ellipse (ra, dec)

  • height_degrees (float) –

    Height of ellipse (degrees)

  • width_degrees (float) –

    Width of ellipse (degrees)

  • style (PolygonStyle) –

    Style of ellipse

  • angle (float, default: 0 ) –

    Angle of rotation clockwise (degrees)

  • num_pts (int, default: 100 ) –

    Number of points to calculate for the ellipse polygon

plot_object(obj)

Plots an object (see SkyObject for details).

Parameters:

plot_polygon(points, style)

Plots a polygon of points

Parameters:

  • points (list) –

    List of polygon points [(ra, dec), ...]

  • style (PolygonStyle) –

    Style of polygon

plot_rectangle(center, height_degrees, width_degrees, style, angle=0, *args, **kwargs)

Plots a rectangle

Parameters:

  • center (tuple) –

    Center of rectangle (ra, dec)

  • height_degrees (float) –

    Height of rectangle (degrees)

  • width_degrees (float) –

    Width of rectangle (degrees)

  • angle (float, default: 0 ) –

    Angle of rotation clockwise (degrees)

  • style (PolygonStyle) –

    Style of rectangle

refresh_legend()

Redraws the legend.

This is useful if you want to include objects in the legend that were plotted AFTER creating the plot (via plot_object)