On May 8, 2012, at 2:23 PM, Vihan Pandey wrote:
On 8 May 2012 19:47, John Kane <jrkrid...@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 :
See if this is helpful. Untested, since you still do not have a
reproducible example for us to work with.
x <- c(12345, 1234567, 123)
paste( round( x/c(1, 1000, 1000000)[findInterval(x,
c(1,1000,1000000)) ], 2),
c("","K","M")[findInterval(x, c(1,1000,1000000)) ] )
[1] "12.35 K" "1.23 M" "123 "
--
David.
======
#!/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: vihanpan...@gmail.com
Sent: Tue, 8 May 2012 19:29:45 +0200
To: r-help@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@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!
______________________________________________
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.
David Winsemius, MD
West Hartford, CT
______________________________________________
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.