Я смущен, когда вы говорите, что self.__a
- это список - когда я пытаюсь построить список:
In [19]: plt.bar(1,[1,2,3], 0.1, color='#ffcc00')
Я получаю
AssertionError: incompatible sizes: argument 'height' must be length 1 or scalar
Однако, что вы можетесделать это построить ваши значения в цикле:
# Setup code here...
indices = [1,2,3,4]
heights = [1.2, 2.2, 3.3, 4.4]
widths = [0.1, 0.1, 0.2, 1]
types = ['spam', 'rabbit', 'spam', 'grail']
for index, height, width, type in zip(indices, heights, widths, types):
if type == 'spam':
plt.bar(index, height, width, color='#263F6A')
elif type == 'rabbit':
plt.bar(index, height, width, color='#3F9AC9', bottom = self.__arch)
elif type == 'grail':
plt.bar(index, height, width, color='#76787a', bottom = 3)