Setting Plot Parameters | Scatter Plots
Visualization in Python with matplotlib

## Setting Plot Parameters

Sometimes we may need to focus on a certain part of the plot. One of the ways is to filter the observations we use for plot building. But what if we don't want to modify the data we work with? The answer is simple - we can modify the chart.

To set the chart limits we use `.set()` function applied to `Axes` object (usually named `ax`). This function has the following parameters (but not only):

• `xlim`, `ylim` - tuple with minimum and maximum value to be displayed on x or y-axis respectively;
• `xticks`, `yticks` - list/array with ticks to be displayed on x or y-axis respectively;
• `xlabel`, `ylabel` - string with the text to be displayed on x or y-axis respectively;
• `title` - string to be displayed as the plot title.

For instance, let's set some parameters for the example plot we considered previously.

As we can see, using `.set()` can save our time and space, since there will be no need to use separate `.set_xlabel()`, `.title()` methods, and so on.

Everything was clear?

Section 3. Chapter 3

Course Content

Visualization in Python with matplotlib

## Setting Plot Parameters

Sometimes we may need to focus on a certain part of the plot. One of the ways is to filter the observations we use for plot building. But what if we don't want to modify the data we work with? The answer is simple - we can modify the chart.

To set the chart limits we use `.set()` function applied to `Axes` object (usually named `ax`). This function has the following parameters (but not only):

• `xlim`, `ylim` - tuple with minimum and maximum value to be displayed on x or y-axis respectively;
• `xticks`, `yticks` - list/array with ticks to be displayed on x or y-axis respectively;
• `xlabel`, `ylabel` - string with the text to be displayed on x or y-axis respectively;
• `title` - string to be displayed as the plot title.

For instance, let's set some parameters for the example plot we considered previously.

As we can see, using `.set()` can save our time and space, since there will be no need to use separate `.set_xlabel()`, `.title()` methods, and so on.

Everything was clear?

Section 3. Chapter 3