Hướng dẫn dùng python loglog python
View Discussion Improve Article Save Article View Discussion Improve Article Save Article Prerequisites: Matplotlib Matplotlib is a comprehensive library for creating interactive, static and animated visualizations in python. Using general-purpose GUI toolkits like wxPython, SciPy, Tkinter or SciPy, it provides an object-oriented API for embedding plots into applications. Matplotlib.pyplot is a collection of functions that makes Matplotlib work like MATLAB. Here, we will be exploring loglog() function of Matplotlib.pyplot. It is used to plot a log scale over both x and y-axis. Syntax: loglog(X,Y) Where, X and Y refer to x and y coordinates respectively. Other function used is linespace(). It returns evenly spaced numbers over a specified interval. Syntax: np.linspace(start, stop, num, endpoint, retstep, dtype, axis) Where,
Example : Without loglog() Python
Output: Example : With loglog() Python3
Output: View Discussion Improve Article Save Article View Discussion Improve Article Save Article Matplotlib is a library in Python and it is numerical – mathematical extension for NumPy library. The Axes Class contains most of the figure elements: Axis, Tick, Line2D, Text, Polygon, etc., and sets the coordinate system. And the instances of Axes supports callbacks through a callbacks attribute. matplotlib.axes.Axes.loglog() FunctionThe Axes.errorbar() function in axes module of matplotlib library is used to make a plot with log scaling on both the x and y axis.
Below examples illustrate the matplotlib.axes.Axes.loglog() function in matplotlib.axes: Example-1:
Output: Example-2:
Output: |