How to set up XAxisLocation while opening my GUI
26 views (last 30 days)
Raymond Gilbers on 8 Jan 2017
Im relative new to Matlab programming so my apologizes for this silly question if so. I have searched all over Mathworks and google but i dont seem to get what I need.
I have a small GUI which draws some vectors in Axis. I want my X and Y axes location to be at the origin. This happens only after I press a button which draws my vectors in the Axis UI. But I would like to see my X and Y axes at the origin when I start the GUI. So even I dont have any vector and havent done anything except starting the GUI I see my X and Y axes in the origin and have 4 quadrants.
I think I have to set this up somewhere during opening and I used this line:
% --- Executes just before LEICIE is made visible. function LEICIE_OpeningFcn(hObject, eventdata, handles, varargin) % This function has no output args, see OutputFcn. % hObject handle to figure % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % varargin command line arguments to LEICIE (see VARARGIN)
% Choose default command line output for LEICIE handles.output = hObject;
% Update handles structure guidata(hObject, handles);
% UIWAIT makes LEICIE wait for user response (see UIRESUME) % uiwait(handles.figure1); global V1 global I1 global PF1 global Angle1
But this doesnt seem to work. Could anybody help me a bit please
Thanks in advance
Image Analyst on 8 Jan 2017
What I do is, after plotting the data, is this (modeled after the help documentation):
ax = gca
ax.XAxisLocation = 'origin';
ax.YAxisLocation = 'origin';
Make sure that the origin in in the field of view. If it's not, and you want to see it, then call xlim() and ylim() and make sure the range includes the origin.