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

pytplot legend_location does not work correctly in some cases #641

Open
nickssl opened this issue Nov 14, 2023 · 0 comments
Open

pytplot legend_location does not work correctly in some cases #641

nickssl opened this issue Nov 14, 2023 · 0 comments
Labels
bug Something isn't working plotting pytplot Issues involving the pytplot package

Comments

@nickssl
Copy link
Contributor

nickssl commented Nov 14, 2023

Legend option "spedas" for "legend_location" places the legend outside the viewable window in the following example. Clicking on the slider button of the plot, and making the subplot parameter "right" smaller, makes the legend visible, but this should happen automatically if possible.

from pyspedas import time_double
from pytplot import options, tplot_options, store_data, tplot


def test_legend():
    trange = ["2022-03-23/00:00:00", "2022-03-23/23:59:59"]

    # Empty panel
    tn = time_double(trange)
    store_data("empty_panel", data={"x": tn, "y": [0, 0]})

    # Panel 1: AE index
    panel1 = "empty_panel"
    options(panel1, "ytitle", "AE index")
    options(panel1, "ysubtitle", "[nT]")
    options(panel1, "legend_names", ["THEMIS AE"])
    options(panel1, "legend_location", "spedas") # doesn't work correctly


    # Create plot
    vars = [panel1, panel1, panel1]
    plot_title = "Overview  Plot (" + trange[0] + ")"
    tplot_options("title", plot_title)
    tplot_options("show_all_axes", False)
    tplot(vars)


test_legend()
@jameswilburlewis jameswilburlewis added bug Something isn't working pytplot Issues involving the pytplot package labels Nov 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working plotting pytplot Issues involving the pytplot package
Projects
None yet
Development

No branches or pull requests

2 participants