Corner histograms

Open this example in the editor - All gramm examples - stat_cornerhist() in the cheat sheet

We start by loading the sample data (structure created from the carbig dataset)

Contents

load example_data;

Visualize x-y difference with inset histogram using stat_cornerhist()

%Generate sample data
N=200;
x=randn(1,N*4);
y=x+randn(1,N*4)/2;
c=repmat([1 2],1,N*2);
b=repmat([1 2 2 2],1,N);
y(c==1 & b==2)=y(c==1 & b==2)+2;


clear g
g=gramm('x',x,'y',y,'color',c);
g.facet_grid([],b);
g.geom_point();
g.stat_cornerhist('edges',-4:0.1:2,'aspect',0.5);
g.geom_abline();

g.set_title('Visualize x-y with stat_cornerhist()');
figure('Position',[100 100 1100 450]);
g.draw();

%Possibility to use axe handles of the inset axes to add elements or change
%properties
xline(g.results.stat_cornerhist(2).child_axe_handle,-2,':','LineWidth',2)
%set([g.results.stat_cornerhist.child_axe_handle],'XTick',[])