Skip to content
Snippets Groups Projects
Unverified Commit 0a909c85 authored by STEVAN Antoine's avatar STEVAN Antoine :crab:
Browse files

add `--aspect-ratio` and `--dpi` to subcommands

parent ccb1f8c8
No related branches found
No related tags found
No related merge requests found
#!/usr/bin/env python
import argparse
from typing import Tuple
import plot
import multi_bar
......@@ -29,6 +30,8 @@ if __name__ == "__main__":
plot_parser.add_argument("--y-scale", "-Y", type=str, choices=["linear", "log"], default="linear", help="the y scale of the plot")
plot_parser.add_argument("--fullscreen", action="store_true")
plot_parser.add_argument("--save", "-s", type=str, help="a path to save the figure to")
plot_parser.add_argument("--aspect-ratio", type=int, nargs=2, default=[16, 9], help="the aspect ratio of the saved image")
plot_parser.add_argument("--dpi", type=int, default=500, help="the DPI of the save image")
multi_bar_parser = subparsers.add_parser(
"multi_bar",
......@@ -40,6 +43,8 @@ if __name__ == "__main__":
multi_bar_parser.add_argument("--label", "-l", type=str, help="the measurement label of the multibar plot")
multi_bar_parser.add_argument("--fullscreen", action="store_true")
multi_bar_parser.add_argument("--save", "-s", type=str, help="a path to save the figure to")
multi_bar_parser.add_argument("--aspect-ratio", type=int, nargs=2, default=[16, 9], help="the aspect ratio of the saved image")
multi_bar_parser.add_argument("--dpi", type=int, default=500, help="the DPI of the save image")
args = parser.parse_args()
if args.subcommand is None:
......@@ -52,10 +57,12 @@ if __name__ == "__main__":
args.title,
args.x_label,
args.y_label,
save=args.save,
plot_layout="constrained" if args.fullscreen else None,
x_scale=args.x_scale,
y_scale=args.y_scale,
save=args.save,
save_aspect_ratio=args.aspect_ratio,
save_dpi=args.dpi,
)
elif args.subcommand == "multi_bar":
groups, measurements = multi_bar.extract(json.loads(args.data))
......@@ -63,5 +70,12 @@ if __name__ == "__main__":
plot_layout = "constrained" if args.fullscreen else None
multi_bar.multi_bar(
groups, measurements, args.title, args.label, save=args.save, plot_layout=plot_layout
groups,
measurements,
args.title,
args.label,
plot_layout=plot_layout,
save=args.save,
save_aspect_ratio=args.aspect_ratio,
save_dpi=args.dpi,
)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment