Question #296   Submitted by Answiki on 12/22/2020 at 05:52:22 PM UTC

In Matlab, how to draw a bar graph?

Answer   Submitted by Answiki on 12/22/2020 at 06:07:54 PM UTC

The MATLAB bar() function creates a bar graph in a figure. Let's consider the following vectors :

x = [1970 1980 1990 2000 2010 2020];
y = [185  248  125  53   200  189];

The following creates a bar graph with one bar for each element of y:

bar (y)

The following draws the bars at the location specified by x:

bar(x,y);

4 events in history
Question by Answiki 12/22/2020 at 06:08:27 PM
How to draw a bar graph in MATLAB?
Answer by Answiki on 12/22/2020 at 06:07:54 PM

The MATLAB bar() function creates a bar graph in a figure. Let's consider the following vectors :

x = [1970 1980 1990 2000 2010 2020];
y = [185  248  125  53   200  189];

The following creates a bar graph with one bar for each element of y:

bar (y)

The following draws the bars at the location specified by x:

bar(x,y);

Answer by Answiki on 12/22/2020 at 06:04:52 PM

The MATLAB bar() function creates a bar graph in a figure. Let's consider the following vectors :

x = [1970 1980 1990 2000 2010 2020];
y = [185  248  125  53   200  189];

The following display the vectors in bar graphs :

bar (y)

bar(x,y);


Question by Answiki 12/22/2020 at 05:52:22 PM
In Matlab, how to draw a bar graph?
# ID Query URL Count

Icons proudly provided by Friconix.