steveberardi / starplot

✨ Star charts and maps in Python
https://starplot.dev
MIT License
17 stars 7 forks source link

Map plot adding Stereographic so i can show the milky way and constellation borders #50

Closed bathoorn closed 3 months ago

bathoorn commented 4 months ago

I would like to see the milky way and the constellation borders in the ZenithPlot. Started adding constellation borders but then got to thinking. Maybe i can add Stereograohic projection to the MapPlot and do everything there.

I hacked Stereographic and Orthographic projections into your implementation. And was able to produce these images

stereographic

04_map_stereographic

orthographic

05_map_orthographic

I would like to share the code if you are interested. Right now it is a bit of a mess but i could fork this repo and work on a merge request.

Thanks for the great project i already had a lot of fun with it

bathoorn commented 4 months ago

oh and my hack putting in constellation borders in the Zenith plot. But this does not work as nice as in the above as it does interpolation of points in the lines to force it through the projection.

01_star_chart
steveberardi commented 4 months ago

@bathoorn

Thanks for your feedback and sharing those great looking plots! 😃

I’d love to add support for plotting the Milky Way and constellation borders on ZenithPlots. There’s some shared logic across plot types for plotting polygons which could help with this. Ideally, the same code could be used to plot the Milky Way for all plot types.

I also like the idea of adding support for Orthographic projections to MapPlots. I'd be curious to see your code for this. Hopefully it was as easy as adding Orthographic to the projection enum?

That’d be great if you want to share some of your code through a PR :) I don’t have any formal contributor guide yet, but definitely open to contributions. I'm working on refactoring some of the shared functionality for plots on the v0.9.0 branch, so if you wanna create a branch from there that'd help us avoid conflicts on the PR.

Thanks again!

Steve

bathoorn commented 4 months ago

i created a merge request for adding constellation boundaries to ZenithPlot

You can test it through running example_01.py

It should produce this

01_star_chart
steveberardi commented 4 months ago

thanks! I'll review the PRs sometime this weekend :) One thing I noticed in your example above though is that not all constellation lines are dashed. I'm guessing cause the data file has overlapping borders. I ran into a similar problem when trying to refactor the constellation border plotting, and used shapely's unary_union to merge the lines

bathoorn commented 4 months ago

Hi Steve,

Indeed this is because i interpolate and send all the points to the projection. And there a lot of short line segments interfere with the dashes. But it should also be possible to draw lines in ra dec space and then project to something else. I think that is what happens in the ZENITH type i added to the MapPlot projections. Because there it looks ok.

On Fri, Feb 9, 2024 at 3:33 PM Steve Berardi @.***> wrote:

thanks! I'll review the PRs sometime this weekend :) One thing I noticed in your example above though is that not all constellation lines are dashed. I'm guessing cause the data file has overlapping borders. I ran into a similar problem when trying to refactor the constellation border plotting, and used shapely's unary_union https://github.com/steveberardi/starplot/blob/8dc4a8a106041c59447b4d81ceffdae5060bc99d/src/starplot/map.py#L395 to merge the lines

— Reply to this email directly, view it on GitHub https://github.com/steveberardi/starplot/issues/50#issuecomment-1936040232, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAFZWJYFJYFWH24WZQWXLTLYSYXSJAVCNFSM6AAAAABC7NJEBSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSMZWGA2DAMRTGI . You are receiving this because you were mentioned.Message ID: @.***>

bathoorn commented 4 months ago

I also ran example_08 09 and 10

ORTHGRAPHIC

08_orthographic

STEREOGRAPHIC

09_stereographic

ZENITH

10_zenith
steveberardi commented 4 months ago

@bathoorn I'm getting ready to release the next version of starplot, 0.9.0, and I have your projection contributions in the open PR for it -- thanks so much again for helping with this!

In the new version, I also made some changes to how you plot things and what's visible -- mainly, I removed the visible style property and now instead you control what's plotted by explicitly calling functions on the plot instance like p.stars(mag=12) -- I feel like this gives you a lot more control for plotting different things in different ways, and it's more consistent with other plotting frameworks (i.e. you start with an empty plot). Anyway, I'd greatly appreciate any thoughts or concerns you have about the changes in the v0.9.0 PR - thanks!!