How to allow rectangeSelector to select edge of plot in Matplotlib? - matplotlib

I have a pyQt interface where the user can select a region of a matplotlib plot using rectangleSelector. My issue is the if the user wants to select a region including the edge of the visible region of the plot, it always stops short. Depending how fast the mouse is moved, it may fall far short. It appears that the box stops updating once the mouse exists the plot axes. This is in contrast to, for example, the built-in magnifying glass selector, which allows the user to drag a box far outside the plot region. Is there a way to force rectangleSelector to select beyond, or at least right up to, the visible plotted areas?

Related

(How) can a matplotlib figure be made to respond to "zoom" navigation in one dimension only?

Matlab has a useful zoom mode triggered by zoom xon or zoom yon whereby you can click-and-drag with the mouse to zoom in on data, but with only one dimension (x or y, respectively) changing. Instead of an elastic box, the cursor changed into an elastic I-beam that allowed you to set the beginning and end of the range quite precisely.
Is there any way of getting a matplotlib figure to do the same thing? Playing with the toolbar, and briefly looking into the code behind it, I only see a "zoom rect" mode.
I'm aware that you can approximate this effect by right-clicking-and-dragging in "pan" mode, while trying to ensure that your hand only moves in one dimension, but that can be quite frustratingly imprecise. If there were a zoom xon equivalent, I would gladly use that instead.
The interactive navigation lists among its shortcuts
Constrain pan/zoom to x axis: hold x when panning/zooming with mouse
Constrain pan/zoom to y axis: hold y when panning/zooming with mouse

Blender 2.8: object pivot + pixel align + object part grouping (newbie)

I have started learning Blender 2.8 as of May-25. Almost 10 years ago, I was using 3dmax v7 but only as a hobby. I want to start doing 3ding again as hobby but got no money to have something that is up to date. So I chose Blender.
Now I have a few questions. I will surely have more questions later. I am still thinking in terms of 3dmax ways.
How do I recenter the object pivot if I accidentally displaced it with MB1 and doing Ctrl-Z is not a solution ?
How do I align vertices to the grid but only using the axis of my choice ? (ex: align on the X axis grid or any other axis of my choice)
how do I group object parts (vertices, faces, ...) as different groups and then working with the group of my choice ?
how can I maximize the view port with one single keys shortcut thus hiding every menus and then once I am done doing what I wanted to on that maxed view, revert back to whatever interface view I was using before ?
how to select anything using a region drawn by mouse movements (meaning selecting without using box or circle or shift, just mouse mouvements)?
Firstly blender 2.80 is under heavy development while making some major changes so can be of varying functionality for now. I would suggest you start learning with 2.79b until 2.80 is finished.
There are several options when it comes to choosing a pivot point, I think what you are referring to is setting the object origin.
There are several snapping options and ways to control transformations. You can limit movement to one axis by pressing it's key while transforming, eg GX will only move along the X axis, you can not move on one axis by adding ⇧ Shift - G⇧ ShiftX will move on Y and Z but not X. To align vertices to one axis is it common to scale to zero one the axis, eg SX0 will scale the verts on the x axis so they all align, in object mode you can do the same as long as you enable manipulate centre points. There are align options available in some addons, like align tools and mesh align plus.
Blender doesn't have vertex grouping and I don't know of any addons that add it. You can assign vertices to a vertex group and use that to select/deselect a collection of vertices.
There are two options to maximise the viewport - ⎈ Ctrl↑ Up arrow will maximize the viewport, the info bar at the top and headers for the view will remain in place or ⎇ AltF10 will make the view full screen also removing the info bar and headers. Also the window layouts are saved as screens which you can make and define to your liking, by saving these screens in your startup blend you can keep them available each time you use blender. The default screens include a 3D only layout.
For lasso select you can hold ⎈ Ctrl while pressing the non-select mouse button to draw an arbitrary region to select items within.

Where does the coordinate system for windows forms stop and start?

I am using VB.NET to write a game that runs in a windows form that uses collision detection. In order to achieve this, I have to be able to understand the positioning system. I know that windows form coordinates start at the top-left, and don't include the bottom or right edges. But at what numbers do the coordinates start and stop? (What i mean is What is the top left corner coordinate, what is the almost bottom right corner coordinate)
The coordinate system depends on if you're talking about client coordinates or screen coordinates. This is a basic Windows UI manager thing, and the WinForms wrappers follow the same pattern.
When you're dealing with client coordinates, the origin (top-left) point has coordinates (0, 0). Always. The extent is defined by the width and height of your form, accessible via Me.ClientSize.Width and Me.ClientSize.Height, respectively. The client rectangle is, therefore:
{ (0, 0) × (ClientSize.Width, ClientSize.Height) }, also retrievable using the ClientRectangle property.
The unique thing about the client area is that it excludes the non-client areas of the form—the borders, the title bars, and other system-dependent properties.
(Image taken for illustrative purposes from Jose Menendez Póo's article on creating an Aero ToolStrip)
You don't have to worry about calculating these sizes (and you shouldn't, either, since they're subject to change). You just work in client coordinates, and the framework will take care of the rest. You use client coordinates when positioning child objects (such as controls) on their parent form, and you can even resize the form by specifying a client size. Its actual size will be calculated automatically, taking into account the non-client area.
It is quite rare that you will ever have to deal in screen coordinates. You only need those if you want to move a form (window) around on the screen (which should also be rare, because you have no idea what size screen the user has nor should you try to control where she places her windows). In screen coordinates, the top-left corner of the primary monitor has coordinates (0, 0). The rest of the coordinate system is based on the virtual screen, which takes into account multiple-monitor configurations.
A form's Location and Size properties give you values in screen coordinates. Should you need to map (convert) between client and screen coordinates, there are PointToClient and PointToScreen methods. Pass these a location defined either in terms of screen or client coordinates, respectively, and they will convert it to the other coordinate system.
The only other complication to note is that Windows uses endpoint-exclusive rectangles. The WinForms wrapper retains that convention in its Rectangle structure. You hardly ever have to worry about this, since this is really a very natural system once you understand it. Plus, all of the pieces and parts of the WinForms framework use the convention, so if you're just passing around points and sizes and rectangles, you aren't likely to run into trouble. But it is something to be aware of. Think of it this way: your client area has the rectangle { (0, 0) × (ClientSize.Width, ClientSize.Height) }, as we saw earlier. If you were to fill in this rectangle with a solid color, the fill would extend from point (0, 0) to point (ClientSize.Width - 1, ClientSize.Height - 1).
If you stay within your form, you can calculate it by "width" and "height".
Also you have "left" and "top".
Starting is (left = 0 and top = 0) and it ends on the right bottom with the coordinates of the values "width" and "height".
A Windows Forms application specifies the position of a window on the screen in screen coordinates. For screen coordinates, the origin is the upper-left corner of the screen. The full position of a window is often described by a Rectangle structure containing the screen coordinates of two points that define the upper-left and lower-right corners of the window. (MSDN)
So upper left corner is (0, 0) and lower right corner is (Form1.Width, Form1.Height).

How can I extend a line from two points to the edges of the plot area using Core Plot?

I'm using Core Plot to graph linear equations.
I would like to be able to supply two different data points and have a line drawn between them, but also extrapolated beyond the points themselves so that the line extends all the way to the edges of the plot area.
For example, given a 20x20 plot area with the origin centered and points at -5,-5 and 5,5, the line (green below) would extend all the way from -10,10 to 10,10 (blue below).
Is this possible? Is the best option just to find the plot range (which will be different each time) and find two points that are outside of it? I'm not sure if this will work; I have user interaction enabled and I want to make sure that the user can't accidentally pan far enough that the line will end.
Your idea of finding two endpoints outside the plot range is what I'd do. If you've limited the scrolling range, just pick points at the limits of that range. If not, you'll need to monitor changes to the plot space ranges with a plot space delegate and update the plot as needed.

How to move a Core Plot graph

I have a Core-Plot Graph within a Mac Application. But the inside table is appearing shifted down and to the left of the containing "frame/border" so that neither of the axis' are showing. I cannot figure out how to change this does anyone know what parameters I need to change to fix this?
Update: Sorry I did not realize I could upload an image, I have done so know and will try your suggestions in the mean-time.
Not sure what you mean by "inside table". It would be easier to offer suggestions if you could post a screenshot.
Without seeing what's wrong, here are some common areas to look at:
If you haven't already done so, look at the example apps included with Core Plot for ideas. The Plot Gallery app has many sample plots and the others are useful, too.
You may need to add padding (paddingLeft, paddingBottom, etc.) on the graph and/or plot area frame. Padding the graph pushes everything in away from the edges of the graph. Padding the plot area frame pushes the plot area in so the axes and titles can hang outside the plot area (the area where the plots are drawn).
If you want to keep an axes pinned to a specific place, e.g., the edge of the graph, set up a floating axis. Otherwise make sure the orthogonal coordinate is set (it defaults to 0). For example, the orthogonal coordinate for the x-axis is the y-value where the x-axis crosses the y-axis.