library(ggplot2)
data<-read.csv("test.csv", header = T)
data$Group <- factor(data$Group, levels=data$Group)
mylabel<-paste(data[,2],"%")
mylabel<-rev(mylabel)
percent<-rev(data$Percentage)
p<-ggplot(data,aes(x="",y=Percentage,fill=Group)) +
geom_bar(stat = "identity",color="white") +
scale_fill_manual(values = c("#FFA533","#2BCF76","#4874EC","#A372E6","#A372E8")) +
coord_polar(theta = "y") +
theme(axis.text.x = element_blank(),
axis.ticks = element_blank(),
panel.grid = element_blank()) +
geom_text(aes(y= cumsum(percent)-percent/2, x= 1),label=mylabel)
p
library(ggplot2)
data<-read.csv("test2.csv", header = T)
p<-ggplot(data, aes(x = height))
p + geom_density(color = "black", fill = "gray")
p + geom_density(aes(color = gender))
p + geom_density(aes(fill = gender), alpha=0.4)
mean<-read.csv("test3.csv")
p+ geom_density(aes(color = gender), alpha=0.4)+geom_vline(data = mean, aes(xintercept = height, color = gender),linetype="dashed")
library(ggplot2)
data<-read.csv("test2.csv", header = T)
data$gender <- as.factor(data$gender)
p<-ggplot(data, aes(x = gender, y = height))
p+geom_violin()
p+geom_violin(aes(fill = gender))
p+geom_violin(aes(fill = "gender"))+scale_fill_manual(values=c("#56B4E9"))
library(reshape2)
library(ggplot2)
data<-read.csv(“your file path”, header = T)
data_melt<-melt (data)
names(data_melt) = c('Gene', 'Cell', 'Value')
p<-ggplot(data_melt, aes(x = Gene, y = Cell, size = Value, color=Cell)) + geom_point()
p<-ggplot(data_melt, aes(x = Gene, y = Cell, size = Value, color=Cell)) + geom_point()+
theme(panel.background = element_blank(),
panel.grid.major = element_line(colour = "gray"),
panel.border = element_rect(colour="black",fill=NA))
library(ggplot2)
data<-read.csv(“your file path”, header = T)
p<-ggplot(data, aes(x=data$销量)) +
geom_histogram(breaks=seq(0,10000,1000))+ xlim(0,10000)
p
install.packages("devtools")
library(devtools)
install_github("kassambara/easyGgplot2")
library(easyGgplot2)
install.package("reshape2")
library(reshape2)
df<-melt(data,id.vars = c("type"))
data<-read.csv(“your file path”, header = T)
ggplot2.violinplot(data=df,xName='variable',yName='value',
groupName='variable', legendPosition="top",
faceting=TRUE,facetingVarNames="type")
ggplot2.violinplot(data=df,xName='variable',yName='value',
groupName='variable', legendPosition="top",
backgroundColor="white",
removePanelGrid=TRUE,
axisLine=c(0.5, "solid", "black"),
faceting=TRUE, facetingVarNames="type")