scatterplot with alpha transparent histograms in R

后端 未结 2 930
别那么骄傲
别那么骄傲 2020-12-12 16:52

How can scatter plots with alpha transparent, scale-less histograms can be made in R, like this figure?

looks like it\'s not made in ggplot2.

2条回答
  •  爱一瞬间的悲伤
    2020-12-12 17:19

    I have no idea whether there is a package that does that directly, but I'm sure this can be done in R. Transparency is easy: you add another two digits to the RGB specification of a color for a given transparency:

    #FF0000 # red
    #FF0000FF # full opacity
    #FF000000 # full transparency
    

    Combining different plots is also easy using the layout function. As for the vertical density plot, it is just the same as the horizontal plot with x and y switched. The example given here can easily be expanded to include colors, smaller margins etc. I can try to come up with a more elaborate example if this description is not sufficient.

提交回复
热议问题