matlab - Hist3 Plotting and Axes Range -


i'm plotting 3-d histogram matlab , it's working pretty ok, except different axes ranges. i'd them defined in way, equal value pairs lie on bisecting line.

my code looks (more or less "stolen" hist3 matlab example):

[vec_voxel_ids, vec_dose_values_reference, vec_dose_values_control] = ...     textread('_boostint_voxel_data.txt', '%u %u %u'); mat_dose_values = [vec_dose_values_reference, vec_dose_values_control]; hist3(mat_dose_values, [100, 100]); xlabel('dose reference'); ylabel('dose control'); set(gcf, 'renderer', 'opengl'); set(get(gca,'child'), 'facecolor', 'interp', 'cdatamode', 'auto'); 

this how looks: histogram

in order reposition bins align centers ticks , choose range of bin values can use hist3's 'edges' option (similar in histc):

data = 500+5*randn(1e3,2);           % dummy data d = 1;                               % width x , y bins x = 480:d:520;                       % range x bins y = x;                               % use same range y bins, can different hist3(data, 'edges', {x-d/2,y-d/2}); % subtract half bin width center bins set(gcf, 'renderer', 'opengl'); set(get(gca,'child'), 'facecolor', 'interp', 'cdatamode', 'auto'); view(2) axis equal axis([478 522 478 522]) grid minor xlabel('x') ylabel('y') 

this example produces this: hist3 output

note, re-binning of data output may different compared before. bins have been shifted align centers , histogram recalculated.


Comments

Popular posts from this blog

php - Calling a template part from a post -

Firefox SVG shape not printing when it has stroke -

How to mention the localhost in android -