1
現時点では、この質問に対する答えはなかったことに気づいた後、私は誰がどのようにアイデアを持っているかどうかを知りたい:Plotlyの伝説、Pythonの
- は、各サブプロットのための伝説を持っています。
- 凡例を名前でグループ化します。 (例:異なるサブプロットでは、すべて同じ2つの曲線を持ちますが、値は異なります)。
ここに私のPlotlyのスクリプトは次のとおりです。
from plotly import tools
import plotly.plotly as py
import plotly.graph_objs as go
import plotly
nom_plot=[]
trace1 = go.Scatter(x=[1, 2, 3], y=[4, 5, 6],name='1',showlegend=True)
nom_plot.append('GRAPH 1')
trace2 = go.Scatter(x=[20, 30, 40], y=[50, 60, 70],name='2',yaxis='y2')
nom_plot.append('GRAPH 2')
trace3 = go.Scatter(x=[300, 400, 500], y=[600, 700, 800],showlegend=False)
nom_plot.append('GRAPH 3')
trace4 = go.Scatter(x=[4000, 5000, 6000], y=[7000, 8000, 9000])
nom_plot.append('GRAPH 4')
trace5 = go.Scatter(x=[20, 30, 40], y=[50, 60, 70])
nom_plot.append('GRAPH 5')
print(trace1)
fig = tools.make_subplots(rows=4, cols=2, subplot_titles=(nom_plot))
fig.append_trace(trace1, 1, 1)
fig['layout']['xaxis1'].update(title='xaxis 1 title')
fig.append_trace(trace2, 1, 1)
fig.append_trace(trace3, 2, 1)
fig.append_trace(trace4, 2, 2)
fig['layout']['yaxis3'].update(title='yaxis 3 title')
fig.append_trace(trace5, 3, 1)
fig['layout']['yaxis2'].update(
overlaying='y1',
side='right',
anchor='x1',
# domain=[0.15, 1],
range=[2, 6],
# zeroline=False,
showline=True,
showgrid=False,
title='yaxis 3 title'
)
fig['layout'].update(height=1000, width=1000, title='Multiple Subplots' +' with Titles')
plotly.offline.plot(fig, filename='multiple-y-subplots6.html')
私は(上記Plotlyスクリプトを使用)を取得何この:
そして、これは私が(Pygal製)何をしたいです。
が作成できる[最小、完全に、かつ検証例](HTTP: //stackoverflow.com/help/mcve)。 – DavidG
第2の質問に何を求めているのかわからないけど、第1の答えは です。https://stackoverflow.com/questions/27016904/matplotlib-legends-in-subplot –
@Veltz私はPlotlyについて話していますが、 not Matplotlib –