3.4. Style Customization
3.4.1. Basic customizations
figure object is implied
explicit assignment is needed when customizing
fig = plt.figure()
3.4.2. Size
Local:
plt.figure(figsize=(3,4))
- Global:
import matplotlib.pyplot as plt plt.rcParams["figure.figsize"] = (20,10)
import matplotlib matplotlib.rc('figure', figsize=(20,10))
3.4.3. Font
'serif'
'sans-serif'
'cursive'
'fantasy'
'monospace'
import matplotlib
import matplotlib.pyplot as plt
matplotlib.rc('font', family='Serif', weight='bold', size=8)
x = [1, 2, 3, 4, 5]
y = [1, 2, 3, 4, 5]
plt.plot(x, y)
plt.grid(True)
plt.show() # doctest: +SKIP
3.4.4. Subplots
fig = plt.figure()
ax1 = plt.subplot2grid(shape=(1,1), loc=(0,0)) # ``loc`` = Location to place axis within grid.
plt.subplot_adjust(left=0.9, bottom=0.16) # set margins