Merge branch '48-august-8-i-drugu-ruznu-mapu-obrisati-a-staviti-loptice-na-tabelu-risk-matrix' into 'master'
Residual risk matrix graph je sada predstavljen na tabeli Closes #48 See merge request kbr4/riskletpy!51
This commit was merged in pull request #100.
This commit is contained in:
@@ -449,16 +449,13 @@ def generate_residual_risk_graph(risks_with_controls):
|
||||
likelihoods = [risk.get('residual_likelihood', 0) for risk in risks_with_controls]
|
||||
risk_ids = [risk['risk']['id'] for risk in risks_with_controls]
|
||||
|
||||
bg_img_path = find('img/graph_matrix.png')
|
||||
bg_img = mpimg.imread(bg_img_path)
|
||||
|
||||
fig, ax = plt.subplots(figsize=(10, 8))
|
||||
|
||||
ax.imshow(bg_img, extent=[0.0, 5.4, 0.0, 5.4], aspect='auto')
|
||||
_draw_risk_matrix_background(ax)
|
||||
|
||||
scatter = ax.scatter(
|
||||
likelihoods, impacts,
|
||||
c="blue", edgecolors="white", s=500, alpha=0.9
|
||||
likelihoods, impacts,
|
||||
c="#000000", edgecolors="white", linewidths=1.5, s=420, alpha=0.95, zorder=3
|
||||
)
|
||||
|
||||
for i, risk_id in enumerate(risk_ids):
|
||||
@@ -470,20 +467,11 @@ def generate_residual_risk_graph(risks_with_controls):
|
||||
ha="center",
|
||||
va="center",
|
||||
weight="bold",
|
||||
zorder=4,
|
||||
)
|
||||
|
||||
ax.set_xticks([])
|
||||
ax.set_yticks([])
|
||||
ax.set_xticklabels([])
|
||||
ax.set_yticklabels([])
|
||||
|
||||
ax.spines['top'].set_visible(False)
|
||||
ax.spines['right'].set_visible(False)
|
||||
ax.spines['left'].set_visible(False)
|
||||
ax.spines['bottom'].set_visible(False)
|
||||
|
||||
buffer = io.BytesIO()
|
||||
plt.savefig(buffer, format="png", transparent=True, bbox_inches='tight', pad_inches=0)
|
||||
plt.savefig(buffer, format="png", transparent=True, bbox_inches='tight', pad_inches=0.1)
|
||||
buffer.seek(0)
|
||||
image_png = buffer.getvalue()
|
||||
buffer.close()
|
||||
|
||||
Reference in New Issue
Block a user