"The positioning of the Legend is driving me crazy"
Here are two options.
Set legend location/position from within your code
In the plotting function that produces the legend, you can set the location or position property of the legend so that it's outside of your axes or within a less populated section of your axes.
legend(app.UIAxes, . . ., 'location', 'eastoutside')
Create an interactive menu option to change legend location
Follow these steps the create a dropdown menu option that allows the user to select a new legend location. This step-by-step demo is also attached.
1) When you produce the legend, store the legend handle within the app.UIAxes.UserData field so it can later be accessed.
lh = legend(app.UIAxes,'A','B','C');
app.UIAxes.UserData = lh;
2) From app designer Design View, add a menu bar item to your UIFigure.
3) Use the component browswer option to rename the menu item and add legend position options. This example uses NE for NorthEast, NW for NorthWest, etc....
4) Add a callback function using the "Add MenuSelectedFcn" option and assign that same callback function to each menu option using the "Select existing callback" option.
This will add a new function in Code View
5) The callback function will get the handle from the UIAxes.UserData field and it will change the legend loctation according to the UIMenu selection.
function NEMenuSelected(app, event)
lh = app.UIAxes.UserData;
lh.Location = 'northeast';
lh.Location = 'southeast';
lh.Location = 'northwest';
lh.Location = 'southwest';
error('Menu item not recognized.')
You could also add a 'Toggle' option that toggles on/off the visibility of the legend.
lh.Visible = 'off';
lh.Visible = 'on';
Now you can move the legend by selecting a new location from the dropdown menu.
"Is it really not possible to move the legend via drag and drop"
Yes, it's really not possible (as of r2019b). App designer is still in development and new features are being rolled out with each Matlab release.
You can, however, pan the axes by using the Pan tool (shown below) so you can see the data behind the legend.