How to plot a Histogram in MATLAB ? Last Updated : 06 Sep, 2021 Comments Improve Suggest changes Like Article Like Report A Histogram is a diagrammatic representation of a group of data over user-specified ranges. Basically, the histogram contains several bins. Bins are non-overlapping intervals in which the data is spread. In MATLAB we have a function named hist() which allows us to plot a bar graph. Syntax: hist(X) where X represents the data. The X is a vector. The histogram function uses an algorithm that returns bins and bins width are equal. And these bins spread according to the data given in vector. The interesting thing is that the height of each bin represents the number of points in that bin. Now let's move to some examples. Example 1: A simple Histogram: MATLAB % generate 10,000 random numbers y=randn(10000,1) % hist() function to plot the histogram % if the value of bins is not given then % this function choose appropriate numbers % of bin hist(y) Output: Example 2: Histogram with a given number of bins: MATLAB % generate 10,000 random numbers y=randn(10000,1) % assign 50 to variable nbins for % number of bins nbins=50; % hist() function to plot the histogram % hist() function use the nbins variable % and spread the data in 50 bins hist(y,nbins) Output: Example 3: Histogram of multiple columns: MATLAB % generate 10,000 random numbers in 4 groups y=randn(10000,4) % hist() function to plot the histogram % hist() function use the nbins variable and % spread the data in 50 bins hist(y) Output : Example 4: Make Histogram of image: MATLAB % read the image I = imread('ngc6543a.jpg'); % display the image imshow(I) MATLAB % imhist() function is used to % draw histogram of image imhist(I) Output : Comment More infoAdvertise with us Next Article How to plot a Histogram in MATLAB ? parasharraghav Follow Improve Article Tags : Software Engineering MATLAB Similar Reads How to Normalize a Histogram in MATLAB? Histogram normalization is a technique to distribute the frequencies of the histogram over a wider range than the current range. This technique is used in image processing too. There we do histogram normalization for enhancing the contrast of poor contrasted images. Formula:  New intensity= ((Inten 2 min read How to Plot Multiple Histograms in R? In this article, we will discuss how to plot multiple histograms in the R Programming language. Method 1: Multiple Histogram in Base R To create multiple histograms in base R, we first make a single histogram and then add another layer of the histogram on top of it. But in doing so some plots may cl 6 min read How to Add Text Labels to a Histogram in Plotly Plotly is a powerful and versatile library for creating interactive visualizations in Python. Among its many features, Plotly allows users to create histograms, which are essential for visualizing the distribution of numerical data. Adding text labels to histograms can enhance the interpretability o 3 min read How to Plot Histogram from List of Data in Matplotlib? In this article, we are going to see how to Plot a Histogram from a List of Data in Matplotlib in Python.The histogram helps us to plot bar-graph with specified bins and can be created using the hist() function.Syntax: hist( dataVariable, bins=x, edgecolor='anyColor' )Parameters:dataVariable- Any va 3 min read Plot 2-D Histogram in Python using Matplotlib 2D Histogram is used to analyse the relationship among two data variables which has wide range of values.A 2D histogram is very similar like 1D histogram.The class intervals of the data set are plotted on both x and y axis.Unlike 1D histogram, it drawn by including the total number of combinations o 4 min read Like