How can I change the x-axis labels of an ocean violin plot without going back and changing the data?


Efren M

I have the following seaborn fiddle plot:

sns.violinplot( x=c1_census['Cluster Labels'], y=c1_census['Land Area (km2)'],palette=my_pal)
plt.show()

enter image description here

How can I change the labels of the x-axis without going back and changing the data. E.g:

Replace 0 for A, 1 for B, 2 for C, 3 for D, 4 for E

Thanks in advance!

Scott Boston

You can use ax.set_xticklabels:

ax = sns.violinplot( x=c1_census['Cluster Labels'], y=c1_census['Land Area (km2)'],palette=my_pal)
ax.set_xticklabels([*'ABCDE'])

Related


ggplot change x-axis labels without changing underlying data

username I am plotting polygons and discrete data on the x-axis. How can I change the x-axis labels without changing the underlying data ? That is, instead of the tags read, "a","b","c","d"they should be read "Lab 1","Lab 2","Lab 3","Lab 4". df <- data.frame(x

ggplot change x-axis labels without changing underlying data

username I am plotting polygons and discrete data on the x-axis. How can I change the x-axis labels without changing the underlying data ? That is, instead of the tags read, "a","b","c","d"they should be read "Lab 1","Lab 2","Lab 3","Lab 4". df <- data.frame(x

ggplot change x-axis labels without changing underlying data

username I am plotting polygons and discrete data on the x-axis. How can I change the x-axis labels without changing the underlying data ? That is, instead of the tags read, "a","b","c","d"they should be read "Lab 1","Lab 2","Lab 3","Lab 4". df <- data.frame(x

How can I set the x-axis range of an ocean dot plot?

Room F76 I created one pointplot()and cannot change the x-axis limits. Although my data only contains 9 months, I want to show all 12 months on the axis. fig,ax = plt.subplots(figsize=(12,4)) sns.pointplot(data=tr_df, x='Month', y='numOfTrips', hue='Year', ax=

How can I set the x-axis range of an ocean dot plot?

Room F76 I created one pointplot()and cannot change the x-axis limits. Although my data only contains 9 months, I want to show all 12 months on the axis. fig,ax = plt.subplots(figsize=(12,4)) sns.pointplot(data=tr_df, x='Month', y='numOfTrips', hue='Year', ax=

How can I set the x-axis range of an ocean dot plot?

Room F76 I created one pointplot()and cannot change the x-axis limits. Although my data only contains 9 months, I want to show all 12 months on the axis. fig,ax = plt.subplots(figsize=(12,4)) sns.pointplot(data=tr_df, x='Month', y='numOfTrips', hue='Year', ax=

How to rename x labels in violin plot?

Twill I made a violin plot and want to rename the x-labels. ax = sns.violinplot(x="Week_Number", y="Ammonia", data=Res) Here is the output: I want, not 1, I want week 1 , not 44, I want 2weeks until week 10 to52. thank you all Alexander B You are looking fo

How to rename x labels in violin plot?

Twill I made a violin plot and want to rename the x-labels. ax = sns.violinplot(x="Week_Number", y="Ammonia", data=Res) Here is the output: I want, not 1, I want week 1 , not 44, I want 2weeks until week 10 to52. thank you all Alexander B You are looking fo

Change axis labels after drawing violin plot on FacetGrid

j My plot is shown below and my code is here g = sns.FacetGrid(teacherValueFinal3, row='Grade Level', col='Course',margin_titles=True) g1=g.set_titles("gg") g1.map(sns.violinplot, '2013-2014 Assessment Score', 'Gender', color="RdBu") It seems that seaborn's d

Change axis labels after drawing violin plot on FacetGrid

j My plot is shown below and my code is here g = sns.FacetGrid(teacherValueFinal3, row='Grade Level', col='Course',margin_titles=True) g1=g.set_titles("gg") g1.map(sns.violinplot, '2013-2014 Assessment Score', 'Gender', color="RdBu") It seems that seaborn's d

How can I invert the x-axis without changing the image?

Menadione In MATLAB, I want to invert my x-axis, but I actually don't want to invert the image/graph while doing this. I want the image/graph to stay the same, and I simply reverse the x-axis ticks. iron ion x=0:10; y=x.^2; plot(x,y); set(gca,'XTickLabel',fli

How can I invert the x-axis without changing the image?

Menadione In MATLAB, I want to invert my x-axis, but I actually don't want to invert the image/graph while doing this. I want the image/graph to stay the same, and I simply reverse the x-axis ticks. iron ion x=0:10; y=x.^2; plot(x,y); set(gca,'XTickLabel',fli

Seaborn violin plot not aligned with x-axis labels

Phil I'm trying to draw a violin plot to illustrate depth on the y-axis and distance from a known point on the x-axis. I am able to get the x-axis labels to distribute appropriately on the x-axis based on variable distances, but I am not able to get a violin p

Seaborn violin plot not aligned with x-axis labels

Phil I'm trying to draw a violin plot to illustrate depth on the y-axis and distance from a known point on the x-axis. I am able to get the x-axis labels to distribute appropriately on the x-axis based on variable distances, but I am not able to get a violin p

Seaborn violin plot not aligned with x-axis labels

Phil I'm trying to draw a violin plot to illustrate depth on the y-axis and distance from a known point on the x-axis. I am able to get the x-axis labels to distribute appropriately on the x-axis based on variable distances, but I am not able to get a violin p

Seaborn violin plot not aligned with x-axis labels

Phil I'm trying to draw a violin plot to illustrate depth on the y-axis and distance from a known point on the x-axis. I am able to get the x-axis labels to distribute appropriately on the x-axis based on variable distances, but I am not able to get a violin p

Seaborn violin plot not aligned with x-axis labels

Phil I'm trying to draw a violin plot to illustrate depth on the y-axis and distance from a known point on the x-axis. I am able to get the x-axis labels to distribute appropriately on the x-axis based on variable distances, but I am not able to get a violin p

Seaborn violin plot not aligned with x-axis labels

Phil I'm trying to draw a violin plot to illustrate depth on the y-axis and distance from a known point on the x-axis. I am able to get the x-axis labels to distribute appropriately on the x-axis based on variable distances, but I am not able to get a violin p