Table widgets#
In order to control interactive plots, sometimes we need to vary certain parameters which depend on the data stored in the table. Therefore, table object has several widgets, which can be used for that purpose.
The table we are going to use as an example is:
[1]:
import os
import ubermagtable as ut
# Sample OOMMF .odt file
dirname = os.path.join("..", "ubermagtable", "tests", "test_sample")
odtfile = os.path.join(dirname, "oommf-new-file2.odt")
table = ut.Table.fromfile(odtfile, x="t")
Slider#
Slider widget allows us to restrict the time values shown in an interactive plot. Slider widget is:
[2]:
table.slider()
The minimum value of the slider is the minimum time value, whereas the maximum value is the maximum time value. The steps on the slider correspond to the time step in data.
Widget description is generated by default, and can be changed by passing description
argument.
[3]:
table.slider(description="my slider")
Similar to plots, we can change the multiplier:
[4]:
table.slider(multiplier=1e-12)
We now get the values in picoseconds and the units are shown in the widget description.
Slider is based on ipywidgets.SelectionSlider, so any keyword arguments accepted by it can be passed.
[5]:
table.slider(orientation="vertical")
We can get a slider for any variable by passing it via x
:
[6]:
table.slider(x="mx")
Value selector#
A simple widget, which allows us to select the columns from data table can be obtained using selector
.
[7]:
table.selector()
This returns a selection widget with all data columns present in the table. This method is based on ipywidgets.SelectMultiple
, so any keyword argument accepted by it can be passed.