Multiple y-Axes in GUI
조회 수: 6 (최근 30일)
이전 댓글 표시
Hey Community,
I have a GUI created with GUIDE (cp. screenshot).
Now, what I want to do is creating several y-Axes for one x-Axis in just one axes (the axes above, where the graph is plotted). At a later stage I want to do the same with y- and z-Axes - but let us postpone that issue.
So, whenever I try to generate a second y-axis in that very same axes handle, the y-axis is not shown. I tried addaxis.m and several other scripts. I also tried
'Units','character'
Do you guys have any idea on what the problem might be here? I do not get any error message but simply won't see the second y-axis. However, the second plot is shown in the axes when using addaxis.m.
This is the original clean code, w/o any of my solution approaches. The code is situated in a for loop, but basically it is plot(x,y,...).
% plot in axes
axes(handles.axes8);
p(k)=plot(sData.(RoundaboutNames1{z}).(DirectionNames1{y}).(ConditionNames1{x}).(DriverNames1{w}).(FileNames1{v}).Cut.(x_axis3),...
sData.(RoundaboutNames1{z}).(DirectionNames1{y}).(ConditionNames1{x}).(DriverNames1{w}).(FileNames1{v}).Cut.(y_axis3),'Color',cmap(cmap_num(k),:), 'LineWidth', 1);
% Add Axis 1
if strcmp(visible_24,'on')
pp(k)=plot(sData.(RoundaboutNames1{z}).(DirectionNames1{y}).(ConditionNames1{x}).(DriverNames1{w}).(FileNames1{v}).Cut.(x_axis3),...
sData.(RoundaboutNames1{z}).(DirectionNames1{y}).(ConditionNames1{x}).(DriverNames1{w}).(FileNames1{v}).Cut.(y_axis4),'Color',cmap(cmap_num(k),:), 'LineWidth', 1);
end
댓글 수: 0
답변 (1개)
Harsha Phadke
2017년 8월 18일
편집: Harsha Phadke
2017년 8월 18일
From the code that you have mentioned in the section - plot in axes, you are creating an axes using the axis command, but it is not being passed to the plot command.
Plot command accepts axis handle as one of its parameter and thus it would indeed plot on the axis mentioned as its parameter and not the current axis, which might me different than the one you created using the axes command. For the syntax refer the following link: Plot axes Use the plot(ax,_) syntax where ax stands for the axes handle.
Also, the addaxis.m from the MATLAB Central is supposed to add multiple y-axis to the plot, thus it is expected that it would add a plot on the same axis.
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Specifying Target for Graphics Output에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!