The next cell shows an example, where the frequency of a sine is connected to a slider.
![make scatter plot window bigger matplotlib make scatter plot window bigger matplotlib](https://i.imgur.com/2AE3gch.png)
The value property of a widget is such a trait, meaning we can use observe to connect a callback function, which will get called every time value changes. To look into this in further detail, check out the traitlets library. Traits are special properties that come from a parent class called HasTraits. This example shows how we can use the observe method to connect a function to a widget trait. Below, we show an example of an application similar to the one above: a sine and a slider (just the one this time). # a VBox container to pack widgets verticallyĪs before, making and displaying widgets is great, but putting them to work is awesome. Int_range_slider = widgets.IntRangeSlider( The indent can be removed by passing the argument indent=False.Ī personal favorite is the combobox at the end, which starts showing a list of matching possibilities as one starts typing. Checkboxes are displayed a little differently with their description on the right, but still indented. RadioButtons allow the selection of single value from a list of options, similar to the dropdown list. The IntRangeSlider is like an IntSlider, but as the name implies, it allows the selection of an lower and upper bound of a range. The cell below shows a few common selection widgets, some of which we met before. # show the three together in a VBox (vertical box container) We also import some libraries: matplotlib for plotting, NumPy to generate data, and ipywidgets for obvious reasons. We do this using a magic command, starting with %.
![make scatter plot window bigger matplotlib make scatter plot window bigger matplotlib](https://chartio.com/assets/822878/tutorials/charts/scatter-plots/1d29db2acb2e2c514859a5d4f724ab0c2f6c3db6997c3a2c68af2a02d43777da/scatter-plot-example-1.png)
To get started, we set the ipympl backend, which makes matplotlib plots interactive. The versions of packages explicitly used to create the examples are: The examples were tested on Windows 10 and Arch Linux. Therefore, if you have problems displaying plots correctly, try using pip only, or Linux.
![make scatter plot window bigger matplotlib make scatter plot window bigger matplotlib](https://datascienceparichay.com/wp-content/uploads/2022/11/matplotlib-create-bubble-plot.png)
Anaconda currently has a matplotlib issue that gives some problems (at least on Windows 10). Note that for this tutorial, all libraries were installed using pip, or the pacman package manager. Setting up an installation lies outside the scope of the tutorial, but can be found in the official docs. To run the notebook locally, the very first requirement is a working Jupyter environment. The notebook used for this tutorial is available on github, together with a link to a live version on binder.