Reputation: 61
I am trying to plot a histogram using Seaborn in python. I am using the sns.distplot function to pllot the histogram. I want to make my chart a little wider. How do I do that? I tried the help functionality in python but that did not help. Thanks
sns.set_style("dark")
ax = sns.distplot(data["Trip_distance"], bins= 50, kde= False, axlabel= "Trip Distance")
ax.set_ylabel('Count')
Upvotes: 1
Views: 4511
Reputation: 339560
Another method would be to create the figure and axes prior to plotting to them.
import matplotlib.pyplot as plt
import seaborn as sns
fig, ax = plt.subplots(figsize=(8,6))
sns.distplot(data["Trip_distance"], bins= 50, kde= False, axlabel= "Trip Distance", ax= ax)
ax.set_ylabel('Count')
ax.set_title("Histogram of Trip Distance")
Upvotes: 1
Reputation: 61
Found the answer. The first line in the code below.
sns.set(rc={"figure.figsize": (8, 4)})
sns.set_style("dark")
ax = sns.distplot(data["Trip_distance"], bins= 50, kde= False, axlabel= "Trip Distance")
ax.set_ylabel('Count')
ax.set_title("Histogram of Trip Distance")
Upvotes: 3