Labeling axes in python

Formatting Axes in Python-Matplotlib

Matplotlib is a python library for creating static, animated and interactive data visualizations.

Note: For more information, refer to Introduction to Matplotlib

What is Axes?

This is what you think of as ‘plot’. It is the region of the image that contains the data space. The Axes contains two or three-axis(in case of 3D) objects which take care of the data limits. Below is an image illustrating the different parts of a figure which contains the graph.

The different aspects of the Axes can be changed according to the requirements.

1. Labelling x, y-Axis

for x-axis
Axes.set_xlabel(self, xlabel, fontdict=None, labelpad=None, \*\*kwargs)

for y-axis
Axes.set_ylabel(self, ylabel, fontdict=None, labelpad=None, \*\*kwargs)

These functions are used to name the x-axis and y-axis.

Output:

2. Limits of x, y-Axis

Оцените статью