seaborn rotate x labels

Solutions on MaxInterview for seaborn rotate x labels by the best coders in the world

showing results for - "seaborn rotate x labels"
Christopher
25 May 2017
1# Basic syntax:
2plt.set_xticklabels(plt.get_xticklabels(), rotation=45, horizontalalignment='right')
3
4# Example usage:
5import pandas as pd
6import seaborn as sns
7import matplotlib.pyplot as plt
8
9# Import data
10data = pd.read_csv("https://raw.githubusercontent.com/mojones/binders/master/olympics.csv", sep="\t")
11
12# Make figure with rotated axes
13plt.figure(figsize=(10,5))
14
15chart = sns.countplot(
16    		data=data[data['Year'] == 1980],
17    		x='Sport',
18    		palette='Set1')
19
20chart.set_xticklabels(chart.get_xticklabels(), rotation=45, horizontalalignment='right')
Monica
11 Feb 2019
1plt.figure(figsize=(15,8))
2
3ax = sns.histplot(data=test, x='date')
4
5ax.tick_params(axis='x', rotation=90)
6
Mila
15 Oct 2020
1plt.figure(figsize=(10,5))
2chart = sns.countplot(
3    data=data[data['Year'] == 1980],
4    x='Sport',
5    palette='Set1'
6)
7chart.set_xticklabels(chart.get_xticklabels(), rotation=45)
Colt
07 Jul 2020
1import pandas
2import matplotlib.pylab as plt
3import seaborn as sns
4import numpy as np
5plt.rcParams["figure.figsize"] = [7.50, 3.50]
6plt.rcParams["figure.autolayout"] = True
7df = pandas.DataFrame({"X-Axis": [np.random.randint(10) for i in range(10)], "YAxis": [i for i in range(10)]})
8bar_plot = sns.barplot(x='X-Axis', y='Y-Axis', data=df)
9plt.xticks(rotation=45)
10plt.show()
Lennart
18 Jan 2018
1chart = data[data['Year'] == 1980]['Sport'].value_counts().plot(kind='bar')
2chart.set_xticklabels(chart.get_xticklabels(), rotation=45, horizontalalignment='right')
queries leading to this page
how to rotate labels in seabornrotate x labels seabornseaborn xlabel rotationrotate labels seabornmake xticks vertical seaborncatplot seaborn x axis rotatedseaborn barplot rotate x labelsplt xticks 28rotation 3d45 in seabornhow to rotate x axis labels in python seabornseaborn catplot xticks rotationhow to rotate xlabel in seabornrotate catplot x labelsheatmap python pandas rotate xlabelseaborn rotate x labels boxplotseaborn rotate xticksslanted x axis snschange string of axis lables seabornrotate xtick label seabornrotate labels description x seaborn barplotseaborn rotate plotseaborn rotate x axis labelshow to make x axis labels vertical in seabornhow to rotate the x labls ins seabornseaborn rotation x labelsrotate text for x axis seabornsns boxplot rotate x labelsrotate x axis names seabornrotate x axis labels in seabornseaborn rotate axis labelshow to rotate x labels in seabornseaborn ax rotate x labelsrotate xlabel seaborn pairplotseaborn ytick rotationsns angle x plotrotate axis labels seabornsns barplot x label rotateseaborn axis labels rotateseaborn x axis tiltseaborn barplot xlabel rotationrotate x labels sns catplotseaborn ylabel rotationseaborn countplot documentation xlabel rotationrotate s lables in seaborncountplot rotation xlable in seabornrotate facegrid seaborn legendseaborn rotationseaborn rotate axis labels barplotsns rotate axis labelsseaborn x axis label rotaterotating x labels seabornsns rotate x axis labelsrotate axis labels in matplotlib and seabornchange xlabel rotate in seabornseaborn rotate labelsseaborn rotate x tick labels rotate x tick labels seabornsns barplot make xlabel tiltrotate xticks seabornsns barplot rotate labelsseaborn heatmap axis labels rotateaxis label rotate in seabornseaborn plot rotate x labelshow to rotate axis labels in seabornseaborn start x axis from first labelseaborn label rotationseaborn x label verticalsns countplot rotate labelscount plot vertical labelslmplot rotationseaborn set xticklabelsrotate y labels seabornsns rotate x labelsrotate y label scatterplot sns seabornseaborn rotate xtick labelsrotate xlabel seabornseaborn rotate xlabelrotate x axis labels seabornseaborn boxplot axis label rotateseaborn countplot rotate x labelshow to rotate the x labls ins seaborn in relplotseaborn axis ticks rotaterotate labels in seaborndisplay x axis labels vertical snsseaborn catplot rotate x labelshow to rotate x labels 45 degrees seabornseaborn relplot xlabel rotationseaborn x axis rotaterotate x axis seabornrotate text countplotseaborn x axis label verticalsns distplot xlabels anglehow to rotate the xlable in seaborndisplay x axis labels vertical sns catplotseaborn labels rotateseaborn rotate y labelshow to angle labes in xlabels seabornseaborn label anglerotate x label in seabornrotate x labels in seabornrotate x axis labels seaborn barplotseaborn rotate x labelsrotate x axis labels 45 degrees in seabornhow to rotate x labels in seaborn lineplotseaborn rotate x labels