Skip to content
Advertisement

How can I change the values on the x-axis of my bar plot? [closed]

I have the following dataframe which produces the following plot:

JavaScript

enter image description here

How can I change the x-axis values from 4, 2, 3, 5 to Gen Y, Gen X, Gen Z, and Greatest, respectively. Here is my desired output:

enter image description here

Advertisement

Answer

You can use plt.xticks() to replace the x value for each column like below:

JavaScript

enter image description here

User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement