【发布时间】:2014-09-23 21:40:58
【问题描述】:
我看过几个例子,但情节的构造不同,我不知道如何使语法起作用。这是我的代码:
pdf_file = PdfPages(sys.argv[1].split('.')[0] + "_graphs.pdf")
for i in range(0, len(list_of_data)):
biorep = int(list_of_figure_key[i].split('.')[1])
construct = int(list_of_figure_key[i].split('.')[0].split('_')[1])
plot(time, list_of_data[i], color=color_dict[construct], linestyle=linestyle_dict[biorep], label=list_of_figure_key[i] )
xlabel('time (hours)', fontsize=9)
ylabel(ReadType, fontsize=9)
xlim(min(time),max(time))
legend(fontsize=8, loc='center left', bbox_to_anchor=(1, .5))
pdf_file.savefig()
它产生了一个美丽的图形,但图例太长并且超出了页面的边缘。我想缩小 x 轴上的图,以便图例适合作为 2 列图例。
图可以看这里:http://i.imgur.com/mvgzIhj.jpg
提前致谢!
【问题讨论】:
-
回答你的问题 Python 标准缩进是四个空格而不是两个
标签: python matplotlib