R: for the same code, labels (q1, median) appear on one computer but don't appear on another computer

て烟熏妆下的殇ゞ 提交于 2021-01-10 03:36:21

问题


I am using the R programming language. I made a simple box plot using the "plotly" library:

library(plotly)
library(ggplot2)

var_1<-rnorm(100,10,5)
var_2 <- sample( LETTERS[1:4], 100, replace=TRUE, prob=c(0.1, 0.2, 0.65, 0.05) )

df = data.frame(var_1, var_2)
df$var_2 = as.factor(df$var_2)


p5 <- plot_ly(df,
              y = ~var_1,
              color = ~var_2,
              type = "box") %>% 
  layout(title = "Income by career stage",
         xaxis = list(title = "Stage",
                      zeroline = FALSE),
         yaxis = list(title = "Income",
                      zeroline = FALSE))
p5

When I run the code on one computer, the labels (median, q1, etc) appear on the plotly boxplot. But when I try this on another computer, these same labels do not show up (the corresponding numbers show up, but the labels are all replaced with either "A", "B", "C" or "D" for the given column). Is there a more definite way (e.g. manually specify) to tell the computer to "make sure" that these labels appear?

Thanks

来源:https://stackoverflow.com/questions/65547448/r-for-the-same-code-labels-q1-median-appear-on-one-computer-but-dont-appea

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!