From 838708a0134ab8e0e0ba7ee01bd97e7aa39b23bb Mon Sep 17 00:00:00 2001 From: RĂ©mi Flamary Date: Mon, 24 Oct 2016 15:36:16 +0200 Subject: add plot and utils functions --- ot/plot.py | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'ot/plot.py') 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 -- cgit v1.2.3