I am plotting the following data set.
data = {'Surface':[0, -50, -100, -250, -600], 'Left':[0, 0, 0, 10, 50], 'Front':[0, 0, 5, 15, 90]}
This is a negative value dataset and therfore I am trying to move the x-axis to the top of the plot instead of the normal bottom axis.
The plot looks like this now:
The dataset and code below:
import seaborn as sns
import pandas as pd
import matplotlib.pyplot as plt
# initialise dataframe
data = {'Surface':[0, -50, -100, -250, -600], 'Left':[0, 0, 0, 10, 50], 'Front':[0, 0, 5, 15, 90]}
# Creates pandas DataFrame.
df = pd.DataFrame(data)
#Plotting
g = sns.PairGrid(df, y_vars=["Surface"], x_vars=["Left", "Front"], height=4)
g.map(plt.scatter, color=".3")
g.map(sns.lineplot)
#Move X Axis to top
g.invert_yaxis()
g.xaxis.set_ticks_position("top")
I know that there is an option in matplotlib, but trying it in seaborn it gives an error with
AttributeError: 'PairGrid' object has no attribute 'xaxis'