最近在做流量分析的可视化图,在网上找资料东学西凑的,最后想了个笨方法写成了这个样子:
现在的问题是注释里的内容过多,想分行显示,但是试过插入换行符,不管插入在哪都无法生效,这种注释是不支持换行么?
部分代码如下
annotation = plt.annotate(
('time='+str(time_label[i]),
'src='+str(src[i]),
'dst='+str(dst[i]),
'srcport='+str(srcport[i]),
'dstport='+str(dstport[i]),
'length='+str(length[i])),
xy = (i + 0.1, length[i] +0.1),
xycoords = 'data',
xytext = (i + 0.7, length[i] + 0.7),
textcoords = 'data',
horizontalalignment = "left",
arrowprops = dict(arrowstyle="simple",connectionstyle="arc3,
rad=-0.1"),
bbox=dict(boxstyle="round",
facecolor="w",
edgecolor="0.5",
alpha=0.9)
)