summaryrefslogtreecommitdiff
path: root/docs/source/auto_examples/plot_barycenter_1D.rst
diff options
context:
space:
mode:
Diffstat (limited to 'docs/source/auto_examples/plot_barycenter_1D.rst')
-rw-r--r--docs/source/auto_examples/plot_barycenter_1D.rst85
1 files changed, 54 insertions, 31 deletions
diff --git a/docs/source/auto_examples/plot_barycenter_1D.rst b/docs/source/auto_examples/plot_barycenter_1D.rst
index 66ac042..a65ac3d 100644
--- a/docs/source/auto_examples/plot_barycenter_1D.rst
+++ b/docs/source/auto_examples/plot_barycenter_1D.rst
@@ -1,6 +1,12 @@
+.. only:: html
+
+ .. note::
+ :class: sphx-glr-download-link-note
+ Click :ref:`here <sphx_glr_download_auto_examples_plot_barycenter_1D.py>` to download the full example code
+ .. rst-class:: sphx-glr-example-title
-.. _sphx_glr_auto_examples_plot_barycenter_1D.py:
+ .. _sphx_glr_auto_examples_plot_barycenter_1D.py:
==============================
@@ -17,8 +23,7 @@ SIAM Journal on Scientific Computing, 37(2), A1111-A1138.
-
-.. code-block:: python
+.. code-block:: default
# Author: Remi Flamary <remi.flamary@unice.fr>
@@ -38,16 +43,14 @@ SIAM Journal on Scientific Computing, 37(2), A1111-A1138.
+
Generate data
-------------
-
-.. code-block:: python
+.. code-block:: default
- #%% parameters
-
n = 100 # nb bins
# bin positions
@@ -71,15 +74,13 @@ Generate data
+
Plot data
---------
+.. code-block:: default
-.. code-block:: python
-
-
- #%% plot the distributions
pl.figure(1, figsize=(6.4, 3))
for i in range(n_distributions):
@@ -91,7 +92,8 @@ Plot data
.. image:: /auto_examples/images/sphx_glr_plot_barycenter_1D_001.png
- :align: center
+ :class: sphx-glr-single-img
+
@@ -100,12 +102,9 @@ Barycenter computation
----------------------
-
-.. code-block:: python
+.. code-block:: default
- #%% barycenter computation
-
alpha = 0.2 # 0<=alpha<=1
weights = np.array([1 - alpha, alpha])
@@ -133,8 +132,9 @@ Barycenter computation
-.. image:: /auto_examples/images/sphx_glr_plot_barycenter_1D_003.png
- :align: center
+.. image:: /auto_examples/images/sphx_glr_plot_barycenter_1D_002.png
+ :class: sphx-glr-single-img
+
@@ -143,11 +143,8 @@ Barycentric interpolation
-------------------------
+.. code-block:: default
-.. code-block:: python
-
-
- #%% barycenter interpolation
n_alpha = 11
alpha_list = np.linspace(0, 1, n_alpha)
@@ -163,7 +160,16 @@ Barycentric interpolation
B_l2[:, i] = A.dot(weights)
B_wass[:, i] = ot.bregman.barycenter(A, M, reg, weights)
- #%% plot interpolation
+
+
+
+
+
+
+
+
+.. code-block:: default
+
pl.figure(3)
@@ -219,33 +225,50 @@ Barycentric interpolation
*
- .. image:: /auto_examples/images/sphx_glr_plot_barycenter_1D_005.png
- :scale: 47
+ .. image:: /auto_examples/images/sphx_glr_plot_barycenter_1D_003.png
+ :class: sphx-glr-multi-img
*
- .. image:: /auto_examples/images/sphx_glr_plot_barycenter_1D_006.png
- :scale: 47
+ .. image:: /auto_examples/images/sphx_glr_plot_barycenter_1D_004.png
+ :class: sphx-glr-multi-img
+
+.. rst-class:: sphx-glr-script-out
+ Out:
+ .. code-block:: none
-**Total running time of the script:** ( 0 minutes 0.413 seconds)
+ /home/rflamary/PYTHON/POT/examples/plot_barycenter_1D.py:160: UserWarning: Matplotlib is currently using agg, which is a non-GUI backend, so cannot show the figure.
+ pl.show()
+
+
+.. rst-class:: sphx-glr-timing
+
+ **Total running time of the script:** ( 0 minutes 0.769 seconds)
+
+
+.. _sphx_glr_download_auto_examples_plot_barycenter_1D.py:
+
+
.. only :: html
.. container:: sphx-glr-footer
+ :class: sphx-glr-footer-example
+
- .. container:: sphx-glr-download
+ .. container:: sphx-glr-download sphx-glr-download-python
:download:`Download Python source code: plot_barycenter_1D.py <plot_barycenter_1D.py>`
- .. container:: sphx-glr-download
+ .. container:: sphx-glr-download sphx-glr-download-jupyter
:download:`Download Jupyter notebook: plot_barycenter_1D.ipynb <plot_barycenter_1D.ipynb>`
@@ -254,4 +277,4 @@ Barycentric interpolation
.. rst-class:: sphx-glr-signature
- `Gallery generated by Sphinx-Gallery <https://sphinx-gallery.readthedocs.io>`_
+ `Gallery generated by Sphinx-Gallery <https://sphinx-gallery.github.io>`_