-
Notifications
You must be signed in to change notification settings - Fork 26
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
Update Plot Legend/Label Functionality #751
Conversation
I don't know why my commits for other PR shows up here. First 4commits are for PR #744 . EDIT: I accidentally created new branch from yge/quickfix branch. They are both small changes though. |
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## master #751 +/- ##
==========================================
- Coverage 94.94% 94.93% -0.01%
==========================================
Files 80 80
Lines 19427 19435 +8
==========================================
+ Hits 18445 18451 +6
- Misses 982 984 +2
|
| benchmark_name | dt(%) | dt(s) | t_new(s) | t_old(s) |
| -------------------------------------- | ---------------------- | ---------------------- | ---------------------- | ---------------------- |
test_build_transform_fft_lowres | +0.26 +/- 1.49 | +4.10e-05 +/- 2.34e-04 | 1.57e-02 +/- 2.0e-04 | 1.56e-02 +/- 1.2e-04 |
test_build_transform_fft_midres | -0.04 +/- 0.89 | -3.31e-05 +/- 8.37e-04 | 9.44e-02 +/- 6.6e-04 | 9.45e-02 +/- 5.1e-04 |
test_build_transform_fft_highres | +0.41 +/- 0.93 | +1.90e-03 +/- 4.30e-03 | 4.66e-01 +/- 2.5e-03 | 4.64e-01 +/- 3.5e-03 |
test_equilibrium_init_lowres | +0.36 +/- 1.11 | +2.85e-03 +/- 8.89e-03 | 8.02e-01 +/- 6.1e-03 | 7.99e-01 +/- 6.4e-03 |
test_equilibrium_init_medres | +0.07 +/- 0.91 | +1.01e-03 +/- 1.29e-02 | 1.42e+00 +/- 7.8e-03 | 1.42e+00 +/- 1.0e-02 |
test_equilibrium_init_highres | +0.24 +/- 0.76 | +9.94e-03 +/- 3.18e-02 | 4.21e+00 +/- 2.3e-02 | 4.20e+00 +/- 2.2e-02 |
test_objective_compile_dshape_current | +0.32 +/- 9.53 | +1.34e-02 +/- 3.95e-01 | 4.16e+00 +/- 2.7e-01 | 4.14e+00 +/- 2.9e-01 |
test_objective_compile_atf | +0.69 +/- 6.28 | +6.36e-02 +/- 5.81e-01 | 9.31e+00 +/- 4.4e-01 | 9.25e+00 +/- 3.8e-01 |
test_objective_compute_dshape_current | -1.59 +/- 3.12 | -3.54e-05 +/- 6.93e-05 | 2.19e-03 +/- 5.0e-05 | 2.22e-03 +/- 4.8e-05 |
test_objective_compute_atf | -0.47 +/- 1.13 | -3.64e-05 +/- 8.72e-05 | 7.65e-03 +/- 6.7e-05 | 7.68e-03 +/- 5.6e-05 |
test_objective_jac_dshape_current | +2.20 +/- 11.09 | +1.02e-03 +/- 5.16e-03 | 4.75e-02 +/- 3.2e-03 | 4.65e-02 +/- 4.0e-03 |
test_objective_jac_atf | +0.28 +/- 3.97 | +6.63e-03 +/- 9.44e-02 | 2.39e+00 +/- 7.6e-02 | 2.38e+00 +/- 5.6e-02 |
test_perturb_1 | -0.54 +/- 12.33 | -4.65e-02 +/- 1.06e+00 | 8.56e+00 +/- 7.7e-01 | 8.61e+00 +/- 7.4e-01 |
test_perturb_2 | -0.30 +/- 4.94 | -4.36e-02 +/- 7.12e-01 | 1.44e+01 +/- 5.4e-01 | 1.44e+01 +/- 4.6e-01 | |
Can you check what happens if multiple things are plotted to the same axis? eg fig, ax = plt.subplots()
for i, eq in enumerate(eqf):
plot_1d(eq, "iota", ax=ax, label=f"eq{i}") I think it might try to draw the legend multiple times |
FWIW this happens with |
from desc.plotting import plot_1d, plot_surfaces, plot_fsa
from desc.examples import get
eq = get("HELIOTRON")
fig, ax = plt.subplots(nrows=1, ncols=2)
for i in range(2):
plot_1d(eq, "|B|", ax=ax[i], label=f"Bmag{i}")
fig, ax = plt.subplots()
for i in range(2):
plot_1d(eq, "iota", ax=ax, label=f"eq{i}")
plot_1d(eq, "|B|", ax=ax, label=f"Bmag{i}")
fig, ax = plt.subplots(nrows=1, ncols=2)
for i in range(2):
plot_1d(eq, "|B|", ax=ax[i], label=f"Bmag{i}")
plot_1d(eq, "iota", ax=ax[i], label=f"iota{i}") If you mean creating a subplot? to create subplot you need to specify row and columns as this one. For just multiple lines on same frame, no need for additional things |
| benchmark_name | dt(%) | dt(s) | t_new(s) | t_old(s) |
| -------------------------------------- | ---------------------- | ---------------------- | ---------------------- | ---------------------- |
test_build_transform_fft_lowres | +16.42 +/- 41.69 | +2.55e-03 +/- 6.48e-03 | 1.81e-02 +/- 6.5e-03 | 1.55e-02 +/- 1.6e-04 |
test_build_transform_fft_midres | -0.45 +/- 1.20 | -4.33e-04 +/- 1.15e-03 | 9.56e-02 +/- 9.1e-04 | 9.60e-02 +/- 7.1e-04 |
test_build_transform_fft_highres | -0.12 +/- 0.77 | -5.62e-04 +/- 3.63e-03 | 4.67e-01 +/- 2.6e-03 | 4.68e-01 +/- 2.6e-03 |
test_equilibrium_init_lowres | +1.83 +/- 1.93 | +1.47e-02 +/- 1.55e-02 | 8.20e-01 +/- 1.4e-02 | 8.05e-01 +/- 7.6e-03 |
test_equilibrium_init_medres | +0.47 +/- 1.21 | +6.79e-03 +/- 1.74e-02 | 1.44e+00 +/- 1.4e-02 | 1.44e+00 +/- 1.0e-02 |
test_equilibrium_init_highres | +0.32 +/- 0.71 | +1.36e-02 +/- 2.99e-02 | 4.22e+00 +/- 1.7e-02 | 4.20e+00 +/- 2.5e-02 |
test_objective_compile_dshape_current | +1.93 +/- 8.72 | +8.02e-02 +/- 3.62e-01 | 4.23e+00 +/- 2.7e-01 | 4.15e+00 +/- 2.4e-01 |
test_objective_compile_atf | +1.06 +/- 5.49 | +9.99e-02 +/- 5.16e-01 | 9.51e+00 +/- 3.5e-01 | 9.41e+00 +/- 3.8e-01 |
test_objective_compute_dshape_current | +0.09 +/- 4.06 | +2.10e-06 +/- 9.10e-05 | 2.24e-03 +/- 5.6e-05 | 2.24e-03 +/- 7.2e-05 |
test_objective_compute_atf | -3.35 +/- 2.83 | -2.66e-04 +/- 2.24e-04 | 7.66e-03 +/- 2.0e-04 | 7.92e-03 +/- 1.0e-04 |
test_objective_jac_dshape_current | +2.10 +/- 9.24 | +9.85e-04 +/- 4.33e-03 | 4.78e-02 +/- 3.1e-03 | 4.68e-02 +/- 3.0e-03 |
test_objective_jac_atf | -1.15 +/- 4.21 | -2.66e-02 +/- 9.73e-02 | 2.28e+00 +/- 3.3e-02 | 2.31e+00 +/- 9.2e-02 |
test_perturb_1 | -1.34 +/- 13.02 | -1.19e-01 +/- 1.16e+00 | 8.77e+00 +/- 8.4e-01 | 8.89e+00 +/- 8.0e-01 |
test_perturb_2 | -0.15 +/- 5.58 | -2.22e-02 +/- 8.22e-01 | 1.47e+01 +/- 7.1e-01 | 1.47e+01 +/- 4.1e-01 | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are the installation instructions changed in this PR? You should remove those changes.
I accidentally created this branch from PR #744 branch. How can I delete those commits? |
| benchmark_name | dt(%) | dt(s) | t_new(s) | t_old(s) |
| -------------------------------------- | ---------------------- | ---------------------- | ---------------------- | ---------------------- |
test_build_transform_fft_lowres | +0.28 +/- 1.42 | +4.34e-05 +/- 2.18e-04 | 1.55e-02 +/- 1.5e-04 | 1.54e-02 +/- 1.6e-04 |
test_build_transform_fft_midres | +1.96 +/- 0.97 | +1.83e-03 +/- 9.15e-04 | 9.57e-02 +/- 7.1e-04 | 9.38e-02 +/- 5.8e-04 |
test_build_transform_fft_highres | +1.07 +/- 0.78 | +4.96e-03 +/- 3.63e-03 | 4.69e-01 +/- 3.0e-03 | 4.64e-01 +/- 2.0e-03 |
test_equilibrium_init_lowres | -0.43 +/- 0.84 | -3.39e-03 +/- 6.62e-03 | 7.81e-01 +/- 4.5e-03 | 7.85e-01 +/- 4.8e-03 |
test_equilibrium_init_medres | +0.38 +/- 1.00 | +5.36e-03 +/- 1.40e-02 | 1.41e+00 +/- 1.0e-02 | 1.40e+00 +/- 9.8e-03 |
test_equilibrium_init_highres | +0.79 +/- 0.77 | +3.27e-02 +/- 3.19e-02 | 4.19e+00 +/- 2.3e-02 | 4.16e+00 +/- 2.2e-02 |
test_objective_compile_dshape_current | -0.03 +/- 7.65 | -1.29e-03 +/- 3.11e-01 | 4.07e+00 +/- 2.3e-01 | 4.07e+00 +/- 2.1e-01 |
test_objective_compile_atf | +0.78 +/- 5.48 | +7.10e-02 +/- 4.97e-01 | 9.14e+00 +/- 4.0e-01 | 9.07e+00 +/- 3.0e-01 |
test_objective_compute_dshape_current | +0.16 +/- 1.98 | +3.37e-06 +/- 4.29e-05 | 2.17e-03 +/- 3.6e-05 | 2.17e-03 +/- 2.4e-05 |
-test_objective_compute_atf | +4.09 +/- 1.23 | +3.06e-04 +/- 9.22e-05 | 7.77e-03 +/- 5.5e-05 | 7.47e-03 +/- 7.4e-05 |
test_objective_jac_dshape_current | +2.64 +/- 10.62 | +1.18e-03 +/- 4.75e-03 | 4.59e-02 +/- 3.8e-03 | 4.47e-02 +/- 2.9e-03 |
test_objective_jac_atf | -1.32 +/- 4.04 | -3.03e-02 +/- 9.23e-02 | 2.25e+00 +/- 6.8e-02 | 2.28e+00 +/- 6.2e-02 |
test_perturb_1 | +0.05 +/- 12.92 | +4.43e-03 +/- 1.09e+00 | 8.42e+00 +/- 7.8e-01 | 8.42e+00 +/- 7.6e-01 |
test_perturb_2 | +0.63 +/- 4.82 | +8.78e-02 +/- 6.76e-01 | 1.41e+01 +/- 4.7e-01 | 1.40e+01 +/- 4.8e-01 | |
| benchmark_name | dt(%) | dt(s) | t_new(s) | t_old(s) |
| -------------------------------------- | ---------------------- | ---------------------- | ---------------------- | ---------------------- |
test_build_transform_fft_lowres | -0.27 +/- 3.46 | -4.16e-05 +/- 5.40e-04 | 1.56e-02 +/- 2.5e-04 | 1.56e-02 +/- 4.8e-04 |
test_build_transform_fft_midres | +1.18 +/- 1.66 | +1.12e-03 +/- 1.58e-03 | 9.61e-02 +/- 7.9e-04 | 9.50e-02 +/- 1.4e-03 |
test_build_transform_fft_highres | +1.58 +/- 0.98 | +7.28e-03 +/- 4.50e-03 | 4.69e-01 +/- 3.4e-03 | 4.61e-01 +/- 2.9e-03 |
test_equilibrium_init_lowres | -0.45 +/- 1.64 | -3.61e-03 +/- 1.32e-02 | 8.02e-01 +/- 9.6e-03 | 8.05e-01 +/- 9.0e-03 |
test_equilibrium_init_medres | +0.02 +/- 1.22 | +3.20e-04 +/- 1.73e-02 | 1.42e+00 +/- 1.3e-02 | 1.42e+00 +/- 1.1e-02 |
test_equilibrium_init_highres | +0.70 +/- 0.88 | +2.91e-02 +/- 3.67e-02 | 4.21e+00 +/- 3.0e-02 | 4.18e+00 +/- 2.1e-02 |
test_objective_compile_dshape_current | +1.20 +/- 8.16 | +4.94e-02 +/- 3.37e-01 | 4.18e+00 +/- 2.4e-01 | 4.13e+00 +/- 2.4e-01 |
test_objective_compile_atf | -0.31 +/- 6.93 | -2.88e-02 +/- 6.47e-01 | 9.30e+00 +/- 5.4e-01 | 9.33e+00 +/- 3.5e-01 |
test_objective_compute_dshape_current | -2.62 +/- 3.29 | -5.91e-05 +/- 7.44e-05 | 2.20e-03 +/- 3.2e-05 | 2.26e-03 +/- 6.7e-05 |
test_objective_compute_atf | -1.22 +/- 1.85 | -9.47e-05 +/- 1.43e-04 | 7.64e-03 +/- 1.3e-04 | 7.74e-03 +/- 5.7e-05 |
test_objective_jac_dshape_current | +1.02 +/- 10.01 | +4.68e-04 +/- 4.59e-03 | 4.64e-02 +/- 3.6e-03 | 4.59e-02 +/- 2.9e-03 |
test_objective_jac_atf | -1.65 +/- 7.74 | -3.92e-02 +/- 1.84e-01 | 2.34e+00 +/- 1.5e-01 | 2.38e+00 +/- 1.0e-01 |
test_perturb_1 | +0.39 +/- 12.72 | +3.39e-02 +/- 1.09e+00 | 8.62e+00 +/- 8.1e-01 | 8.59e+00 +/- 7.3e-01 |
test_perturb_2 | -0.20 +/- 4.89 | -2.91e-02 +/- 7.05e-01 | 1.44e+01 +/- 4.5e-01 | 1.44e+01 +/- 5.4e-01 | |
| benchmark_name | dt(%) | dt(s) | t_new(s) | t_old(s) |
| -------------------------------------- | ---------------------- | ---------------------- | ---------------------- | ---------------------- |
test_build_transform_fft_lowres | +0.96 +/- 4.59 | +1.20e-04 +/- 5.72e-04 | 1.26e-02 +/- 5.6e-04 | 1.25e-02 +/- 1.2e-04 |
test_build_transform_fft_midres | +1.44 +/- 1.16 | +1.32e-03 +/- 1.06e-03 | 9.26e-02 +/- 6.9e-04 | 9.12e-02 +/- 8.0e-04 |
test_build_transform_fft_highres | +0.07 +/- 1.05 | +3.36e-04 +/- 4.86e-03 | 4.64e-01 +/- 4.4e-03 | 4.63e-01 +/- 2.1e-03 |
test_equilibrium_init_lowres | +1.27 +/- 1.14 | +1.01e-02 +/- 9.09e-03 | 8.04e-01 +/- 6.2e-03 | 7.94e-01 +/- 6.6e-03 |
test_equilibrium_init_medres | +0.89 +/- 1.14 | +1.26e-02 +/- 1.62e-02 | 1.43e+00 +/- 1.0e-02 | 1.42e+00 +/- 1.2e-02 |
test_equilibrium_init_highres | +1.08 +/- 0.82 | +4.54e-02 +/- 3.44e-02 | 4.23e+00 +/- 2.1e-02 | 4.18e+00 +/- 2.7e-02 |
test_objective_compile_dshape_current | -0.87 +/- 8.32 | -3.61e-02 +/- 3.45e-01 | 4.11e+00 +/- 2.5e-01 | 4.15e+00 +/- 2.4e-01 |
test_objective_compile_atf | -0.69 +/- 5.94 | -6.35e-02 +/- 5.50e-01 | 9.19e+00 +/- 3.2e-01 | 9.25e+00 +/- 4.5e-01 |
test_objective_compute_dshape_current | -0.03 +/- 2.32 | -7.31e-07 +/- 5.04e-05 | 2.17e-03 +/- 3.8e-05 | 2.17e-03 +/- 3.3e-05 |
test_objective_compute_atf | +0.16 +/- 1.68 | +1.26e-05 +/- 1.29e-04 | 7.70e-03 +/- 7.3e-05 | 7.69e-03 +/- 1.1e-04 |
test_objective_jac_dshape_current | -0.09 +/- 12.15 | -4.21e-05 +/- 5.59e-03 | 4.60e-02 +/- 4.3e-03 | 4.60e-02 +/- 3.5e-03 |
test_objective_jac_atf | -3.93 +/- 5.11 | -8.96e-02 +/- 1.16e-01 | 2.19e+00 +/- 9.6e-02 | 2.28e+00 +/- 6.6e-02 |
test_perturb_1 | -0.48 +/- 12.86 | -4.14e-02 +/- 1.11e+00 | 8.58e+00 +/- 8.3e-01 | 8.62e+00 +/- 7.4e-01 |
test_perturb_2 | +0.26 +/- 4.70 | +3.70e-02 +/- 6.76e-01 | 1.44e+01 +/- 5.2e-01 | 1.44e+01 +/- 4.4e-01 | |
This PR solves the issue mentioned in #629 .
If you use,
It now gives,
without additional plt.legend() command