Multiple y-Axes in GUI

5 visualizaciones (últimos 30 días)
Mathias Dirksmeier
Mathias Dirksmeier el 14 de Ag. de 2017
Editada: Harsha Phadke el 18 de Ag. de 2017
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'
for the new axes, as it was described here .
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

Respuestas (1)

Harsha Phadke
Harsha Phadke el 18 de Ag. de 2017
Editada: Harsha Phadke el 18 de Ag. de 2017
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.

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by