How do you keep the graphs in a constant location in Matlab App Designer?

4 views (last 30 days)
I have been trying to plot a couple of graphs on App Designer so that they can line up. However, whenever once the data is loaded the graphs shift slightly and the graphs do not stay where I orgnailly put them in the Design view. I have also tried to hard code the positions of the graphs, but it has not worked.
Here is the code I am using to fix the points of the graphs.
Length = 1335;
height = 150;
start = 15;
app.O2_Graph.Position = [start, 240, Length, height+100];
app.Salinity_Graph.Position = [start, 490, Length, height];
app.Temp_Graph.Position = [start, 630, Length, height];
  2 Comments
dpb
dpb on 5 Mar 2025
Probably the issue is that when the data are placed on the axes, varying amounts of spacing are needed for labels, etc., depending upon the precision.
You might consider using stackedplot for such comparative plots if the x-axis is the same.
Attaching sample data would be helpful...
Alberto
Alberto on 8 Mar 2025
That is what I was thinking, I am plotting a lot of data points.
I had not considered using stacked plot. One of the graphs I need to be able to click points and I am not sure if stacked plot has this function.
I am not sure if I am able to post the data I am working with. I will double check and reply with some if I can.

Sign in to comment.

Accepted Answer

Voss
Voss on 5 Mar 2025

You can try specifying each (ui)axes InnerPosition, which excludes space for labels, tick labels, etc., rather than Position, adjusting the values appropriately, and/or setting each (ui)axes PositionConstraint to 'innerposition', which holds InnerPosition constant when the labels, etc., are updated.

More Answers (0)

Categories

Find more on 2-D and 3-D Plots 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!