Closed IndrajeetPatil closed 6 years ago
Hi Indrajeet,
I haven't looked through this issue yet, but could you please post a more isolated example, that only uses ggMarginal code and doesn't use your wrapper functions? It would be more indicative of a problem with ggmarginal if you can show a problem using only ggmarginal code
Dean Attali President & CEO AttaliTech Ltd http://AttaliTech.com http://attalitech.com
Want to improve your Shiny skills? Try my new interactive, online video course Shiny Case Studies https://www.datacamp.com/courses/building-web-applications-in-r-with-shiny-case-studies
On 11 March 2018 at 14:09, Indrajeet Patil notifications@github.com wrote:
Hi,
I have a wrapper function around ggExtra::ggMarginal() in my package (it just adds results from statistical tests) and I noticed some unusual behavior with this function: It changes the position of the subtitle based on whether a title is present or not. Is this desired behavior? Is it possible to always have the subtitle on top of the marginal plots? Otherwise, at least in my view, the subtitle looks pretty cramped between the marginal distribution and the plot panel.
Here is a reprex:
install.packages("devtools")devtools::install_github("IndrajeetPatil/ggstatsplot")#> Skipping install of 'ggstatsplot' from a github remote, the SHA1 (f801b442) has not changed since last install.#> Use
force = TRUE
to force installationwithout titlep1 <- ggstatsplot::ggscatterstats(data = iris,
x = Sepal.Length, y = Sepal.Width)#> Warning: This function doesn't return ggplot2 object. Thus, this plot is not further modifiable with ggplot2 commands.#>
with titlep2 <- ggstatsplot::ggscatterstats(data = iris,
x = Sepal.Length, y = Sepal.Width, title = "Dataset: Iris")#> Warning: This function doesn't return ggplot2 object. Thus, this plot is not further modifiable with ggplot2 commands.#>
plotting side-by-side to highlight the differencecowplot::plot_grid(p1,
p2, labels = c("(a)", "(b)"), nrow = 1, ncol = 2)
Created on 2018-03-11 by the reprex package http://reprex.tidyverse.org (v0.2.0).
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/daattali/ggExtra/issues/99, or mute the thread https://github.com/notifications/unsubscribe-auth/AA6IFDWPUZTSWHSYhZKlS2g8vqVWCrUhks5tdWhBgaJpZM4Slylb .
@daattali Sure!
Here is a minimal example with only the ggMarginal
code. You can see that the same issue can be seen from this example.
library(ggExtra)
library(cowplot)
library(ggplot2)
# basic ggplot2 object
# without title
p1 <- ggExtra::ggMarginal(
p = ggplot2::ggplot(
data = iris,
mapping = aes(x = Sepal.Length, y = Sepal.Width)
) +
geom_point() +
geom_smooth(method = "lm") +
labs(subtitle = "subtitle")
)
# with title
p2 <- ggExtra::ggMarginal(
p = ggplot2::ggplot(
data = iris,
mapping = aes(x = Sepal.Length, y = Sepal.Width)
) +
geom_point() +
geom_smooth(method = "lm") +
labs(subtitle = "subtitle",
title = "title") # only change
)
# plotting side-by-side to highlight the difference
cowplot::plot_grid(p1,
p2,
labels = c("(a)", "(b)"),
nrow = 1,
ncol = 2)
Created on 2018-03-11 by the reprex package (v0.2.0).
Yeah, this behavior makes sense, given that we only test for whether a title is present (and not whether a subtitle is present).
Should be an easy fix for the next release.
Awesome, thanks! Looking forward to the next release.
@IndrajeetPatil this has been fixed
Hi,
I have a wrapper function around
ggExtra::ggMarginal()
in my package (it just adds results from statistical tests) and I noticed some unusual behavior with this function: It changes the position of thesubtitle
based on whether atitle
is present or not. Is this desired behavior? Is it possible to always have thesubtitle
on top of the marginal plots? Otherwise, at least in my view, thesubtitle
looks pretty cramped between the marginal distribution and the plot panel.Here is a
reprex
:Created on 2018-03-11 by the reprex package (v0.2.0).