Questions tagged [geom-raster]
52 questions
2
votes
1 answer
drawing a box around a raster key
I'm plotting a species prediction map in ggplot using a spatial pixels data frame. I have the plot pretty much how I want it, the only problem is that my raster scale goes from white to red and so it's hard to see where it begins in the legend see…

Jennifer Taylor
- 33
- 3
1
vote
2 answers
How to use multiple colour scales in ggplot2 in R
Given this matrix where on the x-axis are the latent values (1,2,3,4) and on the y-axis three levels for each drug (RAS, BB and AA). Each box of the matrix contains values between 0 and 1, I would like the boxes colored with an increasing colour…

Nicole
- 11
- 1
1
vote
1 answer
How to plot spatial data when grid cell size varies
I am trying to make a map of global model predictions with the outline of the world on it.
The data I have cover most of the worlds oceans and the grid cells have a resolution of 4 degrees. This is my desired output: Map of global predictions
This…

Jam
- 11
- 2
1
vote
1 answer
Fill Geom_Raster with Multiple Colors
I have a data frame with 3 columns I want to display using geom_raster where the x-axis, y-axis, and fill all contain categorial values. The goal with my original dataset is to show the overlapping data with fills and to show where no data is held…

Patrick
- 292
- 1
- 11
1
vote
1 answer
geom_raster() produces a whitish surface ontop of the map
I am trying to plot a heatmap ontop of a geographical map to show the geographic distribution of a variable. The minimum working code, with absurd data, is the following:
library(ggmap)
library(osmdata)
box <- c(left = 2.075, bottom = 41.325, right…

morphicphicus
- 33
- 4
1
vote
1 answer
How does geom_raster handle duplicated fill?
I would like to present the probabilities of some joint events as a raster using ggplot2 package and wonder how does geom_raster decides which value to promote in case of more than one cell values. I have cases where these events can have more than…

Liman
- 1,270
- 6
- 12
1
vote
0 answers
How to combine the fill and alpha aesthetics from two different geoms when using ggplotly
I am trying to add a relief to an interactive choropleth map. I saw that in a non-interactive setting this can be done using the alpha scale of geom_raster and the fill scale of geom_polygon. This works just fine:
library(ggplot2)
library(plotly)
#…

dropout
- 17
- 5
1
vote
1 answer
producing heat map over Geo locations in R
I want to produce heat map based on some geo-location data on top of the US map using r.
The following plot is created over the US map where I used geom_polygon() and geom_point().
How can I convert this to a heat map to get something as follows…

temp
- 82
- 1
- 10
1
vote
0 answers
How to fix ggplot2 geom_text labels for data points overlapping when exporting as .pdf
I'm working with a data set that I want to output in a geom_tile plot, see below:
plot114 <- ggplot(data = data1,
aes(x = total,
y = vrc)) +
geom_step(step,
aes(x = x,
y =…

tonix
- 13
- 3
1
vote
0 answers
How to use ggplot faceting with data from different dataframes?
I'm trying to use ggplot2 in RStudio to plot nutrient concentrations in a soil profile in function of depth. In addition, I would like to add the proportion of time the soil at that specific depth is unsaturated with a heatmap as background (see…

Niels Van Putte
- 23
- 3
1
vote
0 answers
Change diagonal within geom_raster() from bottom-left-to-top-right to top-left-to-bottom-right
I have created a heatmap using geom_raster() within ggplot. Currently, the diagonal goes from the bottom left to the top right. I went to flip the diagonal so that it goes from the top left to the bottom right.
I've tried to reverse the order x…

CurtLH
- 2,329
- 4
- 41
- 64
1
vote
1 answer
Overlay multiple geom_raster plots with different gradients
I would like to plot with gglot's geom_raster a 2D plot with 2 different gradients, but I do not know if there is a fast and elegant solution for this and I am stuck.
The effect that I would like to see is the overlay of multiple geom_raster,…

qubert
- 83
- 5
1
vote
1 answer
Dual color rectangles from ggplot2 geom_raster()
My question is similar to this link. In this example, 1 is coded for mutation, 0 for wildtype and NA for not available. My dataframe is set up identically, however it may contain two or more types of mutation per gene. I would like to generate a…

bgene
- 21
- 2
1
vote
1 answer
Plotting Heatmap with geom_raster in ggmap
I have a data frame containing longitude, latitude and a intensity variable (var1.pred).
I would like to plot a smooth filled contour plot on a ggmap map. I have done it using a geom_tile plot but it doesn't look smooth. I have decreased the tile…

Robin
- 389
- 5
- 19
1
vote
1 answer
R how to overlay map package and geom_tile?
I'm having trouble overlaying a map (from map package) with raster data (from ggplot2 geom_tile)?
library(ggplot2)
library(ggmap)
library(maps)
library(mapdata)
Here's my data
mydata = read.csv("Seasonal_Temp.csv")
head(mydata)
>…

James
- 123
- 1
- 8