Rotated histogram in Matlab

I wanted to draw some marginal histograms of a 2d distribution in Matlab. There is a function called scatterhist that does this but I couldn’t integrate it with the other subplots I wanted in this figure. Turns out a rotated histogram is as easy as changing the plot’s virtual camera position by setting the axis’ CameraUpVector property. So for example:

hist(tuningcurvems(:),20)
set(gca,'CameraUpVector',[1,0,0]);

Which gives:


Leave a comment

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s