The key is the combination with matplotlib.
You can access the line object from the axes object using ax.get_lines()
. Then, the properties can be changed accordingly.
You may have to figure out which index relates to the markers and which to the line(s). In the example below, the markers come first, hence:
ax.get_lines()[0].set_marker('p')
and the trend line is second:
ax.get_lines()[1].set_linewidth(12.0)
The example below is based on the probplot documentation:
import numpy as np
from scipy import stats
import matplotlib.pyplot as plt
nsample = 100
np.random.seed(7654321)
fig = plt.figure()
ax = fig.add_subplot(111)
x = stats.t.rvs(3, size=nsample)
res = stats.probplot(x, plot=plt)
ax.get_lines()[0].set_marker('p')
ax.get_lines()[0].set_markerfacecolor('r')
ax.get_lines()[0].set_markersize(12.0)
ax.get_lines()[1].set_linewidth(12.0)
plt.show()
The plot this creates looks ugly, but demonstrates the functionality:
The text (r^2=0.9616
) can be accessed through more general get_children
from the axes:
ax.get_children()[2].set_fontsize(22.0)
Without detailed knowledge of the indexing for these items, you can try with:
print ax.get_children()
which gives you:
[<matplotlib.lines.Line2D object at 0x33f4350>, <matplotlib.lines.Line2D object at 0x33f4410>,
<matplotlib.text.Text object at 0x33f4bd0>, <matplotlib.spines.Spine object at 0x2f2ead0>,
<matplotlib.spines.Spine object at 0x2f2e8d0>, <matplotlib.spines.Spine object at 0x2f2e9d0>,
<matplotlib.spines.Spine object at 0x2f2e7d0>, <matplotlib.axis.XAxis object at 0x2f2eb90>,
<matplotlib.axis.YAxis object at 0x2f37690>, <matplotlib.text.Text object at 0x2f45290>,
<matplotlib.text.Text object at 0x2f45310>, <matplotlib.text.Text object at 0x2f45390>,
<matplotlib.patches.Rectangle object at 0x2f453d0>]
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…