Skip to content

Commit 7d3899f

Browse files
authored
v0.4.0 (#33)
* initial * legend styling * legend locations * objects in legend * comment * comment * fix zorder * store hash instead of image * keep dir * add moon * tick marks * tick style * python311 * use python 3.11 * update hashes * add legend style to docs * space * remove shapely step * better positioning of ecliptic labels * plot star labels in order of mag * lint * specify units * not needed * update examples * add legend style * update hash * version * clarify * doc string * doc string * typo
1 parent 3517cb5 commit 7d3899f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+455
-150
lines changed

.github/workflows/release.yml

-3
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,6 @@ jobs:
1010
runs-on: ubuntu-22.04
1111
steps:
1212
- uses: actions/checkout@v3
13-
- uses: actions/setup-python@v4
14-
with:
15-
python-version: '3.9'
1613
- name: Build Docker image - dev
1714
run: make docker-dev
1815
- name: Check Lint

.github/workflows/test.yml

-3
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,6 @@ jobs:
1212
runs-on: ubuntu-22.04
1313
steps:
1414
- uses: actions/checkout@v3
15-
- uses: actions/setup-python@v4
16-
with:
17-
python-version: '3.9'
1815
- name: Build Docker image - dev
1916
run: make docker-dev
2017
- name: Check Lint

Dockerfile

+14-6
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,9 @@
1-
FROM python:3.10.12-bookworm as base
1+
FROM python:3.11.4-bookworm as base
22

33
WORKDIR /starplot
44

55
RUN apt-get update -y && apt-get install -y libgeos-dev libgdal-dev
66

7-
# Install shapely from source to avoid cartopy segfault
8-
# https://stackoverflow.com/questions/52374356/
9-
RUN pip install --no-binary :all: shapely==2.0.1
10-
117
# Install fonts
128
# not required, but make the maps look better (especially greek letters)
139
RUN mkdir -p /usr/share/fonts/truetype
@@ -16,7 +12,19 @@ RUN install -m644 /tmp/fonts/*.ttf /usr/share/fonts/truetype/
1612
RUN fc-cache -f
1713

1814
# ---------------------------------------------------------------------
19-
FROM sberardi/starplot-base as dev
15+
FROM python:3.10.12-bookworm as base310
16+
17+
WORKDIR /starplot
18+
19+
RUN apt-get update -y && apt-get install -y libgeos-dev libgdal-dev
20+
21+
# MAYBE REQUIRED for Python 3.10.x? TODO: investigate more
22+
# Install shapely from source to avoid cartopy segfault
23+
# https://stackoverflow.com/questions/52374356/
24+
RUN pip install --no-binary :all: shapely==2.0.1
25+
26+
# ---------------------------------------------------------------------
27+
FROM base as dev
2028

2129
WORKDIR /starplot
2230

README.md

+1-4
Original file line numberDiff line numberDiff line change
@@ -58,10 +58,7 @@ p.export("starchart.png")
5858
- adjustText
5959

6060
## Coming Soon
61-
62-
- ⭐ Tycho stars
63-
- 🌖 Moon
64-
- 📋 Map legends
61+
- ⭐ Custom markers
6562
- 🔭 Scope plots - that will simulate what you'll see through a telescope eyepiece
6663
- ⚖️ Better auto font-size adjustment
6764
- ☄️ Better label collision detection and handling

docs/examples.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ To create a star chart for the sky as seen from [Palomar Mountain](https://en.wi
1313
{% include 'examples/example_1.py' %}
1414
```
1515

16-
The created file should look something like this:
16+
The created file should look like this:
1717

1818
![starchart-blue](images/example_1.png)
1919

@@ -31,13 +31,13 @@ Building on the first example, you can also plot additional objects and even cus
3131

3232
## Map of Orion
3333

34-
The following code will create a simple map plot that shows the area around the constellation Orion, including an extra marker for M42 - The Great Orion Nebula:
34+
The following code will create a simple map plot that shows the area around the constellation Orion, including a legend and an extra marker for M42 - The Great Orion Nebula:
3535

3636
```python
3737
{% include 'examples/example_3.py' %}
3838
```
3939

40-
The result should look something like this:
40+
The result should look like this:
4141

4242
![map-orion](images/example_3.png)
4343

docs/images/example_1.png

358 Bytes
Loading

docs/images/example_2.png

215 Bytes
Loading

docs/images/example_3.png

132 KB
Loading

docs/installation.md

+14-21
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,9 @@
11
Starplot is available on [PyPI](https://pypi.org/project/starplot/), but it's basically just a thin layer on top of Matplotlib, Skyfield, Cartopy, and others. So, before installing Starplot you'll need a few dependencies. Below are instructions for installing on macOS and Linux.
22

3-
!!! tip "Docker Base Image Available"
4-
5-
Installing the base dependencies for Starplot can take awhile (10+ minutes), so I've created a base Docker image that has some of these dependencies compiled already which saves a lot of time. The image is available on [Docker Hub](https://hub.docker.com/r/sberardi/starplot-base).
6-
73
## Required Dependencies
84

95
- GEOS
106
- GDAL
11-
- Shapely
127

138
## macOS
149

@@ -17,13 +12,7 @@ Starplot is available on [PyPI](https://pypi.org/project/starplot/), but it's ba
1712
brew install geos gdal
1813
```
1914

20-
2. **Install Shapely:**
21-
```
22-
pip install --no-binary :all: shapely
23-
```
24-
*Warning: this step may take awhile (5+ minutes), because it builds shapely from source.*
25-
26-
3. **Install Starplot:**
15+
2. **Install Starplot:**
2716
```
2817
pip install starplot
2918
```
@@ -35,19 +24,23 @@ pip install starplot
3524
apt-get install libgeos-dev libgdal-dev
3625
```
3726

38-
2. **Install Shapely:**
39-
```
40-
pip install --no-binary :all: shapely
41-
```
42-
*Warning: this step may take awhile (5+ minutes), because it builds shapely from source.*
43-
44-
3. **Install Starplot:**
27+
2. **Install Starplot:**
4528
```
4629
pip install starplot
4730
```
4831

49-
---
50-
5132
!!! note "What about Windows?"
5233

5334
I haven't tried installing Starplot on Windows, but if you have and would like to share instructions, please feel free to [open a pull request on GitHub](https://github.com/steveberardi/starplot) with an update to this file (`docs/installation.md`). Thanks! :)
35+
36+
---
37+
38+
## Troubleshooting
39+
40+
### Segmentation Fault with map plots
41+
42+
If you're seeing "segmentation fault" errors when creating map plots, you may have to install [shapely](https://shapely.readthedocs.io/en/stable/index.html) from source for your runtime environment:
43+
```
44+
pip install --no-binary :all: shapely
45+
```
46+
*Warning: this may take awhile (5+ minutes), because it builds shapely from source.*

docs/reference-styling.md

+13
Original file line numberDiff line numberDiff line change
@@ -190,11 +190,13 @@ Starplot has a bunch of built-in style extensions (all imported from `starplot.s
190190
show_root_heading: true
191191
show_docstring_attributes: true
192192

193+
193194
::: starplot.styles.PolygonStyle
194195
options:
195196
show_root_heading: true
196197
show_docstring_attributes: true
197198

199+
198200
::: starplot.styles.LabelStyle
199201
options:
200202
show_root_heading: true
@@ -213,6 +215,11 @@ Starplot has a bunch of built-in style extensions (all imported from `starplot.s
213215
show_root_heading: true
214216
show_docstring_attributes: true
215217

218+
::: starplot.styles.LegendStyle
219+
options:
220+
show_root_heading: true
221+
show_docstring_attributes: true
222+
216223

217224
---
218225
::: starplot.styles.FillStyleEnum
@@ -245,6 +252,12 @@ Starplot has a bunch of built-in style extensions (all imported from `starplot.s
245252
show_docstring_attributes: true
246253
members: true
247254

255+
::: starplot.styles.LegendLocationEnum
256+
options:
257+
show_root_heading: true
258+
show_docstring_attributes: true
259+
members: true
260+
248261
---
249262

250263
## Style Extensions

docs/roadmap.md

+4-6
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
11

22
<!-- Here are some planned features coming soon to Starplot: -->
33

4-
-**Tycho stars**
5-
- 🌖 **Moon**
6-
- 📋 **Map legends**
7-
- ⚖️ **Better auto font-size adjustment**
8-
- ☄️ **Better label collision detection and handling**
9-
- 🔭 **Scope plots** - that will simulate what you'll see through a telescope eyepiece
4+
- ⭐ Custom markers
5+
- 🔭 Scope plots - that will simulate what you'll see through a telescope eyepiece
6+
- ⚖️ Better auto font-size adjustment
7+
- ☄️ Better label collision detection and handling
108

119
✨ Clear Skies! ✨

examples/01_star_chart.png

358 Bytes
Loading

examples/02_star_chart_extra.png

215 Bytes
Loading

examples/03_map_orion.png

132 KB
Loading

examples/example_3.py

+5
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,11 @@
1010
"font_size": 7,
1111
"font_alpha": 0.9,
1212
},
13+
"legend": {
14+
"location": "lower right", # show legend inside map
15+
"num_columns": 1,
16+
"background_alpha": 1,
17+
},
1318
},
1419
)
1520
style.star.label.font_size = 11

pyproject.toml

+1
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ dependencies = [
2222
"numpy >= 1.22.1",
2323
"pandas >= 1.4.0",
2424
"pydantic >= 2.0.3",
25+
"shapely >= 2.0.1",
2526
"skyfield >= 1.41",
2627
"adjustText >= 0.8",
2728
"cartopy >= 0.21.1",

requirements.txt

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ matplotlib==3.7.2
22
numpy==1.25.2
33
pandas==2.0.3
44
pydantic==2.0.3
5+
shapely==2.0.1
56
skyfield==1.46
67
adjustText==0.8
78
cartopy==0.22.0

0 commit comments

Comments
 (0)