Monday, October 6, 2025
HomeLanguagesMatplotlib.axes.Axes.get_yscale() in Python

Matplotlib.axes.Axes.get_yscale() 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.

matplotlib.axes.Axes.get_yscale() Function

The Axes.get_yscale() function in axes module of matplotlib library is used to get the y-axis scale as string.

Syntax: Axes.get_yscale(self)

Parameters: This method does not accepts any parameters.

Return: This function return the y-axis scale as a string.

Below examples illustrate the matplotlib.axes.Axes.get_yscale() function in matplotlib.axes:

Example 1:




# Implementation of matplotlib function
import matplotlib.pyplot as plt
import numpy as np
     
fig, ax = plt.subplots()
  
ax.plot([1, 2, 3])
  
w = ax.get_yscale()
  
ax.set_title("yscale property : "+ str(w),
             fontweight ="bold")
fig.suptitle('matplotlib.axes.Axes.get_yscale() \
function Example\n', fontweight ="bold")
fig.canvas.draw()
plt.show()


Output:

Example 2:




# Implementation of matplotlib function
import matplotlib.pyplot as plt
  
fig, ax = plt.subplots()
  
ax.set_yscale("log")
ax.set_adjustable("datalim")
ax.plot([1, 3, 10], [1, 9, 100], "o-", color ="green")
ax.set_ylim(1e-1, 1e3)
ax.set_aspect(1)
w = ax.get_yscale()
ax.set_title(str(w)+" is the yscale property",
             fontweight ="bold")
fig.suptitle('matplotlib.axes.Axes.get_yscale()\
 function Example\n', fontweight ="bold")
  
plt.show()


Output:

Dominic
Dominichttp://wardslaus.com
infosec,malicious & dos attacks generator, boot rom exploit philanthropist , wild hacker , game developer,
RELATED ARTICLES

Most Popular

Dominic
32338 POSTS0 COMMENTS
Milvus
86 POSTS0 COMMENTS
Nango Kala
6708 POSTS0 COMMENTS
Nicole Veronica
11872 POSTS0 COMMENTS
Nokonwaba Nkukhwana
11936 POSTS0 COMMENTS
Shaida Kate Naidoo
6827 POSTS0 COMMENTS
Ted Musemwa
7090 POSTS0 COMMENTS
Thapelo Manthata
6780 POSTS0 COMMENTS
Umr Jansen
6783 POSTS0 COMMENTS