I want to plot a number of curves for different models. I have curves for different structures. The structures need to have the same color and the different models a different linestyle. I then want 2 legends, one with the colors corresponding to the structures and one with the linestyles. This is the code that I already have:
plt.figure(figsize=(12,8))
styles = ['-', '--']
colors = ['blue', 'orange', 'green', 'red', 'purple', 'brown', 'pink', 'grey']
plans = ['Clinical', 'AP']
for j, plan in enumerate(plans):
for i, structure in enumerate(structures_dvh):
# for i, structure in enumerate(structure_test):
if plan == 'Clinical':
mean_dose, mean_volume = compute_mean_dvh(Lung_R2_adap, structure)
plt.plot(mean_dose, mean_volume, label = structure, c = colors[i], ls = styles[j])
elif plan == 'AP':
mean_dose, mean_volume = compute_mean_dvh(Lung_AP, structure)
plt.plot(mean_dose, mean_volume, c = colors[i], ls = styles[j])
elif plan == 'PS':
mean_dose, mean_volume = compute_mean_dvh(Lung_PS, structure)
plt.plot(mean_dose, mean_volume, c = colors[i], ls = styles[j])
# plt.legend(handles = linestyle_legend_handles, loc = 'lower left')
plt.legend(loc = 'lower center', bbox_to_anchor=(0.5, -0.25), fancybox=True, shadow=True, ncol=3)
plt.title('Mean DVH')
plt.xlabel('Relative dose')
plt.ylabel('Volume [%]')
plt.grid(True)
plt.tight_layout()
plt.show()