{"id":84,"date":"2007-03-13T23:48:34","date_gmt":"2007-03-14T04:48:34","guid":{"rendered":"http:\/\/raffy.ch\/blog\/2007\/03\/13\/r-scatter-plots-with-histograms\/"},"modified":"2007-03-13T23:50:53","modified_gmt":"2007-03-14T04:50:53","slug":"r-scatter-plots-with-histograms","status":"publish","type":"post","link":"https:\/\/raffy.ch\/blog\/2007\/03\/13\/r-scatter-plots-with-histograms\/","title":{"rendered":"R &#8211; Scatter Plots with Histograms"},"content":{"rendered":"<p>I came accross this really nice <a title=\"R Gallery\" href=\"http:\/\/addictedtor.free.fr\/graphiques\/\">library<\/a> of R graphs and scripts. One that I really liked is a scatter plot with histograms for each of the axes. The code to generate such a graph is the following:<\/p>\n<p><code>Dataset < - read.table(\"\/home\/ram\/foo2_200.csv\", header=FALSE, sep=\",\")\nx <- as.numeric(Dataset$V2)\ny <- as.numeric(Dataset$V3)\nnf <- layout(matrix(c(2,0,1,3),2,2,byrow=TRUE), c(3,1), c(1,3), TRUE)\npar(mar=c(3,3,1,1))\nplot(x,y,xlab=\"\",ylab=\"\")\npar(mar=c(0,3,1,1))\nxhist <- hist(x, breaks=seq(min(x),max(x),(max(x)-min(x))\/24), plot=FALSE)\nbarplot(xhist$count,axes=FALSE,space=0,col=heat.colors(24))\npar(mar=c(3,0,1,1))\nyhist <- hist(y, breaks=seq(min(y),max(y),(max(y)-min(y))\/24), plot=FALSE)\nbarplot(yhist$count,axes=FALSE,space=0,horiz=TRUE,col=heat.colors(24))\n<\/code><\/p>\n<p>And the result looks like this:<\/p>\n<p><img decoding=\"async\" title=\"Histogram Scatterplot\" alt=\"Histogram Scatterplot\" src=\"http:\/\/raffy.ch\/blog\/histoscatter.jpg\" \/><\/code><\/p>\n","protected":false},"excerpt":{"rendered":"<p>I came accross this really nice library of R graphs and scripts. One that I really liked is a scatter plot with histograms for each of the axes. The code to generate such a graph is the following: Dataset < - read.table(\"\/home\/ram\/foo2_200.csv\", header=FALSE, sep=\",\") x\n<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2],"tags":[],"class_list":["post-84","post","type-post","status-publish","format-standard","hentry","category-visualization"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/raffy.ch\/blog\/wp-json\/wp\/v2\/posts\/84","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/raffy.ch\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/raffy.ch\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/raffy.ch\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/raffy.ch\/blog\/wp-json\/wp\/v2\/comments?post=84"}],"version-history":[{"count":0,"href":"https:\/\/raffy.ch\/blog\/wp-json\/wp\/v2\/posts\/84\/revisions"}],"wp:attachment":[{"href":"https:\/\/raffy.ch\/blog\/wp-json\/wp\/v2\/media?parent=84"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/raffy.ch\/blog\/wp-json\/wp\/v2\/categories?post=84"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/raffy.ch\/blog\/wp-json\/wp\/v2\/tags?post=84"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}