Limiting the Axis Range of a Subplot
As you've encountered, setting the y-axis range of a subplot is not straightforward. Here's a solution and some additional considerations.
The ylim() Method
To restrict the y-axis range of the second subplot to [0,1000], use the ylim() method after generating the plot:
<code class="python">pylab.plot(abs(fft)) # Plot the data pylab.ylim([0, 1000]) # Set the y-axis range</code>
Note: Ensure that the ylim() command is executed after the plot command.
Other Improvements
pylab.xlabel("Frequency") pylab.ylabel("[abs(FFT)]")
pylab.legend(["Signal"])
The above is the detailed content of How to Control the Y-Axis Range of a Subplot Using ylim()?. For more information, please follow other related articles on the PHP Chinese website!