Labeling a bar graph with names in MATLAB GUI
조회 수: 2 (최근 30일)
이전 댓글 표시
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
답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Bar Plots에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!