change xlabel rotate in seaborn

# Basic syntax:
plt.set_xticklabels(plt.get_xticklabels(), rotation=45, horizontalalignment='right')

# Example usage:
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt

# Import data
data = pd.read_csv("https://raw.githubusercontent.com/mojones/binders/master/olympics.csv", sep="\t")

# Make figure with rotated axes
plt.figure(figsize=(10,5))

chart = sns.countplot(
    		data=data[data['Year'] == 1980],
    		x='Sport',
    		palette='Set1')

chart.set_xticklabels(chart.get_xticklabels(), rotation=45, horizontalalignment='right')

4
2
P. P 85 points

                                    import pandas
import matplotlib.pylab as plt
import seaborn as sns
import numpy as np
plt.rcParams["figure.figsize"] = [7.50, 3.50]
plt.rcParams["figure.autolayout"] = True
df = pandas.DataFrame({"X-Axis": [np.random.randint(10) for i in range(10)], "YAxis": [i for i in range(10)]})
bar_plot = sns.barplot(x='X-Axis', y='Y-Axis', data=df)
plt.xticks(rotation=45)
plt.show()

4 (2 Votes)
0
0
0
Sourblob 140 points

                                    plt.figure(figsize=(10,5))
chart = sns.countplot(
    data=data[data['Year'] == 1980],
    x='Sport',
    palette='Set1'
)
chart.set_xticklabels(chart.get_xticklabels(), rotation=45)

0
0
Are there any code examples left?
Create a Free Account
Unlock the power of data and AI by diving into Python, ChatGPT, SQL, Power BI, and beyond.
Sign up
Develop soft skills on BrainApps
Complete the IQ Test
Relative searches
seaborn rotate axis labels barplot rotate labels seaborn rotate x axis labels in seaborn seaborn label rotation rotate y labels seaborn how to rotate x labels in seaborn lineplot how to rotate x labels in seaborn rotate x axis labels seaborn seaborn axis labels rotate sns barplot rotate labels axis label rotate in seaborn seaborn plot rotate x labels seaborn barplot xlabel rotation rotate axis labels in matplotlib and seaborn rotate x axis labels seaborn barplot change xlabel rotate in seaborn how to rotate x axis labels in python seaborn sns rotate x axis labels seaborn rotate x labels boxplot rotate labels description x seaborn barplot rotate x labels seaborn seaborn labels rotate seaborn x-axis rotate rotate y label scatterplot sns seaborn seaborn rotate x axis labels seaborn heatmap axis labels rotate rotate xlabel seaborn pairplot how to rotate the xlable in seaborn seaborn rotate axis labels seaborn ytick rotation seaborn rotate x tick labels rotate facegrid seaborn legend sns angle x plot seaborn ylabel rotation seaborn x label vertical rotate xlabel seaborn rotate x axis seaborn how to rotate the x labls ins seaborn in relplot how to rotate the x labls ins seaborn seaborn catplot xticks rotation seaborn axis ticks rotate rotate x labels sns catplot countplot rotation xlable in seaborn make xticks vertical seaborn rotate labels in seaborn sns distplot xlabels angle rotate x label in seaborn seaborn countplot documentation xlabel rotation slanted x axis sns rotate catplot x labels seaborn catplot rotate x labels seaborn x axis tilt seaborn relplot xlabel rotation seaborn xlabel rotation rotate text countplot sns barplot make xlabel tilt seaborn rotate labels seaborn rotate xlabel seaborn rotation count plot vertical labels seaborn start x axis from first label rotate x axis labels 45 degrees in seaborn how to rotate xlabel in seaborn display x axis labels vertical sns catplot display x axis labels vertical sns rotate text for x axis seaborn catplot seaborn x axis rotated how to rotate labels in seaborn seaborn rotate y labels seaborn set_xticklabels how to make x axis labels vertical in seaborn plt.xticks(rotation=45 in seaborn sns countplot rotate labels heatmap python pandas rotate xlabel seaborn x axis label vertical seaborn rotate xticks seaborn rotate x labels
Made with love
This website uses cookies to make IQCode work for you. By using this site, you agree to our cookie policy

Welcome Back!

Sign up to unlock all of IQCode features:
  • Test your skills and track progress
  • Engage in comprehensive interactive courses
  • Commit to daily skill-enhancing challenges
  • Solve practical, real-world issues
  • Share your insights and learnings
Create an account
Sign in
Recover lost password
Or log in with

Create a Free Account

Sign up to unlock all of IQCode features:
  • Test your skills and track progress
  • Engage in comprehensive interactive courses
  • Commit to daily skill-enhancing challenges
  • Solve practical, real-world issues
  • Share your insights and learnings
Create an account
Sign up
Or sign up with
By signing up, you agree to the Terms and Conditions and Privacy Policy. You also agree to receive product-related marketing emails from IQCode, which you can unsubscribe from at any time.
Creating a new code example
Code snippet title
Source