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

fix legend bugs #27

Merged
merged 1 commit into from
Sep 23, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified examples/phonons/phonons.pdf
Binary file not shown.
Binary file modified examples/phonons/phonons.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion examples/phonons/plot-phonons.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
legend nicely and still accepts arguments like title. This doesn't stop
you using plt.legend instead (see line 41).
"""
fig, ax, add_legend = tp.axes.one_large.dos_small_legend()
fig, ax, add_legend = tp.axes.one.dos_small_legend()

# Load

Expand Down
2 changes: 1 addition & 1 deletion tp/axes/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,4 @@
legend
"""

from . import one, two, three, four, one_large, two_large, three_large, four_large
from . import one, two, three, four, one_large, two_large, three_large, four_large, legend
32 changes: 16 additions & 16 deletions tp/axes/one.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ def colourbar_small_legend(style=[]):
axes
axes.
function
function to add a pre-posistioned legend.
function to add a pre-positioned legend.
"""

if isinstance(style, str): style=[style]
Expand Down Expand Up @@ -217,7 +217,7 @@ def dos_colourbar_small_legend(style=[]):
axes
axes.
function
function to add a pre-posistioned legend.
function to add a pre-positioned legend.
"""

if isinstance(style, str): style=[style]
Expand Down Expand Up @@ -253,13 +253,13 @@ def add_legend(custom=False, *args, **kwargs):
"""

if custom:
legend = ax.legend(loc="center left", bbox_to_anchor=(1.75, 0.5),
*args, **kwargs)
legend = ax[1].legend(loc="center left", bbox_to_anchor=(1.75, 0.5),
*args, **kwargs)
else:
handles, labels = tp.axes.legend.consolidate(ax)
legend = ax.legend(loc="center left", bbox_to_anchor=(1.75, 0.5),
handles=handles, labels=labels,
*args, **kwargs)
legend = ax[1].legend(loc="center left", bbox_to_anchor=(1.75, 0.5),
handles=handles, labels=labels,
*args, **kwargs)

return legend

Expand All @@ -282,7 +282,7 @@ def dos_small_legend(style=[]):
axes
axes.
function
function to add a pre-posistioned legend.
function to add a pre-positioned legend.
"""

if isinstance(style, str): style=[style]
Expand Down Expand Up @@ -318,13 +318,13 @@ def add_legend(custom=False, *args, **kwargs):
"""

if custom:
legend = ax.legend(loc="center left", bbox_to_anchor=(1, 0.5),
*args, **kwargs)
legend = ax[1].legend(loc="center left", bbox_to_anchor=(1, 0.5),
*args, **kwargs)
else:
handles, labels = tp.axes.legend.consolidate(ax)
legend = ax.legend(loc="center left", bbox_to_anchor=(1, 0.5),
handles=handles, labels=labels,
*args, **kwargs)
legend = ax[1].legend(loc="center left", bbox_to_anchor=(1, 0.5),
handles=handles, labels=labels,
*args, **kwargs)

return legend

Expand All @@ -347,7 +347,7 @@ def small_legend(style=[]):
axes
axes.
function
function to add a pre-posistioned legend.
function to add a pre-positioned legend.
"""

if isinstance(style, str): style=[style]
Expand Down Expand Up @@ -400,7 +400,7 @@ def medium_legend(style=[]):
axes
axes.
function
function to add a pre-posistioned legend.
function to add a pre-positioned legend.
"""

if isinstance(style, str): style=[style]
Expand Down Expand Up @@ -481,7 +481,7 @@ def wide_large_legend(style=[]):
axes
axes.
function
function to add a pre-posistioned legend.
function to add a pre-positioned legend.
"""

if isinstance(style, str): style=[style]
Expand Down
12 changes: 6 additions & 6 deletions tp/axes/one_large.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ def colourbar_small_legend(style=[]):
axes
axes.
function
function to add a pre-posistioned legend.
function to add a pre-positioned legend.
"""

if isinstance(style, str): style=[style]
Expand Down Expand Up @@ -217,7 +217,7 @@ def dos_colourbar_small_legend(style=[]):
axes
axes.
function
function to add a pre-posistioned legend.
function to add a pre-positioned legend.
"""

if isinstance(style, str): style=[style]
Expand Down Expand Up @@ -282,7 +282,7 @@ def dos_small_legend(style=[]):
axes
axes.
function
function to add a pre-posistioned legend.
function to add a pre-positioned legend.
"""

if isinstance(style, str): style=[style]
Expand Down Expand Up @@ -347,7 +347,7 @@ def small_legend(style=[]):
axes
axes.
function
function to add a pre-posistioned legend.
function to add a pre-positioned legend.
"""

if isinstance(style, str): style=[style]
Expand Down Expand Up @@ -400,7 +400,7 @@ def medium_legend(style=[]):
axes
axes.
function
function to add a pre-posistioned legend.
function to add a pre-positioned legend.
"""

if isinstance(style, str): style=[style]
Expand Down Expand Up @@ -481,7 +481,7 @@ def wide_large_legend(style=[]):
axes
axes.
function
function to add a pre-posistioned legend.
function to add a pre-positioned legend.
"""

if isinstance(style, str): style=[style]
Expand Down