Demo entry 6787125

R

   

Submitted by anonymous on Apr 10, 2019 at 02:27
Language: RConsole. Code size: 576 Bytes.

library(ggplot2)
library(RColorBrewer)
df<-data.frame(x=1:6,y=c(2,4,6,7,3,9),lable=c('a','b','c','a','b','c'))

p<-ggplot(df,aes(x,y,color=lable,group=factor(1)))+
  geom_point(size=8,shape='*')+xlab('axis:x')+ylab('axis:y')+
  geom_line(size=0.8)+
  #在折线图中标签,vjust 大于0垂直向下,hjust大于0水平向左
  geom_text(aes(label = y, vjust = 1, hjust = -1 , angle = 0), show_guide = FALSE)+
  scale_color_manual(values = c('pink','red','blue','black','grey','green'))

par(mfrow=c(1,1))
rand.data <- replicate(3,rnorm(1,100,sd=1.5))
barplot(rand.data,col=brewer.pal(8,"Set3"))


p

This snippet took 0.00 seconds to highlight.

Back to the Entry List or Home.

Delete this entry (admin only).