MATLAB: How to change the y direction in gui graph (upside down)? and how to add label and legend into it

axisguiplot

like we do in figure set(gca,'yDir','reverse') xlabel('x') ylabel('Depth(m)') i want it for gui graph

Best Answer

Hello Javed,
Just like how you use "gca" to get the handle to the current axes, you can use the handle to the desired axes in your GUI. If you created the GUI using GUIDE, generally you'll have the handle to the axes saved to the "handles" struct by default. The name will be the axes tag ("handles.axes1" by default). Once you have that, it's a simple:
set(handles.axes1, 'YDir', 'reverse', 'XLabel', 'x', 'YLabel', 'Depth(m)')
Sometimes the axes properties aren't the same as the function name (like for the hold function), so it's always good to check that.
-Cam