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')
1plt.figure(figsize=(15,8))
2
3ax = sns.histplot(data=test, x='date')
4
5ax.tick_params(axis='x', rotation=90)
6
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)
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()