1

I would like the logticks to look a bit like the figure at the bottom of this page: http://www.cyto.purdue.edu/archive/flowcyt/research/cytotech/apopto/data/chap16.htm

I am using the ggcyto package (https://github.com/RGLab/ggcyto) for this, which in turn uses ggplot2.

But adding annotation_logticks() gives ticks on the inside of the x and y axes (see attachment), whereas I think it looks better with the ticks on the outside. Is there any way to do this? I couldn't find the answer in the documentation but maybe I am not looking in the right place? enter image description here

(This is flow cytometry data, which I load into R using Bioconductor packages, and plot using ggcyto. I make the plot using this code, and I am not sure how I can make a MWE with flow cytometry data, but if you think that is relevant, I have posted the data and all the code to generate the plot here for an unrelated issue: https://github.com/RGLab/ggcyto/issues/13 )

ggcyto(gated.selected, aes(x = `PI-A`, y = `BV421-A`)) +
  geom_hex(bins = 200) +
  geom_gate(qg.names) + 
  labs(x = "PI", y = "Annexin V") + 
  geom_stats() +
  annotation_logticks()

Edit: after trying the link in Henrik's comment:

p <- ggcyto(gated.gs[1], aes(x = `PI-A`, y = `BV421-A`)) +
  geom_hex(bins = 200) +
  geom_gate(qg.names) +
  labs(x = "PI", y = "Annexin V") +
  geom_stats() +
  annotation_logticks(short = unit(-0.1, "cm"), mid = unit(-0.2, "cm"), long = unit(-0.3, "cm"))

p.build.gtable <- ggplot_gtable(ggplot_build(p))
p.build.gtable$layout$clip
p.build.gtable$layout$clip <- c("on", "off", "off", "off", "off", "off", "off", "off", "off")
grid.draw(p.build.gtable)

enter image description here

srao
  • 308
  • 1
  • 3
  • 13
  • You may try this workaround: [reversing tick direction with annotation_logticks](https://groups.google.com/forum/#!topic/ggplot2/OlGA8Gm9O7w) – Henrik Sep 29 '16 at 10:50
  • @Henrik, I tried that up to changing the clip settings, but I don't know how to change the code for GeomLogticks? (please see new figure for where I am now). Thanks. – srao Sep 29 '16 at 11:10
  • 1
    You find the code for `annotation_logticks` and `GeomLogticks` [here](https://github.com/hadley/ggplot2/blob/master/R/annotation-logticks.r) – Henrik Sep 29 '16 at 11:18
  • Thanks, I got the code from there, but couldn't figure out where to add `yticks <- with(yticks,yticks[value > base^scales$y.range[1] & value< base^scales$y.range[2],])`. It doesn't seem to make any difference if I add it after `yticks <- coord$transform...` or before `if (scaled)` with no effect. I even tried changing `scales` to `panel_scales`. Besides, these ranges of `xticks` and `yticks` should already be taken care of by the `minpow` and `maxpow` arguments of `calc_logticks()`, shouldn't they? – srao Sep 29 '16 at 16:32

0 Answers0