@@ -4,16 +4,16 @@ Line plots
44
55.. note ::
66 Unfortunately the interactive plots won't work on a website as there is no Python kernel
7- running. So for all the interactive outputs have been replaced by gifs of what you should expect .
7+ running. So for this site all the interactive outputs have been replaced by gifs of what you will see .
88
9- On this example page all of the outputs will use ipywidgets widgets for controls. However, if you are
10- not working in a Jupyter notebook then the examples here will still work with the built-in Matplolitb widgets.
11- For examples that that explicitly use matplotlib widgets instead of ipywidgets check out the :doc: `mpl-sliders ` page.
9+ On this example page all of the outputs will use ** ipywidgets ** widgets for controls. If you are
10+ not working in a Jupyter Notebook the examples here will still work with the built-in Matplolitb widgets.
11+ For examples that that explicitly use Matplotlib widgets instead of ipywidgets see the :doc: `mpl-sliders ` page.
1212
1313
1414.. jupyter-execute ::
1515
16- # only run these lines if you are using a jupyter notebook or jupyter lab
16+ # only run these lines if you are using a Jupyter Notebook or JupyterLab
1717 %matplotlib ipympl
1818 import ipywidgets as widgets
1919
@@ -23,11 +23,11 @@ For examples that that explicitly use matplotlib widgets instead of ipywidgets c
2323 from mpl_interactions import interactive_plot, interactive_plot_factory
2424
2525
26- Simple Example
26+ Simple example
2727--------------
2828
29- To use the interactive plot function all you need to do is write a function that will
30- return a numpy array or a list of numbers. You can provide the parameters that you want
29+ To use the interactive plot function, write a function that will
30+ return a NumPy array or a list of numbers. You can provide the parameters you want
3131to vary with sliders as keyword arguments to the :meth: `~mpl_interactions.interactive_plot ` function.
3232
3333
@@ -39,7 +39,7 @@ to vary with sliders as keyword arguments to the :meth:`~mpl_interactions.intera
3939 def f(x, tau, beta):
4040 return np.sin(x*tau)*x**beta
4141
42- and then to display the plot
42+ Then to display the plot:
4343
4444.. code-block :: python
4545
@@ -51,24 +51,25 @@ and then to display the plot
5151Other ways to set parameter values
5252----------------------------------
5353
54- You can set parameters with any of the following:
54+ You can set parameters using any of the following:
5555
56- - **numpy array/list ** - Creates a slider with the values in the array
57- - **tuple ** - Acts as an argument to linspace. Can have either 2 or 3 items
56+ - **NumPy array/list ** - Creates a slider with the values in the array
57+ - **tuple ** - Acts as an argument to linspace (can have either 2 or 3 items)
5858- **set ** - Creates a categorical selector (order will not preserved)
5959- **set(tuple()) ** - Categorical selector with order maintained
6060- **scalar ** - Fixed value
61- - **ipywidgets.Widget ** any subclass of ``ipywidgets.Widget `` that has a ``value `` attribute can be used
62- - **matplotlib.widgets.Slider ** or **RadioButton ** - Note this cannot be used at the same time as an ipywidgets.Widget
61+ - **ipywidgets.Widget ** - any subclass of ``ipywidgets.Widget `` that has a ``value `` attribute can be used
62+ - **matplotlib.widgets.Slider ** or **RadioButton ** - Note this cannot be used at the same time as an `` ipywidgets.Widget ``
6363
64- Here is an example using all of the possibilities with a dummy function. The ``display=False ``
65- prevent the widgets from being automatically displayed which makes it easier to render them in this webpage,
66- but in general you should not need to use that.
64+ Here is an example using all of the possibilities with a dummy function.
6765
6866
6967.. note ::
7068 The slider labels will not update here as that update requires a Python kernel.
7169
70+ Also, ``display=False `` prevents the widgets from being automatically displayed, making it easier to render
71+ them on this webpage. In general you should not need to use it.
72+
7273.. jupyter-execute ::
7374
7475 def foo(x, **kwargs):
@@ -82,12 +83,12 @@ but in general you should not need to use that.
8283 f = widgets.Checkbox(value=True, description='A checkbox!!')
8384 display(interactive_plot(foo, x=x, a=a, b=b, c=c, d=d, e=e, f_=f, display=False)[-1])
8485
85- Multiple Functions
86+ Multiple functions
8687------------------
8788
8889To plot multiple functions simply pass a list of functions as the first argument ``interactive_plot([f1, f2],...) ``.
89- Also, whenever you add a legend to the resulting plot the names of the functions will be used as the labels, unless you
90- override that using the :ref: `plot_kwargs <plot-kwargs-section >` argument.
90+ When you add a legend to the resulting plot, the function names will be used as the labels unless overriden
91+ using the :ref: `plot_kwargs <plot-kwargs-section >` argument.
9192
9293.. code-block :: python
9394
@@ -102,18 +103,18 @@ override that using the :ref:`plot_kwargs <plot-kwargs-section>` argument.
102103
103104Styling
104105-------
105- Calling ``interactive_plot `` will create and display a new figure for you. After that you can
106- use standard ``pyplot `` command to continue to modify the plot or you can use the references to the ``figure `` and ``axis ``
107- that are returned by interactive_plot. Though be careful, anything you add will not be affected by the sliders.
106+ Calling ``interactive_plot `` will create and display a new figure. Then you can either
107+ use the standard ``pyplot `` command to continue modifying the plot, or you can use the references to the ``figure `` and ``axis ``
108+ that are returned by `` interactive_plot `` . Though be careful, anything you add will not be affected by the sliders.
108109
109110
110111
111- Slider Precision
112+ Slider precision
112113^^^^^^^^^^^^^^^^
113114
114- You can change the precision of individual slider displays by passing slider_format_string as a dictionary.
115- The below example will give the tau slider 99 decimal points of precision and use scientific notation to display it. The
116- beta slider will use the default 1 decimal point of precision
115+ You can change the precision of individual slider displays by passing `` slider_format_string `` as a dictionary.
116+ The example below gives the tau slider 99 decimal points of precision and uses scientific notation to display it. The
117+ beta slider uses the default 1 decimal point of precision.
117118
118119.. code-block :: python
119120
@@ -126,26 +127,24 @@ Axis limits
126127You can control how the ``xlim/ylim `` behaves using the ``xlim/ylim `` arguments.
127128The options are:
128129
129- 1. ``'stretch' `` - The default, allow the x/y axes to expand but never shrink
130- 2. ``'auto' `` - autoscale the limits for every plot update
131- 3. ``'fixed' `` - never automatically update the limits
130+ 1. ``'stretch' `` - The default; allows the x/y axes to expand but never shrink
131+ 2. ``'auto' `` - Autoscales the limits for every plot update
132+ 3. ``'fixed' `` - Never automatically update the limits
1321334. [``float ``, ``float ``] - This value will be passed through to ``plt.xlim `` or ``plt.ylim ``
133134
134135Reference parameter values in the Title
135136^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
136- You can make the title auto update with information about the values by using ``title `` argument.
137- Just use the name of one of the parameters as in a format specifier in the string.
138- e.g. to put the value of `tau ` in the title and round it to two decimals use the following
139- title string: ``{'tau:.2f}' ``
137+ You can make the Title automatically update with information about the values by using ``title `` argument.
138+ Use the name of one of the parameters as a format specifier in the string. For example use the following title string
139+ to put the value of `tau ` in the title and round it to two decimalsg: ``{'tau:.2f}' ``
140140
141141.. _plot-kwargs-section :
142142
143143Matplolitb keyword arguments
144144^^^^^^^^^^^^^^^^^^^^^^^^^^^^
145145
146- You can pass keyword arguments (kwargs) through to the ``plt.plot `` calls using the ``plot_kwargs ``
147- argument to ``interactive_plot ``. For example to add a label and some styling to one of the functions you
148- can do the following:
146+ You can pass keyword arguments (*kwargs *) through to the ``plt.plot `` calls using the ``plot_kwargs ``
147+ argument to ``interactive_plot ``. For example, to add a label and some styling to one of the functions try the following:
149148
150149.. code-block :: python
151150
0 commit comments