4
你能不能帮我找出如何绘制这种与matplotlib阴谋?如何绘制在一个图表多个横条与matplotlib
我具有表示表中的熊猫数据帧对象:
Graph n m
<string> <int> <int>
我希望显示的n
和m
大小为每个Graph
:其中对于每个行中,有含有标签的水平条形图y轴左侧的Graph
名称;在y轴的右边,有两个直接在另一个下面的细水平条,其长度代表n
和m
。应该很清楚地看到,两个细条都属于标有图名的行。
这是迄今为止我所编写的代码:
fig = plt.figure()
ax = gca()
ax.set_xscale("log")
labels = graphInfo["Graph"]
nData = graphInfo["n"]
mData = graphInfo["m"]
xlocations = range(len(mData))
barh(xlocations, mData)
barh(xlocations, nData)
title("Graphs")
gca().get_xaxis().tick_bottom()
gca().get_yaxis().tick_left()
plt.show()