I am trying to do a risk matrix using Python that integrate severity and probability, I already tried using heatmaps, and it is maybe the closest kind of graph I have found so far, but I think it does not represent the basic structure of a risk matrix. The next image shows the kind of matrix graph I want. I would appreciate any recommendation: library, link...whatever to be able to graph a risk matrix.
This is the data I am trying to locate inside the risk matrix:
|---------------------|------------------|----------------------|
| Component | KPI | Classification
|---------------------|------------------|----------------------|
| 12 | 34 | High Criticality
|---------------------|------------------|----------------------|
Start 38 High Criticality
|---------------------|------------------|----------------------|
Fusela 45 Low Criticality
|---------------------|------------------|----------------------|
Hyd 50 Medium Criticality
|---------------------|------------------|----------------------|
Damp 51 Medium Criticality
|---------------------|------------------|----------------------|
Turbine 62 High Criticality
|---------------------|------------------|----------------------|
Intercon 65 Medium Criticality
|---------------------|------------------|----------------------|
Main Rotor 90 High Criticality
|---------------------|------------------|----------------------|
AM-19 93 High Criticality
|---------------------|------------------|----------------------|
Main Trans 98 High Criticality
|---------------------|------------------|----------------------|
And this is the code I already implemented using heatmap:
import matplotlib.pyplot as plt
data = data.sort_values(by = 'KPI', ascending = False)
x = 1
for element in list(data['Componente']):
data['Componente'] = data['Componente'].str.replace(str(element),'{}.
{}'.format(str(x),element))
x = x + 1
data['Clasificación'] = data['Clasificación'].str.replace('Criticidad
Alta','1. Criticidad Alta').str.replace('Criticidad Media','2. Criticidad
Media').str.replace('Criticidad Baja', '3. Criticidad Baja')
result = data.pivot(index='Componente',columns= 'Clasificacion', values =
'KPI')
sb.heatmap(result, annot= True ,cmap='RdYlGn' ,fmt=".1f", vmax=100)
plt.figtext(.5,.9,'RESULTADO MATRIZ RIESGO', fontsize=14, ha='center')
plt.show()
The output I woudl like is something like the next imager: