[IPython-dev] manipulating inline plots with widgets

Zoltán Vörös zvoros at gmail.com
Thu Jan 30 02:27:57 EST 2014


Hi Brian,


On 30/01/14 03:16, Brian Granger wrote:
> Can you file an issue on GitHub for this? Thanks!
You mean the issue with the shortkeys, and not the issue with plotting, 
don't you?

Zoltán

>
> On Wed, Jan 29, 2014 at 12:17 PM, Zoltán Vörös <zvoros at gmail.com> wrote:
>> Hi all,
>>
>> First off, the new widget machinery is really exciting, I believe, it opens
>> an entirely new dimension of user experience. Many thanks to all who have
>> put in hard work to make this happen.
>>
>> I have been playing around with a couple of gadgets, and in particular, I
>> wanted to manipulate plots using the slider. The following works with the
>> qt4 matplotlib backend (I guess, it would work with other backends, but
>> that's off the point):
>>
>> In[48]:     def on_value_change(name, value):
>>                      x = linspace(0, value, 100)
>>                      plot(x, sin(x))
>>
>> In[49]:     fig, ax = subplots(1)
>>                  m1 = widgets.FloatSliderWidget()
>>                  m1.on_trait_change(on_value_change, 'value')
>>                  ax.plot(x, sin(x))
>>                  m1
>>
>> However, I was wondering, whether there is a way of doing the same in the
>> notebook. I have tried to pass ax as the keyword argument in the constructor
>> of m1, but that doesn't seem to produce the desired results. Could someone
>> comment on this?
>>
>> Another issue I have noticed is that if the widgets are inserted in the
>> notebook, it results in an erratic behaviour of the code cell. So, e.g., if
>> I press Cntr-Enter on input line 49, and then pull the slider, and then
>> click on ax.plot(x, sin(x)) with the mouse, the border of the cell becomes
>> green, so I would assume that one can edit the cell at that point. But what
>> happens instead is that the shortkeys bound to the inactive cell are
>> invoked. So, if I press a, then a new code cell will be inserted above. The
>> issue goes away, if I click on the cell once more. This behaviour I noticed
>> on chrome v31. I can try other browsers, if that helps.
>>
>> Thanks,
>>
>> Zoltán
>>
>>
>>
>> _______________________________________________
>> IPython-dev mailing list
>> IPython-dev at scipy.org
>> http://mail.scipy.org/mailman/listinfo/ipython-dev
>>
>
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ipython-dev/attachments/20140130/c610479c/attachment.html>


More information about the IPython-dev mailing list