Matplotlib.pyplot.xscale() function in Python (original) (raw)
Last Updated : 05 Jun, 2020
Matplotlib is a library in Python and it is numerical – mathematical extension for NumPy library. Pyplot is a state-based interface to a Matplotlib module which provides a MATLAB-like interface. There are various plots which can be used in Pyplot are Line Plot, Contour, Histogram, Scatter, 3D Plot, etc.
matplotlib.pyplot.xscale() function
The xscale() function in pyplot module of matplotlib library is used to set the x-axis scale.
Syntax: matplotlib.pyplot.xscale(value, \*\*kwargs)
Parameters: This method accept the following parameters that are described below:
- value: This parameter is the axis scale type to apply.
- **kwargs: There are different keyword arguments which are accepted and its depend on the scale.
Returns: This method does not returns any value.
Below examples illustrate the matplotlib.pyplot.xscale() function in matplotlib.pyplot:
Example 1:
Python3 `
Implementation of matplotlib function
import matplotlib.pyplot as plt import numpy as np from matplotlib.ticker import EngFormatter
val = np.random.RandomState(19680801) xs = np.logspace(1, 9, 100) ys = (0.8 + 4 * val.uniform(size = 100)) * np.log10(xs)**2
plt.xscale('log') plt.plot(xs, ys) plt.xlabel('Frequency')
plt.title('matplotlib.pyplot.xscale()
function Example\n', fontweight ="bold")
plt.show()
`
Output:
Example 2:
Python3 `
Implementation of matplotlib function
import numpy as np import matplotlib.pyplot as plt
fig, ax4 = plt.subplots()
x = 10.0np.linspace(0.0, 2.0, 15) y = x2.0 plt.xscale("log", nonposx ='clip') plt.yscale("log", nonposy ='clip')
plt.errorbar(x, y, xerr = 0.1 * x,
yerr = 2.0 + 1.75 * y,
color ="green")
plt.ylim(bottom = 0.1)
plt.title('matplotlib.pyplot.xscale()
function Example\n', fontweight ="bold")
plt.show()
`
Output:
Similar Reads
- Matplotlib.pyplot.setp() function in Python Matplotlib is a library in Python and it is numerical – mathematical extension for NumPy library. Pyplot is a state-based interface to a Matplotlib module which provides a MATLAB-like interface. There are various plots which can be used in Pyplot are Line Plot, Contour, Histogram, Scatter, 3D Plot, 2 min read
- Matplotlib.pyplot.suptitle() function in Python Matplotlib is a library in Python and it is a mathematical extension for NumPy library. Pyplot is a state-based interface to a Matplotlib module which provides a MATLAB-like interface. matplotlib.pyplot.suptitle() Function The suptitle() function in pyplot module of the matplotlib library is used to 3 min read
- matplotlib.pyplot.semilogy() function in Python Matplotlib is the most popular and Python-ready package that is used for visualizing the data. We use matplotlib for plotting high-quality charts, graphs, and figures. matplotlib.pyplot.semilogy() Function The matplotlib.pyplot.semilogy() function in pyplot module of matplotlib library is used to ma 2 min read
- Matplotlib.pyplot.yscale() in Python Matplotlib Is a library in Python and it is a numerical - mathematical extension for the NumPy library. Pyplot Is a state-based interface to a Matplotlib module which provides a MATLAB-like interface. matplotlib.pyplot.yscale() in Python The matplotlib.pyplot.yscale() function in pyplot module of ma 2 min read
- Matplotlib.pyplot.sca() in Python Matplotlib is a library in Python and it is numerical – mathematical extension for NumPy library. Pyplot is a state-based interface to a Matplotlib module which provides a MATLAB-like interface. There are various plots which can be used in Pyplot are Line Plot, Contour, Histogram, Scatter, 3D Plot, 1 min read
- Matplotlib.pyplot.pcolor() function in Python Matplotlib is the well-known Python package used in data visualization. Numpy is the numerical mathematics extension of Matplotlib. Matplotlib is capable of producing high-quality graphs, charts, and figures. Matplotlib produces object-oriented API for embedding plots into projects using GUI toolkit 2 min read
- Matplotlib.pyplot.hexbin() function in Python Matplotlib is a library in Python and it is numerical – mathematical extension for NumPy library. Pyplot is a state-based interface to a Matplotlib module which provides a MATLAB-like interface. There are various plots which can be used in Pyplot are Line Plot, Contour, Histogram, Scatter, 3D Plot, 2 min read
- Matplotlib.pyplot.figimage() function in Python Matplotlib is a widely used library in Python for plotting various graphs, as it provides very efficient ways and easy to understand methods for complex plots also. pyplot is a collection of command style functions that make matplotlib work like MATLAB. figimage() function matplotlib.pyplot.figimage 2 min read
- Matplotlib.pyplot.sci() in Python Matplotlib is a library in Python and it is numerical - mathematical extension for NumPy library. Pyplot is a state-based interface to a Matplotlib module which provides a MATLAB-like interface. There are various plots which can be used in Pyplot are Line Plot, Contour, Histogram, Scatter, 3D Plot, 2 min read
- Matplotlib.pyplot.autumn() in Python Matplotlib is a library in Python and it is numerical - mathematical extension for NumPy library. Pyplot is a state-based interface to a Matplotlib module which provides a MATLAB-like interface. There are various plots which can be used in Pyplot are Line Plot, Contour, Histogram, Scatter, 3D Plot, 2 min read