Starplot has models for most objects you can plot, including stars, DSOs, planets, moons, and the Sun. These models also have properties relevant to each object (e.g. magnitude, ra, dec, etc). Sometimes you may want to create a plot directly from an object, so Starplot has a way to lookup objects by using each model's get() or find() or all() functions.
For example, here's a way to get Jupiter's position for tonight's sky and then create an optic plot directly from the Planet instance:
fromdatetimeimportdatetimefrompytzimporttimezonefromstarplot.stylesimportPlotStyle,extensionsfromstarplotimportPlanet,opticstonight=datetime.now(timezone("America/Los_Angeles")).replace(hour=21)# get Jupiter for tonightjupiter=Planet.get("jupiter",tonight)# create an optic plot directly from Jupiter instancep=jupiter.create_optic(lat=32.97,lon=-117.038611,dt=tonight,optic=optics.Refractor(focal_length=600,eyepiece_focal_length=4,eyepiece_fov=52,),style=PlotStyle().extend(extensions.GRAYSCALE_DARK),raise_on_below_horizon=False,autoscale=True,)p.planets(true_size=True,# since we're plotting the planets as their "true size"# the 'auto' offset won't work (it's not supported yet!)# so we manually set the offsets here:style__label__offset_x=86,style__label__offset_y=-40,style__label__font_size=56,style__marker__color="#fcdb72",)p.export("tutorial_07.png",padding=0)
More Examples
Get all the planets:
planets=Planet.all()
Get all the stars with limiting magnitude 6:
stars=Star.find(where=[Star.magnitude<=6])
Get the Hercules Globular Cluster (M13):
m13=DSO.get(m="13")
In the next section, we'll learn how to use callables to dynamically define the style of stars...