Skip to content

Commit

Permalink
Merge pull request #215 from oashour/title
Browse files Browse the repository at this point in the history
Add support for band structure titles
  • Loading branch information
utf authored Oct 11, 2023
2 parents 1d805c3 + 11ec551 commit 9edbdba
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 0 deletions.
5 changes: 5 additions & 0 deletions sumo/cli/bandplot.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ def bandplot(
dpi=400,
plt=None,
fonts=None,
title=None,
):
"""Plot electronic band structure diagrams from vasprun.xml files.
Expand Down Expand Up @@ -447,6 +448,7 @@ def bandplot(
style=style,
no_base_style=no_base_style,
spin=spin,
title=title,
)
else:
plt = plotter.get_plot(
Expand All @@ -467,6 +469,7 @@ def bandplot(
style=style,
no_base_style=no_base_style,
spin=spin,
title=title,
)

if save_files:
Expand Down Expand Up @@ -863,6 +866,7 @@ def _get_parser():
"--dpi", type=int, default=400, help="pixel density for image file"
)
parser.add_argument("--font", default=None, help="font to use")
parser.add_argument("--title", default=None, help="plot title")
return parser


Expand Down Expand Up @@ -934,6 +938,7 @@ def main():
image_format=args.image_format,
dpi=args.dpi,
fonts=args.font,
title=args.title,
)


Expand Down
8 changes: 8 additions & 0 deletions sumo/plotting/bs_plotter.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ def get_plot(
fonts=None,
style=None,
no_base_style=False,
title=None,
):
"""Get a :obj:`matplotlib.pyplot` object of the band structure.
Expand Down Expand Up @@ -315,6 +316,7 @@ def get_plot(
dos_label=dos_label,
aspect=aspect,
spin=spin,
title=title,
)
return plt

Expand Down Expand Up @@ -352,6 +354,7 @@ def get_projected_plot(
style=None,
no_base_style=False,
spin=None,
title=None,
):
"""Get a :obj:`matplotlib.pyplot` of the projected band structure.
Expand Down Expand Up @@ -686,6 +689,7 @@ def get_projected_plot(
plot_dos_legend=plot_dos_legend,
aspect=aspect,
spin=spin,
title=title,
)
return plt

Expand All @@ -707,6 +711,7 @@ def _makeplot(
plot_dos_legend=True,
aspect=None,
spin=None,
title=None,
):
"""Tidy the band structure & add the density of states if required."""
if zero_line:
Expand All @@ -730,6 +735,9 @@ def _makeplot(
for vbm in data["vbm"]:
ax.scatter(vbm[0], vbm[1], color="C3", marker="o")

if title:
fig.suptitle(title)

if dos_plotter:
ax = fig.axes[1]

Expand Down
1 change: 1 addition & 0 deletions sumo/plotting/sumo_base.mplstyle
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
figure.figsize : 3.2, 3.2
figure.dpi: 400
figure.titlesize: 14

axes.prop_cycle: cycler('color', ['f0a3ff', '0075dc', '993f00', '4c005c', '426600', 'ff0010', '9dcc00', 'c20088', '003380', 'ffa405', 'ffff00', 'ff5005', '5ef1f2', '740aff', '990000', '00998f', '005c31', '2bce48', 'ffcc99', '94ffb5', '8f7c00', '6fa8bb', '808080'])

Expand Down

0 comments on commit 9edbdba

Please sign in to comment.