Why does uistack not work when I use plotyy?
Show older comments
I am currently designing a function to plot data in a specific way on two separate y-axis. Although I am coding in R2017a, my company generally uses R2013a so I cannot use yyaxis (which probably would not produce this bug). The problem is that a number of lines created at the very end are obscured and plotted 'under' the rest of the data, even though they are plotted last. I tried to use uistack(line, 'top') to bring the desired lines to the top, but there was no effect in the produced graphs.
Here is how I generated the graph:
x0=[0 0];
y0=[0 0];
[AX, hrta_graph(1), hrta_graph(2)]= plotyy(x0,y0,x0,y0);
hold(AX(1));
hold(AX(2));
Later on, I graph data to the figure like this;
hrta_graph(end+1)=plot(AX(2), new_cm.numeric_index{block_index},new_cm.data{block_index});
At the end of the code, I add vertical lines to signify different time intervals;
hrta_graph(end+1)=line(AX(1),[current_redline_position, current_redline_position], [left_axis_lower_limit left_axis_upper_limit], 'color', 'r')
Although the vertical lines were on top of the data in other versions of my code that did not use plotyy, for some reason they appear obscured by the data. This is how I attempted to solve the problem;
uistack(hrta_graph(line_start:line_end), 'top')
Although Matlab did not throw any errors during the compilation of the function, the graphs produced were no different than before.
Is there a better way to bring lines to the top of a figure? Or alternatively, is there a way to use uistack to bring the lines to the top of the plot?
Answers (0)
Categories
Find more on Two y-axis in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!