import matplotlib as mp
import matplotlib.pyplot as plot
import numpy as np
from math import pi
style = {
"axes.linewidth": 3,
"grid.linewidth": 3,
"grid.linestyle": "solid",
"grid.color": "#dadaca",
"lines.linewidth": 3,
"lines.markersize": 10,
"xtick.labelsize": 20,
"ytick.labelsize": 20,
}
for key in style:
mp.rcParams[key]=style[key]
fig = plot.figure()
ax = fig.add_subplot(1, 1, 1)
ax.set_aspect('equal')
color1 = "#707070"
ax.spines['bottom'].set_color(color1)
ax.spines['top'].set_color(color1)
ax.spines['right'].set_color(color1)
ax.spines['left'].set_color(color1)
# ax.spines['left'].set_position('center')
# ax.spines['bottom'].set_position('center')
ax.axhline(y=0, color=color1,zorder=4)
ax.axvline(x=0, color=color1,zorder=4)
# plot.grid(True)
ax.xaxis.grid()
ax.yaxis.grid()
ax.set_axisbelow(True)
ax.xaxis.set_tick_params(width=3,length=4,color=color1)
ax.yaxis.set_tick_params(width=3,length=4,color=color1)
x = np.arange(-2,6,0.01)
plot.axis([-2,6,-2,6])
plot.plot(x,x,color='#a0a0a0',zorder=5,linestyle="dashed")
plot.plot(x,2*x,color='#0000b0',zorder=6)
plot.plot(x,0.5*x,color='#008000',zorder=5)
plot.plot(x,-0.25*x,color='#a00040',zorder=5)
ax.text(1.5,4.2,"f", fontsize=28, style="italic", color="#0000b0")
ax.text(4.2,1.5,"g", fontsize=28, style="italic", color="#008000")
ax.text(4.2,-0.8,"h", fontsize=28, style="italic", color="#a00040")
# plot.show()
plot.savefig("Proportionality.svg",bbox_inches='tight')