How do I get the state name to show in x-axis instead of the numbers and how can I display the chart with different colors. margin of victory by state:
Asked
Active
Viewed 112 times
1 Answers
0
You can use the xticks
function to change the x-axis labels. In your case, this would look something like this:
plt.xticks(locs=list(range(37)), labels=[list of state names goes here])
Documentation here.

hoffee
- 470
- 3
- 16
-
Thank Hoffee, It works now with this line plt.xticks(range(37), [list of state names goes here]) plt.show() – Ola Jul 15 '18 at 11:08