[R] Axes value format
Vihan Pandey
vihanpandey at gmail.com
Tue May 8 20:23:21 CEST 2012
On 8 May 2012 19:47, John Kane <jrkrideau at inbox.com> wrote:
> Quite likely, but we need to know what you are doing and what graphics package you are using.
>
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
Frightfully sorry about that. I'm using R on a Mac, and its a simple
plot using plot() which is taking values from a CSV file, let me
illustrate for one dataset :
======
#!/usr/bin/Rscript
out_file = "foobar.pdf"
pdf(out_file, height=8.5, width=11)
my_values <- read.csv("foo.csv",head=TRUE,sep=",")
plot(my_values$num_sims,
my_values$exec_time,
xlab="Number of Simulations",
ylab="Execution Time(in milliseconds)",
col="red",
main="Execution Time for Simulations")
lines(my_values$num_sims,my_values$exec_time,col="red")
my_values2 <- read.csv("bar.csv",head=TRUE,sep=",")
lines(my_values2$num_sims,my_values2$exec_time,col="blue")
points(my_values2$num_sims,my_values2$exec_time,col="blue")
legend("topright",
lty=c(1,1),
c("foo","bar"),
col=c("red","blue")
);
dev.off()
print(paste("Plot was saved in:", getwd()))
======
foo.csv and bar.csv have values like:
"num_sims","exec_time"
1000000,44556
2000000,89112
3000000,133668
etc.
Please let me know if you require any additional information.
Cheers!
- vihan
>
> John Kane
> Kingston ON Canada
>
>
>> -----Original Message-----
>> From: vihanpandey at gmail.com
>> Sent: Tue, 8 May 2012 19:29:45 +0200
>> To: r-help at r-project.org
>> Subject: [R] Axes value format
>>
>> Hi all,
>>
>> I have some graphs where the values on the X and Y axes are by default
>> in exponent form like 2e+05 or 1.0e+07. Is it possible to make them in
>> a more readable form like 10M for 1.0e+07 or 200K for 2e+05?
>>
>> Thanks and Regards,
>>
>> - vihan
>>
>> ______________________________________________
>> 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.
>
> ____________________________________________________________
> FREE ONLINE PHOTOSHARING - Share your photos online with your friends and family!
> Visit http://www.inbox.com/photosharing to find out more!
>
>
More information about the R-help
mailing list