plotly / plotly/plotly.R

ggplotly() doesn't support multiple colors in axis ticks

Abierto
#1,328 2 comentarios 1 reacción 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

ggplotly plotly.js
Lenguaje dominante
R
Estrellas
2.7k
Forks
641
Métricas de merge de PR
Sin PR fusionados en 30 d

Descripción

Hello and thanks for the great job you did by making this really useful package. I just want to report an issue that appears when I need to colour the axis text of a plot with pre - defined colours. Below you can see the R code to build a really simple shiny app. If I plot my graph with the standard ggplot() function the names of the x axis result colored, but if I use the function ggplotly() to make my plot interactive, the text of the x axis remains black (the functions recognizes the arguments "angle" and "hjust" but not "col").

Thanks in advance for the availability.

Nico

library(ggplot2)
library(plotly)
library(shiny)

### UI
ui <- fluidPage(
  fluidRow(
    column(width = 8,
           plotlyOutput(outputId = "plot", 
                        height = "600px"))))

### SERVER
server <- function(input, output) {
  
output$plot <- renderPlotly({
  
  mpg_s <- mpg[c(1, 19, 38), ] # subset to pick just 3 rows
  
  col <- c("red", "green", "blue")
  
  p <- ggplot(data = mpg_s,
              aes(x = manufacturer, y = hwy)) +
         geom_point() +
         theme(axis.text.x = element_text(size = 20,
                                         angle = 90,
                                         hjust = 1,
                                         colour = col))
  
  ggplotly(p)

  })
}

### LUNCH APP
shinyApp(ui = ui, server = server)

Guía de contribución

Abrir la guía de contribución

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Línea de trabajo

El issue proporciona un ejemplo reproducible de ggplotly(p) en una aplicación Shiny, pero no menciona archivos del repositorio ni tests. Empieza rastreando cómo ggplotly convierte la configuración axis.text.x de ggplot2 y, después, compara las salidas de ggplot y la interactiva; se considera terminado cuando aparecen colores predefinidos en las etiquetas de las marcas del eje x interactivo.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
r
Área
data-visualization
Tipo de issue
Error
Dificultad
4/5
Tiempo estimado
3-5 días
Estado de actividad
Estancado
Claridad
Bastante claro
Aptitud para principiantes
38/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.