[R] Plot data in sequence

roslinazairimah zakaria ro@lin@ump @ending from gm@il@com
Wed Apr 4 17:10:45 CEST 2018


Hi r-users,

I would like to draw line plots. However, the plot starts from 11121 data
and plot data ENTRY last in the plot.

Here is the code and data.

datn <- read.table(header=TRUE, text='
LEVEL   STATUS      CGPA
DIPLOMA ENTRY 3.32
DIPLOMA 11121 2.91
DIPLOMA 11122 2.90
DIPLOMA 12131 2.89
DIPLOMA 12132 2.89
DIPLOMA 13141 2.93
DIPLOMA 13142 2.96
DIPLOMA 14151 2.76
DIPLOMA 14152 2.73
STPM ENTRY 2.77
STPM 11121 3.26
STPM 11122 3.30
STPM 12131 3.28
STPM 12132 3.27
STPM 13141 3.28
STPM 13142 3.28
STPM 14151 3.30
STPM 14152 3.31
MATRIC ENTRY 2.93
MATRIC 11121 2.69
MATRIC 11122 2.79
MATRIC 12131 2.81
MATRIC 12132 2.80
MATRIC 13141 2.77
MATRIC 13142 2.76
MATRIC 14151 2.78
MATRIC 14152 2.82
STAM ENTRY 2.00
STAM 11121 3.05
STAM 11122 2.99
STAM 12131 2.97
STAM 12132 2.89
STAM 13141 2.84
STAM 13142 2.79
STAM 14151 2.79
STAM 14152 2.77
')

ggplot(data=datn, aes(x=STATUS, y=CGPA, group=LEVEL,
colour=LEVEL),cex.axis=0.2, ylim=c(0,4)) +
    geom_line(size=1.3) +
    geom_point()+
    #guides(fill=FALSE) +
    theme(legend.title=element_blank(),legend.position=c(.3,
.3),axis.text.x = element_text(size=8),axis.text=element_text(size=10))

Thank you very much.

-- 
*Roslinazairimah Zakaria*
*Tel: +609-5492370; Fax. No.+609-5492766*

*Email: roslinazairimah at ump.edu.my <roslinazairimah at ump.edu.my>;
roslinaump at gmail.com <roslinaump at gmail.com>*
Faculty of Industrial Sciences & Technology
University Malaysia Pahang
Lebuhraya Tun Razak, 26300 Gambang, Pahang, Malaysia

	[[alternative HTML version deleted]]




More information about the R-help mailing list