I have got these 2 {ndarray}
which has 3 values of Positive, Negative and Neutral score.
>>>y1
array([82, 80, 63])
>>>y2
array([122, 73, 30])
For same I need y1[0]
and y2[0]
to be plotted together as they are corresponding as positive values, same goes with other 2 values from each array.
I tried this:
import matplotlib.pyplot as plt
import numpy as np
def biplt(groundTruth, predictedValues, plt_name='<name>'):
gt = groundTruth
pr = predictedValues
x = np.arange(2)
y1, y2 = gt.values, pr.values
fig, axes = plt.subplots(ncols=1, nrows=1)
width = 0.20
plt.title('%s\n Accuracy Score' % plt_name)
plt.xlabel('Parameters')
plt.ylabel('Score')
axes.bar(x, y1, width, label="Algorithm 1")
axes.bar(x + width, y2, width, color=list(plt.rcParams['axes.prop_cycle'])[2]['color'], label="Algorithm 2")
axes.set_xticks(x + width)
axes.set_xticklabels(['Positive', 'Negative'])
plt.legend()
plt.show()
Which has resulted into ValueError
, check below:
ValueError: shape mismatch: objects cannot be broadcast to a single shape
I'm unable to diagnose with possible shape is of problem