From 3337f787ca0fe81614a3957d8fe332a7d44a14bc Mon Sep 17 00:00:00 2001 From: Pierre Ratinaud Date: Tue, 25 Nov 2014 23:34:59 +0100 Subject: [PATCH] ... --- PrintRScript.py | 13 +++++++++++-- ProfList.py | 1 + Rscripts/simi.R | 6 +++--- configuration/simitxt.cfg | 1 + guifunct.py | 15 +++++++++++++++ 5 files changed, 31 insertions(+), 5 deletions(-) diff --git a/PrintRScript.py b/PrintRScript.py index 760c340..deaddf5 100644 --- a/PrintRScript.py +++ b/PrintRScript.py @@ -909,7 +909,16 @@ class PrintSimiScript(PrintRScript) : if self.parametres['seuil_ok'] : seuil = str(self.parametres['seuil']) else : seuil = 'NULL' - + + if not self.parametres.get('edgecurved', False) : + ec = 'FALSE' + else : + ec = 'TRUE' + + txt += """ + edge.curved <- %s + """ % ec + cols = str(self.parametres['cols']).replace(')',', max=255)') cola = str(self.parametres['cola']).replace(')',',max=255)') @@ -1123,7 +1132,7 @@ class PrintSimiScript(PrintRScript) : vertex.label.color <- colm[membership(com)] } } - coords <- plot.simi(graph.simi, p.type='%s',filename="%s", vertex.label = label.v, edge.label = label.e, vertex.col = vertex.col, vertex.label.color = vertex.label.color, vertex.label.cex=label.cex, vertex.size = vertex.size, edge.col = cola, leg=leg, width = width, height = height, alpha = alpha, movie = film, svg = svg) + coords <- plot.simi(graph.simi, p.type='%s',filename="%s", vertex.label = label.v, edge.label = label.e, vertex.col = vertex.col, vertex.label.color = vertex.label.color, vertex.label.cex=label.cex, vertex.size = vertex.size, edge.col = cola, leg=leg, width = width, height = height, alpha = alpha, movie = film, edge.curved = edge.curved, svg = svg) save.image(file="%s") """ % (type, self.filename, ffr(self.pathout['RData'])) diff --git a/ProfList.py b/ProfList.py index 7308f43..86d3084 100644 --- a/ProfList.py +++ b/ProfList.py @@ -518,6 +518,7 @@ class ProfListctrlPanel(wx.ListCtrl, listmix.ListCtrlAutoWidthMixin, listmix.Col 'halo' : 0, 'tmpchi': self.tmpchi, 'fromprof' : True, + 'edge.curved' : True, } act = {} tableau = copymatrix(tableau) diff --git a/Rscripts/simi.R b/Rscripts/simi.R index 8c5da10..bd772c2 100644 --- a/Rscripts/simi.R +++ b/Rscripts/simi.R @@ -222,7 +222,7 @@ do.simi <- function(x, method = 'cooc',seuil = NULL, p.type = 'tkplot',layout.ty out <- list(graph = g.toplot, mat.eff = mat.eff, eff = eff, mat = mat.simi, v.label = v.label, we.width = we.width, we.label=we.label, label.cex = label.cex, layout = lo, communities = com, halo = halo, elim=vec) } -plot.simi <- function(graph.simi, p.type = 'tkplot',filename=NULL, communities = NULL, vertex.col = 'red', edge.col = 'black', edge.label = TRUE, vertex.label=TRUE, vertex.label.color = 'black', vertex.label.cex= NULL, vertex.size=NULL, leg=NULL, width = 800, height = 800, alpha = 0.1, cexalpha = FALSE, movie = NULL, svg = FALSE) { +plot.simi <- function(graph.simi, p.type = 'tkplot',filename=NULL, communities = NULL, vertex.col = 'red', edge.col = 'black', edge.label = TRUE, vertex.label=TRUE, vertex.label.color = 'black', vertex.label.cex= NULL, vertex.size=NULL, leg=NULL, width = 800, height = 800, alpha = 0.1, cexalpha = FALSE, movie = NULL, edge.curved = TRUE, svg = FALSE) { mat.simi <- graph.simi$mat g.toplot <- graph.simi$graph if (is.null(vertex.size)) { @@ -272,14 +272,14 @@ plot.simi <- function(graph.simi, p.type = 'tkplot',filename=NULL, communities = } par(pch=' ') if (is.null(graph.simi$com)) { - plot(g.toplot,vertex.label='', edge.width=we.width, vertex.size=vertex.size, vertex.color=vertex.col, vertex.label.color='white', edge.label=we.label, edge.label.cex=cex, edge.color=edge.col, vertex.label.cex = 0, layout=lo, edge.curved=FALSE)#, rescale = FALSE) + plot(g.toplot,vertex.label='', edge.width=we.width, vertex.size=vertex.size, vertex.color=vertex.col, vertex.label.color='white', edge.label=we.label, edge.label.cex=cex, edge.color=edge.col, vertex.label.cex = 0, layout=lo, edge.curved=edge.curved)#, rescale = FALSE) } else { if (graph.simi$halo) { mark.groups <- communities(graph.simi$com) } else { mark.groups <- NULL } - plot(com, g.toplot,vertex.label='', edge.width=we.width, vertex.size=vertex.size, vertex.color=vertex.col, vertex.label.color='white', edge.label=we.label, edge.label.cex=cex, edge.color=edge.col, vertex.label.cex = 0, layout=lo, mark.groups = mark.groups, edge.curved=FALSE) + plot(com, g.toplot,vertex.label='', edge.width=we.width, vertex.size=vertex.size, vertex.color=vertex.col, vertex.label.color='white', edge.label=we.label, edge.label.cex=cex, edge.color=edge.col, vertex.label.cex = 0, layout=lo, mark.groups = mark.groups, edge.curved=edge.curved) } #txt.layout <- lo txt.layout <- layout.norm(lo, -1, 1, -1, 1, -1, 1) diff --git a/configuration/simitxt.cfg b/configuration/simitxt.cfg index 6b6c6fc..c034e47 100644 --- a/configuration/simitxt.cfg +++ b/configuration/simitxt.cfg @@ -37,3 +37,4 @@ coeff_temax = 10 type_graph = 1 coeff_tv = True first = False +edgecurved = True diff --git a/guifunct.py b/guifunct.py index 67538dc..6280e94 100644 --- a/guifunct.py +++ b/guifunct.py @@ -323,6 +323,19 @@ class PrefSimi ( wx.Dialog ): self.check_elab = wx.CheckBox( self.m_panel2, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 ) fgSizer3.Add( self.check_elab, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5 ) + self.m_staticline39 = wx.StaticLine( self.m_panel2, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL ) + fgSizer3.Add( self.m_staticline39, 0, wx.EXPAND |wx.ALL, 5 ) + + self.m_staticline40 = wx.StaticLine( self.m_panel2, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL ) + fgSizer3.Add( self.m_staticline40, 0, wx.EXPAND |wx.ALL, 5 ) + + self.m_staticText321 = wx.StaticText( self.m_panel2, wx.ID_ANY, _(u"Edge curved"), wx.DefaultPosition, wx.DefaultSize, 0 ) + self.m_staticText321.Wrap( -1 ) + fgSizer3.Add( self.m_staticText321, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 ) + + self.check_curved = wx.CheckBox( self.m_panel2, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 ) + fgSizer3.Add( self.check_curved, 0, wx.ALL, 5 ) + self.m_staticline2914 = wx.StaticLine( self.m_panel2, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL ) fgSizer3.Add( self.m_staticline2914, 0, wx.EXPAND, 5 ) @@ -787,6 +800,7 @@ class PrefSimi ( wx.Dialog ): self.comcheck.SetValue(self.paramsimi['com']) self.choix_com.SetSelection(self.paramsimi['communities']) self.halo.SetValue(self.paramsimi['halo']) + self.check_curved.SetValue(self.paramsimi.get('edgecurved', True)) def ChangeCount(self, evt) : self.textcount.SetValue('%i' % self.listcol.GetSelectedItemCount()) @@ -963,6 +977,7 @@ class PrepSimi : 'com' :self.dial.comcheck.GetValue(), 'communities' : self.dial.choix_com.GetSelection(), 'halo' : self.dial.halo.GetValue(), + 'edgecurved' : self.dial.check_curved.GetValue(), } if 'cexfromchi' in self.parametres : param['cexfromchi'] = self.dial.checkit.GetValue() -- 2.7.4