Answers for "How to set limit to the y axis values in matplotlib"

1

limit axis matplotlib

plt.xlim(0, 100)
Posted by: Guest on April-27-2020
0

matplotlib set axis limits

import matplotlib.pyplot as plt
import numpy as np

fig = plt.figure()
fig.set_size_inches(8, 8)
ax = fig.add_axes([0.15,0.2,0.7,0.7]) 

x = np.arange(0, 100, 0.1)
y = np.sin(x)

ax.plot(x,y, color='blue', label='Sine wave')

#Set axis limits
ax.set_xlim([25, 50])
ax.set_ylim([-1, 1])

plt.show()
Posted by: Guest on May-04-2021

Code answers related to "How to set limit to the y axis values in matplotlib"

Python Answers by Framework

Browse Popular Code Answers by Language