Skip to content

Make legend title fontsize obey fontsize kwarg by default? #8699

Closed
@gepcel

Description

@gepcel

mpl.version : 2.0.1

Using the method ax.legend(title='something', fontsize=18) to draw a legend, only the handler labels has the fontsize but not the title. Was this the supposed behavior?

Example:

%matplotlib inline
import matplotlib.pyplot as plt

fig, [ax1, ax2] = plt.subplots(1, 2, figsize=(8, 3))

ax1.scatter(1, 1, 40, label='point')
ax1.legend(title='location')

ax2.scatter(1, 1, 40, label='point')
ax2.legend(title='location', fontsize=20)

image

Don't feel reasonable that everytime I have to do something like this:

lg = ax2.legend(title='location', fontsize=20)
title = lg.get_title()
title.set_fontsize(20)

Or am I missing some args like titlefontsize of legend?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions