Skip to content

Instantly share code, notes, and snippets.

@seafooler
Last active November 7, 2019 09:52
Show Gist options
  • Save seafooler/df5dfa0ed56c3ebf338842ebf31ade8c to your computer and use it in GitHub Desktop.
Save seafooler/df5dfa0ed56c3ebf338842ebf31ade8c to your computer and use it in GitHub Desktop.
Example for drawing a line chart 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']
size = np.array([573.5962982,663.0246013,949.9133204,1029.255457,1119.376834,1247.500742,1402.777201,1528.399689,
1694.4369,1915.263185,2212.279345,2985.357858,3109.525989,2787.855024,2710.313029,2778.113192,
2845.668532,3114.45823,3429.272631])
plt.subplots(figsize=(10, 6))
plt.plot(xticks, size, 'H--', label='size')
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