私が望む視覚化をしていません。私はまだ画像を置くことができないので、リンクは下にあります。私はほとんど私が望むものを持っています。問題は、ラベルが正しく配置されていないことです。極座標グラフの内側の端にラベルを揃える方法
逆極性バー・デモ
私は、彼らがしているようにラベルを回転させることが持っていると思いますが、ラベル右エッジは、ちょうど円の外縁内側に整列しています。明確にするために
EDIT:私はこの例で使用
ラベルは、すべての「テスト」です。実際のデータでは、これらのラベルの長さは異なります。私はラベルの終わりを移動して、サークルの外側のエッジの隣に常に最後の文字が表示されるようにしたい。この場合、すべての 'g'は外側のエッジの隣にあります。
import matplotlib.pyplot as mpl
import numpy as np
import random
bgcolor = '#222222'
barcolor = '#6699cc'
bottom = 15
N = 32
Values = np.random.random(N)*10
MetricLabels = ['testing' for _ in range(1, N+1)]
# Select the radii, thetas, and widths.
Radii = -5*np.ones(N)-Values
Theta = np.linspace(0.0, 2 * np.pi, N, endpoint=False)
width = 2*np.pi/N
# Make a list of shifted thetas to place the labels at.
ThetaShifted = np.copy(Theta)
for i in range(N-1):
ThetaShifted[i] = (Theta[i] + Theta[i+1])/2.0
ThetaShifted[-1] = (Theta[-1] + 2.0*np.pi)/2.0
# Make the figure
fig = mpl.figure()
ax = fig.add_subplot(111, projection='polar')
bars = ax.bar(Theta, Radii, width=width, bottom=bottom)
# Set the outer ring to be invisible.
ax.spines["polar"].set_visible(False)
# Set the grid line locations but set the labels to be invisible.
ax.grid(False)
ax.set_thetagrids([], visible=False)
ax.set_rgrids([3], visible=False)
# Apply colors to bars based on the settings above.
for v, bar in zip(Values, bars):
bar.set_facecolor(barcolor)
bar.set_edgecolor(bar.get_facecolor())
# Show the metric and value labels
for counter in range(N):
ax.text(ThetaShifted[counter], bottom-3, MetricLabels[counter],
horizontalalignment='center', verticalalignment='baseline',
rotation=(counter+.5)*360/N, color=bgcolor)
ax.text(ThetaShifted[counter], bottom+0.75, np.round(Values[counter],2),
horizontalalignment='center', verticalalignment='center',
color=bars[counter].get_facecolor())
# Set the background color to be a dark grey,
ax.set_axis_bgcolor(bgcolor)
fig.set_facecolor(bgcolor)
# Show the figure.
mpl.show()
あなた自身、問題を解決した場合、あなたはあなた自身の質問への答えとして、それを投稿することができます。答えを探して "質問"を読むのではなく、未来の人々を発見する方がはるかに簡単です。); –