Try this: D1 = load('X.mat'); D2 = load('Y.mat'); X = D1.X; Y = D2.Y; data = [X,Y]; hh3 = hist3(data, 'Nbins',[1 1]*60); figure image(flipud(hh3)) ax = gca; xt = ax.XTick; yt = ax.YTick; ax.XTickLabel = xt*10; set(ax, 'YTick',[0 yt], 'YTickLabel', [flip([0 yt])]*10) producing: Experiment to get different results. . Answer from Star Strider on mathworks.com
🌐
MathWorks
mathworks.com › matlab › graphics › 2-d and 3-d plots › data distribution plots
Histogram2 - Bivariate histogram plot - MATLAB
Data to distribute among bins, specified as separate arguments of vectors, matrices, or multidimensional arrays. X and Y must be the same size. histogram2 treats matrix or multidimensional array data as single column vectors, X(:) and Y(:), and plots a single histogram.
🌐
MathWorks
mathworks.com › matlab › graphics › 2-d and 3-d plots › data distribution plots
histcounts2 - Bivariate histogram bin counts - MATLAB
For more information, see Run MATLAB Functions in Thread-Based Environment. ... You can normalize histogram values as percentages by specifying the Normalization name-value argument as 'percentage'. histogram | histcounts | discretize | histogram2 | morebins | fewerbins
🌐
MathWorks
mathworks.com › statistics and machine learning toolbox › descriptive statistics and visualization › managing data
hist3 - (Not recommended) Bivariate histogram plot - MATLAB
You can use the name-value pair arguments of histogram2 to use normalization (Normalization), adjust the width of the bins in each dimension (BinWidth), and display the histogram as a rectangular array of tiles instead of 3-D bars (DisplayStyle). ... Run the command by entering it in the MATLAB ...
🌐
Cdslab
cdslab.org › paramonte › notes › examples › matlab › mlx › visualization_histogram2.html
Making 2D histogram plots with the ParaMonte visualization tools
To draw the 2D histogram, the ParaMonte visualizer utilizes the histogram2() function of MATLAB. One can pass pairs of (key,value) properties to this MATLAB function by defining those keyword properties in the histogram2 component of the plot object.
🌐
MathWorks
mathworks.com › matlabcentral › answers › 461874-change-colormap-of-histogram2
change colormap of histogram2 - MATLAB Answers - MATLAB Central
May 13, 2019 - Hi, I was looking for a way to change the colormap for histogram2 from parula to something else. Couldn't find it. x = randn(5000); y = randn(5000); h = histogram2(test1, test2, 'DisplayStyle',...
Find elsewhere
🌐
MathWorks
mathworks.com › matlabcentral › answers › 557791-extract-data-using-histogram2
Extract data using histogram2() - MATLAB Answers - MATLAB Central
July 1, 2020 - If you want the data that was passed into histogram2 retrieve the Data property of the histogram.
🌐
MathWorks
mathworks.com › matlabcentral › answers › 471261-how-to-construct-a-weighed-2d-histogram
How to construct a weighed 2D histogram? - MATLAB Answers - MATLAB Central
July 11, 2019 - H = histogram2( X, Y ) to plot (along the z-axis) the sum/count of number of points per bin. My question: how can I modify this to account for the weight of every sample point within a bin?
🌐
MathWorks
mathworks.com › matlabcentral › answers › 837553-histogram-of-a-a-function-with-two-variable
histogram of a a function with two variable - MATLAB Answers - MATLAB Central
May 23, 2021 - H = HISTOGRAM2(...) also returns a Histogram2 object. Use this to inspect and adjust the properties of the histogram. Class support for inputs X, Y, XEDGES, YEDGES: float: double, single integers: uint8, int8, uint16, int16, uint32, int32, uint64, int64 logical See also HISTCOUNTS2, HISTCOUNTS, HISTOGRAM, DISCRETIZE, matlab.graphics.chart.primitive.Histogram2 Documentation for histogram2 doc histogram2 Other functions named histogram2 tall/histogram2
🌐
Plotly
plotly.com › matlab › 3D-histogram
3d histograms in MATLAB
Generate 10,000 pairs of random numbers and create a bivariate histogram. The histogram2 function automatically chooses an appropriate number of bins to cover the range of values in x and y and show the shape of the underlying distribution.
🌐
MathWorks
mathworks.com › matlabcentral › fileexchange › 66629-2-d-histogram-plot
2-D histogram plot - File Exchange - MATLAB Central
November 1, 2023 - HIST2D mimics the core Matlab function HISTOGRAM2 introduced in R2015b. But the first uses release compatible language, without any dependency.
Top answer
1 of 1
2
histogram2() creates a bivariate histogram plot that you can apply to your data. Here's a demo that applies this plot to noisy gaussian curves. Pay attention the variables x and y which will be inputs to histogram2. Produce the noisy data. You'll already have the data; you just need to make sure it has the same general shape as these x and y variables. % Produce noise gaussian data % x is a 1xm or mx1 vector that defines the x values for each curve. % y is a mxn matrix of m y-values for n curves. gausFcn = @(X,C,A,S)exp(-(X - C).^2/(2*S^2)) * A; % guassian function (x, center, amp, sigma) x = 0 : 0.5 : 3000; % The x values for all curves nCurves = 20; % Number of curves to produce y = zeros(numel(x),nCurves); % We'll store the y data here % Produce n noisy curves for i = 1:nCurves y(:,i) = gausFcn(x,randi(100)+1200,(rand(1)+1)*4+10,randi(120)+500) + sin(linspace(0,randi(20)*pi,numel(x))); end % Show the noisy data figure() sph(1) = subplot(2,1,1); plot(x,y) grid on Apply the bivariate histogram % First, replicate the x values so there's 1 x value for each y value. xRep = repmat(x, 1, nCurves); % for row vectors; if col vec: repmat(x, nCurves, 1) % apply the bivariate historgram sph(2) = subplot(2,1,2); linkaxes(sph) h = histogram2(xRep(:),y(:),'DisplayStyle','tile','ShowEmptyBins','on'); Result Note, if you'd like it to look like the image you shared, set colormap to gray but reverse the order of colors. colormap(flipud(gray(255))) See the histogram2() link to learn how to set the x and y grid in the bivariate histogram.
🌐
MathWorks
mathworks.com › matlab › graphics › 2-d and 3-d plots › data distribution plots
histcounts - Histogram bin counts - MATLAB
histogram | histogram2 | discretize | histcounts2 | kde · Replace Discouraged Instances of hist and histc · You clicked a link that corresponds to this MATLAB command: Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
🌐
MathWorks
mathworks.com › matlabcentral › answers › 2102616-how-to-draw-an-histogram
How to draw an histogram? - MATLAB Answers - MATLAB Central
April 3, 2024 - It sounds like you want the second ... or a matrix (use histogram2). Here is an example of both. ... This is the right question: How do I draw an histogram knowing the frequency of all the individual elements in a 150x150 matrix appears using matlab?...
🌐
MathWorks
mathworks.com › matlabcentral › answers › 403222-how-to-normalize-a-histogram2-along-one-dimension
How to normalize a histogram2 along one dimension? - MATLAB Answers - MATLAB Central
May 30, 2018 - Histogram2 provides an alternative, where bin heights or colors show the amount of counts or probability (or corresponding density) to have events in a given region.
🌐
MathWorks
mathworks.com › matlabcentral › answers › 1950748-apply-different-colormaps-to-different-data-sets-on-histogram2
Apply different colormaps to different data sets on histogram2 - MATLAB Answers - MATLAB Central
April 21, 2023 - histogram2(x, y, xedges, yedges, 'normalization', 'probability', 'DisplayStyle','tile', 'FaceColor','flat') hold on histogram2(x2, y2, xedges, yedges, 'normalization', 'probability',...