diff options
author | Alexandre Gramfort <alexandre.gramfort@m4x.org> | 2017-07-12 22:20:08 +0200 |
---|---|---|
committer | Alexandre Gramfort <alexandre.gramfort@m4x.org> | 2017-07-20 14:05:12 +0200 |
commit | d6091dae858a82f69e6843859f164269fa338c6b (patch) | |
tree | 4c6b60ef30514a7d86d06b0f7664769c7d871bb6 /examples | |
parent | c5a72cc1ff6a1f5462fdca6ced837180820fe19b (diff) |
more
Diffstat (limited to 'examples')
-rw-r--r-- | examples/plot_OT_1D.py | 18 | ||||
-rw-r--r-- | examples/plot_optim_OTreg.py | 6 |
2 files changed, 12 insertions, 12 deletions
diff --git a/examples/plot_OT_1D.py b/examples/plot_OT_1D.py index b36fa6a..2f3b924 100644 --- a/examples/plot_OT_1D.py +++ b/examples/plot_OT_1D.py @@ -8,7 +8,7 @@ """ import numpy as np -import matplotlib.pylab as plt +import matplotlib.pylab as pl import ot from ot.datasets import get_1D_gauss as gauss @@ -29,21 +29,21 @@ M /= M.max() #%% plot the distributions -plt.figure(1) -plt.plot(x, a, 'b', label='Source distribution') -plt.plot(x, b, 'r', label='Target distribution') -plt.legend() +pl.figure(1, figsize=(6.4, 3)) +pl.plot(x, a, 'b', label='Source distribution') +pl.plot(x, b, 'r', label='Target distribution') +pl.legend() #%% plot distributions and loss matrix -plt.figure(2, figsize=(5, 5)) +pl.figure(2, figsize=(5, 5)) ot.plot.plot1D_mat(a, b, M, 'Cost matrix M') #%% EMD G0 = ot.emd(a, b, M) -plt.figure(3, figsize=(5, 5)) +pl.figure(3, figsize=(5, 5)) ot.plot.plot1D_mat(a, b, G0, 'OT matrix G0') #%% Sinkhorn @@ -51,7 +51,7 @@ ot.plot.plot1D_mat(a, b, G0, 'OT matrix G0') lambd = 1e-3 Gs = ot.sinkhorn(a, b, M, lambd, verbose=True) -plt.figure(4, figsize=(5, 5)) +pl.figure(4, figsize=(5, 5)) ot.plot.plot1D_mat(a, b, Gs, 'OT matrix Sinkhorn') -plt.show() +pl.show() diff --git a/examples/plot_optim_OTreg.py b/examples/plot_optim_OTreg.py index 0041770..1c3a1c5 100644 --- a/examples/plot_optim_OTreg.py +++ b/examples/plot_optim_OTreg.py @@ -31,7 +31,7 @@ M /= M.max() G0 = ot.emd(a, b, M) -pl.figure(3) +pl.figure(3, figsize=(5, 5)) ot.plot.plot1D_mat(a, b, G0, 'OT matrix G0') #%% Example with Frobenius norm regularization @@ -64,7 +64,7 @@ reg = 1e-3 Ge = ot.optim.cg(a, b, M, reg, f, df, verbose=True) -pl.figure(4) +pl.figure(4, figsize=(5, 5)) ot.plot.plot1D_mat(a, b, Ge, 'OT matrix Entrop. reg') #%% Example with Frobenius norm + entropic regularization with gcg @@ -82,6 +82,6 @@ reg2 = 1e-1 Gel2 = ot.optim.gcg(a, b, M, reg1, reg2, f, df, verbose=True) -pl.figure(5) +pl.figure(5, figsize=(5, 5)) ot.plot.plot1D_mat(a, b, Gel2, 'OT entropic + matrix Frob. reg') pl.show() |