Open HealthyPear opened 1 year ago
I want to make a simple plot that shows the evolution of altitude with time for different declinations
The working code snippet without labels is the following,
fig, ax = plt.subplots() for dec in range(-90,90,10): test_source = SkyCoord(dec=dec, ra=22,unit="deg",frame="icrs") time_range = Time([f"2023-01-01 00:00", f"2023-01-01 23:59"]) time_resolution = 1 * u.h observe_time = time_grid_from_range(time_range, time_resolution=time_resolution) plot_options = {#"label":dec, "fmt":"-" } plot_altitude(test_source, observer, observe_time, ax=ax, airmass_yaxis=True, style_kwargs=plot_options )
As soon as I uncomment the "label" option which I naïvely thought would work I get the following error,
--------------------------------------------------------------------------- TypeError Traceback (most recent call last) Cell In[132], line 15 9 observe_time = time_grid_from_range(time_range, time_resolution=time_resolution) 11 plot_options = {"label":dec, 12 "fmt":"-" 13 } ---> 15 plot_altitude(test_source, 16 observer, 17 observe_time, 18 ax=ax, 19 airmass_yaxis=True, 20 style_kwargs=plot_options 21 ) File ~/Applications/mambaforge/envs/swgo-plot/lib/python3.11/site-packages/astroplan/plots/time_dependent.py:402, in plot_altitude(targets, observer, time, ax, style_kwargs, style_sheet, brightness_shading, airmass_yaxis, min_altitude, min_region, max_altitude, max_region) 399 target_name = '' 401 # Plot data --> 402 ax.plot_date(time.plot_date, masked_altitude, label=target_name, **style_kwargs) 404 # Format the time axis 405 ax.set_xlim([time[0].plot_date, time[-1].plot_date]) TypeError: matplotlib.axes._axes.Axes.plot_date() got multiple values for keyword argument 'label'
Is this a bug or am I using this in a wrong way?
I want to make a simple plot that shows the evolution of altitude with time for different declinations
The working code snippet without labels is the following,
As soon as I uncomment the "label" option which I naïvely thought would work I get the following error,
Is this a bug or am I using this in a wrong way?