0

I have been practicing on a DataFrame and I have a big problem. Here is my original code that create a group bar graph:

import pandas as pd
import matplotlib.pyplot as plt
import numpy as np

df = pd.read_csv(r'C:\Users\admin\Desktop\Customer_list_practice.csv')

print(df)

# set width of bar
barwidth = 0.5

# Plot the graph
df.plot(x="Customer_No", y=["Jan", "Feb", "Mar", "Apr", "May"], kind="bar", width = barwidth, figsize = (20,20), stacked=False)
plt.legend(fontsize=20) # using a size in points

Here are the results:

For print(df): 1

For df.plot:

2

(This image should show the graph of each customers for the last 5 months)

My goal is now to add labels for all bar graphs in the grouped bar graph and they must be on top of each bar graphs for each customers.

At the same time, I want to add Reference Line Pointers at all ticks of the Y-axis for easy tracing and add a thick line at the x-axis where y = 0.

My coding skills are so bad since I am a beginner. Hope to receive a favorable reply soon. Thanks!

Quang Hoang
  • 146,074
  • 10
  • 56
  • 74
Thad
  • 11
  • 4
  • Do not put the image of `print(df)`, copy the output and paste to the question insted. – Quang Hoang Jul 13 '22 at 02:24
  • For bar labels, see [this question](https://stackoverflow.com/questions/43214978/how-to-display-custom-values-on-a-bar-plot/43219008#43219008) – Quang Hoang Jul 13 '22 at 02:27
  • I understand. But, the thing is that I have searched the internet for answers for more than a day. I have even tired to copy them into my code to try out. However, it does not seem to work. – Thad Jul 13 '22 at 02:56

0 Answers0