使用plotly进行三元图旋转
Ternary diagram rotation using plotly
有人可以帮忙解答下一个问题吗?
我怎样才能用B代替C,用C代替B?
现在我有三元图 ACB(顺时针),但我想得到 ABC(顺时针)。
fig = px.scatter_ternary(df_small,a=df_small.Toluene, b =df_small.Benzene, c=df_small.Ethylbenzene,size_max = 10, opacity = [1,1],symbol_sequence = [1,0])
fig.update_layout({'ternary': {'sum':1,
'aaxis':{'title': ' A <br>','min': 0,
'linewidth':2, 'ticks':'outside',
'tickmode':'array','tickvals':[0,0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9]},
'baxis':{'title': '<br>B', 'min': 0,
'linewidth':2, 'ticks':'outside',
'tickmode':'array','tickvals':[0,0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9]},
'caxis':{'title': '<br>C', 'min': 0,
'linewidth':2, 'ticks':'outside',
'tickmode':'array','tickvals':[0,0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9]}}})
fig.show()
我想你可以在创建plotly.express图形时调换B和C的位置。然后也切换标题。
fig = px.scatter_ternary(df_small,a=df_small.Toluene, b=df_small.Ethylbenzene, c=df_small.Benzene,size_max = 10, opacity = [1,1],symbol_sequence = [1,0])
fig.update_layout({'ternary': {'sum':1,
'aaxis':{'title': ' A <br>','min': 0,
'linewidth':2, 'ticks':'outside',
'tickmode':'array','tickvals':[0,0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9]},
'baxis':{'title': '<br>C', 'min': 0,
'linewidth':2, 'ticks':'outside',
'tickmode':'array','tickvals':[0,0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9]},
'caxis':{'title': '<br>B', 'min': 0,
'linewidth':2, 'ticks':'outside',
'tickmode':'array','tickvals':[0,0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9]}}})
fig.show()
有人可以帮忙解答下一个问题吗? 我怎样才能用B代替C,用C代替B? 现在我有三元图 ACB(顺时针),但我想得到 ABC(顺时针)。
fig = px.scatter_ternary(df_small,a=df_small.Toluene, b =df_small.Benzene, c=df_small.Ethylbenzene,size_max = 10, opacity = [1,1],symbol_sequence = [1,0])
fig.update_layout({'ternary': {'sum':1,
'aaxis':{'title': ' A <br>','min': 0,
'linewidth':2, 'ticks':'outside',
'tickmode':'array','tickvals':[0,0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9]},
'baxis':{'title': '<br>B', 'min': 0,
'linewidth':2, 'ticks':'outside',
'tickmode':'array','tickvals':[0,0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9]},
'caxis':{'title': '<br>C', 'min': 0,
'linewidth':2, 'ticks':'outside',
'tickmode':'array','tickvals':[0,0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9]}}})
fig.show()
我想你可以在创建plotly.express图形时调换B和C的位置。然后也切换标题。
fig = px.scatter_ternary(df_small,a=df_small.Toluene, b=df_small.Ethylbenzene, c=df_small.Benzene,size_max = 10, opacity = [1,1],symbol_sequence = [1,0])
fig.update_layout({'ternary': {'sum':1,
'aaxis':{'title': ' A <br>','min': 0,
'linewidth':2, 'ticks':'outside',
'tickmode':'array','tickvals':[0,0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9]},
'baxis':{'title': '<br>C', 'min': 0,
'linewidth':2, 'ticks':'outside',
'tickmode':'array','tickvals':[0,0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9]},
'caxis':{'title': '<br>B', 'min': 0,
'linewidth':2, 'ticks':'outside',
'tickmode':'array','tickvals':[0,0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9]}}})
fig.show()