R generate 2D histogram from raw data

后端 未结 6 1945
谎友^
谎友^ 2021-02-01 07:47

I have some raw data in 2D, x, y as given below. I want to generate a 2D histogram from the data. Typically, dividing the x,y values into bins of size 0.5, and count the number

6条回答
  •  死守一世寂寞
    2021-02-01 08:03

    i came to this page from http://www.r-bloggers.com/5-ways-to-do-2d-histograms-in-r/ which lists one of the answers above. It provides code samples for a total of 5 methods:

    hist2d from the library gplots
    hexbin,hexbinplot from the library hexbin
    stat_bin2d from the library ggplot2
    kde2d from the library MASS
    the "hard way" solution listed above.
    

提交回复
热议问题