Skip to content

Instantly share code, notes, and snippets.

@seafooler
Last active November 7, 2019 09:51
Show Gist options
  • Save seafooler/14f3a7b4ea42299d9b0990c53894e160 to your computer and use it in GitHub Desktop.
Save seafooler/14f3a7b4ea42299d9b0990c53894e160 to your computer and use it in GitHub Desktop.
Example for drawing a bar in Python
import matplotlib.pyplot as plt
import numpy as np
xticks = ['15-1','15-2','15-3','15-4','16-1','16-2','16-3','16-4',
'17-1','17-2','17-3','17-4','18-1','18-2','18-3','18-4','19-1','19-2','19-3']
cnt = np.array([17.17646221,19.43652252,30.54252321,32.78014989,34.46738787,37.55476953,40.99359145,42.65602493,
45.62631487,50.40547517,51.19912708,55.64568829,57.58204446,51.35193284,49.39556185,50.08214678,
50.84948824,55.20547267,60.22801956])
plt.subplots(figsize=(10, 6))
plt.bar(xticks, cnt)
plt.xlabel('XXXXXX',fontsize = 'large')
plt.ylabel('YYYYYY', fontsize = 'large')
plt.tight_layout()
plt.savefig("test.png")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment