On Tue, Oct 8, 2013 at 2:01 AM, Jim Lemon <j...@bitwrit.com.au> wrote: > On 10/07/2013 09:02 PM, Prasad Joshi wrote: >> >> Hello All, >> .... >> >> I would like Y axis to represent BW and X axis to represent disk, vmfs and >> vmdk. >> >> All the examples in books or online have single X axis. I could not >> find an example which does something similar to what I am trying. Can >> anyone please give me some pointers? >> > Hi Prasad, > You may want something like the following: > > df<-read.table( > text="disk vmfs vmdk IOPS BW > > naa.5000a7203007ed8f 3 eager 16886.77 65.96393 > naa.5000a7203007ed8f 3 lazy 44623.15 174.3092 > naa.5000a7203007ed8f 5 eager 16767.53 65.49815 > naa.5000a7203007ed8f 5 lazy 45891.55 179.2639", > header=TRUE) > x11(width=10,height=5) > par(mfrow=c(1,3)) > brkdn_disk<-by(df$BW,df$disk,FUN=mean) > plot(brkdn_disk,xaxt="n") > axis(1,at=1:length(brkdn_disk),labels=names(brkdn_disk)) > brkdn_vmfs<-by(df$BW,df$vmfs,FUN=mean) > plot(brkdn_vmfs,xaxt="n") > axis(1,at=1:length(brkdn_vmfs),labels=names(brkdn_vmfs)) > brkdn_vmdk<-by(df$BW,df$vmdk,FUN=mean) > plot(brkdn_vmdk,xaxt="n") > axis(1,at=1:length(brkdn_vmdk),labels=names(brkdn_vmdk)) > > You can also have the plots in a vertical format by using:
Thanks Jim for your efforts. The code you gave works for me if I include df <- read.table() line. Since I am kind of new to R, I think I am not being efficient with the data.frame df. > dput(df) structure(list(disk = list("naa.5000a7203007ed8f", "naa.5000a7203007ed8f", "naa.5000a7203007ed8f", "naa.5000a7203007ed8f", "naa.5000a720300895c4", "naa.5000a720300895c4", "naa.5000a720300895c4", "naa.5000a720300895c4"), vmfs = list(3, 3, 5, 5, 3, 3, 5, 5), vmdk = list("eager", "lazy", "eager", "lazy", "eager", "lazy", "eager", "lazy"), IOPS = list(16886.766301, 44623.145983, 16767.526886, 45891.547436, 16794.495655, 45289.670722, 16603.198764, 46092.4011), BW = list(65.963931, 174.309164, 65.498152, 179.263857, 65.603499, 176.912776, 64.856245, 180.048442)), .Names = c("disk", "vmfs", "vmdk", "IOPS", "BW"), row.names = c(NA, -8L), class = "data.frame") I will find the way to correctly represent the result dataframe. Any ways thanks Jim for your reply. Thanks and Regards, Prasad > > par(mfrow=c(3,1)) > > Jim ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.