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: