Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Constellation Labels not being inside the constellation boundaries #99

Open
hemisemidemipresent opened this issue Sep 5, 2024 · 3 comments
Labels
enhancement New feature or request

Comments

@hemisemidemipresent
Copy link

Sometimes, constellation labels will be awkwardly to a side (e.g. Hercules, Scutum, Corona Australis) and in some cases, just completely out of the boundary (e.g. Sagitta)

Also could there be labels for both Serpens (either duplicate Serpens labels or have one for Serpens cauda/caput)

image:

image

code:

from starplot import Star, DSO, MapPlot, Projection
from starplot.styles import PlotStyle, PolygonStyle, extensions

style = PlotStyle().extend(
    extensions.BLUE_LIGHT,
    extensions.MAP,
)
p = MapPlot(
    projection=Projection.MILLER,  # specify a non-perspective projection
    ra_min=14,  # limit the map to a specific area
    ra_max=22,
    dec_min=-45,
    dec_max=65,
    style=style,
    resolution=4000,
    hide_colliding_labels=False
)
p.gridlines() # add gridlines

p.stars(
    where=[Star.magnitude < 6],
    where_labels=[ (Star.magnitude < 3)],
    bayer_labels=True
)

p.constellations()
p.constellation_borders()
p.milky_way()
p.celestial_equator()
p.ecliptic()

p.export("test.png", padding=0.2, transparent=True)

Environment Details:

  • Starplot version: v0.11.4
  • Python version: 3.11.8
  • Matplotlib version: 3.9.2
@steveberardi
Copy link
Owner

This is a known issue with constellation labels, and something I'm continually trying to improve. This one is tough because it's difficult to come up with a good foolproof way to automatically determine the best positions for labels (which can also change depending on how many objects you plot, the styles, etc). It's easier to do this for points (e.g. stars) cause the label has a much smaller range where it makes sense.

In early versions of Starplot, I just put the constellation label at the centroid of the constellation lines, which works well for some constellations but not all.

Anyway, hopefully I stumble upon a good solution soon. Open to any and all ideas!

@steveberardi steveberardi added the enhancement New feature or request label Sep 5, 2024
@hemisemidemipresent
Copy link
Author

How are constellation name labels position determined currently?

@steveberardi
Copy link
Owner

currently, the constellation label positions are hard-coded here -- these positions were originally calculated by finding the centroid of each constellation (can't remember if I did it by stars, or boundary) and then manually fine-tuning a bunch of them where the centroid wasn't a good place to put the label. This actually works pretty well for zenith projections, but not great for others (as you've discovered).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants