Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

matplotlib: values for the (xx-small, x-small, small, medium, large, x-large, xx-large, larger, smaller) special sizes

The matplotlibrc sample file states that:

## The font.size property is the default font size for text, given in pts.
## 10 pt is the standard value.
##
## Note that font.size controls default text sizes.  To configure
## special text sizes tick labels, axes, labels, title, etc, see the rc
## settings for axes and ticks.  Special text sizes can be defined
## relative to font.size, using the following values: xx-small, x-small,
## small, medium, large, x-large, xx-large, larger, or smaller

What are the equivalent values in pts for those "special text sizes"?

like image 243
Gabriel Avatar asked Jun 09 '20 17:06

Gabriel


People also ask

How do I show all X values in Matplotlib?

Use xticks() method to show all the X-coordinates in the plot. Use yticks() method to show all the Y-coordinates in the plot. To display the figure, use show() method.

What is the size of Matplotlib?

Syntax of matplotlib. It is an optional attribute, by default the figure has the dimensions as (6.4, 4.8). This is a standard plot where the attribute is not mentioned in the function. Normally each unit inch is of 80 x 80 pixels.

How do I define the size of a graph in Matplotlib?

Using set_size_inches The second option you have is matplotlib. figure. set_size_inches() that is used to set the figure size in inches.

How do I make the X axis larger in Matplotlib?

To increase the space for X-axis labels in Matplotlib, we can use the spacing variable in subplots_adjust() method's argument.


1 Answers

You can also compute the absolute font sizes yourself very easily

import matplotlib as mpl
import matplotlib.pyplot as plt

fig, ax = plt.subplots()

t = ax.text(0.5, 0.5, 'Text')

fonts = ['xx-small', 'x-small', 'small', 'medium', 'large', 
         'x-large', 'xx-large', 'larger', 'smaller']

for font in fonts:
    t.set_fontsize(font)
    print (font, round(t.get_fontsize(), 2))

plt.close()    

Output

xx-small 5.79
x-small 6.94
small 8.33
medium 10.0
large 12.0
x-large 14.4
xx-large 17.28
larger 12.0
smaller 8.33
like image 193
Sheldore Avatar answered Oct 17 '22 17:10

Sheldore