问题
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