[R] making scatter plot points fill semi-transparent

Gabor Grothendieck ggrothendieck at gmail.com
Thu Aug 6 06:13:06 CEST 2009


Lattice graphics can do that:

library(lattice)
xyplot(0:20 ~ 0:20, alpha = 0:20/20, col = "red", pch = 19, cex = 5)

Google for
  HTML colors
to find out more about the hex codes you are referring to.

On Wed, Aug 5, 2009 at 11:48 PM, per freem<perfreem at gmail.com> wrote:
> hi all,
>
> i have a simple scatter plot, and i'd like to make it so the scatter
> plot colors are slightly transparent. i see in a previous post that
> someone mentioned the "alpha" parameter, but i am not sure how it can
> be used with the 'plot' function [*].
>
> for example, suppose i have:
>
> plot(mydata$column1, mydata$column2, col="red", cex=1)
>
> i now want to make it so the color of these points (in this case red)
> is slightly transparent, which will make overlap between them very
> obvious. i realize that hexbin and other density plot methods are used
> to make this, but i am using it for a different purpose, and so i just
> want the points to be transparent without any binning or shading.
>
> a previous poster suggested:
>
> plot( rnorm(1000), rnorm(1000), col="#0000ff22", pch=16,cex=3)
>
> but i don't understand this color notation. is there any way to pass
> in the usual col="colorname" argument and then tweak that color's
> transparency?
>
> thank you.
>
> https://stat.ethz.ch/pipermail/r-help/2007-October/142934.html
>
> ______________________________________________
> R-help at 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.
>




More information about the R-help mailing list