This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Shift label to upside in ggscatter graph

Hi. I'm R starter. I'm using ggscatter to draw a regression line. The label is sitting down like that. How can I move up? The code is shown below.

enter image description here

ggscatter(JJ_1year, x = "Ammonium", y = "Potassium",
          add = "reg.line",                         # Add regression line
          color = "Season", palette = "jco",           # Color by groups "Season"
          shape = "Season",                            # Change point shape by groups "Season"
          fullrange = TRUE,                         # Extending the regression line
          rug = FALSE                                # Add marginal rug
)+
    stat_cor(method = "spearman", aes(color = Season))           # Add correlation coefficient
r ggscatter ggpubr

Hello whrhkdrhs!

We believe that this post does not fit the main topic of this site.

Not related to bioinformatics. Search StackOverflow and Google for `ggscatter`.

For this reason we have closed your question. This allows us to keep the site focused on the topics that the community can help with.

If you disagree please tell us why in a reply below, we'll be happy to talk about it.

Cheers!

Try adding repel = TRUE :

ggscatter(JJ_1year, x = "Ammonium", y = "Potassium",
          add = "reg.line",                 # Add regression line
          color = "Season", palette = "jco",# Color by groups "Season"
          shape = "Season",                 # Change point shape by groups "Season"
          fullrange = TRUE,                 # Extending the regression line
          rug = FALSE,                      # Add marginal rug
          repel = TRUE    # <---------------- repel labels to avoid overlapping
          ) +
  stat_cor(method = "spearman", aes(color = Season)) # Add correlation coefficient

0 answers

No answers yet.

Log in to answer this question.