1

私はこのような棒グラフを使用しています http://matplotlib.org/examples/pylab_examples/barchart_demo2.html

バーの外観を変更したいと思います。たとえば、バーに立体的な外観を与えます。私が念頭に置いているのは、次のようなものです: http://tinyurl.com/oczlafw

ただ、どこから始めればよいかわかりません。たぶん、バーに沿って同じ画像を繰り返しますか?

助けてくれてありがとうAC

4

1 に答える 1

4

Matplotlib ユーザー リストのこの投稿では、棒グラフで色のグラデーションを使用する方法を示しています。これは、あなたが望むものに似ているかもしれません。以下では、水平バーに適応させました。棒グラフで画像を使用 するこの例もご覧ください。

from pylab import figure, show, np, cm, hold

def gbar(ax, x, y, height=0.5, left=0):
    X = [[.7, .7],[.6,.6]]
    for right,bottom in zip(x, y):
        top = bottom+height
        print bottom
        print top
        print ''
        ax.imshow(X, interpolation='bicubic', cmap=cm.Blues,
                    extent=(left, right, bottom, top), alpha=1)

fig = figure()

xmin, xmax = xlim = 0,10
ymin, ymax = ylim = 0,1
ax = fig.add_subplot(111, xlim=xlim, ylim=ylim,
                        autoscale_on=False)
hold(True)
X = [[.6, .6],[.7,.7]]

N = 10
y = np.arange(N)+0.25
x = 10*np.random.rand(N)
gbar(ax, x, y)
ax.set_aspect('normal')
ax.set_ylim([0,10])
show()

グラデーションカラーの横棒グラフ

于 2013-10-28T18:05:15.693 に答える