import numpy as np
import matplotlib.pyplot as plt
%matplotlib inline
x = [np.random.normal(0,std,100) for std in range(1,4)]
fig = plt.figure(figsize=(8,6))
plt.boxplot(x,notch=False,sym='s',vert=True)
fig = plt.gca()
fig.axes.get_xaxis().set_visible(False)
fig.axes.get_yaxis().set_visible(False)

x = [np.random.normal(0,std,100) for std in range(1,4)]
fig = plt.figure(figsize=(8,6))
plt.boxplot(x,notch=False,sym='s',vert=True)
fig = plt.gca()
fig.axes.get_xaxis().set_visible(False)
fig.axes.spines['top'].set_visible(False)
fig.axes.spines['right'].set_visible(False)
fig.axes.spines['left'].set_visible(False)
plt.grid(True)

x = range(30)
y = range(30)
labels = ['xxxxxxxxxx' for i in range(len(x))]
fig = plt.figure(figsize=(4,2))
plt.plot(x,y)
fig = plt.gca()
fig.set_xticklabels(labels)
[Text(0,0,'xxxxxxxxxx'),
Text(0,0,'xxxxxxxxxx'),
Text(0,0,'xxxxxxxxxx'),
Text(0,0,'xxxxxxxxxx'),
Text(0,0,'xxxxxxxxxx'),
Text(0,0,'xxxxxxxxxx'),
Text(0,0,'xxxxxxxxxx'),
Text(0,0,'xxxxxxxxxx'),
Text(0,0,'xxxxxxxxxx')]

x = range(30)
y = range(30)
labels = ['xxxxxxxxxx' for i in range(len(x))]
fig = plt.figure(figsize=(4,2))
plt.plot(x,y)
fig = plt.gca()
fig.set_xticklabels(labels, rotation=45, horizontalalignment='right')
[Text(0,0,'xxxxxxxxxx'),
Text(0,0,'xxxxxxxxxx'),
Text(0,0,'xxxxxxxxxx'),
Text(0,0,'xxxxxxxxxx'),
Text(0,0,'xxxxxxxxxx'),
Text(0,0,'xxxxxxxxxx'),
Text(0,0,'xxxxxxxxxx'),
Text(0,0,'xxxxxxxxxx'),
Text(0,0,'xxxxxxxxxx')]

x = np.arange(30)
y = np.arange(30)
for i in range(3):
plt.plot(x,y*i,label='Group %d'%i)
plt.legend(loc='best')
<matplotlib.legend.Legend at 0x240b129dc18>

x = np.arange(30)
y = np.arange(30)
for i in range(3):
plt.plot(x,y*i,label='Group %d'%i, marker='o')
plt.legend(loc='upper center', bbox_to_anchor=(0.5,1), ncol=3, framealpha=0.3)
<matplotlib.legend.Legend at 0x240b26bfd68>

对全局参数的操作
import matplotlib as mpl
mpl.rcParams['axes.titlesize'] = '10'