0

I am attempting to visualize the level of importance from the following information.

import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns

df_A_scr = pd.DataFrame({'Features' : ['age', 'weight', 'height', 'walk'],
                              'importance score': [0.153, 0.105, 0.105, 0.071]
                              })
df_B_scr = pd.DataFrame({'Features' : ['age', 'weight', 'height', 'walk'],
                              'importance score': [0.144, 0.112, 0.093, 0.068]
                              })

df_A_conf = pd.DataFrame({'Features' : ['blood pressure', 'creatinine', 'stroke'],
                              'importance score': [0.102, 0.0903, 0.083]
                              })

df_B_conf = pd.DataFrame({'Features' : ['blood pressure', 'creatinine', 'stroke'],
                              'importance score': [0.095, 0.088, 0.085]
                              })

fig, axes = plt.subplots(2, 2, figsize=(10, 8))

sns.barplot('importance score','Features',data=df_A_scr, ax=axes[0, 0], color='darkorange').set_title('set_A')
sns.barplot('importance score','Features',data=df_B_scr, ax=axes[0, 1], color='darkorange').set_title('set_A')

sns.barplot('importance score','Features',data=df_A_conf, ax=axes[1, 0], color='green').set_title('set_B')
sns.barplot('importance score','Features',data=df_B_conf, ax=axes[1, 1], color='green').set_title('set_B')

sns.set_style("whitegrid", {'grid.linestyle': '--'})

axes[0,1].set_yticklabels([]);
axes[1,1].set_yticklabels([]);

axes[0,1].set_ylabel('');
axes[1,1].set_ylabel('');

plt.subplots_adjust(hspace=0.3)

enter image description here

I have one question.

Is it possible to align the maximum value of the x-axis of the two graphs of setA to 0.16 and the maximum value of the graph of setB to 0.12?

I'm glad if you tell me.

Dai
  • 91
  • 8

0 Answers0