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

Changing aesthetics of the correlation plot #288

Open
MarkKramer opened this issue May 8, 2023 · 2 comments
Open

Changing aesthetics of the correlation plot #288

MarkKramer opened this issue May 8, 2023 · 2 comments

Comments

@MarkKramer
Copy link

I am struggling to make 2 aesthetic adjustments and am sincerely hoping that you can assist:

i. How can I make the legend (colorbar) continuous as opposed to discrete?
ii. How can I change the orientation of the plot (i.e. top left vs. bottom right)?
Ankle_ROM_vs_PF_LR

@DominiqueMakowski
Copy link
Member

Hi Mark,

You can customize the legend and change the orientation by overwriting some ggplot specifications:

library(ggplot2)
#> Warning: package 'ggplot2' was built under R version 4.2.2
library(correlation)

mtcars |> 
  correlation() |> 
  summary() |> 
  plot() +
  scale_fill_gradient2(low = "purple", high="green") +
  scale_y_discrete(limits = rev)
#> Scale for fill is already present.
#> Adding another scale for fill, which will replace the existing scale.
#> Scale for y is already present.
#> Adding another scale for y, which will replace the existing scale.

Created on 2023-05-08 by the reprex package (v2.0.1)

Hope that helps!

@MarkKramer
Copy link
Author

Brilliant, this is exactly what I was looking for. The next question is: I then plotted the correlation for some of the relationships using:
plot(cor_test(ROM_PF_left, "PF_LLLI","PF_LLSJ")) +
theme_bw()
I am trying to increase the marker size and color, but nothing seems to alter the marker size. I tried using "cex=3" but this was not effective. Are there any suggestions?
I also tried creating another layer using "geom_point", which works, but if I change the alpha level, the dots from the original layer are visible.
Correlation1

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