Reputation: 11
i have an axes in my GUI program, that xlimmode and ylimmode, should be manual at first, and when a user click on the button thye should be auto, anyone has idea? in other word, how should i set xlimmode dynamically? i try this code but it dosent work:
set(gca,'XLimMode','auto')
and another question is how can i plot a quadratic equation like:
4+3x+8y+9x^2+18y^2=0
thank u in advance
Upvotes: 1
Views: 786
Reputation: 124563
To answer your first question, setting the limit-mode back to auto should work.. Here is an example to show:
plot(rand(10,1))
set(gca, 'XLim',[1 10], 'YLim',[0 1], ...
'XLimMode','manual', 'YLimMode','manual')
uicontrol('Style','pushbutton', 'String','auto', ...
'Callback','set(gca, ''XLimMode'',''auto'', ''YLimMode'',''auto'')')
If we plot something outside the current range (before pushing the button), the axes will not scale to show the new data.
hold on
plot(30:49, rand(20,1)*5)
hold off
If you click the button, the axis will automatically adjust (based on the XData/YData properties).
Upvotes: 2