[R-sig-Geo] Avoid axis labels, ticks and marks in ggRGB() plot

Agustin Lobo alobolistas at gmail.com
Mon Mar 13 12:10:42 CET 2017


In order to save space, I prefer to avoid coordinates in the plot
generated by ggRGB. Is there any way? I've tried:

ggplot() +
ggRGB(rlogo, r=1, g=2, b=3,ggLayer=TRUE) +
  theme(
    axis.text = element_blank(),
    axis.ticks = element_blank(),
    axis.title = element_blank())

but get an empty plot.
I can circumvent the problem as follows, but it is kind of ugly and complicated,
there must be another way:

a <- as(extent(rlogo), 'SpatialPolygons')
y <- fortify(a,region=id)
ggplot(data=y,aes(y=lat, x=long)) +
  ggRGB(rlogo, r=1, g=2, b=3,ggLayer=TRUE) +
  geom_polygon(colour="yellow", fill=NA) +
  guides(fill=FALSE) +
  coord_fixed(ratio=1) +
  theme(
    axis.text = element_blank(),
    axis.ticks = element_blank(),
    axis.title = element_blank())

Agus



More information about the R-sig-Geo mailing list