MATLAB Answers

0

How can I select an axes to put labels on top of each bar in bar graph with other bar graphs on other axes in GUI ?

Asked by Martinppp on 18 May 2018 at 12:02
Latest activity Answered by Martinppp on 18 May 2018 at 12:38

Hello,

In GUI, I created 3 axes next to each other. on each axes I want to have a bar graph and to put the label of each bar on top. My problem is that I can't select on which axes I want each labels.

if true
%% Median Topspeed Sector 
bar(handles.axes12,z(1:length(speed1med)),speed1med,'FaceColor','m','EdgeColor','white','LineWidth',5)
text(z(1:length(speed1med)),speed1med,num2str(speed1med(:,1)),'horizontalalignment','center')
set(handles.axes12,'xtick',0:1:21);
set(handles.axes12,'ytick',0:1:350);
ylim(handles.axes12,[minspeed1med-3 Maxspeed1med+2])
xlim(handles.axes12,[0 22])
ylabel (handles.axes12,'TopSpeed Median Sector 1')
%% Median Topspeed Sector 2
bar(handles.axes13,z(1:length(speed1med)),speed2med,'FaceColor','c','EdgeColor','white','LineWidth',5)
text(z(1:length(speed1med)),speed2med,num2str(speed2med(:,1)),'horizontalalignment','center')
set(handles.axes13,'xtick',0:1:21);
set(handles.axes13,'ytick',0:1:350);
ylim(handles.axes13,[minspeed2med-3 Maxspeed2med+2])
xlim(handles.axes13,[0 22])
ylabel (handles.axes13,'TopSpeed Median Sector 2')
%% Median Topspeed Sector 3
bar(handles.axes14,z(1:length(speed1med)),speed3med,'FaceColor','b','EdgeColor','white','LineWidth',5)
text(z(1:length(speed1med)),speed3med,num2str(speed3med(:,1)),'horizontalalignment','center')
set(handles.axes14,'xtick',0:1:21);
set(handles.axes14,'ytick',0:1:350);
ylim(handles.axes14,[minspeed3med-3 Maxspeed3med+2])
xlim(handles.axes14,[0 22])
xlabel(handles.axes14,'Driver #')
ylabel (handles.axes14,'TopSpeed Median Sector 3')
end

I tried:

if true
  text(handles.axes12,z(1:length(speed1med)),speed1med,num2str(speed1med(:,1)),'horizontalalignment','center')
end

but I have an error.

Do you have an idea to solve this problem ?

Thank you,

Martin

  1 Comment

If you have an error please post what it is else how can you expect help with it?!

Sign in to comment.

Products

1 Answer

Answer by Martinppp on 18 May 2018 at 12:38

I don't have a real error, but in this case I have the last labels just for the last bar graph on the third axes because I can't select on which graph I want which labels.

I would like to know how can I define on which axes I can put the labels I want ?

  0 Comments

Sign in to comment.


Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today