I need to creat a single figure with some subplots. The figure must look exactly like below:
I'm having a problem to plot the second graph, I don't know how to get a "zoom" from the other graph, I was using tricks but if I use this to generate the second graph, doesn't work. How can I plot? This is what I did:
import matplotlib.pyplot as plt
def plot_graph():
x = list(range(0,1000))
y1 = [10*a-4 for a in x]
y2 = [a**2 for a in x]
plt.subplot2grid((2,2), (0,0))
plt.plot(x,y1,y2)
plt.xticks(list(range(0,120,20)), labels=[0,200,400,600,800,1000])
plt.xlim(0,100)
plt.yticks([1,100,1000,10000,100000])
plt.ylim(1,100000)
plt.grid(True)
plt.plot(x,y1, "r-", label = "y=10.x-4")
plt.plot(x,y2, "g-", label = "y=x²")
plt.legend(loc = "lower right")
plt.yscale('log')
plt.xlabel('X')
plt.ylabel('Y')
plt.title('Functions:')
plt.subplot2grid((2,2), (0,1))
plt.plot(x,y1,y2)
plt.grid(True)
plt.plot(x,y1, "r-")
plt.plot(x,y2, "g-")
plt.yscale('log')
plt.title('Intersection:')
plot_graph()