Mapping alpha to continuous variable in geom_tile()/geom_raster()
Nadie ha tomado este issue todavía.
- Lenguaje dominante
- R
- Estrellas
- 2.7k
- Forks
- 641
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Descripción
I am trying to convert a heatmap I created with ggplot to a plotly object. Everything works fine, except no matter what I do, it won't translate the alpha values (I have tried both having it as aes- what I want- but also giving it a random value and it won't work. This is the ggplot code and output, which works fine:
I have tried both geom tile and geom raster and none of them seem to work.
plot <- datos%>%
ggplot(aes(Var2, Var1, fill = value, alpha = dum,
text = paste("<b>Edad:</b>", Var2, "<br>",
"<b>Año:</b>", Var1, "<br>",
"<b> Año de nacimiento: </b>", (Var1 - Var2), "<br>",
"<b>Renta relativa:</b>", format(value,
big.mark = ".",
scientific = FALSE,
digits = 2))))+
geom_raster()+
scale_alpha(range = c(0.6, 1))+
scale_x_continuous(breaks = seq(20, 75, by = 5), limits = c(20, 80))+
scale_y_continuous(breaks = seq(2008, 2016, by = 2 ), limits = c(2008, 2016))+
theme_minimal()
ggplot output (with a little more formatting:

ggplotly output (just doing ggplotly(plot)):

Guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Línea de trabajo
Comienza reproduciendo el ejemplo proporcionado con ggplotly(plot), comparando geom_raster() y geom_tile(), así como valores de alpha mapeados y fijos. Sigue la ruta de conversión de ggplotly para la estética alpha y verifica el resultado frente a la salida original de ggplot. Se considera terminado cuando los valores continuos de alpha se conservan en el mapa de calor interactivo convertido.
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
- 3/5
- Tiempo estimado
- 1-2 días
- Estado de actividad
- Estancado
- Claridad
- Bastante claro
- Aptitud para principiantes
- 35/100