2 axes in GUI, permanently set the max and min values of the X and Y Coordinates.
1 view (last 30 days)
Show older comments
I have 2 axes in a GUI, axes1 and axes2.
I have the sizes of the axes set. When I hit "Run Figure," the size of axes1 changes (becomes a 1X1 square).
I want to keep the size of axes1 the same, but change the maximum and minimum values for the y and x coordinate axes while keeping the scale of the axes1 the same. I start with this,
but when I hit "run figure" I get this, where the size of the axes has changed.:
Also, now I want to set the max and min for the x and y coordinates, but
axes(handles.axes1)
axis([0 300 0 100]);
does something that causes axes to disappear entirely. Please help!!
Thank you!
Also, if I want set a patch to axes2, how do I do that?
0 Comments
Answers (2)
Ben11
on 14 Jul 2014
To manually set the x and y-limits of an axes you can use this command:
set(handles.axes1,'XLim',[0 300],'YLim',[0 300]);
Also what do you mean by "set a patch to axes2"? I would say:
axes(handles.axes2);
...draw the patch object
Is it what you mean? If not please add a bit more details :)
Matt
on 15 Jul 2014
2 Comments
Ben11
on 15 Jul 2014
Ok maybe the axes resizing is due to the units used which may be different between axes. For instance are you sure all the axes are in "pixels" units? It might also be that their "xlimmode" or "ylimmode" properties are set to auto instead of manual; it once happened to me so that would be my guess.
Otherwise could you post a bit of code from your pushbutton "Run Figure"? That would help a lot to diagnose the problem better.
Thanks!
See Also
Categories
Find more on Data Exploration 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!