Matplotlib automatically fits the complete data range in the input data for both the x and the y axis, splits it into bins, and displays ticks and ticklabels accordingly. At times, we may want to see a specific range of data more closely on either of the axes, instead of a complete range of data. In this recipe, we will learn how to do this.
Using autoscale and axis limits
Getting ready
Let's import the required libraries:
import numpy as np
import matplotlib.pylab as plt
from matplotlib.ticker import FuncFormatter
How to do it...
The following code displays two plots...