Note that there are some explanatory texts on larger screens.

plurals
  1. POScatterplot with marginal histograms in ggplot2
    primarykey
    data
    text
    <p>Is there a way of creating scatterplots with marginal histograms just like in the sample below in <code>ggplot2</code>? In Matlab it is the <code>scatterhist()</code> function and there exist equivalents for R as well. However, I haven't seen it for ggplot2.</p> <p><img src="https://i.stack.imgur.com/uKiQS.jpg" alt="scatterplot with marginal histograms"></p> <p>I started an attempt by creating the single graphs but don't know how to arrange them properly.</p> <pre><code> require(ggplot2) x&lt;-rnorm(300) y&lt;-rt(300,df=2) xy&lt;-data.frame(x,y) xhist &lt;- qplot(x, geom="histogram") + scale_x_continuous(limits=c(min(x),max(x))) + opts(axis.text.x = theme_blank(), axis.title.x=theme_blank(), axis.ticks = theme_blank(), aspect.ratio = 5/16, axis.text.y = theme_blank(), axis.title.y=theme_blank(), background.colour="white") yhist &lt;- qplot(y, geom="histogram") + coord_flip() + opts(background.fill = "white", background.color ="black") yhist &lt;- yhist + scale_x_continuous(limits=c(min(x),max(x))) + opts(axis.text.x = theme_blank(), axis.title.x=theme_blank(), axis.ticks = theme_blank(), aspect.ratio = 16/5, axis.text.y = theme_blank(), axis.title.y=theme_blank() ) scatter &lt;- qplot(x,y, data=xy) + scale_x_continuous(limits=c(min(x),max(x))) + scale_y_continuous(limits=c(min(y),max(y))) none &lt;- qplot(x,y, data=xy) + geom_blank() </code></pre> <p>and arranging them with the function posted <a href="http://gettinggeneticsdone.blogspot.com/2010/03/arrange-multiple-ggplot2-plots-in-same.html">here</a>. But to make long story short: Is there a way of creating these graphs?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload