Seaborn Scatterplot - Order the X axis lables
NickName:Malintha Ask DateTime:2020-11-10T20:53:15

Seaborn Scatterplot - Order the X axis lables

I have the name of the day of the week on the x-axis of my seaborn scatterplot.

I want to order it according to the following natural order

cats = [ 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday']

I tried following which is working for other plot types:

sns.scatterplot(data=df, x='Day', y='Time', hue='Type', order= cats)

But gives me an error: it seems like order is not in the scatterplot func. How to solve this?

  File "/..lib/python3.7/site-packages/matplotlib/artist.py", line 970, in _update_property
.format(type(self).__name__, k))
 AttributeError: 'PathCollection' object has no property 'order'

Copyright Notice:Content Author:「Malintha」,Reproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/64769301/seaborn-scatterplot-order-the-x-axis-lables

More about “Seaborn Scatterplot - Order the X axis lables” related questions

Seaborn Scatterplot - Order the X axis lables

I have the name of the day of the week on the x-axis of my seaborn scatterplot. I want to order it according to the following natural order cats = [ 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'F...

Show Detail

How to rotate x-axis tick lables in Seaborn scatterplot using subplots

How can I rotate the x-axis tick labels in a Seaborn scatterplot that is plotted using subplots? import pandas as pd import matplotlib.pyplot as plt from matplotlib import gridspec import seaborn a...

Show Detail

Seaborn line across scatterplot

I have a seaborn scatterplot across categories (y-axis) with time on the x-axis: z=sns.scatterplot(data=df], x="transaction_date", y="product_name", hue="source_of_business...

Show Detail

How to set the x-axis in a Seaborn Scatterplot

After plotting my data using seaborn scatterplot, it looks like this. Now in this graph most of the data appears in the year 2013-2017, so i tried to set the x-axis limit to 2013-2017 but i am not ...

Show Detail

Seaborn - ScatterPlot with Average Y-axis

I have written the below code in the seaborn scatterplot for the visual to create sns.scatterplot(x="Year_Birth", y="NumStorePurchases", data=md) I get the plot in the format be...

Show Detail

Seaborn hue Scatterplot breaks when plotting to same axis

I want to highlight peaks detected using scipy.signal.find_peaks() on my Seaborn scatterplot with multiple hues. Whatever I plot on the axis causes the first plot to flatten to a vertical line: sns.

Show Detail

Retrieve color label mapping from a seaborn scatterplot hue

I have the following code to plot my seaborn scatterplot plt.figure(figsize=(120,120)) p1 = sn.scatterplot('tsne1', # Horizontal axis 'tsne2', # Vertical axis data=data, # Data source...

Show Detail

Using Seaborn Catplot scatterplot creates a numerically unordered y-axis

Using this dataset, I tried to make a categorical scatterplot with two mutation types (WES + RNA-Seq & WES) being shown on the x-axis and a small set of numerically ordered numbers spaced apart...

Show Detail

seaborn scatterplot x/y ticks datatype are switched (float values to int, and vice versa)

I'm using seaborn scatterplot to plot engine 'liter' values (float) vs engine 'cylinder' values (integer). There are three 'cylinder' values- 4, 6, and 8. However the ticks for cylinders on the

Show Detail

Sort categorical x-axis in a seaborn scatter plot

I am trying to plot the top 30 percent values in a data frame using a seaborn scatter plot as shown below. The reproducible code for the same plot: import seaborn as sns df = sns.load_dataset('ir...

Show Detail