Tooltips disappear after zoom in/out when using matplotlib mpld3 - matplotlib

I have a matplotlib figure with tooltips on the point markers:
And the zoom in/out is working:
However after the zoom in/out is performed the tooltips no longer function: and even restoring the original (non-zoomed) size they do not come back.

If you use the pan-and-zoom tool (crossed arrows icon), tooltips should remain unchanged after zooming. If you use the box zoom (magnifier icon), while box zoom is active, the tooltips are turned off. The tooltips should appear again after clicking the box zoom magnify icon a second time to deactivate it.
Perhaps this UI could be clearer.
Here is scatter plot with tooltips example you can use to see this in action.

Related

Matplotlib: Figure controls (zoom, save, etc) disappear when figure too small

When a matplotlib figure is shrunk below a given size, the controls on the bottom disappear. I want to save the figure, at the size that I have stretched it too, but it seems that I cannot, because the save button disappears when the figure is that small. Is there any way around this, other than manually calling fig.savefig() in the code?
Edit: Backend is TkAgg
Ah, well it turns out there are keyboard shortcuts to the controls.
You can press CTRL-S to save (even on Mac - not Command-S).
The full list of shortcuts is here: https://matplotlib.org/users/navigation_toolbar.html
When using "Qt4Agg" or "Qt5Agg" as backend,
import matplotlib
matplotlib.use("Qt4Agg")
the navigation toolbar can be extended with the two small arrows as shown below.

Psychtoolbox scale slider

I'm trying to make a slider for a simple scale where the user can see mouse movement ONLY in the horizontal axis (fixed y location on the horizontal scale).
In more detail: When the scale appears, I want the cursor to appear as a short vertical line (aka slider) in the center of the horizontal scale.
When the user moves the mouse, the slider should move accordingly on the horizontal axis (without reflecting any changes in the vertical axis, i.e. it should stay on the scale)
I'm stuck on both changing the appearance of the cursor to a vertical line slider and on limiting the cursor's movement to the horizontal axis.
Here's what I've tried:
I can successfully place the cursor with SetMouse.
I tried ShowCursor to change the appearance of the cursor, but this only has a few named options and the numbered ones are not portable across OSs ("mapping of numbers to shapes is operating system dependent"), which I need. Any other ideas on how to change the cursor to a vertical line slider?
As for limiting the movement to horizontal, I couldn't find any PTB functions that seem to do this. I did find some workarounds in Matlab to make user GUIs, but it seems these can't be used with PTB's screen. Any ideas would be great!
I'm a still very new to PTB so thank you so much for your help!
I wrote a function for exactly that called slideScale. If you want to see how it works see the test script.
The crucial thing for you is to create a loop, which runs until a click has been made and record the position of the cursor for instance with the function GetMouse(), which gives you the x- and y-coordinates of the cursor. Then, the only thing you basically need is to update the position of your vertical line using the x-coordinate you recorded with GetMouse() without changing the y-coordinates, for which you can just use a fixed value.

vb.net - Remove border around Progress-bar

How would i go about removing the thin border around the edges of the Progress-bar tool? There doesn't seem to be any properties to change the style. It looks like the default 3d border.
It is not the best solution from a programmatically correct point of view, but it works and is an easy solution.
You create a Panel control
You put the BorderStyle property of the Panel to None
You moove your Progress Bar inside the Panel control
You rezise the Panel and the Progress Bar so that dimension of the Progress Bar is a few pixels larger than the dimension of the Panel control. This way, when the controls are drawn, the borders of the Progress Bar do not show because they are outside of Panel control
You set the Anchors property of the Progress Bar to Left, Right, Top and Bottom so that when you rezise the Panel control, the Progress Bar inside resizes well.
You resize and place your Panel where you need it (and the Progress Bar will resize well into it)
And your done. As I said, it is not a nice solution from a programmation point of view, but overall it works well and allow you to do what you want without spending too much time.

Dygraphs - Legend disappears when Zoom is in progress

When I do a horizontal zoom on the Graph, Legend disappears and comes back when the zoomed graph is loaded.
Screenshots:
Do we have any option to make the Legend static/ appear even when a Zoom is in process internally instead of disappear/appear between zoom operations.
You might try setting hideOverlayOnMouseOut: false or legend: "always".

Animations in Matplotlib: Making a "Loading Bar"

Note this example:
http://laplace.ucv.cl/Cursos/FisicaExperimental_2/Old/Python/Programas/strip_chart_demo.py
where an oscilloscope is animated out. Is there any way to use Matplotlib to control the pace that the graph is animated? I am trying to make a loading/progress bar and would like to control how quickly the loading bar expands. What I have tried is to change the line
gobject.idle_add(scope.update)
to
gobject.timeout_add(100, scope.update)
but that causes the line to not draw at all.
Any tips?