starplot 0.15.8__py2.py3-none-any.whl → 0.16.1__py2.py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (43) hide show
  1. starplot/__init__.py +7 -2
  2. starplot/base.py +57 -60
  3. starplot/cli.py +3 -3
  4. starplot/config.py +56 -0
  5. starplot/data/__init__.py +5 -5
  6. starplot/data/bigsky.py +3 -3
  7. starplot/data/db.py +2 -2
  8. starplot/data/library/sky.db +0 -0
  9. starplot/geometry.py +48 -0
  10. starplot/horizon.py +194 -90
  11. starplot/map.py +71 -168
  12. starplot/mixins.py +0 -55
  13. starplot/models/dso.py +10 -2
  14. starplot/observer.py +71 -0
  15. starplot/optic.py +61 -26
  16. starplot/plotters/__init__.py +2 -0
  17. starplot/plotters/constellations.py +4 -6
  18. starplot/plotters/dsos.py +3 -2
  19. starplot/plotters/gradients.py +153 -0
  20. starplot/plotters/legend.py +247 -0
  21. starplot/plotters/milkyway.py +8 -5
  22. starplot/plotters/stars.py +5 -3
  23. starplot/projections.py +155 -55
  24. starplot/styles/base.py +98 -22
  25. starplot/styles/ext/antique.yml +0 -1
  26. starplot/styles/ext/blue_dark.yml +0 -1
  27. starplot/styles/ext/blue_gold.yml +60 -52
  28. starplot/styles/ext/blue_light.yml +0 -1
  29. starplot/styles/ext/blue_medium.yml +7 -7
  30. starplot/styles/ext/blue_night.yml +178 -0
  31. starplot/styles/ext/cb_wong.yml +0 -1
  32. starplot/styles/ext/gradient_presets.yml +158 -0
  33. starplot/styles/ext/grayscale.yml +0 -1
  34. starplot/styles/ext/grayscale_dark.yml +0 -1
  35. starplot/styles/ext/nord.yml +0 -1
  36. starplot/styles/extensions.py +90 -0
  37. starplot/zenith.py +174 -0
  38. {starplot-0.15.8.dist-info → starplot-0.16.1.dist-info}/METADATA +18 -11
  39. {starplot-0.15.8.dist-info → starplot-0.16.1.dist-info}/RECORD +42 -36
  40. starplot/settings.py +0 -26
  41. {starplot-0.15.8.dist-info → starplot-0.16.1.dist-info}/WHEEL +0 -0
  42. {starplot-0.15.8.dist-info → starplot-0.16.1.dist-info}/entry_points.txt +0 -0
  43. {starplot-0.15.8.dist-info → starplot-0.16.1.dist-info}/licenses/LICENSE +0 -0
@@ -1,7 +1,7 @@
1
1
  # blue_medium
2
2
 
3
3
  background_color: hsl(218, 88%, 97%)
4
- figure_background_color: '#fff'
4
+ figure_background_color: hsl(212, 27%, 48%)
5
5
 
6
6
  text_border_color: '#f1f6ff'
7
7
 
@@ -20,11 +20,11 @@ bayer_labels:
20
20
 
21
21
  # Constellations
22
22
  constellation_labels:
23
- font_alpha: 0.75
24
- font_color: hsl(212, 20%, 34%)
23
+ font_alpha: 1
24
+ font_color: hsl(212, 20%, 36%)
25
25
  constellation_lines:
26
- alpha: 0.5
27
- color: '#6ba832'
26
+ alpha: 0.45
27
+ color: hsl(91, 60%, 43%)
28
28
 
29
29
  celestial_equator:
30
30
  label:
@@ -65,7 +65,7 @@ sun:
65
65
 
66
66
  horizon:
67
67
  line:
68
- color: hsl(212, 27%, 56%)
68
+ color: hsl(212, 27%, 48%)
69
69
  edge_color: '#2f4358'
70
70
  label:
71
71
  font_color: '#f1f6ff'
@@ -130,7 +130,6 @@ dso_unknown: &DSO
130
130
  label:
131
131
  font_color: hsl(91, 53%, 40%)
132
132
  dso_dark_nebula: *DSO
133
- dso_hii_ionized_region: *DSO
134
133
  dso_supernova_remnant: *DSO
135
134
  dso_nova_star: *DSO
136
135
  dso_nonexistant: *DSO
@@ -139,3 +138,4 @@ dso_duplicate: *DSO
139
138
 
140
139
  legend:
141
140
  background_color: '#f1f6ff'
141
+ border_color: '#c9daf8'
@@ -0,0 +1,178 @@
1
+ background_color: hsl(210, 29%, 15%)
2
+ figure_background_color: hsl(210, 29%, 8%)
3
+
4
+ text_border_color: hsl(210, 29%, 15%)
5
+
6
+ border_bg_color: hsl(210, 29%, 5%)
7
+ border_font_color: hsl(209, 56%, 86%)
8
+ border_line_color: hsl(209, 38%, 50%)
9
+
10
+ title:
11
+ font_color: hsl(210, 29%, 94%)
12
+
13
+ legend:
14
+ background_color: hsl(210, 29%, 20%)
15
+ background_alpha: 1.0
16
+ font_color: hsl(210, 29%, 94%)
17
+
18
+ info_text:
19
+ font_color: hsl(210, 29%, 8%)
20
+
21
+ gridlines:
22
+ label:
23
+ font_alpha: 1
24
+ font_color: hsl(209, 53%, 94%)
25
+ line:
26
+ alpha: 0.8
27
+ # color: hsl(209, 53%, 54%)
28
+ color: hsl(210, 19%, 45%)
29
+ style: solid
30
+ width: 1
31
+
32
+ zenith:
33
+ marker:
34
+ color: hsl(209, 20%, 75%)
35
+ label:
36
+ font_color: hsl(209, 20%, 75%)
37
+
38
+ horizon:
39
+ line:
40
+ color: hsl(210, 29%, 8%)
41
+ edge_color: hsl(209, 38%, 50%)
42
+ label:
43
+ font_color: hsl(210, 29%, 94%)
44
+
45
+ celestial_equator:
46
+ label:
47
+ font_color: hsl(211deg 47% 81%)
48
+ line:
49
+ color: hsl(211deg 47% 61%)
50
+
51
+ ecliptic:
52
+ label:
53
+ font_color: '#e33b3b'
54
+ line:
55
+ color: hsl(1, 80%, 40%)
56
+ alpha: 1
57
+
58
+ # Stars
59
+ star:
60
+ label:
61
+ font_color: hsl(210, 29%, 94%)
62
+ font_weight: bold
63
+ marker:
64
+ color: hsl(210, 29%, 98%)
65
+ edge_color: hsl(210, 29%, 15%)
66
+
67
+ bayer_labels:
68
+ font_alpha: 0.9
69
+ font_color: hsl(210, 29%, 94%)
70
+ font_size: 24
71
+
72
+ flamsteed_labels:
73
+ font_alpha: 0.9
74
+ font_color: hsl(210, 29%, 94%)
75
+
76
+
77
+ # Constellations
78
+ constellation_lines:
79
+ alpha: 0.64
80
+ color: hsl(91, 60%, 70%)
81
+ constellation_labels:
82
+ font_alpha: 1
83
+ font_color: hsl(210, 10%, 56%)
84
+ border_color: hsl(210, 29%, 15%)
85
+ constellation_borders:
86
+ width: 2
87
+ color: hsl(209, 50%, 74%)
88
+
89
+ # Milky Way
90
+ milky_way:
91
+ alpha: 0.4
92
+ fill_color: hsl(210, 29%, 25%)
93
+ edge_width: 0
94
+
95
+ # DSOs
96
+ dso_double_star:
97
+ label:
98
+ font_color: hsl(209, 23%, 72%)
99
+ marker:
100
+ alpha: 0.8
101
+ color: '#88c0d0'
102
+ edge_color: '#88c0d0'
103
+
104
+ dso_galaxy:
105
+ marker:
106
+ alpha: 1
107
+ color: hsl(323, 34%, 54%)
108
+ edge_color: hsl(321, 97%, 83%)
109
+ edge_width: 2
110
+ label:
111
+ font_color: hsl(321, 95%, 80%)
112
+
113
+ dso_nebula: &DSO-NEB
114
+ marker:
115
+ alpha: 1
116
+ color: hsl(160, 13%, 37%)
117
+ edge_color: hsl(119, 100%, 95%)
118
+ label:
119
+ font_color: hsl(119, 95%, 90%)
120
+ dso_planetary_nebula: *DSO-NEB
121
+
122
+ dso_open_cluster: &DSO-OC
123
+ marker:
124
+ alpha: 1
125
+ color: hsl(62, 48%, 33%)
126
+ edge_color: hsl(58, 98%, 74%)
127
+ edge_width: 1
128
+ label:
129
+ font_color: hsl(58, 98%, 58%)
130
+ dso_association_stars: *DSO-OC
131
+
132
+ dso_globular_cluster:
133
+ marker:
134
+ alpha: 1
135
+ color: hsl(62, 29%, 14%)
136
+ edge_color: hsl(58, 98%, 72%)
137
+ label:
138
+ font_color: hsl(58, 98%, 58%)
139
+
140
+ dso_unknown: &DSO
141
+ label:
142
+ font_color: hsl(209, 23%, 72%)
143
+ marker:
144
+ alpha: 0.46
145
+ color: hsl(209, 50%, 78%)
146
+ edge_color: hsl(209, 50%, 20%)
147
+ zorder: -500
148
+ dso_dark_nebula: *DSO
149
+ dso_supernova_remnant: *DSO
150
+ dso_nova_star: *DSO
151
+ dso_nonexistant: *DSO
152
+ dso_unknown: *DSO
153
+ dso_duplicate: *DSO
154
+
155
+ # Solar System
156
+ sun:
157
+ label:
158
+ font_color: hsl(60, 92%, 71%)
159
+ font_size: 9
160
+ font_weight: bold
161
+ marker:
162
+ color: hsl(209, 50%, 90%)
163
+ edge_color: hsl(209, 50%, 94%)
164
+
165
+ moon:
166
+ label:
167
+ font_color: '#f2f2f2'
168
+ font_alpha: 0.8
169
+ marker:
170
+ color: '#e9e9e9'
171
+
172
+ planets:
173
+ label:
174
+ font_color: hsl(37, 80%, 76%)
175
+ marker:
176
+ alpha: 1
177
+ color: hsl(37, 80%, 56%)
178
+ fill: full
@@ -98,7 +98,6 @@ dso_unknown: &DSO
98
98
  color: hsl(163, 99%, 31%)
99
99
  edge_color: hsl(163, 99%, 21%)
100
100
  dso_dark_nebula: *DSO
101
- dso_hii_ionized_region: *DSO
102
101
  dso_supernova_remnant: *DSO
103
102
  dso_nova_star: *DSO
104
103
  dso_nonexistant: *DSO
@@ -0,0 +1,158 @@
1
+ bold_sunset:
2
+ - [0.0, '#FFAF36']
3
+ - [0.1, '#F56140']
4
+ - [0.25, '#932885']
5
+ - [0.4, '#591D76']
6
+ - [0.7, '#0B0C40']
7
+ - [1.0, '#000033']
8
+
9
+ civil_twilight:
10
+ - [0.0, "#F6C9A1"]
11
+ - [0.1, "#DCD4BB"]
12
+ - [0.3, "#96C6D6"]
13
+ - [0.55, "#4199CF"]
14
+ - [1.0, "#3A73A1"]
15
+
16
+ nautical_twilight:
17
+ - [0.0, '#F3C176']
18
+ - [0.1, '#9292C9']
19
+ - [0.25, '#4661D6']
20
+ - [0.4, '#5428B2']
21
+ - [0.7, '#2C105F']
22
+ - [1.0, '#14012C']
23
+
24
+ astronomical_twilight:
25
+ - [0.0, "#00184C"]
26
+ - [0.1, "#001B42"]
27
+ - [0.4, "#000D37"]
28
+ - [0.7, "#00061D"]
29
+ - [1.0, '#000000']
30
+
31
+ true_night:
32
+ - [0.0, '#00002B']
33
+ - [0.3, '#000022']
34
+ - [0.7, '#000018']
35
+ - [1.0, '#000000']
36
+
37
+ pre_dawn:
38
+ - [0.0, '#FEDCAF']
39
+ - [0.05, "#BEB0D0"]
40
+ - [0.15, '#8274C9']
41
+ - [0.3, '#444294']
42
+ - [0.45, '#222164']
43
+ - [0.7, '#000033']
44
+ - [1.0, '#000000']
45
+
46
+ bold_sunset_radial:
47
+ - [0.0, '#FFAF36']
48
+ - [0.03, '#F56140']
49
+ - [0.08, '#932885']
50
+ - [0.15, '#591D76']
51
+ - [0.30, '#0B0C40']
52
+ - [1.0, '#000033']
53
+
54
+ civil_twilight_radial:
55
+ - [0.0, "#F6C9A1"]
56
+ - [0.05, "#DCD4BB"]
57
+ - [0.1, "#96C6D6"]
58
+ - [0.2, "#4199CF"]
59
+ - [0.6, "#3A73A1"]
60
+ - [1.0, "#266191"]
61
+
62
+ nautical_twilight_radial:
63
+ - [0.0, '#F3C176']
64
+ - [0.05, '#9292C9']
65
+ - [0.15, '#5428B2']
66
+ - [0.27, '#2C105F']
67
+ - [0.40, '#1A0539']
68
+ - [1.0, '#14012C']
69
+
70
+ astronomical_twilight_radial:
71
+ - [0.0, "#00184C"]
72
+ - [0.05, "#001B42"]
73
+ - [0.15, "#000D37"]
74
+ - [0.3, "#00061D"]
75
+ - [1.0, '#000000']
76
+
77
+ true_night_radial:
78
+ - [0.0, '#00002B']
79
+ - [0.1, '#000022']
80
+ - [0.2, '#000018']
81
+ - [1.0, '#000000']
82
+
83
+ pre_dawn_radial:
84
+ - [0.0, '#FEDCAF']
85
+ - [0.025, "#BEB0D0"]
86
+ - [0.05, '#8274C9']
87
+ - [0.1, '#444294']
88
+ - [0.2, '#222164']
89
+ - [0.4, '#000033']
90
+ - [1.0, '#000000']
91
+
92
+ blue_mollweide:
93
+ - [0.0, "#00000F"]
94
+ - [0.15, "#000015"]
95
+ - [0.4, "#070D27"]
96
+ - [0.45, "#0C123B"]
97
+ - [0.5, "#180F55"]
98
+ - [0.55, "#0C123B"]
99
+ - [0.6, "#070D27"]
100
+ - [0.85, "#000015"]
101
+ - [1.0, "#00000F"]
102
+
103
+ purple_mollweide:
104
+ - [0.0, "#00000F"]
105
+ - [0.15, "#000015"]
106
+ - [0.35, "#130013"]
107
+ - [0.4, "#200020"]
108
+ - [0.45, "#270020"]
109
+ - [0.5, "#410034"]
110
+ - [0.55, "#270020"]
111
+ - [0.6, "#200020"]
112
+ - [0.65, "#130013"]
113
+ - [0.85, "#000015"]
114
+ - [1.0, "#00000F"]
115
+
116
+ milky_way_mollweide:
117
+ - [0.0, "#00000f"]
118
+ - [0.25, "#00001f"]
119
+ - [0.4, "#27112C"]
120
+ - [0.45, "#4E2238"]
121
+ - [0.5, "#793A4D"]
122
+ - [0.55, "#4E2238"]
123
+ - [0.6, "#27112C"]
124
+ - [0.75, "#00001f"]
125
+ - [1.0, "#00000f"]
126
+
127
+ dust_lane_mollweide:
128
+ - [0.0, "#000010"]
129
+ - [0.25, "#000020"]
130
+ - [0.4, "#27181B"]
131
+ - [0.45, "#4E3016"]
132
+ - [0.5, "#6E3F0C"]
133
+ - [0.55, "#4E3016"]
134
+ - [0.6, "#27181B"]
135
+ - [0.75, "#000020"]
136
+ - [1.0, "#000010"]
137
+
138
+ gas_cloud_mollweide:
139
+ - [0.0, "#000000"]
140
+ - [0.25, "#000B18"]
141
+ - [0.4, "#04132B"]
142
+ - [0.45, "#0C1B3B"]
143
+ - [0.5, "#0A243D"]
144
+ - [0.55, "#0C1B3B"]
145
+ - [0.6, "#04132B"]
146
+ - [0.75, "#000B18"]
147
+ - [1.0, "#000000"]
148
+
149
+ naked_eye_mollweide:
150
+ - [0.0, "#000010"]
151
+ - [0.25, "#000020"]
152
+ - [0.4, "#1E1522"]
153
+ - [0.45, "#271A15"]
154
+ - [0.5, "#35251A"]
155
+ - [0.55, "#2E1F1A"]
156
+ - [0.6, "#1E1522"]
157
+ - [0.75, "#000020"]
158
+ - [1.0, "#000010"]
@@ -53,7 +53,6 @@ dso_unknown: &DSO
53
53
  color: '#000'
54
54
  alpha: 0.28
55
55
  dso_dark_nebula: *DSO
56
- dso_hii_ionized_region: *DSO
57
56
  dso_supernova_remnant: *DSO
58
57
  dso_nova_star: *DSO
59
58
  dso_nonexistant: *DSO
@@ -104,7 +104,6 @@ dso_unknown: &DSO
104
104
  color: 'hsl(136, 0%, 97%)'
105
105
  alpha: 0.28
106
106
  dso_dark_nebula: *DSO
107
- dso_hii_ionized_region: *DSO
108
107
  dso_supernova_remnant: *DSO
109
108
  dso_nova_star: *DSO
110
109
  dso_nonexistant: *DSO
@@ -94,7 +94,6 @@ dso_unknown: &DSO
94
94
  label:
95
95
  font_color: '#52896e'
96
96
  dso_dark_nebula: *DSO
97
- dso_hii_ionized_region: *DSO
98
97
  dso_supernova_remnant: *DSO
99
98
  dso_nova_star: *DSO
100
99
  dso_nonexistant: *DSO
@@ -23,7 +23,97 @@ BLUE_LIGHT = load("blue_light.yml")
23
23
  BLUE_MEDIUM = load("blue_medium.yml")
24
24
  BLUE_DARK = load("blue_dark.yml")
25
25
  BLUE_GOLD = load("blue_gold.yml")
26
+ BLUE_NIGHT = load("blue_night.yml")
26
27
  ANTIQUE = load("antique.yml")
27
28
  NORD = load("nord.yml")
28
29
  CB_WONG = load("cb_wong.yml")
29
30
  COLOR_PRINT = load("color_print.yml")
31
+
32
+ # Horizon Background Gradient Presets
33
+ GRADIENTS = load("gradient_presets.yml")
34
+
35
+ GRADIENT_BOLD_SUNSET = {
36
+ "background_color": [
37
+ [0.0, "#FFAF36"],
38
+ [0.1, "#F56140"],
39
+ [0.25, "#932885"],
40
+ [0.4, "#591D76"],
41
+ [0.7, "#0B0C40"],
42
+ [1.0, "#000033"],
43
+ ]
44
+ }
45
+
46
+
47
+ GRADIENT_CIVIL_TWILIGHT = {
48
+ "background_color": [
49
+ [0.0, "#F6C9A1"],
50
+ [0.1, "#DCD4BB"],
51
+ [0.3, "#96C6D6"],
52
+ [0.55, "#4199CF"],
53
+ [1.0, "#3A73A1"],
54
+ ]
55
+ }
56
+
57
+ GRADIENT_NAUTICAL_TWILIGHT = {
58
+ "background_color": [
59
+ [0.0, "#F3C176"],
60
+ [0.1, "#9292C9"],
61
+ [0.25, "#4661D6"],
62
+ [0.4, "#5428B2"],
63
+ [0.7, "#2C105F"],
64
+ [1.0, "#14012C"],
65
+ ]
66
+ }
67
+
68
+ GRADIENT_ASTRONOMICAL_TWILIGHT = {
69
+ "background_color": [
70
+ [0.0, "#00184C"],
71
+ [0.1, "#001B42"],
72
+ [0.4, "#000D37"],
73
+ [0.7, "#00061D"],
74
+ [1.0, "#000000"],
75
+ ]
76
+ }
77
+
78
+ GRADIENT_TRUE_NIGHT = {
79
+ "background_color": [
80
+ [0.0, "#00002B"],
81
+ [0.1, "#00002B"],
82
+ [0.3, "#000022"],
83
+ [0.7, "#000018"],
84
+ [1.0, "#000000"],
85
+ ]
86
+ }
87
+
88
+ GRADIENT_PRE_DAWN = {
89
+ "background_color": [
90
+ [0.0, "#FEDCAF"],
91
+ [0.05, "#BEB0D0"],
92
+ [0.15, "#8274C9"],
93
+ [0.3, "#444294"],
94
+ [0.45, "#222164"],
95
+ [0.7, "#000033"],
96
+ [1.0, "#000000"],
97
+ ]
98
+ }
99
+
100
+ GRADIENT_OPTIC_FALLOFF = {
101
+ "background_color": [
102
+ [0.0, "hsl(0, 0%, 0%)"],
103
+ [0.1, "hsl(0, 0%, 8%)"],
104
+ [0.3, "hsl(0, 0%, 12%)"],
105
+ [0.6, "hsl(0, 0%, 14%)"],
106
+ [1.0, "hsl(0, 0%, 20%)"],
107
+ ]
108
+ }
109
+
110
+ # needs work
111
+ GRADIENT_OPTIC_FALL_IN = {
112
+ "background_color": [
113
+ [0.0, "hsl(0, 0%, 50%)"],
114
+ [0.3, "hsl(0, 0%, 25%)"],
115
+ [0.45, "hsl(0, 0%, 20%)"],
116
+ [0.7, "hsl(0, 0%, 10%)"],
117
+ [1.0, "hsl(0, 0%, 0%)"],
118
+ ]
119
+ }
starplot/zenith.py ADDED
@@ -0,0 +1,174 @@
1
+ import numpy as np
2
+ from matplotlib import path, patches
3
+
4
+ from starplot.coordinates import CoordinateSystem
5
+ from starplot.map import MapPlot
6
+ from starplot.observer import Observer
7
+ from starplot.projections import Stereographic
8
+ from starplot.styles import LabelStyle, PlotStyle, PathStyle, GradientDirection
9
+ from starplot.styles.helpers import use_style
10
+
11
+
12
+ DEFAULT_MAP_STYLE = PlotStyle() # .extend(extensions.MAP)
13
+
14
+
15
+ class ZenithPlot(MapPlot):
16
+ """Creates a new zenith plot.
17
+
18
+ Args:
19
+ observer: Observer instance which specifies a time and place
20
+ ephemeris: Ephemeris to use for calculating planet positions (see [Skyfield's documentation](https://rhodesmill.org/skyfield/planets.html) for details)
21
+ style: Styling for the plot (colors, sizes, fonts, etc)
22
+ resolution: Size (in pixels) of largest dimension of the map
23
+ hide_colliding_labels: If True, then labels will not be plotted if they collide with another existing label
24
+ scale: Scaling factor that will be applied to all sizes in styles (e.g. font size, marker size, line widths, etc). For example, if you want to make everything 2x bigger, then set the scale to 2. At `scale=1` and `resolution=4096` (the default), all sizes are optimized visually for a map that covers 1-3 constellations. So, if you're creating a plot of a _larger_ extent, then it'd probably be good to decrease the scale (i.e. make everything smaller) -- and _increase_ the scale if you're plotting a very small area.
25
+ autoscale: If True, then the scale will be set automatically based on resolution.
26
+ suppress_warnings: If True (the default), then all warnings will be suppressed
27
+
28
+ Returns:
29
+ ZenithPlot: A new instance of a ZenithPlot
30
+
31
+ """
32
+
33
+ _coordinate_system = CoordinateSystem.RA_DEC
34
+ _gradient_direction = GradientDirection.RADIAL
35
+
36
+ def __init__(
37
+ self,
38
+ observer: Observer = Observer(),
39
+ ephemeris: str = "de421_2001.bsp",
40
+ style: PlotStyle = DEFAULT_MAP_STYLE,
41
+ resolution: int = 4096,
42
+ hide_colliding_labels: bool = True,
43
+ scale: float = 1.0,
44
+ autoscale: bool = False,
45
+ suppress_warnings: bool = True,
46
+ *args,
47
+ **kwargs,
48
+ ) -> "ZenithPlot":
49
+ projection = Stereographic(
50
+ center_ra=observer.lst,
51
+ center_dec=observer.lat,
52
+ )
53
+
54
+ super().__init__(
55
+ projection,
56
+ 0,
57
+ 360,
58
+ -90,
59
+ 90,
60
+ observer,
61
+ ephemeris,
62
+ style,
63
+ resolution,
64
+ hide_colliding_labels,
65
+ clip_path=None,
66
+ scale=scale,
67
+ autoscale=autoscale,
68
+ suppress_warnings=suppress_warnings,
69
+ *args,
70
+ **kwargs,
71
+ )
72
+
73
+ @use_style(PathStyle, "horizon")
74
+ def horizon(
75
+ self,
76
+ style: PathStyle = None,
77
+ labels: list = ["N", "E", "S", "W"],
78
+ ):
79
+ """
80
+ Draws a [great circle](https://en.wikipedia.org/wiki/Great_circle) representing the horizon for the given `lat`, `lon` at time `dt` (so you must define these when creating the plot to use this function)
81
+
82
+ Args:
83
+ style: Style of the horizon path. If None, then the plot's style definition will be used.
84
+ labels: List of labels for cardinal directions. **NOTE: labels should be in the order: North, East, South, West.**
85
+ """
86
+ if self.observer is None:
87
+ raise ValueError("observer is required for plotting the horizon")
88
+
89
+ """
90
+ For zenith projections, we plot the horizon as a patch to make a more perfect circle
91
+ """
92
+ style_kwargs = style.line.matplot_kwargs(self.scale)
93
+ style_kwargs["clip_on"] = False
94
+ style_kwargs["edgecolor"] = style_kwargs.pop("color")
95
+ patch = patches.Circle(
96
+ (0.50, 0.50),
97
+ radius=0.454,
98
+ facecolor=None,
99
+ fill=False,
100
+ transform=self.ax.transAxes,
101
+ **style_kwargs,
102
+ )
103
+ self.ax.add_patch(patch)
104
+ self._background_clip_path = patch
105
+ self._update_clip_path_polygon(
106
+ buffer=style.line.width / 2 + 2 * style.line.edge_width + 20
107
+ )
108
+
109
+ if not labels:
110
+ return
111
+
112
+ label_ax_coords = [
113
+ (0.5, 0.95), # north
114
+ (0.045, 0.5), # east
115
+ (0.5, 0.045), # south
116
+ (0.954, 0.5), # west
117
+ ]
118
+ for label, coords in zip(labels, label_ax_coords):
119
+ self.ax.annotate(
120
+ label,
121
+ coords,
122
+ xycoords=self.ax.transAxes,
123
+ clip_on=False,
124
+ **style.label.matplot_kwargs(self.scale),
125
+ )
126
+
127
+ def _set_extent(self):
128
+ theta = np.linspace(0, 2 * np.pi, 100)
129
+ center, radius = [0.5, 0.5], 0.45
130
+ verts = np.vstack([np.sin(theta), np.cos(theta)]).T
131
+ circle = path.Path(verts * radius + center)
132
+ extent = self.ax.get_extent(crs=self._proj)
133
+ self.ax.set_extent((p / 3.548 for p in extent), crs=self._proj)
134
+ self.ax.set_boundary(circle, transform=self.ax.transAxes)
135
+
136
+ @use_style(LabelStyle, "info_text")
137
+ def info(self, style: LabelStyle = None):
138
+ """
139
+ Plots info text in the lower left corner, including date/time and lat/lon.
140
+
141
+ Args:
142
+ style: Styling of the info text. If None, then the plot's style definition will be used.
143
+ """
144
+ dt_str = self.dt.strftime("%m/%d/%Y @ %H:%M:%S") + " " + self.dt.tzname()
145
+ info = f"{str(self.observer.lat)}, {str(self.observer.lon)}\n{dt_str}"
146
+ self.ax.text(
147
+ 0.05,
148
+ 0.05,
149
+ info,
150
+ transform=self.ax.transAxes,
151
+ **style.matplot_kwargs(self.scale),
152
+ )
153
+
154
+ def _plot_background_clip_path(self):
155
+ if self.style.has_gradient_background():
156
+ background_color = "#ffffff00"
157
+ self._plot_gradient_background(self.style.background_color)
158
+ else:
159
+ background_color = self.style.background_color.as_hex()
160
+
161
+ self._background_clip_path = patches.Circle(
162
+ (0.50, 0.50),
163
+ radius=0.45,
164
+ fill=True,
165
+ facecolor=background_color,
166
+ # edgecolor=self.style.border_line_color.as_hex(),
167
+ linewidth=0,
168
+ zorder=-2_000,
169
+ transform=self.ax.transAxes,
170
+ )
171
+ self.ax.set_facecolor(background_color)
172
+
173
+ self.ax.add_patch(self._background_clip_path)
174
+ self._update_clip_path_polygon()