[英]Python/ploty - How to reverse axis direction in a Parallel Coordinates plot?
I'm trying to make a Parallel Coordinates plot with plotly.graph_objs Here is my code.我正在尝试使用 plotly.graph_objs 制作平行坐标图这是我的代码。
'''
import plotly.graph_objs as go
layout = go.Layout( autosize=False, width=800, height=600)
fig = go.Figure(data =
go.Parcoords(
dimensions = list([
dict(range = [1,9],
label = 'col1', values = df.col1),
dict(range = [1,9],
label = 'col2', values = df.col2),
dict(range = [1,9],
label = 'col3', values = df.col3)
])
), layout = layout
)
fig.show()
'''
This graph works, but I need to reversed y-axis.该图有效,但我需要反转 y 轴。 Here 3 are what i tried这是我尝试过的3个
If I understood correctly you could just reverse the range
parameter:如果我理解正确,您可以反转range
参数:
import plotly.graph_objs as go
layout = go.Layout( autosize=False, width=800, height=600)
fig = go.Figure(data =
go.Parcoords(
# Reversed ranges.
dimensions = list([
dict(range = [9, 1],
label = 'col1', values = df.col1),
dict(range = [9, 1],
label = 'col2', values = df.col2),
dict(range = [9, 1],
label = 'col3', values = df.col3)
])
), layout = layout
)
fig.show()
'''
Before (fake data):之前(假数据):
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.