# -*- coding: utf-8 -*- """ Created on Mon Nov 4 07:25:13 2019 @author: Finn Haugen """ import matplotlib.pyplot as plt import numpy as np # Data to be plotted: x = ['Alfa', 'Beta', 'Gamma'] y = np.array([10, 20, 30]) # Size of figure window: fig_width_cm = 24 fig_height_cm = 18 plt.figure(num=1, figsize=(fig_width_cm/2.54, fig_height_cm/2.54)) # Plots a bar graph: plt.bar(x, y, width=0.8, color=('green', 'blue', 'red')) # Plots text on top of each bar using plt.txt(): offset_y = 0.5 for k in range(0, len(x)): plt.text(x[k], y[k]+offset_y, str(y[k])) plt.title('Debt overview') plt.xlabel('Bank name') plt.ylabel('Debt [MNOK]') #plt.show() plt.savefig('bar_graph.pdf')