Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python
- # coding: utf-8
- import matplotlib.pyplot as plt
- import numpy as np
- import matplotlib.ticker as mtick
- objects = ('Republika', 'Sovětská Lidová Republika')
- y_pos = np.arange(len(objects))
- performance = [100, 140]
- plt.bar(y_pos, performance, align='center')
- plt.xticks(y_pos, objects)
- plt.gca().yaxis.set_major_formatter(mtick.PercentFormatter())
- plt.title('Plnění plánu')
- plt.ylim(95, 150)
- plt.savefig('plan.png')
- plt.show()
- objects = ('Republika', 'Sovětská Lidová Republika')
- y_pos = np.arange(len(objects))
- performance = [1, 1.5]
- plt.bar(y_pos, performance, align='center')
- plt.xticks(y_pos, objects)
- #plt.gca().yaxis.set_major_formatter(mtick.PercentFormatter())
- plt.title('Počet obyvatel per capita')
- #plt.ylim(95, 150)
- plt.savefig('per capita.png')
- plt.show()
- objects = ('Republika', 'Sovětská Lidová Republika')
- y_pos = np.arange(len(objects))
- performance = [1, 1.5]
- #plt.bar(y_pos, performance, align='center')
- #plt.xticks(y_pos, objects)
- plt.plot([2, 2, 2, 2, 2, 2])
- plt.plot([2, 2**2, 2**3, 2**4, 2**5, 2**6])
- #plt.gca().yaxis.set_major_formatter(mtick.PercentFormatter())
- plt.title('Spokojenost obyvatel, index štěstí, ve dnech od založení')
- plt.legend(objects)
- #plt.ylim(95, 150)
- plt.savefig('happines.png')
- plt.show()
- labels = ['Lid']
- sizes = [100]
- #explode = (0, 0.1, 0, 0) # only "explode" the 2nd slice (i.e. 'Hogs')
- fig1, ax1 = plt.subplots()
- ax1.pie(sizes, labels=labels, autopct='%1.f%%',
- shadow=True, startangle=90, colors=['red'])
- ax1.axis('equal') # Equal aspect ratio ensures that pie is drawn as a circle.
- plt.title('Průzkum volebních preferencí')
- plt.savefig('pie.png')
- plt.show()
- labels = ['Lid']
- sizes = [100]
- #explode = (0, 0.1, 0, 0) # only "explode" the 2nd slice (i.e. 'Hogs')
- fig1, ax1 = plt.subplots()
- ax1.pie(sizes, labels=labels, autopct='%1.f%%',
- shadow=True, startangle=90, colors=['red'])
- ax1.axis('equal') # Equal aspect ratio ensures that pie is drawn as a circle.
- plt.title('Rozložení etnické příslušnosti')
- plt.savefig('pie_race.png')
- plt.show()
- objects = ['Těžký prům.', 'Civilní prům.', 'Zemědělství', 'Služby', 'Doprava', 'Volby',
- 'Chemický prům.', 'Energetika', 'Plodnost']
- y_pos = np.arange(len(objects))
- performance = [100] * len(objects)
- plt.bar(y_pos, performance, align='center', color='r')
- plt.xticks(y_pos, objects)
- plt.gca().yaxis.set_major_formatter(mtick.PercentFormatter())
- plt.xticks(rotation=40)
- plt.title('Míra automatizace')
- plt.savefig('automa.png')
- plt.show()
- objects = ('Republika', 'Sovětská Lidová Republika')
- y_pos = np.arange(len(objects))
- performance = [1, 1.5]
- #plt.bar(y_pos, performance, align='center')
- #plt.xticks(y_pos, objects)
- plt.plot((5+8*np.random.rand(50)).tolist()+np.zeros(50).tolist())
- plt.gca().yaxis.set_major_formatter(mtick.PercentFormatter())
- plt.gca().axvline(50, color='r')
- ymin, ymax = plt.ylim()
- arrowprops=dict(
- width=3,
- headwidth=10,
- headlength=5,
- color='r'
- )
- plt.gca().annotate('Revoluce', xy=(50, ymax-1), xytext=(60, -30), textcoords='offset points',
- rotation=0, va='bottom', ha='center', annotation_clip=False, arrowprops=arrowprops)
- plt.title('Vývoj nezaměstnanosti')
- #plt.ylim(95, 150)
- plt.savefig('unemployment.png')
- plt.show()
Advertisement
Add Comment
Please, Sign In to add comment