绘图:平行坐标绘图:轴样式 [英] Plotly: Parallel Coordinates Plot: Axis Styling

查看:129
本文介绍了绘图:平行坐标绘图:轴样式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我真的很喜欢在 密谋,但我遇到一个我可以寻求帮助的问题.

I really like the parallel coordinates plot available in Plotly but I just ran into an issue I could use help with.

如您在下面的示例中看到的那样,执行log10转换可以更好地区分较小的值.但是,通过转换数据,我们失去了解释值的能力.我希望对比例轴而不是数据进行日志缩放,但是找不到解决方法.

As you can see in the example below performing a log10 transform allows to better distinguish the smaller values. However, by transforming the data we loose the ability to interpret the values. I would prefer to log scale the axis instead of the data but couldn't find a way to do this.

我确实在github问题 https://github.com/plotly/plotly.js/issues/1071#issuecomment-264860379 但 不能解决这个问题.

I did find something related to "axis styling" in the github issue https://github.com/plotly/plotly.js/issues/1071#issuecomment-264860379 but not a solution to this problem.

我将不胜感激任何想法/指针.

I would appreciate any ideas/pointer.

library(plotly)

# Setting up some data that span a wide range.
df <- read.csv("https://raw.githubusercontent.com/bcdunbar/datasets/master/iris.csv")
df$sepal_width[1] = 50
df$sepal_width_log10 = log10(df$sepal_width)

p <- df %>%
plot_ly(type = 'parcoords',
        line = list(color = ~species_id,
                    colorscale = list(c(0,'red'),c(0.5,'green'),c(1,'blue'))),
        dimensions = list(
            list(range = c(~min(sepal_width),~max(sepal_width)),
                label = 'Sepal Width', values = ~sepal_width),
            list(range = c(~min(sepal_width_log10),~max(sepal_width_log10)),
                tickformat='.2f',
                label = 'log10(Sepal Width)', values = ~sepal_width_log10),
            list(range = c(4,8),
                constraintrange = c(5,6),
                label = 'Sepal Length', values = ~sepal_length))
        )
p

更多平行坐标示例

打印平行坐标文档

推荐答案

底层的plotly.js parcoords目前不支持对数投影(比例尺,轴),尽管您提到它有时会出现并且我们计划此功能.同时,一种选择是提前获取数据的对数,其最大缺点是轴刻度将显示对数值,这需要解释并增加认知负担.

The underlying plotly.js parcoords doesn't support log projection (scales, axes) at the moment, though as you mention it comes up sometimes and we plan with this functionality. In the meantime, an option is to take the logarithm of the data ahead of time, with the big drawback that axis ticks will show log values, which needs explanation and adds to cognitive burden.

这篇关于绘图:平行坐标绘图:轴样式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆