I have the following code generating a bar graph. However, for the last bar, I need a star marker to show that there is no data for the last bar, here in the graph it's number 10.
data = pd.read_csv('data.csv')
df = pd.DataFrame(data)
plt.figure(figsize=(3,2))
X = list(df.iloc[:, 0])
Y = list(df.iloc[:, 1])
Z= list(df.iloc[:, 2])
X_axis = np.arange(len(X))
plt.bar(X_axis - 0.2, Y, 0.4, label='Actual',color='#436bad')
plt.bar(X_axis 0.2, Z, 0.4, label='Predicted',color='#c5c9c7')
plt.legend(loc=2, prop={'size': 6.5})
labels=['1','2','3','4','5','6','7','8','9','10']
plt.xticks(X,labels,rotation=60)
plt.xlabel("Node no")
plt.ylabel("Accuracy (%)")
plt.ylim(60,95)
CodePudding user response:
I know a very simple approach that could help you:
# You can take the last elements in the 'X' and 'Y'
# lists and then plot a point there
plt.plot(x[-1], y[-1], "*g", markersize=14) # This produces a star marker as desired
# You could also use any other color instead of 'g' for green