Matplotlib.axes.Axes.get_data_ratio() in Python Last Updated : 30 Apr, 2020 Summarize Comments Improve Suggest changes Share Like Article Like Report 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.get_data_ratio() Function The Axes.get_data_ratio() function in axes module of matplotlib library is used to get the aspect ratio of the raw data. Syntax: Axes.get_data_ratio(self) Parameters: This method does not accepts any parameter. Returns: This method return the aspect ratio of the raw data. Below examples illustrate the matplotlib.axes.Axes.get_data_ratio() function in matplotlib.axes: Example 1: Python3 # Implementation of matplotlib function import matplotlib.pyplot as plt import numpy as np fig, ax1 = plt.subplots() x = np.random.randn(20, 50) x[12, :] = 0. x[:, 22] = 0. ax1.spy(x) ax1.set_title("Value Return by get_data_ratio : " +str(ax1.get_data_ratio())+"\n") fig.suptitle('matplotlib.axes.Axes.get_data_ratio() \ Example') plt.show() Output: Example 2: Python3 # Implementation of matplotlib function import matplotlib.pyplot as plt import numpy as np fig, [(ax1, ax2), (ax3, ax4)] = plt.subplots(2, 2) x = np.random.randn(20, 50) x[5, :] = 0. x[:, 12] = 0. ax1.spy(x, markersize = 4) ax2.spy(x, precision = 0.2, markersize = 4) ax3.spy(x) ax4.spy(x, precision = 0.4) ax1.set_title("Value Return by get_data_ratio : " +str(ax1.get_data_ratio())+"\n") ax2.set_title("Value Return by get_data_ratio : " +str(ax2.get_data_ratio())+"\n") ax3.set_title("Value Return by get_data_ratio : " +str(ax3.get_data_ratio())+"\n") ax4.set_title("Value Return by get_data_ratio : " +str(ax4.get_data_ratio())+"\n") fig.suptitle('matplotlib.axes.Axes.get_data_ratio\ Example') plt.show() Output: Comment More infoAdvertise with us Next Article Matplotlib.axes.Axes.get_xlim() in Python S SHUBHAMSINGH10 Follow Improve Article Tags : Python Write From Home Python-matplotlib Matplotlib axes-class Practice Tags : python Similar Reads Matplotlib.axes.Axes.get_xaxis() in Python 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. 1 min read Matplotlib.axes.Axes.get_yaxis() in Python 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. 1 min read Matplotlib.axes.Axes.get_rasterized() in Python 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. 2 min read Matplotlib.axes.Axes.get_xlim() in Python 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. 2 min read Matplotlib.axes.Axes.get_ylim() in Python 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. 2 min read Matplotlib.axes.Axes.has_data() in Python 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. 2 min read Like