Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Data Science by (17.6k points)

By default the seaborn displaces the X axis ranges from -5 to 35 in distplots. But I need to display the distplots with the X axis ranges from 1 to 30 with 1 unit. How can I do that?

1 Answer

0 votes
by (41.4k points)

You can use below code to accomplish your task:

import matplotlib.pyplot as plt

import seaborn as sns

tips = sns.load_dataset("tips")

sns.set_style("whitegrid")

g = sns.lmplot(x="tip", y="total_bill", data=tips,

 aspect=2)

g = (g.set_axis_labels("Tip","Total bill(USD)").

set(xlim=(0,15),ylim=(0,100)))

plt.title("title")

plt.show(g)

If you face any further issues, then you can go through this article on python for reference.

Wanna become an Expert in python? Come & join our Python Certification course

Related questions

0 votes
1 answer
asked Apr 26, 2020 in Data Science by blackindya (18.4k points)
0 votes
1 answer
asked Apr 25, 2020 in Data Science by blackindya (18.4k points)
0 votes
1 answer
asked Dec 26, 2020 in BI by Chris (11.1k points)
0 votes
1 answer

Browse Categories

...