How can I display a bar chart ?

2 visualizzazioni (ultimi 30 giorni)
Mallouli Marwa
Mallouli Marwa il 18 Giu 2019
Commentato: Mallouli Marwa il 20 Giu 2019
Hi
How can I display a bar chart like the attached one ?
Best regards.

Risposta accettata

Aravind Ravikumar
Aravind Ravikumar il 19 Giu 2019
What you are looking for is 2-D Bar Graph. You can add legends using legend.
  3 Commenti
Aravind Ravikumar
Aravind Ravikumar il 19 Giu 2019
x = [3 4;1.5 1.75;0.25 0.3];
bar(x,'hist');
legend('PZT','MFC');
set(gca,'xticklabel',{'20Hz','30Hz','40Hz'});
This code will produce bar graph like the attached image. gca will select the current axes and then you could specify the xticklabel for the bar graph.
Mallouli Marwa
Mallouli Marwa il 19 Giu 2019
Thanks

Accedi per commentare.

Più risposte (1)

the cyclist
the cyclist il 18 Giu 2019
Use the bar function.
  3 Commenti
the cyclist
the cyclist il 19 Giu 2019
I suggest you take a look at the MATLAB Plot Gallery, which has examples of lots of plot types, along with the code that produces them. This may save you time asking about everything small addition that you want, one at a time.
Mallouli Marwa
Mallouli Marwa il 20 Giu 2019
Thanks

Accedi per commentare.

Categorie

Scopri di più su 2-D and 3-D Plots in Help Center e File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by