使用 plotly 时如何反转轴值? [英] How to reverse axis values when using plotly?

查看:26
本文介绍了使用 plotly 时如何反转轴值?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我使用的程序:

library(plotly)

mydata = read.csv("data_to_plot.txt")
df = as.data.frame(mydata)

p <- df %>%
  group_by(X) %>%
  plot_ly(x = ~Y, y = ~X, z = ~Z, type = "scatter3d", mode = "lines")
p  

以下是mydata"的摘录:

and below is an excerpt of "mydata":

df[1:12,]
X Y Z
1 1 0.2818017 0.0005993884
2 1 0.2832173 0.0007896421
3 1 0.2846330 0.0010293849
4 1 0.2860487 0.0013282462
5 1 0.2874643 0.0016969544

df[1:12,]
X Y Z
1 1 0.2818017 0.0005993884
2 1 0.2832173 0.0007896421
3 1 0.2846330 0.0010293849
4 1 0.2860487 0.0013282462
5 1 0.2874643 0.0016969544

我想在 X 轴上反转 X 值,但找不到如何修改我的程序.plotly 语法的细节对我来说非常模糊.有人能提供一些帮助吗?非常感谢.

I would like to have the X values reversed on the X-axis, but can't find how to modify my program. Details of the plotly syntax are quite obscure to me. Could someone afford some help? Many thanks.

绘制的数据:

推荐答案

您可能正在寻找layout(xaxis = list(autorange = "reversed").

You are probably looking for layout(xaxis = list(autorange = "reversed").

这篇关于使用 plotly 时如何反转轴值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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