diff --git a/sumo/cli/bandplot.py b/sumo/cli/bandplot.py index 7b14031b..0a1e07f3 100644 --- a/sumo/cli/bandplot.py +++ b/sumo/cli/bandplot.py @@ -91,6 +91,7 @@ def bandplot( dpi=400, plt=None, fonts=None, + title=None, ): """Plot electronic band structure diagrams from vasprun.xml files. @@ -447,6 +448,7 @@ def bandplot( style=style, no_base_style=no_base_style, spin=spin, + title=title, ) else: plt = plotter.get_plot( @@ -467,6 +469,7 @@ def bandplot( style=style, no_base_style=no_base_style, spin=spin, + title=title, ) if save_files: @@ -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 @@ -934,6 +938,7 @@ def main(): image_format=args.image_format, dpi=args.dpi, fonts=args.font, + title=args.title, ) diff --git a/sumo/plotting/bs_plotter.py b/sumo/plotting/bs_plotter.py index 29e0495a..ab69fa0b 100644 --- a/sumo/plotting/bs_plotter.py +++ b/sumo/plotting/bs_plotter.py @@ -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. @@ -315,6 +316,7 @@ def get_plot( dos_label=dos_label, aspect=aspect, spin=spin, + title=title, ) return plt @@ -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. @@ -686,6 +689,7 @@ def get_projected_plot( plot_dos_legend=plot_dos_legend, aspect=aspect, spin=spin, + title=title, ) return plt @@ -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: @@ -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] diff --git a/sumo/plotting/sumo_base.mplstyle b/sumo/plotting/sumo_base.mplstyle index f774c9a2..bc195f34 100644 --- a/sumo/plotting/sumo_base.mplstyle +++ b/sumo/plotting/sumo_base.mplstyle @@ -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'])