RGLab / ggcyto

Visualize Cytometry data with ggplot2

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

axis_x_inverse_trans overlapping text around 0

alexheubeck opened this issue · comments

Hey @mikejiang and @jacobpwagner,

I'm using axis_x_inverse_trans() and axis_y_inverse_trans() on data with the logicle transform, and the linear portion of the data always has the 0 and 10^2 axis labels overlapping. Any way to have overlapping text on the axis just display 0?

Here is an example:

Screen Shot 2020-08-12 at 1 42 25 PM

Thanks!

Hey @alexheubeck . Ideally, the continuous scale added by the axis_x/y_inverse_trans functions would pass down all parameters to scale_x/y_continuous and properly apply them later, so you could just set the breaks accordingly. However, because of how it's currently implemented, that is not currently honored. For example, my omission of 1e2 is ignored here and that tick is still labeled:

library(ggcyto)
gs <- load_gs(system.file("extdata", "gs_manual", package = "flowWorkspaceData"))
ggcyto(gs[[1]], subset = "CD3+", aes("CD4", "CD8")) +
  geom_hex(bins=0) +
  axis_x_inverse_trans(breaks=c(0,1e3,1e4,1e5)) +
  axis_y_inverse_trans(breaks=c(0,1e3,1e4,1e5))

image

I can put together some workarounds, but they will likely involve going through a standard ggplot object using as.ggplot or just building it directly from the dataframe, which sort of defeats the point. So, I will try to add in support for passing arguments to scale_x/y_continuous as above.

Hey @jacobpwagner,

That would be awesome, thanks so much. On a related note, do you know if it's possible to put log tick marks on a ggplot axis? Particularly on the outside of the plot so it lines up with the axis_x/y_inverse_trans tick marks.

Haven't found a solution to this online, but for anyone with the same problem this workaround worked for me:
p + guides(x = guide_axis(check.overlap = T))