Questions tagged [ggh4x]

Use this tag for questions related to the ggh4x package. The ggh4x package is a ggplot2 extension package which provides some 'hacky' utility functions which can be useful in tweaking your ggplots.

The is a extension package. It provides some utility functions that don’t entirely fit within the ‘grammar of graphics’ concept —they can be a bit hacky— but can nonetheless be useful in tweaking your ggplots.

An overview and introduction to the package can be found on the package website.

16 questions
2
votes
3 answers

How to add vertical lines between facet strips in ggplot?

reprex: library(tidyverse) df <- tibble::tibble( epoca = factor(c("H", "S", "S", "H", "S", "H", "S"), levels = c("S", "H")), ano = c("2019", "2018", "2019", "2021", "2022", "2022", "2021"), n = rep(3:1, c(3L, 2L, 2L)), etiqueta = rep(c("3",…
Alvaro Morales
  • 1,845
  • 3
  • 12
  • 21
2
votes
0 answers

Separating only the outer facets in nested facet plot

I have a plot using doubly nested facets in ggh4x. I would like to have horizontal lines inside the plot separating only the outer facets. library(data.table) library(ggh4x) DT <- data.table(feature = rep(c("var1","var2"),each=9), …
danibarna
  • 21
  • 2
1
vote
1 answer

ggh4x: Rotate group labels with guide_axis_nested ggplot2

Hello I am using this package I found very handy So this is the data: df <- data.frame( x = LETTERS[1:16], group = rep(c("Group 1", "Group 2", "Group 3"), c(5, 3, 8)), value = rpois(16, 10) ) And this is the code: ggplot(df, aes(paste0(x,…
Jorge Paredes
  • 996
  • 7
  • 13
1
vote
2 answers

secondary axis is not working properly with geom_col

I am trying to use help_secondary of ggh4x with geom_col like library(tidyverse) library(ggh4x) library(scales) # Run the secondary axis helper sec <- help_secondary(df, primary = c(Tmax, Tmin, RH), secondary =…
UseR10085
  • 7,120
  • 3
  • 24
  • 54
1
vote
1 answer

ggh4x: Grouping Sub-Groups together in Faceted Plots with guide_nested_axis

I would like to create a bar plot in which the discrete values of the x axis would be grouped into subgroups (see code below), when I have already faceted on another variable. I have used ggh4x to get me close. But I'm not quite there: set.seed(9)…
Nathan
  • 323
  • 3
  • 13
1
vote
0 answers

Error generating builder APK on Android Studio

When you configure the apk file of the Android Studio program this appears etc. Is there a solution to this problem knowing that I am working on a source code called newsfreak? java.lang.AssertionError at…
0
votes
2 answers

R ggh4x facetted_pos_scales

I want to show all facets on the one plot if possible, even if one of the facets has a very different scale. Dataset looks like this: dat <- structure(list(u_measure = c(1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 3L, 3L, 3L, 3L), type = c("FT", "OE",…
Keelin
  • 367
  • 1
  • 10
0
votes
2 answers

How to remove empty panel in 2-way facet_grid?

I want to remove the whole panel from ggplot 2-way facet_grid. I have taken some lead from this question. Here is the code with example data library(ggplot2) library(ggh4x) df <- data.frame(x=rnorm(80),y=rnorm(80), col=rep(c(" ",…
UseR10085
  • 7,120
  • 3
  • 24
  • 54
0
votes
1 answer

When using help_secondary function in ggh4x package, is it possible to add points and change the names of two y-axes?

When using help_secondary function in ggh4x package, is it possible to add points and change the names of two y-axes? For instance, let’s consider examples provided in the manual of help_secondary function …
Rustam
  • 87
  • 6
0
votes
1 answer

Modifying axis labels via scales::number() introduces NAs in combination with facetted_pos_scales()

I have the following butterfly plot that works as expected thanks to the ggh4x package. librarian::shelf(ggpol, tidyverse) dat <- tibble(group = rep(letters[1:5], each = 2), type = factor(paste0("type", rep(c(1:2), 5))), value…
r-newbie
  • 149
  • 7
0
votes
1 answer

How to reorder geom_col in ggh4x::facet_wrap2() based off only one of the graphs

I have created a facet_wrap graph and I am trying to reorder the bars from low to high. Obviously that order will be different for the 3 grids, but I want to make them go from low to high BASED off my bottom graph titled "Salt water". Here is my…
Kristen Cyr
  • 629
  • 5
  • 16
0
votes
1 answer

Create labeller to select which strip texts are displayed using facet_manual

I have the following plot: Sample code: dat = data.frame(grp = rep(c("Group1", "Group2"), 24), label = rep(c(rep("Yes",2), rep("Rather yes",2), rep("Rather no",2), rep("No",2)), 6), pct = rep(c(25,25,25,25), 12), …
Gan Uger
  • 23
  • 4
0
votes
1 answer

how to enquote variable names in r ggplot wrappers

I would like to write custom wrappers for facets in ggplot and have problems handling variable names. What I would like to achieve: mtcars %>% ggplot() + ggh4x::facet_manual(vars(cyl %>% recode('4' = "four", '6' =…
mzuba
  • 1,226
  • 1
  • 16
  • 33
0
votes
1 answer

Plotting the theoretical distribution of exponential with a minimum on facets (ggh4x)

Users of a Shiny app can test data sets for Poisson, normality, and exponentiality. I am returning the results of the statistical test they chose. In addition, I thought it would be nice to plot the density from the data along with the theoretical…
0
votes
2 answers

keeping axis labels with the same limits(no free axis) but removing inner labels facet_wrap2 (ggh4x)

I have a facet_wrap that looks good; however, I want to only have the external lines with actual numerical data and the internal graph lines with tick marks. I am not sure if there is a way top do thisthe first image is the desired plot edited in…
Regan
  • 21
  • 6
1
2