Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Bar Chart axis
#1
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()
Larz60+ write Dec-01-2020, 02:10 PM:
Please post all code, output and errors (it it's entirety) between their respective tags. Refer to BBCode help topic on how to post. Use the "Preview Post" button to make sure the code is presented as you expect before hitting the "Post Reply/Thread" button.

Fixed for you this time. Please use bbcode tags on future posts.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  How matplotlib automatically set x-axis and y-axis limits for bar graph ? ift38375 3 5,528 Jul-04-2019, 08:23 AM
Last Post: scidam

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020