Description Usage Arguments Details Value Author(s) See Also Examples
The imagering1
function is a tool for creating versatile ring charts
by filling the ring with images.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | imagering1(
group1,
pct1,
pattern.type1,
pattern.type.inner,
frame.color = "black",
frame.size = 1,
label1,
label.size1 = 4,
label.color1 = "black",
label.distance1 = 1.2,
r1,
r2
)
|
group1 |
a vector of strings, containing the names of each slice. |
pct1 |
a vector of non-negative numbers, containing percentages of each group. The numbers must sum up to 100. |
pattern.type1 |
a list of objects returned by |
pattern.type.inner |
an object returned by |
frame.color |
the color for the borders of the ring. |
frame.size |
a numeric value, the line size for the borders of the ring. |
label1 |
a vector of strings, giving the names for the slices shown in the ring chart. |
label.size1 |
the font size of labels shown in the ring chart. |
label.color1 |
the color of labels shown in the ring chart. |
label.distance1 |
the distance of labels from the border of the ring chart. |
r1 |
a numeric value, the inner radius of the ring. |
r2 |
a numeric value, the outer radius of the ring. |
imagering1
function offers flexible ways of doing ring charts.
A ggplot object.
Chunqiao Luo (chunqiaoluo@gmail.com)
Function patternring1
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 | #Example 1
library(patternplot)
library(png)
library(ggplot2)
location<-gsub('\\','/',tempdir(), fixed=TRUE)
pattern(type="blank", density=1, color='white', pattern.line.size=1,
background.color="darkgreen",pixel=6, res=4)
FarWest<-readPNG(paste(location,'/',"blank",".png", sep=''))
pattern(type="blank", density=1, color='white', pattern.line.size=1,
background.color="darkcyan",pixel=6, res=4)
GreatLakes<-readPNG(paste(location,'/',"blank",".png", sep=''))
pattern(type="blank", density=1, color='white', pattern.line.size=1,
background.color="chocolate",pixel=6, res=4)
Mideast<-readPNG(paste(location,'/',"blank",".png", sep=''))
pattern(type="blank", density=1, color='white', pattern.line.size=1,
background.color="cadetblue1",pixel=6, res=4)
NewEngland<-readPNG(paste(location,'/',"blank",".png", sep=''))
pattern(type="blank", density=1, color='white', pattern.line.size=1,
background.color="darkorchid",pixel=6, res=4)
Plains<-readPNG(paste(location,'/',"blank",".png", sep=''))
pattern(type="blank", density=1, color='white', pattern.line.size=1,
background.color="yellowgreen",pixel=6, res=4)
RockyMountain<-readPNG(paste(location,'/',"blank",".png", sep=''))
pattern(type="blank", density=1, color='white', pattern.line.size=1,
background.color="hotpink",pixel=6, res=4)
Southeast<-readPNG(paste(location,'/',"blank",".png", sep=''))
pattern(type="blank", density=1, color='white', pattern.line.size=1,
background.color="lightslateblue",pixel=6, res=4)
Southwest <-readPNG(paste(location,'/',"blank",".png", sep=''))
group1<-c('New_England','Great_Lakes','Plains','Rocky_Mountain', 'Far_West',
'Southwest', 'Southeast', 'Mideast')
pct1<-c( 12, 11, 17, 15, 8, 11, 16, 10)
label1<-paste(group1, " \n ", pct1, "%", sep="")
pattern.type1<-list(NewEngland, GreatLakes,Plains, RockyMountain, FarWest,
Southwest, Southeast, Mideast)
pattern.type.inner<-readPNG(system.file("img", "USmap.png", package="patternplot"))
imagering1(group1, pct1, pattern.type1, pattern.type.inner, frame.color='black',
frame.size=1.5, r1=3, r2=4,label1, label.size1=4,label.color1='black', label.distance1=1.2)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.