I'm making some figures in Matlab, many of which I'd like to print at different zoom levels. The figure is made using subplot. Each subplot has its own title, but I also want a larger title for the entire figure.
The problem is this: once I add a supertitle, the figure no longer pans or zooms. If I remove the supertitle with supertitle(), then I can once again pan and zoom. The brute force solution to this problem is to continue toggling the supertitle on and off while I pan and zoom in between, but this is both time consuming and irritating.
Does anyone know a way to restore the pan and zoom functions while keeping the supertitle of a figure?
AFAIK, supertitle() is not an in-built function in MATLAB and is not shipped with the common toolboxes from Mathworks. This is probably a custom function file that extends MATLAB's plotting capabilities.
That said, the error is most likely due to the function not returning focus to the original plot which makes zoom & pan to not work as desired. The exact reason can only be figured out by looking at the original code.
Try panning and zooming programmatically, rather than using the GUI controls.
Related
I use the Leaflet plug-in "Leaflet.ImageOverlay.Rotated.js" to use its L.imageOverlay.rotated(...) thing in order to overlay certain map pieces in various places on top of the normal map.
It does this by taking an image and having me tell it its top-left, top-right and bottom-left coordinates to figure out how to rotate, tilt and stretch/squeeze it properly.
It took me a very long time to figure these coordinates out by hand. For this reason, I'm looking for some sort of "geopositioning mode", perhaps enabled by this extension, which would simply let me click three times on the map to tell it where these points go. That would be so simple for the developers to do and would help so much. It's such an obvious thing to do that I strongly suspect it's already implemented and ready.
Is there such a "mode"? If not, how am I expected to find the positions without spending so much time and trial-and-error as I did for the first overlay map image?
Added: I should also clarify that the image should be shown in this mode so that you can re-adjust the points and watch in real time as the image bends/warps, to get it just right.
you can develop a modul for this problem.
find minimum 4 point on raster map.
click on tilemap for 4 points
than find different slope and distance same 2 points.
maybe you must rotate and use affine transformation.
when rotating a 3D-plot in Matlab one can only rotate completely, so full 360°, around the z-axis (azimuthal angle) but only from +/-90° around the x/y-axes (elevation angle). I know that this includes all possible views in a spherical coordinate system, yet, a customer of mine would like to have the same functionality like in Fiji (3D-Viewer) or similar 3D-Viewers, to rotate fully about the 360° around an arbitary axis.
As simple demo:
surf(peaks); rotate3d on
I thought of a handles listener with callback when the view changes and then adjusting the azimuthal and elevation angles accordingly to generate the feeling of a full rotation but maybe someone has a better and simpler idea :)
Cheers Mika
I found a possible solution:
One can enable the camera control toolbar and use the camorbit functionality which does exactly what it should. In my GUI I just enable/disable it via a custom toggle button in the toolbar like so
if strcmp(get(handles.uitoggletool5,'State'),'on') == 1
cameratoolbar('SetMode','orbit');
else
cameratoolbar('SetMode','nomode');
end
I have created a basic MATLAB UI (without using GUIDE). I basically have a bunch of panels for various things, (sliders, axes, text boxes, etc).
The one thing I would like to do though, it make it so that they scale properly, when I resize the figure. Right now, I painstakingly have to make a re-scale function for every button, panel, sub-panel, etc etc to make it rescale correctly.
Is there an easy way to simply automate the re-scaling here?
Thanks.
Use the GUI Layout Toolbox from the MATLAB File Exchange. I haven't personally used dynamic resizing functionality, but that's one benefit of using this package.
It functions much like using uicontrols, except you can't use the inspect tool on these objects.
EDIT: If you're looking only to do resizing when the figure itself is resized, set the Units property for all your uicontrols to normalized.
You could also use the builtin, but undocumented uigridcontainer and uiflowcontainer.
They have the benefit of e.g. allowing to set contraints, such that e.g. your pushbuttons don't get increased in size, when the full figure does. Check the link for some examples:
http://undocumentedmatlab.com/blog/matlab-layout-managers-uicontainer-and-relatives/
I wanted to create a gui that worked as a canvas for free drawing lines with the mouse and with option of erasing...
anyone can help me?
The simplest solution is to look at how other people have implemented this. For example, searching for freehand on the File Exchange brings up this freehand drawing function.
As a basic idea, you'll want to either regularly capture the mouse position, or to evaluate a callback on mouse movement.
I'm trying to resize a drawn quadCurve by dragging one of its 3 control points so the curve can fit. What is the best approach to do this? letting you know that I'm using an imageView for drawing. Not using drawRect.
I know that I should detect if the touch is on the control points which is pretty easy but I don't know what to do after in my touchMoved and touchEnded methods.
Several things:
I would not use an image view for this. This is the kind of problem that drawRect: is for.
Don't use touchesMoved. Use a UIPanGestureRecognizer on the control points.
Make the control points subviews so you can attach gesture recognizers to them.
To work well, the control points typically need to have a pretty large hit area (larger than they are visually). You can do this pretty easily by making the control point views larger than what they draw (so if they're drawn as a 13 point circle, you put that in the middle of a 23 point view).
For an example of code that does all this see CurvyTextView.m. It doesn't do the last point (the control point views are too small to use well on a real device). Ignore all the text drawing code. You just care about updateControlPoints, addControlPoint:color:, initWithFrame:, pan:, and drawPath.