plotly / plotly/plotly.R

Cannot modify xaxis and yxais labels for type="scatter3d"

未关闭
#2,284 3 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

主要语言
R
星标
2.7k
派生
641
PR 合并指标
30 天内没有已合并 PR

描述


Brief description of the problem:
I cannot modify the labels for the x-axis and y-axis. Copied from web page fig1 ; xaxis = list(title = 'XXXXXXXXXXXX') and yaxis = list(title = 'YYYYYYYYYYY') they render properly. When rendering as fig2: plot_ly(type="scatter3d",mode = "markers" ; the labels for x an y axis are incorrect. Both plots print in rstudio but fig2 's axis labels are incorrect. No errors are presented. Please see attacthed PDF with screen prints.

[plotly axis labels.pdf](https://github.com/plotly/plotly.R/files/12268079/plotly.axis.labels.pdf)

# insert reprex here
``` r
[plotly axis labels.pdf](https:/
[plotly axis labels.pdf](https://github.com/plotly/plotly.R/files/12268082/plotly.axis.labels.pdf)
/github.com/plotly/plotly.R/files/12268078/plotly.axis.labels.pdf)

#fig1
# clean out environemnt
rm(list = ls(all.names = TRUE))

library(plot3D)
library(plotly)
#> Loading required package: ggplot2
#> 
#> Attaching package: 'plotly'
#> The following object is masked from 'package:ggplot2':
#> 
#>     last_plot
#> The following object is masked from 'package:stats':
#> 
#>     filter
#> The following object is masked from 'package:graphics':
#> 
#>     layout
library(ggplot2)
library(stats)
library(stats4)
library(graphics)
library(crosstalk)
library(rgl)
library(plotrix)
#> 
#> Attaching package: 'plotrix'
#> The following object is masked from 'package:rgl':
#> 
#>     mtext3d
library(tidyr)
library(RColorBrewer)
library(dplyr)
#> 
#> Attaching package: 'dplyr'
#> The following objects are masked from 'package:stats':
#> 
#>     filter, lag
#> The following objects are masked from 'package:base':
#> 
#>     intersect, setdiff, setequal, union
library(readr)

##########################
# resolve library conflicts
conflicted::conflicts_prefer(plotly::filter)
#> [conflicted] Will prefer plotly::filter over any other package.
conflicted::conflicts_prefer(plotly::layout)
#> [conflicted] Will prefer plotly::layout over any other package.


fig1 <-  plot_ly(data = iris ,x =  ~Sepal.Length, y = ~Sepal.Width, color = ~Species, type = 'scatter', mode = 'markers')%>%
    layout(title = 'type = scatter, mode = markers', plot_bgcolor = "#e5ecf6", xaxis = list(title = 'XXXXXXXXXXXX'),
           yaxis = list(title = 'YYYYYYYYYYY'), legend = list(title=list(text='<b> Species of Iris </b>')))
fig1
#> PhantomJS not found. You can install it with webshot::install_phantomjs(). If it is installed, please make sure the phantomjs executable can be found via the PATH variable.

Created on 2023-08-05 with reprex v2.0.2



```r
# insert reprex here
``` r
#fig2
# clean out environemnt
rm(list = ls(all.names = TRUE))

library(plot3D)
library(plotly)
#> Loading required package: ggplot2
#> 
#> Attaching package: 'plotly'
#> The following object is masked from 'package:ggplot2':
#> 
#>     last_plot
#> The following object is masked from 'package:stats':
#> 
#>     filter
#> The following object is masked from 'package:graphics':
#> 
#>     layout
library(ggplot2)
library(stats)
library(stats4)
library(graphics)
library(crosstalk)
library(rgl)
library(plotrix)
#> 
#> Attaching package: 'plotrix'
#> The following object is masked from 'package:rgl':
#> 
#>     mtext3d
library(tidyr)
library(RColorBrewer)
library(dplyr)
#> 
#> Attaching package: 'dplyr'
#> The following objects are masked from 'package:stats':
#> 
#>     filter, lag
#> The following objects are masked from 'package:base':
#> 
#>     intersect, setdiff, setequal, union
library(readr)

##########################
# resolve library conflicts
conflicted::conflicts_prefer(plotly::filter)
#> [conflicted] Will prefer plotly::filter over any other package.
conflicted::conflicts_prefer(plotly::layout)
#> [conflicted] Will prefer plotly::layout over any other package.


fam17npg02 <- data.frame(x=c(77,77),y=c(61,77),z=c(77,79),p=c("np","np"),pcolor=c("BLACK","BLACK"))   


fig2 <- plot_ly(type="scatter3d",mode = "markers",
                fam17npg02, 
                x = fam17npg02$x, 
                y = fam17npg02$y,
                z = fam17npg02$z, 
                name="fam17npg02",    
                opacity = 0.8, color = I(fam17npg02$pcolor)) %>% 
    layout(title = 'type = scatter3d, mode = markers', plot_bgcolor = "#e5ecf6", xaxis = list(title = 'XXXXXXXXXXXX'),
           yaxis = list(title = 'YYYYYYYYYYY'), legend = list(title=list(text='<b> Species of Iris </b>')))

fig2
#> PhantomJS not found. You can install it with webshot::install_phantomjs(). If it is installed, please make sure the phantomjs executable can be found via the PATH variable.

Created on 2023-08-05 with reprex v2.0.2

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

首先运行提供的 fig1 和 fig2 reprex,并比较 plot_ly(type="scatter3d") 如何处理 layout xaxis 和 yaxis 标题。检查 plotly.R 中 scatter3d 的入口点以及 layout 轴处理;当所请求的 x 轴和 y 轴标签在 3D 图中正确渲染且不破坏 2D 示例时,即表示完成。

由索引模型根据 Issue 内容生成。

评估

技术栈
r
领域
data-visualization
Issue 类型
缺陷
难度
3/5
预计耗时
1-2 天
活跃度
停滞
描述清晰度
基本清楚
新手友好度
35/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。