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

Add vertical or horizontal line to a ggscatterhist #176

Closed
juliechevalier opened this issue Apr 26, 2019 · 8 comments
Closed

Add vertical or horizontal line to a ggscatterhist #176

juliechevalier opened this issue Apr 26, 2019 · 8 comments

Comments

@juliechevalier
Copy link

I'd like to add a vertical and an horizontal line to my ggscatterhist. But the ggadd seems to not run properly with ggscatterhist, as I've tested it to add a point without any success.
So, is there a way to add such line to my plot where the code is :

ggscatterhist(
  dfScatter, x = "SpeIndex", y = "BindingSignal",
  color = colors, size = 1, alpha = 1,
  palette = c("blue", "grey"),
  margin.plot="boxplot"
  )

I'd want to add a vertical line at a specific point of my xaxis through all the plot.
Thanks in advance for your help
Julie

@wenbostar
Copy link

Does ggpubr support this function?

@wenbostar
Copy link

@juliechevalier, I updated ggscatterhist to support this function. You can find the version here: https://github.com/wenbostar/ggpubr/blob/master/R/ggscatterhist.R.

@juliechevalier
Copy link
Author

Thanks ! It will be very helpful.

@kassambara
Copy link
Owner

The following enhancement required:

  1. the output of ggscatterhist() should be a list of ggplots, containing the main scatter plot and the marginal plots, which can be customized by the end user using the standard ggplot verbs
  2. writing a S3 printing method for an object of class ggscatterhist. The printing method should display the arranged final figure
# returns a list of plots which can be modified
plots <- ggscaterhist()
# Display the arranged ggscatterhist
plots

kassambara added a commit that referenced this issue May 10, 2020
kassambara added a commit that referenced this issue May 10, 2020
New printing method added in ggscatterhist #176
@kassambara
Copy link
Owner

fixed now, thanks!

library(ggpubr)

# Add vertical and horizontal line to a ggscatterhist
plots <- ggscatterhist(iris, x = "Sepal.Length", y = "Sepal.Width", print = FALSE)
plots$sp <- plots$sp + 
  geom_hline(yintercept = 3, linetype = "dashed", color = "blue") +
  geom_vline(xintercept = 6, linetype = "dashed", color = "red")
plots

Created on 2020-05-10 by the reprex package (v0.3.0.9001)

@DanielIAvila
Copy link

This is not longer working.

@LuisEnriqueAngelesGonzalez

It is now.

@DanielIAvila
Copy link

Now, it is not working. First, it is not possible to select xxplot$sp, $spseems to not exist.

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

No branches or pull requests

5 participants