MCPcopy Create free account
hub / github.com/src-d/hercules / deploy_plot

Function deploy_plot

python/labours/plotting.py:54–74  ·  view source on GitHub ↗
(title: str, output: str, background: str, tight: bool = True)

Source from the content-addressed store, hash-verified

52
53
54def deploy_plot(title: str, output: str, background: str, tight: bool = True) -> None:
55 import matplotlib.pyplot as pyplot
56
57 if not output:
58 pyplot.gcf().canvas.set_window_title(title)
59 pyplot.show()
60 else:
61 po = Path(output)
62 if len(po.name) > 64:
63 suffix = po.suffix[:5]
64 output = str(po.with_name(po.stem[:64 - len(suffix)] + suffix))
65 if title:
66 pyplot.title(title, color="black" if background == "white" else "white")
67 if tight:
68 try:
69 pyplot.tight_layout()
70 except: # noqa: E722
71 print("Warning: failed to set the tight layout")
72 print("Writing plot to %s" % output)
73 pyplot.savefig(output, transparent=True)
74 pyplot.clf()

Callers 8

plot_burndownFunction · 0.90
show_devs_parallelFunction · 0.90
show_devsFunction · 0.90
show_devs_effortsFunction · 0.90
show_old_vs_newFunction · 0.90
plot_ownershipFunction · 0.90
plot_overwrites_matrixFunction · 0.90
show_sentiment_statsFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected