starplot 0.10.2__py2.py3-none-any.whl → 0.11.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.
starplot/styles/base.py CHANGED
@@ -2,12 +2,14 @@ import json
2
2
  from enum import Enum
3
3
  from pathlib import Path
4
4
  from typing import Optional
5
+ from functools import cache
5
6
 
6
7
  import yaml
7
8
 
8
9
  from pydantic import BaseModel
9
10
  from pydantic.color import Color
10
11
  from pydantic.functional_serializers import PlainSerializer
12
+ from matplotlib import patheffects
11
13
  from typing_extensions import Annotated
12
14
 
13
15
  from starplot.data.dsos import DsoType
@@ -27,6 +29,8 @@ HERE = Path(__file__).resolve().parent
27
29
 
28
30
 
29
31
  class BaseStyle(BaseModel):
32
+ __hash__ = object.__hash__
33
+
30
34
  class Config:
31
35
  use_enum_values = True
32
36
  extra = "forbid"
@@ -77,6 +81,9 @@ class MarkerSymbolEnum(str, Enum):
77
81
  POINT = "point"
78
82
  """\u00B7"""
79
83
 
84
+ PLUS = "plus"
85
+ """+"""
86
+
80
87
  CIRCLE = "circle"
81
88
  """\u25CF"""
82
89
 
@@ -113,6 +120,9 @@ class MarkerSymbolEnum(str, Enum):
113
120
  COMET = "comet"
114
121
  """\u2604"""
115
122
 
123
+ STAR_4 = "star_4"
124
+ """\u2726"""
125
+
116
126
  STAR_8 = "star_8"
117
127
  """\u2734"""
118
128
 
@@ -122,6 +132,7 @@ class MarkerSymbolEnum(str, Enum):
122
132
  MarkerSymbolEnum.POINT: ".",
123
133
  MarkerSymbolEnum.CIRCLE: "o",
124
134
  MarkerSymbolEnum.SQUARE: "s",
135
+ MarkerSymbolEnum.PLUS: "P",
125
136
  MarkerSymbolEnum.SQUARE_STRIPES_DIAGONAL: "$\u25A8$",
126
137
  MarkerSymbolEnum.STAR: "*",
127
138
  MarkerSymbolEnum.SUN: "$\u263C$",
@@ -132,7 +143,7 @@ class MarkerSymbolEnum(str, Enum):
132
143
  MarkerSymbolEnum.CIRCLE_DOTTED_EDGE: "$\u25CC$",
133
144
  MarkerSymbolEnum.COMET: "$\u2604$",
134
145
  MarkerSymbolEnum.STAR_8: "$\u2734$",
135
- }.get(self.value)
146
+ }[self.value]
136
147
 
137
148
 
138
149
  class LineStyleEnum(str, Enum):
@@ -164,6 +175,7 @@ class LegendLocationEnum(str, Enum):
164
175
  class AnchorPointEnum(str, Enum):
165
176
  """Options for the anchor point of labels"""
166
177
 
178
+ CENTER = "center"
167
179
  TOP_LEFT = "top left"
168
180
  TOP_RIGHT = "top right"
169
181
  TOP_CENTER = "top center"
@@ -192,6 +204,9 @@ class AnchorPointEnum(str, Enum):
192
204
  elif self.value == AnchorPointEnum.TOP_CENTER:
193
205
  style["va"] = "bottom"
194
206
  style["ha"] = "center"
207
+ elif self.value == AnchorPointEnum.CENTER:
208
+ style["va"] = "center"
209
+ style["ha"] = "center"
195
210
 
196
211
  return style
197
212
 
@@ -239,6 +254,7 @@ class MarkerStyle(BaseStyle):
239
254
  def symbol_matplot(self) -> str:
240
255
  return MarkerSymbolEnum(self.symbol).as_matplot()
241
256
 
257
+ @cache
242
258
  def matplot_kwargs(self, size_multiplier: float = 1.0) -> dict:
243
259
  return dict(
244
260
  color=self.color.as_hex() if self.color else "none",
@@ -294,15 +310,33 @@ class LineStyle(BaseStyle):
294
310
  zorder: int = -1
295
311
  """Zorder of the line"""
296
312
 
313
+ edge_width: int = 0
314
+ """Width of the line's edge. _If the width or color is falsey then the line will NOT be drawn with an edge._"""
315
+
316
+ edge_color: Optional[ColorStr] = None
317
+ """Edge color of the line. _If the width or color is falsey then the line will NOT be drawn with an edge._"""
318
+
319
+ @cache
297
320
  def matplot_kwargs(self, size_multiplier: float = 1.0) -> dict:
321
+ line_width = self.width * size_multiplier
322
+
298
323
  result = dict(
299
324
  color=self.color.as_hex(),
300
325
  linestyle=self.style,
301
- linewidth=self.width * size_multiplier,
326
+ linewidth=line_width,
302
327
  # dash_capstyle=self.dash_capstyle,
303
328
  alpha=self.alpha,
304
329
  zorder=self.zorder,
305
330
  )
331
+
332
+ if self.edge_width and self.edge_color:
333
+ result["path_effects"] = [
334
+ patheffects.withStroke(
335
+ linewidth=line_width + 2 * self.edge_width * size_multiplier,
336
+ foreground=self.edge_color.as_hex(),
337
+ )
338
+ ]
339
+
306
340
  return result
307
341
 
308
342
 
@@ -516,7 +550,7 @@ class PlotStyle(BaseStyle):
516
550
 
517
551
  figure_background_color: ColorStr = ColorStr("#fff")
518
552
 
519
- text_border_width: int = 2
553
+ text_border_width: int = 3
520
554
  text_offset_x: float = 0.005
521
555
  text_offset_y: float = 0.005
522
556
 
@@ -549,7 +583,7 @@ class PlotStyle(BaseStyle):
549
583
 
550
584
  # Stars
551
585
  star: ObjectStyle = ObjectStyle(
552
- marker=MarkerStyle(fill=FillStyleEnum.FULL, zorder=1, size=20, edge_color=None),
586
+ marker=MarkerStyle(fill=FillStyleEnum.FULL, zorder=1, size=36, edge_color=None),
553
587
  label=LabelStyle(font_size=9, font_weight=FontWeightEnum.BOLD, zorder=400),
554
588
  )
555
589
  """Styling for stars *(see [`ObjectStyle`][starplot.styles.ObjectStyle])*"""
@@ -834,6 +868,39 @@ class PlotStyle(BaseStyle):
834
868
  )
835
869
  """Styling for the Celestial Equator"""
836
870
 
871
+ horizon: PathStyle = PathStyle(
872
+ line=LineStyle(
873
+ color="#fff",
874
+ width=64,
875
+ edge_width=4,
876
+ edge_color="#000",
877
+ style=LineStyleEnum.SOLID,
878
+ dash_capstyle=DashCapStyleEnum.BUTT,
879
+ alpha=1,
880
+ zorder=2000,
881
+ ),
882
+ label=LabelStyle(
883
+ anchor_point=AnchorPointEnum.CENTER,
884
+ font_color="#000",
885
+ font_size=23,
886
+ font_weight=FontWeightEnum.BOLD,
887
+ zorder=2000,
888
+ ),
889
+ )
890
+ """Styling for the horizon"""
891
+
892
+ zenith: ObjectStyle = ObjectStyle(
893
+ marker=MarkerStyle(
894
+ symbol=MarkerSymbolEnum.TRIANGLE,
895
+ size=24,
896
+ fill=FillStyleEnum.FULL,
897
+ color="#000",
898
+ alpha=0.8,
899
+ ),
900
+ label=LabelStyle(font_size=14, font_weight=FontWeightEnum.BOLD),
901
+ )
902
+ """Styling for the zenith marker"""
903
+
837
904
  def get_dso_style(self, dso_type: DsoType):
838
905
  """Returns the style for a DSO type"""
839
906
  styles_by_type = {
@@ -8,9 +8,24 @@
8
8
 
9
9
  background_color: hsl(48, 80%, 96%)
10
10
  figure_background_color: hsl(60, 9%, 29%)
11
+
11
12
  border_bg_color: hsl(60, 3%, 32%)
12
13
  border_font_color: hsl(60, 20%, 93%)
13
14
  border_line_color: hsl(60, 20%, 53%)
15
+
16
+ horizon:
17
+ line:
18
+ color: hsl(60, 3%, 32%)
19
+ edge_color: hsl(60, 20%, 53%)
20
+ label:
21
+ font_color: hsl(60, 20%, 93%)
22
+
23
+ zenith:
24
+ marker:
25
+ color: hsl(26, 93%, 82%)
26
+ label:
27
+ font_color: hsl(26, 93%, 82%)
28
+
14
29
  title:
15
30
  font_color: hsl(60, 20%, 93%)
16
31
  bayer_labels:
@@ -62,6 +77,7 @@ gridlines:
62
77
  star:
63
78
  marker:
64
79
  color: hsl(60, 12%, 32%)
80
+ edge_color: hsl(48, 80%, 96%)
65
81
  label:
66
82
  font_color: hsl(60, 3%, 42%)
67
83
  planets:
@@ -1,8 +1,23 @@
1
1
  background_color: hsl(209, 50%, 24%)
2
2
  figure_background_color: hsl(209, 43%, 15%)
3
+
3
4
  border_bg_color: hsl(209, 50%, 20%)
4
5
  border_font_color: hsl(209, 56%, 86%)
5
6
  border_line_color: hsl(209, 38%, 50%)
7
+
8
+ horizon:
9
+ line:
10
+ color: hsl(209, 50%, 20%)
11
+ edge_color: hsl(209, 38%, 50%)
12
+ label:
13
+ font_color: hsl(209, 56%, 86%)
14
+
15
+ zenith:
16
+ marker:
17
+ color: hsl(209, 20%, 75%)
18
+ label:
19
+ font_color: hsl(209, 20%, 75%)
20
+
6
21
  title:
7
22
  font_color: hsl(209, 56%, 86%)
8
23
  bayer_labels:
@@ -119,7 +134,7 @@ star:
119
134
  font_weight: bold
120
135
  marker:
121
136
  color: hsl(209, 50%, 94%)
122
- size: 25
137
+ edge_color: hsl(209, 50%, 24%)
123
138
  sun:
124
139
  label:
125
140
  font_color: hsl(209, 23%, 80%)
@@ -1,9 +1,27 @@
1
1
  background_color: '#fff'
2
+
2
3
  border_bg_color: '#b5cbe3'
3
4
  border_font_color: '#2f4358'
4
5
  border_line_color: '#2f4358'
6
+
7
+ horizon:
8
+ line:
9
+ color: '#b5cbe3'
10
+ edge_color: '#2f4358'
11
+ label:
12
+ font_color: '#2f4358'
13
+
14
+ zenith:
15
+ marker:
16
+ color: hsl(18, 68%, 75%)
17
+ label:
18
+ font_color: hsl(18, 68%, 75%)
19
+
5
20
  title:
6
21
  font_color: '#2f4358'
22
+ star:
23
+ marker:
24
+ edge_color: '#fff'
7
25
  celestial_equator:
8
26
  label:
9
27
  font_color: '#2d5ec2'
@@ -1,10 +1,15 @@
1
1
  background_color: '#f1f6ff'
2
2
  figure_background_color: '#fff'
3
+
3
4
  border_bg_color: '#7997b9'
4
5
  border_font_color: '#f1f6ff'
5
6
  border_line_color: '#2f4358'
7
+
6
8
  title:
7
9
  font_color: '#f1f6ff'
10
+ star:
11
+ marker:
12
+ edge_color: '#f1f6ff'
8
13
  bayer_labels:
9
14
  font_alpha: 0.8
10
15
  font_color: '#000'
@@ -53,6 +58,19 @@ sun:
53
58
  color: '#ffd22e'
54
59
  edge_color: 'hsl(47, 100%, 29%)'
55
60
 
61
+ horizon:
62
+ line:
63
+ color: '#7997b9'
64
+ edge_color: '#2f4358'
65
+ label:
66
+ font_color: '#f1f6ff'
67
+
68
+ zenith:
69
+ marker:
70
+ color: '#b979b7'
71
+ label:
72
+ font_color: '#b979b7'
73
+
56
74
  # DSOs
57
75
  dso_double_star:
58
76
  marker:
@@ -3,11 +3,30 @@
3
3
  # via https://davidmathlogic.com/colorblind
4
4
 
5
5
  background_color: '#fff'
6
+
6
7
  border_bg_color: '#fff'
7
8
  border_font_color: hsl(0, 0%, 0%)
8
9
  border_line_color: hsl(0, 0%, 0%)
10
+
11
+ horizon:
12
+ line:
13
+ color: hsl(0, 0%, 96%)
14
+ edge_color: hsl(0, 0%, 0%)
15
+ label:
16
+ font_color: hsl(0, 0%, 0%)
17
+
18
+ zenith:
19
+ marker:
20
+ alpha: 1.0
21
+ color: hsl(26, 100%, 42%)
22
+ label:
23
+ font_color: hsl(26, 100%, 42%)
24
+
9
25
  title:
10
26
  font_color: '#2f4358'
27
+ star:
28
+ marker:
29
+ edge_color: '#fff'
11
30
  celestial_equator:
12
31
  label:
13
32
  font_color: hsl(202, 100%, 35%)
@@ -17,7 +36,7 @@ constellation:
17
36
  label:
18
37
  font_color: '#c5c5c5'
19
38
  line:
20
- alpha: 0.35
39
+ alpha: 0.346
21
40
  color: hsl(202, 100%, 35%)
22
41
  width: 2
23
42
  dso_double_star:
@@ -0,0 +1,108 @@
1
+ background_color: '#fff'
2
+ # figure_background_color: hsl(211, 26%, 24%)
3
+ figure_background_color: '#fff'
4
+ border_bg_color: '#fff'
5
+ border_font_color: '#000'
6
+ border_line_color: '#fff'
7
+ title:
8
+ font_color: '#000'
9
+ star:
10
+ marker:
11
+ edge_color: '#fff'
12
+ bayer_labels:
13
+ font_alpha: 0.8
14
+ font_color: '#000'
15
+ celestial_equator:
16
+ label:
17
+ font_color: '#2b89ed'
18
+ line:
19
+ color: '#2b89ed'
20
+ alpha: 0.6
21
+ constellation:
22
+ label:
23
+ font_size: 4
24
+ font_weight: light
25
+ font_color: '#8c8c8c'
26
+ font_alpha: 0.1
27
+ line:
28
+ alpha: 0.2
29
+ color: '#2b89ed'
30
+ width: 2
31
+ ecliptic:
32
+ label:
33
+ font_color: '#d11925'
34
+ line:
35
+ color: '#d11925'
36
+ alpha: 0.6
37
+ planets:
38
+ marker:
39
+ alpha: 0.4
40
+ color: '#f89d00'
41
+ fill: full
42
+ milky_way:
43
+ alpha: 0.1
44
+ color: '#2b89ed'
45
+ edge_width: 0
46
+ gridlines:
47
+ label:
48
+ font_alpha: 1
49
+ font_color: hsl(211, 80%, 97%)
50
+ font_size: 18
51
+ font_weight: light
52
+ line:
53
+ alpha: 0.4
54
+ color: '#888'
55
+ style: solid
56
+ width: 1
57
+ sun:
58
+ marker:
59
+ color: '#ffd22e'
60
+ edge_color: 'hsl(47, 100%, 29%)'
61
+
62
+ horizon:
63
+ line:
64
+ color: '#7997b9'
65
+ edge_color: '#2f4358'
66
+ edge_width: 8
67
+ label:
68
+ font_color: '#f1f6ff'
69
+
70
+ zenith:
71
+ marker:
72
+ color: 'red'
73
+
74
+ # DSOs
75
+ dso_double_star:
76
+ marker:
77
+ alpha: 0.6
78
+
79
+ dso_galaxy:
80
+ marker:
81
+ alpha: 0.3
82
+ color: '#d11925'
83
+ edge_color: '#d11925'
84
+
85
+ dso_nebula:
86
+ marker:
87
+ alpha: 0.5
88
+ # color: hsl(91, 62%, 82%)
89
+ color: '#2b89ed'
90
+ edge_color: hsl(211, 84%, 20%)
91
+ dso_open_cluster:
92
+ marker:
93
+ alpha: 0.6
94
+ color: '#2b89ed'
95
+ symbol: circle_dotted_edge
96
+ dso_association_stars:
97
+ marker:
98
+ alpha: 0.6
99
+ color: '#2b89ed'
100
+ symbol: circle_dotted_edge
101
+ dso_globular_cluster:
102
+ marker:
103
+ alpha: 0.8
104
+ color: '#2b89ed'
105
+ edge_color: '#444'
106
+
107
+ legend:
108
+ background_color: '#f1f6ff'
@@ -1,7 +1,9 @@
1
1
  background_color: '#fff'
2
+
2
3
  border_bg_color: '#fff'
3
4
  border_font_color: '#000'
4
5
  border_line_color: '#000'
6
+
5
7
  title:
6
8
  font_color: '#000'
7
9
  celestial_equator:
@@ -12,6 +14,9 @@ celestial_equator:
12
14
  constellation:
13
15
  line:
14
16
  color: '#c8c8c8'
17
+ star:
18
+ marker:
19
+ edge_color: '#fff'
15
20
  dso_double_star:
16
21
  marker:
17
22
  color: '#000'
@@ -51,3 +56,16 @@ sun:
51
56
 
52
57
  legend:
53
58
  background_color: '#fff'
59
+
60
+ horizon:
61
+ line:
62
+ color: 'white'
63
+ edge_color: 'black'
64
+ label:
65
+ font_color: 'black'
66
+
67
+ zenith:
68
+ marker:
69
+ color: black
70
+ label:
71
+ font_color: black
@@ -1,20 +1,36 @@
1
1
  background_color: hsl(136, 0%, 10%)
2
2
  figure_background_color: hsl(136, 0%, 100%)
3
+
3
4
  border_bg_color: hsl(136, 0%, 20%)
4
- border_font_color: hsl(136, 0%, 0%)
5
- border_line_color: hsl(136, 0%, 97%)
5
+ border_font_color: hsl(136, 0%, 90%)
6
+ border_line_color: hsl(136, 0%, 54%)
7
+
8
+ horizon:
9
+ line:
10
+ color: hsl(136, 0%, 20%)
11
+ edge_color: hsl(136, 0%, 54%)
12
+ label:
13
+ font_color: hsl(136, 0%, 90%)
14
+
15
+ zenith:
16
+ marker:
17
+ color: hsl(136, 0%, 90%)
18
+ label:
19
+ font_color: hsl(136, 0%, 90%)
20
+
6
21
  title:
7
22
  font_color: hsl(136, 0%, 0%)
8
23
  info_text:
9
24
  font_color: hsl(136, 0%, 0%)
10
25
  star:
11
26
  label:
12
- font_color: hsl(136, 0%, 97%)
27
+ font_color: hsl(136, 0%, 90%)
13
28
  marker:
14
29
  color: hsl(136, 0%, 97%)
30
+ edge_color: hsl(136, 0%, 10%)
15
31
  sun:
16
32
  label:
17
- font_color: hsl(136, 0%, 97%)
33
+ font_color: hsl(136, 0%, 90%)
18
34
  marker:
19
35
  color: hsl(136, 0%, 97%)
20
36
  edge_color: hsl(136, 0%, 97%)
@@ -1,10 +1,22 @@
1
1
  background_color: '#4c566a'
2
- bayer_labels:
3
- font_alpha: 0.8
4
- font_color: '#85c9de'
2
+
5
3
  border_bg_color: '#2e3440'
6
4
  border_font_color: '#a3be8c'
7
5
  border_line_color: '#a3be8c'
6
+
7
+ horizon:
8
+ line:
9
+ color: '#2e3440'
10
+ edge_color: '#a3be8c'
11
+ label:
12
+ font_color: '#a3be8c'
13
+
14
+ zenith:
15
+ marker:
16
+ color: '#D99CBA'
17
+ label:
18
+ font_color: '#D99CBA'
19
+
8
20
  title:
9
21
  font_color: '#a3be8c'
10
22
  celestial_equator:
@@ -94,6 +106,7 @@ star:
94
106
  font_weight: bold
95
107
  marker:
96
108
  color: '#88c0d0'
109
+ edge_color: '#4c566a'
97
110
  sun:
98
111
  label:
99
112
  font_color: '#88c0d0'
@@ -109,7 +122,11 @@ moon:
109
122
  font_weight: bold
110
123
  marker:
111
124
  color: '#88c0d0'
112
-
125
+
126
+ bayer_labels:
127
+ font_alpha: 0.8
128
+ font_color: '#85c9de'
129
+
113
130
  legend:
114
131
  background_color: '#515e76'
115
132
  background_alpha: 1.0
@@ -2,7 +2,7 @@ star:
2
2
  label:
3
3
  font_size: 15
4
4
  marker:
5
- size: 16
5
+ size: 30
6
6
  bayer_labels:
7
7
  font_size: 15
8
8
  planets:
@@ -25,3 +25,4 @@ BLUE_DARK = load("blue_dark.yml")
25
25
  ANTIQUE = load("antique.yml")
26
26
  NORD = load("nord.yml")
27
27
  CB_WONG = load("cb_wong.yml")
28
+ COLOR_PRINT = load("color_print.yml")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: starplot
3
- Version: 0.10.2
3
+ Version: 0.11.1
4
4
  Summary: Star charts and maps
5
5
  Keywords: astronomy,stars,charts,maps,constellations
6
6
  Author-email: Steve Berardi <hello@steveberardi.com>
@@ -43,7 +43,7 @@ Project-URL: Source, https://github.com/steveberardi/starplot
43
43
  - 🔭 **Optic Plots** - simulates what you'll see through an optic (e.g. binoculars, telescope) from a time/location
44
44
  - 🪐 **Planets and Deep Sky Objects (DSOs)**
45
45
  - 🎨 **Custom Styles** - for all objects
46
- - 📥 **Export** - png, svg
46
+ - 📥 **Export** - png, svg, jpeg
47
47
  - 🧭 **Label Collision Avoidance**
48
48
 
49
49
  ## Examples
@@ -97,7 +97,11 @@ For a demo of Starplot's zenith plots, check out:
97
97
 
98
98
  Chat with other starplotters on our Discord server:
99
99
 
100
- https://discord.gg/bwazdyD7
100
+ https://discord.gg/WewJJjshFu
101
+
102
+ ## Contributing
103
+
104
+ Contributing to Starplot is welcome and very much appreciated! Please see [here](CONTRIBUTING.md) for details.
101
105
 
102
106
  ## Core Dependencies
103
107