Nov-21-2021, 08:40 AM
Here are some changes. For example you can bracket abcissa values or ordinates ones, or you can also implemente Latex formula, and so on. There are many options
import matplotlib.pyplot as plt import numpy as np import os x = np.arange(-4., 4.2, 0.2) y = x**2 Path = str(os.path.abspath('')) fig = plt.figure(figsize=(6, 6)) ax = fig.add_subplot(121) #ax2 = fig.add_subplot(122) #ax.fig(num='This is the title') # Move left y-axis and bottom x-axis to centre, passing through (0,0) ax.spines['left'].set_position('center') ax.spines['bottom'].set_position('zero') # Eliminate upper and right axes ax.spines['right'].set_color('none') ax.spines['top'].set_color('none') # Show ticks in the left and lower axes only ax.xaxis.set_ticks_position('bottom') ax.yaxis.set_ticks_position('left') ax.set_title('Full view') ax.plot(x, y, color='blue', label=r'Parabola $y = x^2$') ax.set(xlim=(-4., 4.), ylim=(0., 20.)) plt.xlabel("X axis") plt.ylabel(r"$Y = x^2$") plt.legend() # plt.show() plt.savefig(Path + '/Fig.png',dpi=300)