Adding Title to the Plot | Plots Customization
Ultimate Visualization with Python

Course Content

Ultimate Visualization with Python

## Ultimate Visualization with Python

1. Matplotlib Introduction
2. Creating Commonly Used Plots
3. Plots Customization
4. More Statistical Plots
5. Plotting with Seaborn

# Adding Title to the Plot

## Choosing a Title

First of all, a good plot should have a concise yet meaningful title. Titles, such as "Line plot" or "Scatter plot" are too abstract and give us no insight about the purpose of the plot or its data. An example of a good title is "New York Average Monthly Temperatures (2022)", since we understand what the data is, the place and time period to which our data is related (these aspects are important in our example).

Now let’s have a look how we can set a plot title in `matplotlib`:

## Setting a Title

In order to set a title, we simply use the `plt.title()` function passing a title as a string. However, there is actually more to it. In addition to the first parameter `label`, we can modify the font size via the `fontsize` parameter (`10` is a default value) and font color via `color` (there are more options to font customization, but these two are the most important).

Another important parameter is `loc` (location) which can take either of the values: `center` (default), `left` and `right`.

Let’s now modify the title in our example:

Here we placed the title on the left, made the font larger and changed the font color. Most of the time you will only care about these parameters, however, you can always refer to the documentation for more information.

The code in this task creates a line plot for the average Boston and Seattle yearly temperatures. Your task is the following:

1. Use the correct function to set the title for the plot.
2. Set the following title: `'Boston and Seattle average yearly temperatures'`.
3. Set the font size of the title to be `15`.
4. Set the location of the title to `right`.

The code in this task creates a line plot for the average Boston and Seattle yearly temperatures. Your task is the following:

1. Use the correct function to set the title for the plot.
2. Set the following title: `'Boston and Seattle average yearly temperatures'`.
3. Set the font size of the title to be `15`.
4. Set the location of the title to `right`.

Everything was clear?

Section 3. Chapter 1

# Adding Title to the Plot

## Choosing a Title

First of all, a good plot should have a concise yet meaningful title. Titles, such as "Line plot" or "Scatter plot" are too abstract and give us no insight about the purpose of the plot or its data. An example of a good title is "New York Average Monthly Temperatures (2022)", since we understand what the data is, the place and time period to which our data is related (these aspects are important in our example).

Now let’s have a look how we can set a plot title in `matplotlib`:

## Setting a Title

In order to set a title, we simply use the `plt.title()` function passing a title as a string. However, there is actually more to it. In addition to the first parameter `label`, we can modify the font size via the `fontsize` parameter (`10` is a default value) and font color via `color` (there are more options to font customization, but these two are the most important).

Another important parameter is `loc` (location) which can take either of the values: `center` (default), `left` and `right`.

Let’s now modify the title in our example:

Here we placed the title on the left, made the font larger and changed the font color. Most of the time you will only care about these parameters, however, you can always refer to the documentation for more information.

The code in this task creates a line plot for the average Boston and Seattle yearly temperatures. Your task is the following:

1. Use the correct function to set the title for the plot.
2. Set the following title: `'Boston and Seattle average yearly temperatures'`.
3. Set the font size of the title to be `15`.
4. Set the location of the title to `right`.

The code in this task creates a line plot for the average Boston and Seattle yearly temperatures. Your task is the following:

1. Use the correct function to set the title for the plot.
2. Set the following title: `'Boston and Seattle average yearly temperatures'`.
3. Set the font size of the title to be `15`.
4. Set the location of the title to `right`.

Everything was clear?

Section 3. Chapter 1

# Adding Title to the Plot

## Choosing a Title

First of all, a good plot should have a concise yet meaningful title. Titles, such as "Line plot" or "Scatter plot" are too abstract and give us no insight about the purpose of the plot or its data. An example of a good title is "New York Average Monthly Temperatures (2022)", since we understand what the data is, the place and time period to which our data is related (these aspects are important in our example).

Now let’s have a look how we can set a plot title in `matplotlib`:

## Setting a Title

In order to set a title, we simply use the `plt.title()` function passing a title as a string. However, there is actually more to it. In addition to the first parameter `label`, we can modify the font size via the `fontsize` parameter (`10` is a default value) and font color via `color` (there are more options to font customization, but these two are the most important).

Another important parameter is `loc` (location) which can take either of the values: `center` (default), `left` and `right`.

Let’s now modify the title in our example:

Here we placed the title on the left, made the font larger and changed the font color. Most of the time you will only care about these parameters, however, you can always refer to the documentation for more information.

The code in this task creates a line plot for the average Boston and Seattle yearly temperatures. Your task is the following:

1. Use the correct function to set the title for the plot.
2. Set the following title: `'Boston and Seattle average yearly temperatures'`.
3. Set the font size of the title to be `15`.
4. Set the location of the title to `right`.

The code in this task creates a line plot for the average Boston and Seattle yearly temperatures. Your task is the following:

1. Use the correct function to set the title for the plot.
2. Set the following title: `'Boston and Seattle average yearly temperatures'`.
3. Set the font size of the title to be `15`.
4. Set the location of the title to `right`.

Everything was clear?

## Choosing a Title

First of all, a good plot should have a concise yet meaningful title. Titles, such as "Line plot" or "Scatter plot" are too abstract and give us no insight about the purpose of the plot or its data. An example of a good title is "New York Average Monthly Temperatures (2022)", since we understand what the data is, the place and time period to which our data is related (these aspects are important in our example).

Now let’s have a look how we can set a plot title in `matplotlib`:

## Setting a Title

In order to set a title, we simply use the `plt.title()` function passing a title as a string. However, there is actually more to it. In addition to the first parameter `label`, we can modify the font size via the `fontsize` parameter (`10` is a default value) and font color via `color` (there are more options to font customization, but these two are the most important).

Another important parameter is `loc` (location) which can take either of the values: `center` (default), `left` and `right`.

Let’s now modify the title in our example:

Here we placed the title on the left, made the font larger and changed the font color. Most of the time you will only care about these parameters, however, you can always refer to the documentation for more information.

2. Set the following title: `'Boston and Seattle average yearly temperatures'`.
3. Set the font size of the title to be `15`.
4. Set the location of the title to `right`.