Question: (Closed) Shift label to upside in ggscatter graph
0
gravatar for whrhkdrhs
23 months ago by
whrhkdrhs0
whrhkdrhs0 wrote:

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
ggpubr ggscatter R • 1.5k views
ADD COMMENTlink modified 23 months ago by zx87549.6k • written 23 months ago by whrhkdrhs0
2

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
ADD REPLYlink modified 23 months ago • written 23 months ago by zx87549.6k

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!

ADD REPLYlink written 23 months ago by Joe18k
Please log in to add an answer.
The thread is closed. No new answers may be added.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 1798 users visited in the last hour