1import matplotlib.pyplot as plt
2import numpy as np
3
4# 100 linearly spaced numbers
5x = np.linspace(0,1,10)
6eta1=0.05
7eta2=0.1
8lmd1= 2.8
9# the function, which is y = x^2 here
10y = 0.5*(-(1/3)*eta1*x**2 + np.sqrt( ((1/3)*eta1*x**2)**2-4*(3*x**2*2.8**2-1))
11
12# setting the axes at the centre
13fig = plt.figure()
14ax = fig.add_subplot(1, 1, 1)
15ax.spines['left'].set_position('center')
16ax.spines['bottom'].set_position('zero')
17ax.spines['right'].set_color('none')
18ax.spines['top'].set_color('none')
19ax.xaxis.set_ticks_position('bottom')
20ax.yaxis.set_ticks_position('left')
21
22# plot the function
23plt.plot(x,y, 'r')
24
25# show the plot
26plt.show()