如何以简单的方式截断用matplotlib制作的图

时间:2017-03-30 22:52:48

标签: python matplotlib truncation

我制作了这个情节:enter image description here

使用以下代码:

l = 0.6       
siz = 6
x = range (1,9)
plt.figure (1, figsize = (10,6))
plt.subplots_adjust( left  = 0.1,  right = 0.9,   bottom = 0.1,  top = 0.9     ,   wspace = 0.2,  hspace = 0.2)

plt.subplot(2,2,1)
plt.plot(x, grand_mean_RT_cumul_cues_TARGET_massed, "k", marker = "o", label  = "study 1", fillstyle = 'none', markersize=siz, linewidth = l)
plt.plot(x, grand_mean_RT_cumul_cues_DIST_massed, "k", marker = "o",     markersize=siz, linewidth = l)
plt.xlim(0,9)
plt.ylim(.4, .55)
plt.subplot(2,2,1).axes.set_xticklabels([])
plt.title("Massed practice", fontsize = 15)
plt.ylabel ('Mean RT (s)', fontsize = 15)
plt.yticks (np.arange (0.4, 0.56, 0.05))

ax = plt.subplot(2,2,1)
ax.spines['right'].set_visible(False)
ax.spines['top'].set_visible(False)
ax.yaxis.set_ticks_position('left')
ax.xaxis.set_ticks_position('bottom')

plt.subplot(2,2,3)
plt.plot(x, grand_accuracy_cumul_cues_TARGET_massed, "k", marker = "o", fillstyle = 'none', markersize=siz, linewidth = l, label ="Responses to targets" )
plt.plot(x, grand_accuracy_cumul_cues_DIST_massed, "k", marker = "o", markersize=siz, linewidth = l, label ="Responses to distractors")

plt.xlim(0,9)
plt.xticks (np.arange (1, 9, 1))
plt.ylim(0.95, 1.0)
plt.yticks (np.arange (0.9, 1.01, 0.05))
plt.ylabel ('Accuracy', fontsize = 15)
plt.xlabel ("Memory set repetition", fontsize = 15)

ax = plt.subplot(2,2,3)
ax.spines['right'].set_visible(False)
ax.spines['top'].set_visible(False)
ax.yaxis.set_ticks_position('left')
ax.xaxis.set_ticks_position('bottom')

plt.legend(loc = "lower center", prop={'size':11})

plt.subplot(2,2,2)
plt.plot(x, grand_mean_RT_cumul_cues_TARGET_spaced, "k", marker = "o",fillstyle = 'none',  markersize=siz, linewidth = l)
plt.plot(x, grand_mean_RT_cumul_cues_DIST_spaced, "k", marker = "o", markersize=siz, linewidth = l)
plt.xlim(0,9)
plt.ylim(.4, .55)
plt.xticks (np.arange (1, 9, 1))
plt.yticks (np.arange (0.4, 0.56, 0.05))
plt.title("Spaced practice", fontsize = 15)
plt.subplot(2,2,2).axes.set_xticklabels([])
plt.subplot(2,2,2).axes.set_yticklabels([])

ax = plt.subplot(2,2,2)
ax.spines['right'].set_visible(False)
ax.spines['top'].set_visible(False)
ax.yaxis.set_ticks_position('left')
ax.xaxis.set_ticks_position('bottom')


plt.subplot(2,2,4)
plt.plot(x, grand_accuracy_cumul_cues_TARGET_spaced, "k", marker = "o",  fillstyle = 'none', markersize=siz, linewidth = l, label ="Responses to targets" )
plt.plot(x,  grand_accuracy_cumul_cues_DIST_spaced, "k", marker = "o", markersize=siz, linewidth = l, label ="Responses to distractors")
plt.xlim(0,9)
plt.xticks (np.arange (1, 9, 1))
plt.subplot(2,2,4).axes.set_yticklabels([])
plt.xlim(0,9)
plt.ylim(0.95, 1.0)
plt.yticks (np.arange (0.9, 1.01, 0.05))
plt.xlabel ("Memory set repetition", fontsize = 15)


ax = plt.subplot(2,2,4)
ax.spines['right'].set_visible(False)
ax.spines['top'].set_visible(False)
ax.yaxis.set_ticks_position('left')
ax.xaxis.set_ticks_position('bottom')

我现在想以类似于以下示例的方式截断我的情节: enter image description here

我无法在matplotlib中以简单的方式做到这一点。任何帮助将不胜感激。

0 个答案:

没有答案