Questions tagged [geom-tile]
86 questions
4
votes
2 answers
how to change / specify fill color which exceeds the limits of a gradient bar?
In ggplot2/geom_tile, how to change fill color whice exceed the limits?
As the image, Region_4/5 are out of limis(1,11) , so the fill color is default grey, how to change 'Region_4' to 'darkblue', 'Region_5' to 'black' .…

anderwyang
- 1,801
- 4
- 18
4
votes
0 answers
Is there a way to force geom_tile heatmap cells to be a specific size when generating a grid of heatmaps (using facet_wrap)?
In my Shiny data quality assessment application, users upload datasets and can generate reports using RMarkdown. One of those reports is a visual summary of the dataset, rating each variable of the dataset on three metrics: % Compliance (how well…

Judy
- 102
- 1
- 5
4
votes
2 answers
Change x axis labels to hours (time) on geom_tile()
Here is a geom_tile displaying hours and days of the week, how can it made to display each hour (i.e. 00:00 through to 23:00 on the x axis)?
library(tidyverse)
df %>%
ggplot(aes(hour, day, fill = value)) +
geom_tile(colour = "ivory")…

stevec
- 41,291
- 27
- 223
- 311
3
votes
1 answer
Tooltips in plotly generated from ggplot geom_tile
I'm trying to produce an interactive plotly graphic with two vertical axes and on-hover tooltips. The plot should have y1 data as points and y2 data as bars. Everything works just as needed when I use points for data in both sides, but when I use…

djbetancourt
- 347
- 3
- 11
3
votes
1 answer
Different colors for every column in heat map using geom_tile()
I am trying to get a heat map where every column has a different color.
I have a heatmap like this:
# install.packages("reshape")
library(reshape)
library(ggplot2)
# Data
set.seed(8)
m <- matrix(round(rnorm(200), 2), 5, 5)
colnames(m) <-…

user3483060
- 337
- 2
- 13
3
votes
2 answers
Split overlapping tiles by facet in geom_tile
I have stacked a data frame which shows values per id across groups:
df <- tibble::tibble(id = c(LETTERS[1:6], LETTERS[1:5]),
value = c(paste0("V", 1:6), paste0("V", 1:5)),
group = c(rep("group_1", 6),…

henhesu
- 756
- 4
- 9
3
votes
2 answers
How to remove empty spaces between tiles in geom_tile and change tile size
I have a df with the following structure:
id col1 col2 col3
#1 A 1 3 3
#2 B 2 2 3
#3 C 1 2 3
#4 D 3 1 1
I wanted to create a "heatmap-like" figure where col1-col3 are treated as a factor…

YASEM
- 39
- 7
3
votes
1 answer
Problem with ggplot geom-tile convert to plotly chartusing ggplotly
I tried to convert the ggplot geom-tile chart to plotly by using ggplotly function. However, I realized that the outcomes are different. Please refer for the link below to view the difference. Besides that, ggplotly chart also missing colorbar.…

Yo Tee
- 33
- 4
2
votes
1 answer
Geom_tile plots non-existent discontinuities in data for time axis
If I have the following dataframe called data
year month id group returns
2016 2 asset_a group1 0.11592118
2016 3 asset_a group1 0.104526128
2016 4 asset_a group1 0.244925532
2016 5 asset_a group1 0.252377372
2016 …

user96e
- 41
- 4
2
votes
1 answer
How to customize the shape of an contour made inside a geom_tile in ggplot2?
An X, Y, and Z dataset was plotted using geom_tile. I want to make a contour line around the tiles with values less than or equal to 2. For this, I used the stat_contour function, but the result was not as expected. How can I get the expected…

Daniel Valencia C.
- 2,159
- 2
- 19
- 38
2
votes
3 answers
Simulate a two-dimensional random walk in a grid in R and plot with ggplot
I was looking for a simple code that could simulate a two-dimensional random walk in a grid (using R), and then plot the data using ggplot.
In particular, I was interested to a random walk from few position (5 points) in a 2D grid to the center of…

CafféSospeso
- 1,101
- 3
- 11
- 28
2
votes
2 answers
How can I use gganimate with geom_tile?
I was having trouble animating a geom_tile() plot where the tile remains visible after it appears.
Here's my code using the airquality data.
First, the static plot. Here, the x-axis is Day. The y-axis is Month and Temp is the…

FR_Data
- 23
- 3
2
votes
1 answer
R: Heatmap with colour based on groups, NA values in grey and characters included
I am trying to create a heatmap using ggplot and geom_tile. The fill colour is based on my x values and alpha based on values. Based on small example (left), I would like my Plot to look similar to this example (right).
Two problems:
I get errors…

BeccaLi
- 174
- 7
1
vote
1 answer
ggplot legend with geom_tile and geom_line
I'm trying to produce a ggplot chart with two vertical axes where the user can decide which geom to use at each side. The options are lines, points and bars. I'm having troubles to have the correct shape in the legend when adding bars at the left…

djbetancourt
- 347
- 3
- 11
1
vote
2 answers
Scale ticks/ breaks to percentile in continuous colourbar in scale_fill_gradientn (ggplot2)
Here's a reproducible code of the type of plot that I have with ggplot:
set.seed(123)
library(ggplot2)
df = data.frame(
"x_var" = factor(rep(letters[1:10], 100)),
"y_var" = factor(rep(LETTERS[1:10], each=100)),
"fill_var" =…

Léa
- 13
- 2