matlab scatter plot using colorbar for 2 vectors -


i have 2 columns of data. x = model values of nox concentrations , y = observations of nox concentrations. now, want scatter plot x, y (markers varying colors) colourbar show me counts (i.e. number of data points in range). x , y daily data year, i.e. 365 rows.

please me. appreciated. have attached sample image.enter image description here

if understand correctly, real problem creating color information, is, creating bivariate histogram. luckily, matlab has function, hist3, in statistics & machine learning toolbox. syntax is

[n,c] = hist3(x,nbins) 

where x m-by-2 matrix containing data, , nbins 1-by-2 vector containing number of bins in each dimension. return value n matrix of size nbins(1)-by-nbins(2), , contains histogram data. c 1-by-2 cell array, containing bin centers in both dimensions.

% generate sample data x = randn(10000, 1); y = x + rand(10000, 1);  % generate histogram [n,c] = hist3([x,y], [100,100]);  % plot imagesc(c{1},c{2},n); set(gca,'ydir','normal'); colormap(flipud(pink)); colorbar; 

result:

resulting figure


Comments

Popular posts from this blog

Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.12:test (default-test) on project.Error occurred in starting fork -

windows - Debug iNetMgr.exe unhandle exception System.Management.Automation.CmdletInvocationException -

configurationsection - activeMq-5.13.3 setup configurations for wildfly 10.0.0 -