Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Translate axis labels, etc in ggiNEXT #69

Open
jaahumadap opened this issue Jan 25, 2022 · 2 comments
Open

Translate axis labels, etc in ggiNEXT #69

jaahumadap opened this issue Jan 25, 2022 · 2 comments

Comments

@jaahumadap
Copy link

Hello,

I would like to create plots with ggiNEXT where the labels (e.g. Species diversity) are translated to Spanish (Diversidad de especies). I downloaded the code for ggiNEXT and did a find/search/replace.. but sourcing that code did not work. I assume the package has to be rebuilt with these changes... Is this easy to do?

Thank you,

Jorge

@Bee-ginner
Copy link

Hola @jaahumadap, espero hayas encontrado una solución, a mi me funciono el siguiente código para traducir las leyendas de los ejes "X" y "Y"

ggiNEXT(x, type=2, facet.var="none", color.var="site") +labs(x = "Número de individuos", y = "Cobertura de la muestra")

Como has de saber x hace referencia a tus datos. Yo quiero traducir la leyenda que dice interpolated y extrapolated a español, pero no he encontrado información aún.

@jaahumadap
Copy link
Author

Gracias @Bee-ginner! Tuve que recrear las gráficas desde cero... Anexo el código por si es útil:

ggplot(rarefaction_data, aes(x = m, y = qD)) + 
    geom_ribbon(aes(ymin = qD.LCL, ymax = qD.UCL), alpha = 0.7, fill = "#6FC38C") + 
    geom_line(data = filter(rarefaction_data, Method == "Rarefaction"), size = 2, linetype = 1) +
    geom_line(data = filter(rarefaction_data, Method == "Extrapolation"), size = 1, linetype = 2) +
    geom_point(data = filter(rarefaction_data, Method == "Observed"), size =5) +
    labs(x = lan$t("Número de observaciones"), y = lan$t("Número de especies")) +
    scale_fill_viridis_d() +
    theme_bw()

donde rarefaction_data es el objeto con los resultados de iNEXT. Por ejemplo para observaciones de abundancia:

res_rarefaction <- iNEXT(abundance_observations, datatype = "abundance")
  rarefaction_data <- res_rarefaction$iNextEst$size_based

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants