Python Forum
Bar Chart axis - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: Data Science (https://python-forum.io/forum-44.html)
+--- Thread: Bar Chart axis (/thread-31263.html)



Bar Chart axis - Blyzz - Dec-01-2020

I am trying to create a bar chart for statistical parity difference where the value is 0.22222. I am using matplotlib and want to change the x axis to width of the chart so that chart show up in the middle region only. Also want to change the chart color to gray . How can I do that.
Below is my code:
import matplotlib.pyplot as plt
import matplotlib.colors as mcolors

plt.axhline(y=0, color='k')
ax = plt.gca
plt.ylim=((-1,1))

plt.bar(0,-0.2222222222, width=.01)
plt.fill_between(x,0,0.25, color='gray')
plt.legend()
plt.show()