import matplotlib.pyplot as plt import numpy as np x1 = np.linspace(-1,0) x2 = np.linspace(0,1) y1 = -x1 y2 = 2*x2 plt.figure(figsize=(8,3)) plt.plot(x1,y1,'r:',lw=3,label='y=-x') plt.plot(x2,y2,'b-',lw=3,label='y=2x') plt.plot([0],[0],'o',color='orange',markersize=10,label='Optimal') plt.grid(); plt.legend() plt.savefig('conditional.png',dpi=600) plt.show()