Hello, I can't seem to add transparency to any color ramp I create using colorRampPalette(). Can someone tell me if it is possible to create transparent colour ramps? I am attempting to map shaded relief under elevation data. I know I can use the terrain.colors() with the alpha option, but I would prefer to create my own colour ramp using more vibrant colours. My most recent attempt at doing this involved generating multiple rgb colours with transparency (alpha = 0.5) and then combining these colours using colorRampPalette(). I am able to use the resulting colour ramp, but it has no transparency. # Make terrain colour ramp rgb7 <- rgb(red=0, green=255, blue=77, alpha = 0.5, maxColorValue = 255) rgb8 <- rgb(red=26, green=255, blue=0, alpha = 0.5, maxColorValue = 255) rgb9 <- rgb(red=128, green=255, blue=0, alpha = 0.5, maxColorValue = 255) rgb10 <- rgb(red=230, green=255, blue=0, alpha = 0.5, maxColorValue = 255) rgb11 <- rgb(red=255, green=255, blue=0, alpha = 0.5, maxColorValue = 255) rgb12 <- rgb(red=255, green=229, blue=60, alpha = 0.5, maxColorValue = 255) rgb13 <- rgb(red=255, green=219, blue=119, alpha = 0.5, maxColorValue = 255) rgb14 <- rgb(red=255, green=224, blue=178, alpha = 0.5, maxColorValue = 255) rgb15 <- rgb(red=255, green=255, blue=255, alpha = 0.5, maxColorValue = 255) terraincolours <- colorRampPalette(c(rgb7, rgb8, rgb9, rgb10, rgb11, rgb12, rgb13, rgb14, rgb15))
# Plot map image(terrain, col = shadecolours(512), axes = TRUE) # plots the shaded relief #image(dem, col = terrain.colors(512, alpha = 0.5), add = TRUE) # this option works, but I don't like the colours in the terrain.colors pallet. image(dem, col = terraincolours(512), add = TRUE) # draws the elevation data with no transparancy and it won't accept an alpha value Thank you, James Please consider the environment before printing this email. NIWA is the trading name of the National Institute of Water & Atmospheric Research Ltd. [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.