I want to use ginput to draw a straight line on a graph.
The line is used to select a cross-section of a contour plot.
I was afraid it wasn’t going to be easy.
Getting to it from the other side, is there a matplotlib widget in the works where I can type text or numbers in a box? Like the FloatTextWidget in IPython?
Problem is I want to make a small GUI that includes both a text widget (which is available in IPython) and a ‘select points in graph’ widget like ginput in matplotlib.
On Mon, Jan 26, 2015 at 11:47 PM, Thomas Caswell <tcaswell@…149…> wrote:
nbagg is always running in the IPython event loop (as I understand it), so I am not sure how to integrate that with the blocking.
On the 1.4.x/master branch we have support for (almost, one PR still pending) all mouse and keyboard events so all of the mpl widgets should work (big thanks to Steven Silvester). T
What do you want to use that relies on ginput?
You can fake up a non-blocking version something like:
from collections import deque
def init(self, n=5):
self.list_of_points = deque(maxlen=n)
def on_event(self, event):
import numpy as np
import matplotlib.pyplot as plt
fig, ax = plt.subplots()
x = np.linspace(0,10,10000)
y = np.sin(x)
ln, = ax.plot(x,y)
dd = accumulator(15)
and then get the points by
This code obviously needs lots of bells and whistles, but points in the right direction.
On Mon Jan 26 2015 at 2:45:45 PM Mark Bakker <markbak@…55…149…> wrote:
Are there any plans to make ginput work in the nbagg backend?
It would be so cool if I could use that in an IPython Notebook together with the other widgets.