Hello All, The version of R I am using is as follows> version_ platform x86_64-pc-linux-gnu arch x86_64 os linux-gnu system x86_64, linux-gnu status major 2 minor 14.1 year 2011 month 12 day 22 svn rev 57956 language R version.string R version 2.14.1 (2011-12-22) I just few days back started using R for basic statistical analysis. I want to plot the graph of following information> dfdisk vmfs vmdk IOPS BW 1 naa.5000a7203007ed8f 3 eager 16886.77 65.96393 2 naa.5000a7203007ed8f 3 lazy 44623.15 174.3092 3 naa.5000a7203007ed8f 5 eager 16767.53 65.49815 4 naa.5000a7203007ed8f 5 lazy 45891.55 179.2639> str(df)'data.frame': 4 obs. of 5 variables: $ disk:List of 4 ..$ : chr "naa.5000a7203007ed8f" ..$ : chr "naa.5000a7203007ed8f" ..$ : chr "naa.5000a7203007ed8f" ..$ : chr "naa.5000a7203007ed8f" $ vmfs:List of 4 ..$ : num 3 ..$ : num 3 ..$ : num 5 ..$ : num 5 $ vmdk:List of 4 ..$ : chr "eager" ..$ : chr "lazy" ..$ : chr "eager" ..$ : chr "lazy" $ IOPS:List of 4 ..$ : num 16887 ..$ : num 44623 ..$ : num 16768 ..$ : num 45892 $ BW :List of 4 ..$ : num 66 ..$ : num 174 ..$ : num 65.5 ..$ : num 179 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? Thanks and Regards, Prasad
First. You should update R to the latest version, 3.0.2. Second. What commands have you tried and what error messages did you receive? Third. Use dput(df) and send the output to the mailing list. A data frame usually consists of several vectors, not several lists. It might be necessary to explain how you created or obtained df. ------------------------------------- David L Carlson Associate Professor of Anthropology Texas A&M University College Station, TX 77840-4352 -----Original Message----- From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] On Behalf Of Prasad Joshi Sent: Monday, October 7, 2013 5:03 AM To: r-help at r-project.org Subject: [R] Need help with plotting the graph Hello All, The version of R I am using is as follows> version_ platform x86_64-pc-linux-gnu arch x86_64 os linux-gnu system x86_64, linux-gnu status major 2 minor 14.1 year 2011 month 12 day 22 svn rev 57956 language R version.string R version 2.14.1 (2011-12-22) I just few days back started using R for basic statistical analysis. I want to plot the graph of following information> dfdisk vmfs vmdk IOPS BW 1 naa.5000a7203007ed8f 3 eager 16886.77 65.96393 2 naa.5000a7203007ed8f 3 lazy 44623.15 174.3092 3 naa.5000a7203007ed8f 5 eager 16767.53 65.49815 4 naa.5000a7203007ed8f 5 lazy 45891.55 179.2639> str(df)'data.frame': 4 obs. of 5 variables: $ disk:List of 4 ..$ : chr "naa.5000a7203007ed8f" ..$ : chr "naa.5000a7203007ed8f" ..$ : chr "naa.5000a7203007ed8f" ..$ : chr "naa.5000a7203007ed8f" $ vmfs:List of 4 ..$ : num 3 ..$ : num 3 ..$ : num 5 ..$ : num 5 $ vmdk:List of 4 ..$ : chr "eager" ..$ : chr "lazy" ..$ : chr "eager" ..$ : chr "lazy" $ IOPS:List of 4 ..$ : num 16887 ..$ : num 44623 ..$ : num 16768 ..$ : num 45892 $ BW :List of 4 ..$ : num 66 ..$ : num 174 ..$ : num 65.5 ..$ : num 179 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? Thanks and Regards, Prasad ______________________________________________ R-help at 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.
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: par(mfrow=c(3,1)) Jim