Add --dpi flag to subunit2sql-graph

This commit adds a new flag, --dpi, to the subunit2sql-graph command.
This flag is used to specify a DPI for generated graph images.
Previously most graph commands hard coded the DPI to 900 (which is far
too high for most people) and others didn't specify one. This commit
changes that so it's user adjustable and consistent between all
commands.

Change-Id: I5c8c48bda18daff11d6069c35451d932ffe4e33b
This commit is contained in:
Matthew Treinish 2018-02-11 22:54:33 -05:00
parent 6f95e43478
commit 6e9dae785f
No known key found for this signature in database
GPG Key ID: FD12A0F214C9E177
9 changed files with 13 additions and 7 deletions

View File

@ -0,0 +1,4 @@
---
features:
- Add a new CLI flag, --dpi, for subunit2sql-graph to adjust the output image
DPI for the generated graphs.

View File

@ -78,4 +78,4 @@ def generate_series():
df = pd.DataFrame.from_dict(test_dict, orient='index')
plot = df.plot(kind='barh', stacked=True).set_title(title)
fig = plot.get_figure()
fig.savefig(CONF.output)
fig.savefig(CONF.output, dpi=CONF.dpi)

View File

@ -84,4 +84,4 @@ def generate_series():
upper_std_dev[10:],
color='b', alpha=0.2, label='Std Dev')
plt.legend()
plt.savefig(CONF.output, dpi=900)
plt.savefig(CONF.output, dpi=CONF.dpi)

View File

@ -75,5 +75,5 @@ def generate_series():
print('Success Percentage: %.4f%%' % percent(success_count, run_count))
print('Skip Percentage: %.4f%%' % percent(skip_count, run_count))
fig = plot.get_figure()
fig.savefig(CONF.output)
fig.savefig(CONF.output, dpi=CONF.dpi)
return ts

View File

@ -43,6 +43,8 @@ SHELL_OPTS = [
cfg.StrOpt('stop-date', short='s',
help='Stop date for the graph only data from before this date '
'will be used. Uses ISO 8601 format: 1914-06-28'),
cfg.IntOpt('dpi', default=900,
help='Image DPI to use for the output graph images')
]

View File

@ -74,4 +74,4 @@ def generate_series():
locs, labels = plt.yticks(range(len(perc_data)), list(perc_data.keys()))
plt.xlabel('Failure Percentage')
plt.tight_layout()
plt.savefig(CONF.output, dpi=900)
plt.savefig(CONF.output, dpi=CONF.dpi)

View File

@ -79,5 +79,5 @@ def generate_series():
lower_std_dev, color='b', alpha=0.2,
label='std dev')
plt.legend()
plt.savefig(CONF.output, dpi=900)
plt.savefig(CONF.output, dpi=CONF.dpi)
return ts

View File

@ -68,4 +68,4 @@ def generate_series():
df.plot(kind='box', rot=90)
plt.ylabel('Time (sec.)')
plt.tight_layout()
plt.savefig(CONF.output, dpi=900)
plt.savefig(CONF.output, dpi=CONF.dpi)

View File

@ -63,4 +63,4 @@ def generate_series():
df.plot(kind='box', rot=90)
plt.ylabel('Time (sec.)')
plt.tight_layout()
plt.savefig(CONF.output, dpi=900)
plt.savefig(CONF.output, dpi=CONF.dpi)