Skip to content

Instantly share code, notes, and snippets.

@Mahedi-61
Last active December 29, 2018 11:16
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Mahedi-61/53ab717f751bdc2d0e216916216cc591 to your computer and use it in GitHub Desktop.
Save Mahedi-61/53ab717f751bdc2d0e216916216cc591 to your computer and use it in GitHub Desktop.
creating group bar chart using r for research publication.
setEPS()
postscript("example.eps")
nm=c(98.45, 97.58, 98.75, 96.92, 99.41)
bag=c(56.23, 72.14, 72.73, 85.78, 87.10)
coat=c(16.93, 45.45, 41.50, 68.11, 55.13)
data=matrix(c(nm,bag,coat), ncol=3)
colnames(data)=c("normal", "bag", "coat")
rownames(data)=c("GEI+PCA", "SPAE", "GaitGAN", "PTSN", "Proposed")
par(mar=c(8, 4, 8, 2)) # where arguments are (b, l, t, r)
xx = barplot(data, col=c("cyan", "gold", "green", "purple", "blue"),
border="white", beside = T, space=c(0.4, 3), ylim=c(0,115), axes = TRUE,
width = c(1, 1, 1, 1, 1), ylab="Average Recognition Rate (%)")
legend("topright",
legend=rownames(data),
fill = c("cyan", "gold", "green", "purple", "blue"),
ncol = 2,
cex = 0.75)
grid(nx=NA, ny=NULL, col = "black")
text(x = xx + 0.5, y = data + 2, label = data, pos = 3, cex = 1, srt = 60, adj= 1, xpd=TRUE, col = "black")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment