Remove code repetition in `specific_plotting_dynamic.R`
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Aptitud para principiantes
- 35/100
- Tipo de issue
- Refactorización
- Claridad
- Bastante claro
- Estado de actividad
- Estancado
- Stack tecnológico
- r
- Área
- data-visualization
Línea de trabajo
Start by reading specific_plotting_dynamic.R and identify the plotting functions that repeat observation and error-bar aesthetics. The work is done when a generic add_obs function adds observations and Obs_SD error bars, and those aesthetics are no longer repeated in the plotting layers.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
In specific_plotting_dynamic.R, we can remove code repetition by putting all aes into the parent call (the ggplot()). This way we can remove the aes from the geom_line, geom_points and geom_errorbar, and put them in a more generic function that we would call similarly in all plotting functions:
Example, instead of:
p <- ggplot2::ggplot(
df_data,
ggplot2::aes(x = .data$Date, colour = .data$variable)
) +
ggplot2::geom_line(ggplot2::aes(y = .data$Simulated)) +
ggplot2::facet_wrap(~ .data$group_var, scales = "free") +
ggplot2::labs(shape = "Variable", colour = "Variable")
if ("Observed" %in% colnames(df_data)) {
p <- p + ggplot2::geom_point(
ggplot2::aes(y = .data$Observed, shape = .data$variable),
na.rm = TRUE
)
if ("Obs_SD" %in% colnames(df_data)) {
p <- p +
ggplot2::geom_errorbar(
ggplot2::aes(
ymin = .data$Observed - 2 * .data$Obs_SD,
ymax = .data$Observed + 2 * .data$Obs_SD,
shape = .data$version
),
na.rm = TRUE
)
}
}
We would do:
p <- ggplot2::ggplot(
df_data,
ggplot2::aes(x = .data$Date, colour = .data$variable, shape = .data$variable)
) +
ggplot2::geom_line(ggplot2::aes(y = .data$Simulated)) +
ggplot2::facet_wrap(~ .data$group_var, scales = "free") +
ggplot2::labs(shape = "Variable", colour = "Variable")
p <- add_obs(p)
With the add_obs function the function above that adds obs and obs_sd.
- Lenguaje dominante
- R
- Estrellas
- 1
- Forks
- 3
- Merge medio
- 9 h 41 min
- PR fusionados (30 d)
- 2
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Sin plantilla de pull request
- Leer la 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.
Más de SticsRPacks/CroPlotR
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 62/100
SticsRPacks/CroPlotR#185 ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 65/100
SticsRPacks/CroPlotR#180 ·
-
Dificultad 3/5 1-2 días Aptitud para principiantes 55/100
SticsRPacks/CroPlotR#186 ·
-
Error is raised if not any var in data.frames in sim_list of a stics_wrapper returned objectAbierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 57/100
SticsRPacks/CroPlotR#181 ·
-
enhancement
Dificultad 3/5 Medio día Aptitud para principiantes 64/100
SticsRPacks/CroPlotR#173 ·
Todos los issues de SticsRPacks/CroPlotR
Issues similares
-
1.7
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
pharmaverse/admiral#3235 ·
Los mantenedores suelen responder en 2 días
-
Typo: p.381Abierto
Dificultad 1/5 Menos de una hora Aptitud para principiantes 95/100
rmcelreath/rethinking#482 ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 74/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 84/100
Los mantenedores suelen responder en 1 día