Questions tagged [geom-tile]

86 questions
1
vote
1 answer

Merging identical tiles

I use geom_tile() together with geom_text from ggplot2 to generate basically a table: Two factors (X and Y) are plotted on the x-axis (resulting in two columns of tiles). Levels of factor Y are nested within factor X. Therefore, multiple identical…
empetrum
  • 37
  • 6
1
vote
1 answer

Multiple heatmaps at once

I am trying to get multiple heatmaps using facet_wrap and geom_tile function, I have 1000 samples. My objective is to obtain a heatmap for each Parent_Gene that include the "Condition" in the “X” axis, "response value" as a “fill” and the Genes…
1
vote
2 answers

Label or Highlight Specific Rows in ggplot2

I have a great looking geom_tile plot, but I need a way to highlight specific rows or label specific rows based on a binary value. Here is a small subset of data in wide format and resulting output: df <- structure(list(bin_level = c(0,1), sequence…
Doda
  • 285
  • 1
  • 9
1
vote
1 answer

Adding a Group Label to x-axis in geom_tile()

I'm looking to add an overarching grouping label to variables on the x-axis of geom_tile(). This is similar to the result I'm looking for: However, the best I can come up with (WITHOUT using geom_text() and manually adding group 1, group 2 and…
aczich
  • 140
  • 11
1
vote
1 answer

How to use geom_tile to plot factorial variable (photoperiod) behind continuous numeric data (x = time, y = variable)

I am working with time-series data, where at every timepoint, I have many measurements for each of up to 16 subjects, spanning multiple days. I currently have the data organized as tidily as I can - here is a snippet. > df # A tibble: 23,844 x 40 …
Chelsea
  • 13
  • 3
1
vote
1 answer

Remove grey vertical stripes separating samples in geom_tile

Hi My data (data_long) looks like this: genes sample value Group Type A1 O7high 6796.448 G0 A AA O7high 4997.250 G0 A A3 O7high 9477.100 G0 A A4 O7high 6083.558 G0 A A1 08low 075.364 G0 B AA 08low …
Biofreek
  • 39
  • 5
1
vote
1 answer

How to plot geom_tile() with offset geom_text() labels indicated using arrows?

I can plot geom_tile()s with labels via geom_text() like so: library(ggplot2) df <- structure(list(x = c(1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L), y = c("A", "A", "A", "A",…
Dunois
  • 1,813
  • 9
  • 22
1
vote
2 answers

R heatmap: assign colors to values

I've found the following R code in the R graph gallery (https://www.r-graph-gallery.com/79-levelplot-with-ggplot2.html) for a heatmap and modified it a little bit: # Library library(ggplot2) set.seed(10) # Dummy data x <- LETTERS[1:20] y <-…
MDStat
  • 355
  • 2
  • 17
1
vote
1 answer

Adding the track colors below x-axis using geom_tile

I plotted a matrix using geom_tile. Then, I would like to add the track colors below the x-axis. I ran the following code from the similar topic answer (ggplot Adding Tracking Colors Below X-Axis), but it shows the error "Discrete value supplied to…
marie
  • 315
  • 1
  • 9
1
vote
2 answers

Make ggplot2 heatmap with different colors for values over/under thresholds

I want to make a table with cells highlighted according to their value, Perc_Diff in this case. I want values between -100 and +100 to follow a scale_fill_gradient2 pattern (see code below), but values <= -100 to be blue, and values of >= 100 to be…
user8229029
  • 883
  • 9
  • 21
1
vote
1 answer

changing the breaks in geom_tile()

I have matrix data and would like to create heat map using geom_tile(). geom_tile() successfully functioned, but the limit of "value" seemed to be lengthout. (For example, over 100 value is the same color breaks) . I would like to compare the result…
marie
  • 315
  • 1
  • 9
1
vote
2 answers

Invert continuous color scale legend in ggplot geom_tile heatmap

Minimal example: library(ggplot2) x <- c(1:3) y <- c(1:3) data <- expand.grid(X=x, Y=y) data$Z <- runif(9) ggplot(data, aes(X, Y, fill=Z)) + geom_tile() Produces this: How do you get the Z scale bar on the right to run from 0 on top to 1 on the…
goweon
  • 1,111
  • 10
  • 19
1
vote
2 answers

Paste mean values on geom_tile plot (ggplot in R)

I am using this code: library(tidyverse) library(reshape) mtcars <- melt(mtcars, id="vs") mtcars$vs <- as.character(mtcars$vs) ggplot(mtcars, aes(x=vs, y=variable, fill=value)) + geom_tile() How can I paste the mean values as text on…
Sylvia Rodriguez
  • 1,203
  • 2
  • 11
  • 30
1
vote
1 answer

geom_tile: show tile color if a specific condition meets

I want to show color if a specific condition meets (for example z > 1) and colorless otherwise. Could you please tell me how to do that? xp <- c('Disease_1','Disease_2','Disease_3','Disease_4') xp1 <- xp[1:2] yp <- c('BCell','TCell') df <-…
yazdan
  • 23
  • 5
1
vote
1 answer

Adding zero values where none exists for geom_tile

I'm trying to create a heat map with geom_tile but not all have coordinates have values. Therefore my geom_tile looks like this: The code to create the image is library(dplyr) data(mpg) mydata <- mpg %>% group_by(manufacturer, cyl) %>%…
spiga
  • 15
  • 3