1 #* Copyright © - 2008-2013 ANR Textométrie - http://textometrie.ens-lyon.fr
3 #* This file is part of the TXM platform.
5 #* The TXM platform is free software: you can redistribute it and/or modif y
6 #* it under the terms of the GNU General Public License as published by
7 #* the Free Software Foundation, either version 3 of the License, or
8 #* (at your option) any later version.
10 #* The TXM platform is distributed in the hope that it will be useful,
11 #* but WITHOUT ANY WARRANTY; without even the implied warranty of
12 #* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 #* General Public License for more details.
15 #* You should have received a copy of the GNU General Public License
16 #* along with the TXM platform. If not, see <http://www.gnu.org/licenses/>.
18 `printrepartition` <-function(positions, names, colors, styles, widths, corpusname, Xmin, T, doCumulative, structurepositions, strutnames, graphtitle, bande) {
24 if (length(positions) > length(colors)) stop("colors list size too small");
25 if (length(positions) > length(names)) stop("names list size too small");
26 if (length(positions) > length(styles)) stop("styles list size too small");
27 if (length(positions) > length(widths)) stop("widths list size too small");
29 # if (length(structurepositions) > length(strutnames)) stop("structure names list size too small");
31 doCumu <- (doCumulative == "true")
37 # set maxX and maxY the ranges
40 for(i in 1:length(names))
45 d = density(x, bw=bande)
55 for(i in 1:length(names))
57 my <- length(positions[[i]])
64 for(i in 1:length(names))
66 #line styles and width update
67 linestyle = linestyle + 1
71 linewidth = linewidth+ 1
78 y <- c( c(0), y , c(y[[length(x)]]) )
79 x <- c( c(x[[1]]), x , c(maxX) )
81 if(draw == 0)# first draw
86 plot(x, y, type="s", xlab=paste("T = ", maxX), main = graphtitle, ylab="Occurrences", ylim=c(0, maxY), xlim=c(Xmin, maxX), pch=15, col=colors[i], lty=styles[i], lwd=widths[i], xaxs="i", yaxs="i")
90 plot(density(x, bw=bande), type="l", xlab=paste("T = ", maxX), graphtitle, ylab="Density", ylim=c(0, maxY), xlim=c(Xmin, maxX), pch=15, col=colors[i], lty=styles[i], lwd=widths[i], xaxs="i", yaxs="i")
97 points(x, y, type="s", pch=15, col=colors[i], lty=styles[i], lwd=widths[i])
101 points(density(x, bw=bande), type="l", pch=15, col=colors[i], lty=styles[i], lwd=widths[i])
110 for(i in 1:length(names))
111 names[i] = paste(names[i], length(positions[[i]]))
114 legend("topleft", names, inset = .02, col = colors, lty=styles, lwd=widths)
116 # draw hist of struct
118 if(length(structurepositions) > 0)
120 for(i in 1:length(structurepositions))
123 text(structurepositions[[i]], maxY*0.70, strutnames[[i]], cex = .8, srt=-90, adj = c(0,0))
125 points(structurepositions, y, type="h", ylim=c(0, maxY), xlim=c(Xmin, maxX))