starplot.MapPlot
Map plots are general purpose maps of the sky. They're not dependent on an observer's location, but they are dependent on time if you want to include the planets and/or the moon in the plot.
There are four supported projections for map plots:
- Mercator (the default)
- Stereographic North
- Stereographic South
- Mollweide
starplot.MapPlot(projection, ra_min, ra_max, dec_min, dec_max, dt=None, limiting_magnitude=6.0, limiting_magnitude_labels=6.0, ephemeris='de421_2001.bsp', style=MAP_BASE, resolution=2048, hide_colliding_labels=True, adjust_text=False, rasterize_stars=False, star_catalog=stars.StarCatalog.HIPPARCOS, dso_types=dsos.DEFAULT_DSO_TYPES, *args, **kwargs)
Creates a new map plot.
Parameters:
-
projection
(Projection
) –Projection of the map
-
ra_min
(float
) –Minimum right ascension (hours) of the map
-
ra_max
(float
) –Maximum right ascension (hours) of the map
-
dec_min
(float
) –Minimum declination (degrees) of the map
-
dec_max
(float
) –Maximum declination (degrees) of the map
-
dt
(datetime
, default:None
) –Date/time to use for star/planet positions, (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:6.0
) –Limiting magnitude of stars to label on the plot
-
ephemeris
(str
, default:'de421_2001.bsp'
) –Ephemeris to use for calculating planet positions (see Skyfield's documentation for details)
-
style
(PlotStyle
, default:MAP_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
-
star_catalog
(StarCatalog
, default:HIPPARCOS
) –The catalog of stars to use: "hipparcos" or "tycho-1" -- Hipparcos is the default and has about 10x less stars than Tycho-1 but will also plot much faster
-
dso_types
(list[DsoType]
, default:DEFAULT_DSO_TYPES
) –List of Deep Sky Objects (DSOs) types that will be plotted
Returns:
-
MapPlot
–A new instance of a MapPlot
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
in_bounds(ra, dec)
Determine if a coordinate is within the bounds of the plot.
Parameters:
-
ra
(float
) –Right ascension
-
dec
(float
) –Declination
Returns:
-
bool
–True if the coordinate is in bounds, otherwise False
plot_bino_fov(ra, dec, fov, magnification, style=DEFAULT_FOV_STYLE)
Draws a circle representing the field of view for binoculars.
Parameters:
-
ra
(float
) –Right ascension of the center of view
-
dec
(float
) –Declination of the center of view
-
fov
(float
) –field of view (degrees) of the binoculars
-
magnification
(float
) –magnification of the binoculars
-
style
(PolygonStyle
, default:DEFAULT_FOV_STYLE
) –style of the polygon
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)
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
plot_scope_fov(ra, dec, scope_focal_length, eyepiece_focal_length, eyepiece_fov, style=DEFAULT_FOV_STYLE)
Draws a circle representing the field of view for a telescope and eyepiece.
Parameters:
-
ra
(float
) –Right ascension of the center of view
-
dec
(float
) –Declination of the center of view
-
scope_focal_length
(float
) –focal length (mm) of the scope
-
eyepiece_focal_length
(float
) –focal length (mm) of the eyepiece
-
eyepiece_fov
(float
) –field of view (degrees) of the eyepiece
-
style
(PolygonStyle
, default:DEFAULT_FOV_STYLE
) –style of the polygon
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
)
starplot.Projection
Supported projections for MapPlots
MERCATOR = 'mercator'
class-attribute
instance-attribute
Good for declinations between -70 and 70, but distorts objects near the poles
MOLLWEIDE = 'mollweide'
class-attribute
instance-attribute
Good for showing the entire celestial sphere in one plot
STEREO_NORTH = 'stereo_north'
class-attribute
instance-attribute
Good for objects near the north celestial pole, but distorts objects near the mid declinations
STEREO_SOUTH = 'stereo_south'
class-attribute
instance-attribute
Good for objects near the south celestial pole, but distorts objects near the mid declinations
starplot.map.DEFAULT_FOV_STYLE = PolygonStyle(fill=False, edge_color='red', line_style='dashed', edge_width=4, zorder=1000)
module-attribute
Default style for plotting scope and bino views