Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Libraries
- import numpy as np
- from matplotlib import rcParams, pyplot as plt
- import random
- # Plot parameters
- def plot_params():
- params = {
- 'font.family' : 'sans-serif',
- 'font.sans-serif' : 'Calibri',
- 'axes.labelsize': 24,
- 'axes.labelweight': "bold",
- 'axes.titlesize': 24,
- 'axes.titleweight': "bold",
- 'font.size': 24,
- 'font.weight': "bold",
- 'legend.fontsize': 24,
- 'xtick.labelsize': 24,
- 'ytick.labelsize': 24,
- 'text.usetex': False,
- 'figure.figsize': [6*1.5, 3.7082*1.5]
- }
- rcParams.update(params)
- plot_params()
- # Data
- data_1 = random.sample(range(1, 100), 20)
- data_2 = random.sample(range(1, 200), 20)
- data_3 = random.sample(range(1, 300), 20)
- # Plot
- fig = plt.figure()
- ax = fig.add_subplot()
- plt.plot(np.sort(data_1), color = 'red', label = "data 1", marker = 'o', markersize = 8, linestyle = 'solid', linewidth = 3)
- plt.plot(np.sort(data_2), color = 'green', label = "data 2", marker = 'o', markersize = 8, linestyle = 'solid', linewidth = 3)
- plt.plot(np.sort(data_3), color = 'mediumblue', label = "data 3", marker = 'o', markersize = 8, linestyle = 'solid', linewidth = 3)
- plt.xlabel("Data Points", fontsize=24)
- plt.ylabel("Data Values", fontsize=24)
- plt.xticks([0, 4, 9, 14, 19], [1, 5, 10, 15, 20])
- plt.text(0.02, 0.95, '(a)', transform=ax.transAxes, fontsize=24, fontweight='bold', va='top')
- plt.legend(prop={'size': 24}, loc='upper left', bbox_to_anchor=(0.07, 0., 0.92, 1.02))
- plt.savefig("python_graph.png", format='png', bbox_inches='tight', dpi=720)
- plt.savefig("python_graph.eps", format='eps', bbox_inches='tight', dpi=720)
- plt.show()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement