Repository navigation
Expand file tree
/
Copy pathtutorial_08.py
More file actions
61 lines (53 loc) · 1.53 KB
/
Copy pathtutorial_08.py
File metadata and controls
61 lines (53 loc) · 1.53 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
from datetime import datetime
from zoneinfo import ZoneInfo
from starplot import Observer, HorizonPlot, styles, callables, DSO, _
tz = ZoneInfo("America/Los_Angeles")
dt = datetime(2025, 11, 18, 21, 30, 0, tzinfo=tz)
observer = Observer(
dt=dt,
lat=32.97,
lon=-117.038611,
)
style = styles.PlotStyle().extend(
styles.extensions.GRAYSCALE_DARK,
styles.extensions.HORIZON,
)
style.axes.background.fill = {
"stops": styles.gradients.NIGHT,
"type": "linear",
}
style.figure.background.fill = "#000"
p = HorizonPlot(
altitude=(0, 70),
azimuth=(30, 150),
observer=observer,
style=style,
resolution=2000,
autoscale=True,
)
p.ground(min_altitude=5, max_altitude=8)
p.stars(
where=[_.magnitude < 3.6],
where_labels=[_.magnitude < 1.6],
# callable to color the stars based on their BV index:
color_fn=callables.color_by_bv_gradient,
# callable to make dimmer stars semi-transparent:
opacity_fn=lambda s: 1 if s.magnitude < 2 else 0.5,
)
style.gridlines.label.font_size *= 1.2 # make the labels 20% bigger
style.gridlines.label.fill = "#e5ecf3"
style.gridlines.line.width = 0 # hide the gridlines, we just want the labels
p.gridlines(alt_label_locations=[])
# Plot a dotted circle around the Pleiades (M45) and an arrow pointing to it
m45 = DSO.get(m="45")
p.polygon(
geometry=m45.geometry,
style={
"fill": None,
"stroke": "#fffb0e",
"stroke_width": 6,
"dash_array": "dotted",
},
)
p.arrow(target=(m45.ra, m45.dec))
p.export("tutorial_08.svg")