Skip to content

Commit af6fedc

Browse files
authored
Update 2019-08-12-geom_raster.md
1 parent 7164bb4 commit af6fedc

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

_posts/ggplot2/2019-08-12-geom_raster.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,10 @@ geom\_raster creates a coloured heatmap, with two variables acting as the x- and
4545

4646
```r
4747
library(reshape2)
48+
library(plotly)
49+
4850
df <- melt(volcano)
4951

50-
library(plotly)
5152
p <- ggplot(df, aes(Var1, Var2)) +
5253
geom_raster(aes(fill=value)) +
5354
labs(x="West to East",
@@ -69,9 +70,10 @@ This uses the Spectral palette from [ColorBrewer](https://ggplot2.tidyverse.org/
6970

7071
```r
7172
library(reshape2)
73+
library(plotly)
74+
7275
df <- melt(volcano)
7376

74-
library(plotly)
7577
p <- ggplot(df, aes(Var1, Var2)) +
7678
geom_raster(aes(fill=value)) +
7779
scale_fill_distiller(palette = "Spectral", direction = -1) +

0 commit comments

Comments
 (0)