An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20110114/7854d78f/attachment.pl>
bug in qplot (library ggplot2)
6 messages · David Winsemius, ONKELINX, Thierry, Pierre-Olivier Chasset
On Jan 13, 2011, at 8:17 PM, Pierre-Olivier Chasset wrote:
Hello,
this following code give a nice png:
/library(ggplot2)
i <- 1
png(file=paste('test ',i,'.png',sep=''))
qplot(carat, data=diamonds,
fill=color,geom='histogram')+scale_y_continuous(i)
dev.off()
/
I would like to get more files, but the following code doesn't make
any
file:
/library(ggplot2)
for (i in 1:2) {
png(file=paste('test ',i,'.png',sep=''))
qplot(carat, data=diamonds,
fill=color,geom='histogram')+scale_y_continuous(i)
dev.off()
Read the FAQs.
} / Have you got any idea? Have I made something false? Thanks, Pierre-Olivier
David Winsemius, MD West Hartford, CT
David, I haven't found any FAQs for ggplot. Do you mean the http://cran.r-project.org/faqs.html? In this one, no subject seems to be linked with my problem about qplot in a loop. Best regards, Pierre-Olivier Le 14/01/2011 05:43, David Winsemius a ?crit :
On Jan 13, 2011, at 8:17 PM, Pierre-Olivier Chasset wrote:
Hello,
this following code give a nice png:
/library(ggplot2)
i <- 1
png(file=paste('test ',i,'.png',sep=''))
qplot(carat, data=diamonds,
fill=color,geom='histogram')+scale_y_continuous(i)
dev.off()
/
I would like to get more files, but the following code doesn't make any
file:
/library(ggplot2)
for (i in 1:2) {
png(file=paste('test ',i,'.png',sep=''))
qplot(carat, data=diamonds,
fill=color,geom='histogram')+scale_y_continuous(i)
dev.off()
Read the FAQs.
} / Have you got any idea? Have I made something false? Thanks, Pierre-Olivier
David Winsemius, MD West Hartford, CT
______________________________________________ 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.
Pierre, You did not look hard enough. You need FAQ 7.22 http://cran.r-project.org/doc/FAQ/R-FAQ.html#Why-do-lattice_002ftrellis-graphics-not-work_003f Best regards, Thierry ---------------------------------------------------------------------------- ir. Thierry Onkelinx Instituut voor natuur- en bosonderzoek team Biometrie & Kwaliteitszorg Gaverstraat 4 9500 Geraardsbergen Belgium Research Institute for Nature and Forest team Biometrics & Quality Assurance Gaverstraat 4 9500 Geraardsbergen Belgium tel. + 32 54/436 185 Thierry.Onkelinx at inbo.be www.inbo.be To call in the statistician after the experiment is done may be no more than asking him to perform a post-mortem examination: he may be able to say what the experiment died of. ~ Sir Ronald Aylmer Fisher The plural of anecdote is not data. ~ Roger Brinner The combination of some data and an aching desire for an answer does not ensure that a reasonable answer can be extracted from a given body of data. ~ John Tukey
-----Oorspronkelijk bericht----- Van: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] Namens Pierre-Olivier Chasset Verzonden: vrijdag 14 januari 2011 10:31 Aan: David Winsemius; r-help at r-project.org Onderwerp: Re: [R] bug in qplot (library ggplot2) David, I haven't found any FAQs for ggplot. Do you mean the http://cran.r-project.org/faqs.html? In this one, no subject seems to be linked with my problem about qplot in a loop. Best regards, Pierre-Olivier Le 14/01/2011 05:43, David Winsemius a ?crit :
On Jan 13, 2011, at 8:17 PM, Pierre-Olivier Chasset wrote:
Hello,
this following code give a nice png:
/library(ggplot2)
i <- 1
png(file=paste('test ',i,'.png',sep='')) qplot(carat,
data=diamonds,
fill=color,geom='histogram')+scale_y_continuous(i) dev.off() / I would like to get more files, but the following code
doesn't make
any
file:
/library(ggplot2)
for (i in 1:2) {
png(file=paste('test ',i,'.png',sep=''))
qplot(carat, data=diamonds,
fill=color,geom='histogram')+scale_y_continuous(i)
dev.off()
Read the FAQs.
} / Have you got any idea? Have I made something false? Thanks, Pierre-Olivier
David Winsemius, MD West Hartford, CT
______________________________________________ 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.
______________________________________________ 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.
The corrected code:
library(ggplot2)
for (i in 1:2) {
png(file=paste('test ',i,'.png',sep=''))
print(qplot(carat, data=diamonds, fill=color,geom='histogram')+scale_y_continuous(i))
dev.off()
}
Thanks
Le 14/01/2011 02:17, Pierre-Olivier Chasset a ?crit :
Hello,
this following code give a nice png:
/library(ggplot2)
i<- 1
png(file=paste('test ',i,'.png',sep=''))
qplot(carat, data=diamonds,
fill=color,geom='histogram')+scale_y_continuous(i)
dev.off()
/
I would like to get more files, but the following code doesn't make any
file:
/library(ggplot2)
for (i in 1:2) {
png(file=paste('test ',i,'.png',sep=''))
qplot(carat, data=diamonds,
fill=color,geom='histogram')+scale_y_continuous(i)
dev.off()
}
/
Have you got any idea?
Have I made something false?
Thanks,
Pierre-Olivier
R version 2.12.1 (2010-12-16)
Platform: i386-redhat-linux-gnu (32-bit)
[[alternative HTML version deleted]]
______________________________________________ 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.
Dear Pierre,
A more elegant solution is to use ggsave()
library(ggplot2)
for (i in 1:2) {
p <-
qplot(carat, data=diamonds, fill=color,geom='histogram')+scale_y_continuous(i)
ggsave(filename = paste('test ',i,'.png',sep=''), plot = p)
}
Best regards,
Thierry
----------------------------------------------------------------------------
ir. Thierry Onkelinx
Instituut voor natuur- en bosonderzoek
team Biometrie & Kwaliteitszorg
Gaverstraat 4
9500 Geraardsbergen
Belgium
Research Institute for Nature and Forest
team Biometrics & Quality Assurance
Gaverstraat 4
9500 Geraardsbergen
Belgium
tel. + 32 54/436 185
Thierry.Onkelinx at inbo.be
www.inbo.be
To call in the statistician after the experiment is done may be no more than asking him to perform a post-mortem examination: he may be able to say what the experiment died of.
~ Sir Ronald Aylmer Fisher
The plural of anecdote is not data.
~ Roger Brinner
The combination of some data and an aching desire for an answer does not ensure that a reasonable answer can be extracted from a given body of data.
~ John Tukey
-----Oorspronkelijk bericht-----
Van: r-help-bounces at r-project.org
[mailto:r-help-bounces at r-project.org] Namens Pierre-Olivier Chasset
Verzonden: vrijdag 14 januari 2011 12:08
Aan: r-help at r-project.org
Onderwerp: Re: [R] bug in qplot (library ggplot2)
The corrected code:
library(ggplot2)
for (i in 1:2) {
png(file=paste('test ',i,'.png',sep=''))
print(qplot(carat, data=diamonds,
fill=color,geom='histogram')+scale_y_continuous(i))
dev.off()
}
Thanks
Le 14/01/2011 02:17, Pierre-Olivier Chasset a ?crit :
Hello,
this following code give a nice png:
/library(ggplot2)
i<- 1
png(file=paste('test ',i,'.png',sep='')) qplot(carat, data=diamonds,
fill=color,geom='histogram')+scale_y_continuous(i)
dev.off()
/
I would like to get more files, but the following code doesn't make
any
file:
/library(ggplot2)
for (i in 1:2) {
png(file=paste('test ',i,'.png',sep=''))
qplot(carat, data=diamonds,
fill=color,geom='histogram')+scale_y_continuous(i)
dev.off()
}
/
Have you got any idea?
Have I made something false?
Thanks,
Pierre-Olivier
R version 2.12.1 (2010-12-16)
Platform: i386-redhat-linux-gnu (32-bit)
[[alternative HTML version deleted]]
______________________________________________ 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.
______________________________________________ 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.