'Seaborn module - histplot - trying to plot histogram with correct data
Could someone please help me solve this?
I am trying to plot an histogram where the Y axis is in percentage and the X axis ranges between 0 (extremely unlikely) to 10 (extremely likely).
import seaborn as sns
sns.set(rc = {'figure.figsize':(8,6)})
sns.set_theme(style="whitegrid")
col = "4.1. Extremely Unlikely vs Extremely Likely"
data = file[[col,"1. Vaccination Status"]].dropna()
data[col] = data[col].astype(int)
hist = sns.histplot(data=data, x=col, hue="1. Vaccination Status", multiple="dodge", stat='count')
hist.set_title("Likeliness to recive vaccination")
hist.set_xlabel('0:Extremely Unlikely, 10:Extremely Likely')
data[col]
48 1
27 0
2 5
36 10
12 9
Name: 4.1. Extremely Unlikely vs Extremely Likely, dtype: int32
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
