Skip to content
This repository has been archived by the owner on Oct 14, 2023. It is now read-only.

Orbits with no label appear in the plot legend. #1629

Open
joebro1907 opened this issue May 25, 2023 · 0 comments
Open

Orbits with no label appear in the plot legend. #1629

joebro1907 opened this issue May 25, 2023 · 0 comments

Comments

@joebro1907
Copy link

joebro1907 commented May 25, 2023

馃悶 Problem

When adding an orbit with no label (label=False) to the plot, the date of the orbit still shows in the legend.

In some cases, having an orbit label-less could be because the orbit needs to be invisible in the plot, but because the date still shows in the legend, it could make the user think there is something "missing", when this is not the case.

This issue is related to #1538.

Example of case with the orbit not needing a label (because it's used as a reference, therefore invisible):

# Call OrbitPlotter and set backend
op = OrbitPlotter(backend=Matplotlib2D(ax=ax, use_dark_theme=True), plane=plane, length_scale_units=u.AU)
# Create "unit" orbit as the reference for plot in polar view
ref_coe = np.array([0, 1, 0, 0, 0, 0])
ref_orb = Orbit.from_classical(Sun, ref_coe[1]*u.AU, ref_coe[0]*u.one, ref_coe[2]*u.deg, ref_coe[3]*u.deg, ref_coe[4]*u.deg,ref_coe[5]*u.deg, epoch, plane)
op.plot(ref_orb, label=False, color="black")
# Create Orbits for the Inner Planets
op.plot_body_orbit(Mercury, epoch, label="Mercury", color='gray', trail=True)
op.plot_body_orbit(Venus, epoch, label="Venus", color='orange', trail=True)
op.plot_body_orbit(Earth, epoch, label="Earth", color='blue', trail=True)
op.plot_body_orbit(Mars, epoch, label="Mars", color='red', trail=True)

Example

馃枼 Please paste the output of following commands

  • pip freeze
# Paste your output here:
aiobotocore==2.5.0
aiohttp==3.8.4
aioitertools==0.11.0
aiosignal==1.3.1
asdf==2.15.0
asdf-standard==1.0.3
asdf-transform-schemas==0.3.0
asdf-unit-schemas==0.1.0
astropy==5.2.2
astroquery==0.4.6
asttokens==2.2.1
async-timeout==4.0.2
attrs==23.1.0
backcall==0.2.0
beautifulsoup4==4.12.2
bleach==6.0.0
botocore==1.29.76
Bottleneck==1.3.7
certifi==2023.5.7
charset-normalizer==3.1.0
click==8.1.3
cloudpickle==2.2.1
colorama==0.4.6
comm==0.1.3
contourpy==1.0.7
cycler==0.11.0
dask==2023.5.0
DateTime==5.1
debugpy==1.6.7
decorator==5.1.1
exceptiongroup==1.1.1
executing==1.2.0
fastjsonschema==2.16.3
fonttools==4.39.4
frozenlist==1.3.3
fsspec==2023.5.0
h5py==3.8.0
html5lib==1.1
idna==3.4
importlib-metadata==6.6.0
iniconfig==2.0.0
ipykernel==6.23.0
ipython==8.13.2
jaraco.classes==3.2.3
jedi==0.18.2
jmespath==1.0.1
jplephem==2.18
jsonschema==4.17.3
jupyter_client==8.2.0
jupyter_core==5.3.0
kaleido==0.2.1
keyring==23.13.1
kiwisolver==1.4.4
llvmlite==0.40.0
locket==1.0.0
lxml==4.9.2
matplotlib==3.7.1
matplotlib-inline==0.1.6
more-itertools==9.1.0
mpmath==1.3.0
multidict==6.0.4
nbformat==5.8.0
nest-asyncio==1.5.6
numba==0.57.0
numpy==1.24.3
packaging==23.1
pandas==2.0.1
parso==0.8.3
partd==1.4.0
pickleshare==0.7.5
Pillow==9.5.0
platformdirs==3.5.1
plotly==5.14.1
pluggy==1.0.0
poliastro @ https://github.com/poliastro/poliastro/archive/main.zip#sha256=c6c13eab5a41336327c11795cb180bca8227113cfec50918048f7d67c1ceb63b
prompt-toolkit==3.0.38
psutil==5.9.5
pure-eval==0.2.2
pyarrow==12.0.0
pyerfa==2.0.0.3
Pygments==2.15.1
pyparsing==3.0.9
pyrsistent==0.19.3
pytest==7.3.1
python-dateutil==2.8.2
pytz==2023.3
pyvo==1.4.1
pywin32==306
pywin32-ctypes==0.2.0
PyYAML==6.0
pyzmq==25.0.2
requests==2.30.0
s3fs==2023.5.0
scipy==1.10.1
semantic-version==2.10.0
six==1.16.0
sortedcontainers==2.4.0
soupsieve==2.4.1
spyder-kernels==2.4.3
stack-data==0.6.2
tenacity==8.2.2
tomli==2.0.1
toolz==0.12.0
tornado==6.3.1
traitlets==5.9.0
typing_extensions==4.5.0
tzdata==2023.3
urllib3==1.26.15
wcwidth==0.2.6
webencodings==0.5.1
wrapt==1.15.0
yarl==1.9.2
zipp==3.15.0
zope.interface==6.0

馃挕 Possible solutions

Similar to issue #1538, as indicated by @astrojuanlu, either OrbitPlotter or the backends should implement a way for whether adding or not the obit to the legend of the plot, by checking if label is Boolean or a string, so if it is False then it won't be added to the legend, and if it is True or a string, it will be added.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant