How to set font size of Matplotlib axis Legend? Last Updated : 05 Nov, 2021 Comments Improve Suggest changes Like Article Like Report Prerequisite: Matplotlib In this article, we will see how to set the font size of matplotlib axis legend using Python. For this, we will use rcParams() methods to increase/decrease the font size. To use this we have to override the matplotlib.rcParams['legend.fontsize'] method. Syntax: matplotlib.rcParams['legend.fontsize'] = font_size_value Example 1: Setting plot size of the legend is 15 Python3 # import required modules import numpy from matplotlib import pyplot import matplotlib # assign value to x axis x_axis = numpy.arange(1, 20, 0.5) # get the value of log10 y_axis_log10 = numpy.exp(x_axis) # plot the graph pyplot.plot(x_axis, y_axis_log10, c="blue", label="exponential") # title of the graph/plot pyplot.title("Exponential Graph Plot") # to set the font size of the legend matplotlib.rcParams['legend.fontsize'] = 15 pyplot.legend(loc='best') pyplot.show() Output: Example 2: Setting the plot size of the legend is 25 Python3 # import required modules import numpy from matplotlib import pyplot import matplotlib # assign value to x axis x_axis = numpy.arange(1, 20, 0.5) # get the value of log10 y_axis_log10 = numpy.exp(x_axis) # plot the graph pyplot.plot(x_axis, y_axis_log10, c="blue", label="exponential") # Title of the graph/ploy pyplot.title("Exponential Graph Plot") # to set the font size of the legend matplotlib.rcParams['legend.fontsize'] = 25 pyplot.legend(loc='best') pyplot.show() Output: Comment More infoAdvertise with us Next Article How to set font size of Matplotlib axis Legend? M maheswaripiyush9 Follow Improve Article Tags : Python Python-matplotlib Practice Tags : python Similar Reads How to Set Tick Labels Font Size in Matplotlib? Prerequisite: MatplotlibMatplotlib is one of the most widely used data visualization libraries in Python. It provides a variety of ways to create high-quality 2D plots. One important aspect of making plots readable and aesthetically pleasing is formatting tick labels, including adjusting their font 3 min read How to change the size of axis labels in Matplotlib? Matplotlib is a Python library that helps in visualizing and customizing various plots. One of the customization you can do is to change the size of the axis labels to make reading easier. In this guide, weâll look how to adjust font size of axis labels using Matplotlib.Letâs start with a basic plot 2 min read How to add a title to a Matplotlib legend? Prerequisites: Matplotlib In this article, we will see how can we can add a title to a legend in our graph using matplotlib, Here we will take two different examples to showcase our graph. Approach: Import required module.Create data.Add a title to a legend.Normally plot the data.Display plot. Below 2 min read How to Change the Font Size of Colorbars in Matplotlib Matplotlib is a powerful and widely used library in Python for data visualization. It offers a variety of plotting functions to create complex graphs and charts. One common visualization is a heatmap, which often includes a color bar to indicate the scale of values represented by colors. Adjusting t 4 min read How to Remove the Legend in Matplotlib? Matplotlib is one of the most popular data visualization libraries present in Python. Using this matplotlib library, if we want to visualize more than a single variable, we might want to explain what each variable represents. For this purpose, there is a function called legend() present in matplotli 5 min read How to change the font size of the Title in a Matplotlib figure ? In this article, we are going to discuss how to change the font size of the title in a figure using matplotlib module in Python. As we use matplotlib.pyplot.title() method to assign a title to a plot, so in order to change the font size, we are going to use the font size argument of the pyplot.title 2 min read How to add a legend to a scatter plot in Matplotlib ? Adding a legend to a scatter plot in Matplotlib means providing clear labels that describe what each group of points represents. For example, if your scatter plot shows two datasets, adding a legend will display labels for each dataset, helping viewers interpret the plot correctly. We will explore s 2 min read How to Adjust Title Position in Matplotlib? In this article, you learn how to modify the Title position in matplotlib in Python. Method 1: Using matplotlib.pyplot.title() function The title() method in matplotlib module is used to specify title of the visualization depicted and displays the title using various attributes. Syntax: matplotlib.p 3 min read How to Change the Size of Figures in Matplotlib? Matplotlib provides a default figure size of 6.4 inches in width and 4.8 inches in height. While this is suitable for basic graphs, various situations may require resizing figures for better visualization, presentation or publication. This article explores multiple methods to adjust the figure size 3 min read How to Place Legend Outside of the Plot in Matplotlib? Placing the legend outside of the plot in Matplotlib helps make the chart cleaner and easier to read, especially when dealing with multiple lines or subplots. Instead of cluttering the plot area, the legend can be positioned beside or above the plot, giving more space to the data. Letâs explore diff 3 min read Like