Advertisement
RajibHossen

multi lines chart

May 20th, 2022
719
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import matplotlib.pyplot as plt
  2. import matplotlib.font_manager
  3. import numpy as np
  4.  
  5. plt.rcParams.update({"font.size": 40})
  6. plt.rcParams.update({"font.weight": 'bold'})
  7. plt.rcParams.update({"font.family": 'Palatino Linotype'})
  8.  
  9. def ts_ss_merged_cost_from_optimum():
  10.     # plt.figure(figsize=(10, 6))
  11.     fig, ax = plt.subplots(figsize=(8, 6))
  12.     plt.grid(zorder=1, color='#999999', linestyle='--', alpha=0.4)
  13.  
  14.     ts_cost_from_optimum = [1.00, 1.10, 1.21, 1.33, 1.46, 1.6, 1.7]
  15.     ts_response = [895.2426314, 773.5780168, 722.6832199, 598.5705376, 525.2256989, 500.1245, 480.32]
  16.     ts_response_normalized = np.divide(ts_response, 900)
  17.  
  18.     ss_response = [249, 240.8825427, 219.3213886, 209.1821135, 195.189519, 183.1074663, 169.9133813, 165.0975195,
  19.                    155.6659093]
  20.     ss_response = np.divide(ss_response, 250)
  21.     ss_resource = [1, 1.114945092, 1.241382164, 1.374588561, 1.494256309, 1.579441219, 1.666670498, 1.79310757,
  22.                    2.137935949]
  23.  
  24.     hr_response = [49.8, 26.8, 17.2, 16.88, 16.96, 16.66, 16.6]
  25.     hr_resource = [9.4, 9.8, 10.5, 11.7, 12.3, 13.4, 15.2]
  26.     hr_resource = np.divide(hr_resource, 9.4)
  27.     hr_response = np.divide(hr_response, 50)
  28.  
  29.     plt.plot(ts_cost_from_optimum, ts_response_normalized, color="#00bbd6", linewidth=4, marker='d', zorder=5,
  30.              markersize=10, markeredgecolor="#00bbd6", label="Train Ticket")
  31.     plt.plot(ss_resource, ss_response, color="#faa32b", linewidth=4, marker='s', zorder=5, markersize=10,
  32.              markeredgecolor="#faa32b", label="Sock Shop")
  33.     plt.plot(hr_resource, hr_response, color='#237194', linewidth=4, marker='o', zorder=5, markersize=10,
  34.              markeredgecolor='#237194', label="Hotel Reserve")
  35.  
  36.     plt.xticks(np.arange(1.0, 2.3, 0.2))
  37.     plt.yticks(np.arange(0.0, 1.05, 0.2))
  38.     plt.ylim(ymax=1.05)
  39.     # plt.xlim(xmin=0.95)
  40.     plt.xlabel("Normalized Resource", weight='bold')
  41.     plt.ylabel("Normalized Response", weight='bold')
  42.     ax.yaxis.set_label_coords(-0.13, .4)
  43.     plt.legend(loc='lower left', ncol=2, frameon=False, fontsize=30, borderaxespad=0.05, handlelength=0.8, handletextpad=0.2, columnspacing=0.6)
  44.     plt.tight_layout(pad=0.0, h_pad=0.0, w_pad=0.0)
  45.     plt.savefig("figures/ts_ss_dr_vs_cost_from_optimum.png", bbox_inches='tight', pad_inches=0)
  46.     plt.show()
  47.  
  48.  
Advertisement
RAW Paste Data Copied
Advertisement