Labeling a bar graph with names in MATLAB GUI
2 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Hi there,
I am trying to plot a bar graph in MATLAB to show the power rating of appliances. The variable which hold all the appliances names and power is called databaseApps of type cell and looks like the following:
databaseApps={'tv',50;'kettle',100};
I have tried various methods to plot a bar graph in the GUI with little success:
bar(handles.axes1,databaseApps(:,1),cell2mat(databaseApps(:,2))) This just says arrays must be numeric or logic.
bar(handles.axes1,cell2mat(databaseApps(:,2)) Then tried to use the set function to set the tick labels but an error appears saying values must be handles: set(get(handles.axes1,'XTickLabel'),databaseApps(:,1));
The only thing that seems to work is if I use gca but this is risky because I have more than one axes and the labels do not line up well with the bars. Any suggestions?
Cheers
Stuart
0 commentaires
Réponses (0)
Voir également
Catégories
En savoir plus sur Bar Plots dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!