Answers for "sns histogram plot"

2

plot histogram in seaborn

sns.distplot(gapminder['lifeExp'], kde=False, color='red', bins=100)
plt.title('Life Expectancy', fontsize=18)
plt.xlabel('Life Exp (years)', fontsize=16)
plt.ylabel('Frequency', fontsize=16)
Posted by: Guest on May-30-2020
0

sns datetime histogram

import datetime
import seaborn as sns
import matplotlib.pyplot as plt
# Generate dates -- change by your actual dates!
dates = [datetime.datetime.fromordinal(int(d)) for d in (43 * np.random.randn(200) + 737555)]
# Go back to ordinal numbers...
ordinal_dates = np.array([d.toordinal() for d in dates])
sns.distplot(ordinal_dates, kde=True)
# Now, get the positions of the xticks
ticks_locations, _ = plt.xticks();
# Get the labels for those positions
labels = [datetime.datetime.fromordinal(int(t)).date() for t in ticks_locations]
plt.xticks(ticks_locations, labels, rotation=90)
plt.title("Date distribution");
Posted by: Guest on September-29-2021

Python Answers by Framework

Browse Popular Code Answers by Language