この種のプロットを matplotlib で描画する方法を理解するのを手伝ってもらえますか?
テーブルを表す pandas データ フレーム オブジェクトがあります。
Graph n m
<string> <int> <int>
I want to visualize the size of n
and m
for each Graph
: A horizontal bar chart where for each row, there is a label containing the Graph
name to the left of the y-axis; to the right of the y-axis, there are two thin horizontal bars directly below each other, whose length represents n
and m
. It should be clear to see that both thin bars belong to the row labelled with the graph name.
This is the code I have written so far:
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()