-
Notifications
You must be signed in to change notification settings - Fork 107
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Lang
committed
Oct 27, 2016
1 parent
258b9b4
commit c8e95b1
Showing
10 changed files
with
128 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
##' Change the themes of wordcloud2 | ||
##' | ||
##' @description | ||
##' Function for Creating wordcloud theme | ||
##' | ||
##' | ||
##' @param e1 wordcloud2 object | ||
##' @param e2 wordcloud2 themes | ||
##' @export | ||
##' @method + wordcloud2 | ||
##' @examples | ||
##' wc = wordcloud2(demoFreq) | ||
##' | ||
##' wc + WCtheme(1) | ||
##' wc + WCtheme(2) | ||
##' wc + WCtheme(3) | ||
##' wc + WCtheme(2) + WCtheme(3) | ||
`+.wordcloud2` = function(e1, e2){ | ||
if(e2$class == 1){ | ||
e1$x$minRotation = -pi/2 | ||
e1$x$maxRotation = -pi/2 | ||
}else if (e2$class ==2){ | ||
e1$x$minRotation = -pi/6 | ||
e1$x$maxRotation = -pi/6 | ||
e1$x$rotateRatio = 1 | ||
}else if (e2$class == 3){ | ||
e1$x$color = "random-light" | ||
e1$x$backgroundColor = "grey" | ||
} | ||
return(e1) | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
##' Change the themes of wordcloud2 | ||
##' | ||
##' @description | ||
##' Function for Creating wordcloud theme | ||
##' | ||
##' @usage | ||
##' WCtheme(class = 1) | ||
##' | ||
##' @param class class for theme in wordcloud2 | ||
##' | ||
##' @export | ||
##' @examples | ||
##' wc = wordcloud2(demoFreq) | ||
##' | ||
##' wc + WCtheme(1) | ||
##' wc + WCtheme(2) | ||
##' wc + WCtheme(3) | ||
##' wc + WCtheme(2) + WCtheme(3) | ||
|
||
WCtheme = function(class = 1){ | ||
if(class == 1){ | ||
return(list(class =1, | ||
minRotation = -pi/2, | ||
maxRotation = -pi/2)) | ||
}else if (class ==2){ | ||
return(list(class =2, | ||
minRotation = -pi/6, | ||
maxRotation = -pi/6, | ||
rotateRatio = 1)) | ||
}else if (class == 3| class=='Dark'){ | ||
return(list(class =3, | ||
color = "random-light", | ||
backgroundColor = "grey")) | ||
}else{ | ||
stop("Out of themes~") | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
% Generated by roxygen2 (4.1.1): do not edit by hand | ||
% Please edit documentation in R/theme.R | ||
\name{WCtheme} | ||
\alias{WCtheme} | ||
\title{Change the themes of wordcloud2} | ||
\usage{ | ||
WCtheme(class = 1) | ||
} | ||
\arguments{ | ||
\item{class}{class for theme in wordcloud2} | ||
} | ||
\description{ | ||
Function for Creating wordcloud theme | ||
} | ||
\examples{ | ||
wc = wordcloud2(demoFreq) | ||
|
||
wc + WCtheme(1) | ||
wc + WCtheme(2) | ||
wc + WCtheme(3) | ||
wc + WCtheme(2) + WCtheme(3) | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
% Generated by roxygen2 (4.1.1): do not edit by hand | ||
% Please edit documentation in R/plot-construction.R | ||
\name{+.wordcloud2} | ||
\alias{+.wordcloud2} | ||
\title{Change the themes of wordcloud2} | ||
\usage{ | ||
\method{+}{wordcloud2}(e1, e2) | ||
} | ||
\arguments{ | ||
\item{e1}{wordcloud2 object} | ||
|
||
\item{e2}{wordcloud2 themes} | ||
} | ||
\description{ | ||
Function for Creating wordcloud theme | ||
} | ||
\examples{ | ||
wc = wordcloud2(demoFreq) | ||
|
||
wc + WCtheme(1) | ||
wc + WCtheme(2) | ||
wc + WCtheme(3) | ||
wc + WCtheme(2) + WCtheme(3) | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters