0

I would like to scale a particular part of the y axis of a ggplot graph. The basic code is:

set.seed(1)
df <- data.frame(val = rnorm(100), 
                 gene = rep(letters[1:20], 5), 
                 cell = c(sapply(LETTERS[1:5], 
                                 function(l) rep(l, 20))))
library(ggplot2)
ggplot(df, aes(y = gene, x = cell, fill = val)) +
  geom_tile(color = "white")

which gives the following output:

enter image description here

And I need an output like:

I need to scale particular rows of squares

Maybe you have an idea? Thanks

RRuiz
  • 2,159
  • 21
  • 32
  • 1
    Maybe these existing answers can help: https://stackoverflow.com/questions/7194688/using-ggplot2-can-i-insert-a-break-in-the-axis. It's unclear exactly what type of different scaling you are expecting. – MrFlick Dec 09 '21 at 03:43
  • Hi, thanks. I want that the squares from the upper part have bigger dimensions than the lower ones. – RRuiz Dec 09 '21 at 03:46
  • 1
    But by how much? What determines when the change happens? How exactly do you want these axes labeled? Are distances preserved and you are just changing labels or are you actually trying to transform only part of the data in the graph? – MrFlick Dec 09 '21 at 03:47
  • Oh sorry. If you run the code you see all the characteristics of the basic plot. By how much will depend on other factors. But i need to find the way to change the thickness of them. – RRuiz Dec 09 '21 at 03:48
  • Or maybe i need to find another way to drawn the squares. – RRuiz Dec 09 '21 at 03:56

0 Answers0