diff --git a/R/ggphylomorpho.R b/R/ggphylomorpho.R index 8ce1d4f..7abd357 100644 --- a/R/ggphylomorpho.R +++ b/R/ggphylomorpho.R @@ -10,6 +10,7 @@ #' @param xlab the text label for the x axis #' @param ylab the text label for the y axis #' @param repel boolean indicating whether or not to use the \code{ggrepel} package to prevent overplotting of labels +#' @param edge.width size parameter for edges drawn on phylomorphospace. Default is 1 #' @return the ggplot object representing the phylomorphospace @@ -22,7 +23,8 @@ ggphylomorpho <- function(tree, title="Phylomorphospace", xlab="PC1", ylab="PC2", - repel=TRUE) + repel=TRUE, + edge.width=1) { require(ggplot2) @@ -62,13 +64,13 @@ ggphylomorpho <- function(tree, theplot <- ggplot() + - geom_segment(data=edgecoords,aes(x=x.x,xend=x.y, y=y.x, yend=y.y)) + + geom_segment(data=edgecoords,aes(x=x.x,xend=x.y, y=y.x, yend=y.y), size=edge.width) + geom_point(data=pointsForPlot, aes(x=x, y=y, color=color), size=5) + labs(title=title, x=xlab, y=ylab) + theme_bw(20) + theme(legend.position='bottom') if(repel){ - theplot <- theplot + geom_text_repel(data=pointsForPlot, aes(x=x, y=y, label=label)) + theplot <- theplot + geom_text_repel(data=pointsForPlot, aes(x=x, y=y, label=label), segment.alpha=0.5) } else{ theplot <- theplot + geom_text(data=pointsForPlot, aes(x=x, y=y, label=label)) } diff --git a/man/ggphylomorpho.Rd b/man/ggphylomorpho.Rd index 535e3f8..978f7ca 100644 --- a/man/ggphylomorpho.Rd +++ b/man/ggphylomorpho.Rd @@ -6,7 +6,7 @@ \usage{ ggphylomorpho(tree, tipinfo, xvar = PC1, yvar = PC2, factorvar = group, labelvar = taxon, title = "Phylomorphospace", xlab = "PC1", - ylab = "PC2", repel = TRUE) + ylab = "PC2", repel = TRUE, edge.width = 1) } \arguments{ \item{tree}{object of class \code{phylo}} @@ -28,6 +28,8 @@ ggphylomorpho(tree, tipinfo, xvar = PC1, yvar = PC2, factorvar = group, \item{ylab}{the text label for the y axis} \item{repel}{boolean indicating whether or not to use the \code{ggrepel} package to prevent overplotting of labels} + +\item{edge.width}{size parameter for edges drawn on phylomorphospace. Default is 1} } \value{ the ggplot object representing the phylomorphospace diff --git a/readme.html b/readme.html index b045938..629bf21 100644 --- a/readme.html +++ b/readme.html @@ -134,15 +134,15 @@

make example data

sampleData <- makesampledata()
 
 plot(sampleData$tree)
-

+

head(sampleData$DF)
-
##             PC1        PC2 taxon  group
-## AAAAA  1.416156 -3.4994342 AAAAA group1
-## BBBBB  2.364885 -3.1435084 BBBBB group2
-## CCCCC  3.923850 -3.7085053 CCCCC group1
-## DDDDD  4.779961 -3.1848266 DDDDD group2
-## EEEEE  1.433133  2.9528747 EEEEE group1
-## FFFFF -0.273229 -0.6153418 FFFFF group2
+
##              PC1       PC2 taxon  group
+## AAAAA -1.6961220 -3.166955 AAAAA group1
+## BBBBB -1.6417467 -3.020521 BBBBB group2
+## CCCCC -1.2058984 -3.519850 CCCCC group1
+## DDDDD -1.6926564 -1.302847 DDDDD group2
+## EEEEE  1.1066959 -1.219074 EEEEE group1
+## FFFFF  0.8772968 -1.233387 FFFFF group2

check out the documentation for the function

@@ -151,7 +151,7 @@

check out the documentation for the function

make a phylomorphospace

ggphylomorpho(tree=sampleData$tree, tipinfo=sampleData$DF)
-

+

diff --git a/readme.md b/readme.md index 37c3d7e..0fa581a 100644 --- a/readme.md +++ b/readme.md @@ -28,13 +28,13 @@ head(sampleData$DF) ``` ``` -## PC1 PC2 taxon group -## AAAAA 1.416156 -3.4994342 AAAAA group1 -## BBBBB 2.364885 -3.1435084 BBBBB group2 -## CCCCC 3.923850 -3.7085053 CCCCC group1 -## DDDDD 4.779961 -3.1848266 DDDDD group2 -## EEEEE 1.433133 2.9528747 EEEEE group1 -## FFFFF -0.273229 -0.6153418 FFFFF group2 +## PC1 PC2 taxon group +## AAAAA -1.6961220 -3.166955 AAAAA group1 +## BBBBB -1.6417467 -3.020521 BBBBB group2 +## CCCCC -1.2058984 -3.519850 CCCCC group1 +## DDDDD -1.6926564 -1.302847 DDDDD group2 +## EEEEE 1.1066959 -1.219074 EEEEE group1 +## FFFFF 0.8772968 -1.233387 FFFFF group2 ``` ## check out the documentation for the function diff --git a/readme_files/figure-html/unnamed-chunk-1-1.png b/readme_files/figure-html/unnamed-chunk-1-1.png index 24caaa8..a6d9027 100644 Binary files a/readme_files/figure-html/unnamed-chunk-1-1.png and b/readme_files/figure-html/unnamed-chunk-1-1.png differ diff --git a/readme_files/figure-html/unnamed-chunk-3-1.png b/readme_files/figure-html/unnamed-chunk-3-1.png index 77791dc..3b0cb8c 100644 Binary files a/readme_files/figure-html/unnamed-chunk-3-1.png and b/readme_files/figure-html/unnamed-chunk-3-1.png differ