summaryrefslogtreecommitdiff
path: root/ot/plot.py
diff options
context:
space:
mode:
authorRémi Flamary <remi.flamary@gmail.com>2016-10-24 15:36:16 +0200
committerRémi Flamary <remi.flamary@gmail.com>2016-10-24 15:36:16 +0200
commit838708a0134ab8e0e0ba7ee01bd97e7aa39b23bb (patch)
tree38131877d09373144b716cf03af5d0a2f8e240c0 /ot/plot.py
parent04262dd46420304dd8d9bb01d37e4ceb3e44c11d (diff)
add plot and utils functions
Diffstat (limited to 'ot/plot.py')
-rw-r--r--ot/plot.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/ot/plot.py b/ot/plot.py
index 743ab4a..f78daf6 100644
--- a/ot/plot.py
+++ b/ot/plot.py
@@ -38,3 +38,13 @@ def otplot1D(a,b,M,title=''):
pl.xlim((0,nb))
+def otplot2D_samples(xs,xt,G,thr=1e-8,**kwargs):
+ """ Plot matrix M in 2D with lines using alpha values"""
+ if ('color' not in kwargs) and ('c' not in kwargs):
+ kwargs['color']='k'
+ mx=G.max()
+ for i in range(xs.shape[0]):
+ for j in range(xt.shape[0]):
+ if G[i,j]/mx>thr:
+ pl.plot([xs[i,0],xt[j,0]],[xs[i,1],xt[j,1]],alpha=G[i,j]/mx,**kwargs)
+ \ No newline at end of file