[R] Cross-platforms solution to export R graphs
Hello Rusers, I have worked on a R Wiki page for solutions in exporting R graphs, especially, the often-asked questions: - How can I export R graphs in vectorized format (EMF) for inclusion in MS Word or OpenOffice outside of Windows? - What is the best solution(s) for post-editing/annotating R graphs. The page is at: http://wiki.r-project.org/rwiki/doku.php?id=tips:graphics-misc:export. I would be happy to receive your comments and suggestions to improve this document. All the best, PhG -- ..<°}))>< ) ) ) ) ) ( ( ( ( (Prof. Philippe Grosjean ) ) ) ) ) ( ( ( ( (Numerical Ecology of Aquatic Systems ) ) ) ) ) Mons-Hainaut University, Belgium ( ( ( ( ( .. __ 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.
Re: [R] Cross-platforms solution to export R graphs
Thank you Philippe. That is very helpful. Philippe Grosjean wrote: > > Hello Rusers, > > I have worked on a R Wiki page for solutions in exporting R graphs, > especially, the often-asked questions: > - How can I export R graphs in vectorized format (EMF) for inclusion in > MS Word or OpenOffice outside of Windows? > - What is the best solution(s) for post-editing/annotating R graphs. > > The page is at: > http://wiki.r-project.org/rwiki/doku.php?id=tips:graphics-misc:export. > > I would be happy to receive your comments and suggestions to improve > this document. > All the best, > > PhG > -- > ..<°}))>< > ) ) ) ) ) > ( ( ( ( (Prof. Philippe Grosjean > ) ) ) ) ) > ( ( ( ( (Numerical Ecology of Aquatic Systems > ) ) ) ) ) Mons-Hainaut University, Belgium > ( ( ( ( ( > .. > > __ > 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. > > -- View this message in context: http://www.nabble.com/Cross-platforms-solution-to-export-R-graphs-tp22970668p22973759.html Sent from the R help mailing list archive at Nabble.com. __ 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.
Re: [R] Cross-platforms solution to export R graphs
Le jeudi 09 avril 2009 à 15:04 +0200, Philippe Grosjean a écrit : > Hello Rusers, > > I have worked on a R Wiki page for solutions in exporting R graphs, > especially, the often-asked questions: > - How can I export R graphs in vectorized format (EMF) for inclusion in > MS Word or OpenOffice outside of Windows? > - What is the best solution(s) for post-editing/annotating R graphs. > > The page is at: > http://wiki.r-project.org/rwiki/doku.php?id=tips:graphics-misc:export. > > I would be happy to receive your comments and suggestions to improve > this document. Well, if you insist ... The PDF import plugin in OpenOffice is still beta, and some report deem it difficult to install correctly an/or flaky. Having checked that both MSWord (>=2000) and OpenOffice (>=2.4) import and display correctly (i. e. vectorially, including fonts) EPS files, I switched to this format, most notably for use with the marvellous Max Kuhn's odfWeave package, which is a *must* for us working in state/administrative/corporate salt mines, where \LaTeX is deemed obscene and plain \TeX causes seizures ... The point is that this format doesn't need any intermediary step, thus allowing for automatisation. Be aware, however, that the embedded EPS images are not editable in-place by OpenOffice nor, as far as I know, by MS Word. But my point was to *avoid* post-production as much as humanly possible (I tend to be inhumanly lazy...). HTH, Emmanuel Charpentier > All the best, > > PhG __ 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.
Re: [R] Cross-platforms solution to export R graphs
Emmanuel Charpentier wrote: Le jeudi 09 avril 2009 à 15:04 +0200, Philippe Grosjean a écrit : Hello Rusers, I have worked on a R Wiki page for solutions in exporting R graphs, especially, the often-asked questions: - How can I export R graphs in vectorized format (EMF) for inclusion in MS Word or OpenOffice outside of Windows? - What is the best solution(s) for post-editing/annotating R graphs. The page is at: http://wiki.r-project.org/rwiki/doku.php?id=tips:graphics-misc:export. I would be happy to receive your comments and suggestions to improve this document. Well, if you insist ... The PDF import plugin in OpenOffice is still beta, and some report deem it difficult to install correctly an/or flaky. Having checked that both MSWord (>=2000) and OpenOffice (>=2.4) import and display correctly (i. e. vectorially, including fonts) EPS files, I switched to this format, most notably for use with the marvellous Max Kuhn's odfWeave package, which is a *must* for us working in state/administrative/corporate salt mines, where \LaTeX is deemed obscene and plain \TeX causes seizures ... The point is that this format doesn't need any intermediary step, thus allowing for automatisation. Be aware, however, that the embedded EPS images are not editable in-place by OpenOffice nor, as far as I know, by MS Word. But my point was to *avoid* post-production as much as humanly possible (I tend to be inhumanly lazy...). Ok, I understand your point of view. I tend to consider PDF import buggy in early trials, but now, the beta version seems fine and easy to install on all tested platforms. Also, using odfWeave and avoiding post-edition of graphs as much as possible is certainly the best practice. However, when you use EPS, you need a postscript printer to render the graphs. So, this is an additional constraint to consider. I will emphasize a little bit more the qualities of EPS in the document. Thanks. PhG HTH, Emmanuel Charpentier All the best, PhG __ 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. __ 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.
Re: [R] Cross-platforms solution to export R graphs
To further add to this discussion. I would like to propose **cross-platform** solutions, emphasizing that the proposed solutions should work on Windows, Mac OS X and Ubuntu, at least. First of all, inclusion of a simple EPS graphs produced by R 2.9.0 with: > setEPS(); postscript("TestGraph.eps", width = 7, height = 7) > hist(rnorm(500), col = "yellow") > dev.off() systematically crashes native OpenOffice 3.0.1 (build 9379) on my Mac OS X 10.4. When I try to recover the document, it crashes again. The document is lost (impossible to get the rest of it when the EPS file in included)! Further experience is probably needed, but I cannot recommend a solution that does not work on my Mac test machine. Further arguments against EPS: - No support of semi-transparent colors (rarely used, but...) - It is the bitmap version that is displayed in the OOo document => not optimal in comparison with the use of EMF files, or with import into native shapes from PDF. This is particularly important because the PDF documents produced from OOo apparently also display the bitmap version of the EPS. Not nice when the intended result is in PDF form. It is then easier to use PNG files. Obviously, further experimentation is required here. Best, PhG Philippe Grosjean wrote: Emmanuel Charpentier wrote: Le jeudi 09 avril 2009 à 15:04 +0200, Philippe Grosjean a écrit : Hello Rusers, I have worked on a R Wiki page for solutions in exporting R graphs, especially, the often-asked questions: - How can I export R graphs in vectorized format (EMF) for inclusion in MS Word or OpenOffice outside of Windows? - What is the best solution(s) for post-editing/annotating R graphs. The page is at: http://wiki.r-project.org/rwiki/doku.php?id=tips:graphics-misc:export. I would be happy to receive your comments and suggestions to improve this document. Well, if you insist ... The PDF import plugin in OpenOffice is still beta, and some report deem it difficult to install correctly an/or flaky. Having checked that both MSWord (>=2000) and OpenOffice (>=2.4) import and display correctly (i. e. vectorially, including fonts) EPS files, I switched to this format, most notably for use with the marvellous Max Kuhn's odfWeave package, which is a *must* for us working in state/administrative/corporate salt mines, where \LaTeX is deemed obscene and plain \TeX causes seizures ... The point is that this format doesn't need any intermediary step, thus allowing for automatisation. Be aware, however, that the embedded EPS images are not editable in-place by OpenOffice nor, as far as I know, by MS Word. But my point was to *avoid* post-production as much as humanly possible (I tend to be inhumanly lazy...). Ok, I understand your point of view. I tend to consider PDF import buggy in early trials, but now, the beta version seems fine and easy to install on all tested platforms. Also, using odfWeave and avoiding post-edition of graphs as much as possible is certainly the best practice. However, when you use EPS, you need a postscript printer to render the graphs. So, this is an additional constraint to consider. I will emphasize a little bit more the qualities of EPS in the document. Thanks. PhG HTH, Emmanuel Charpentier All the best, PhG __ 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. __ 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. __ 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.
Re: [R] Cross-platforms solution to export R graphs
Hello, On Thu, Apr 9, 2009 at 3:04 PM, Philippe Grosjean wrote: > "Cross-platforms solution to export R graphs" > There is playwith, and latticist, which seem cross-platform (binaries available for both Mac&Win). rattle uses latticist. Rcmdr can be used for saving graphs. JavaGD (used in JGR) saves PDF and EPS plots, but I was not very happy with the quality of the graphics saved. Liviu -- Do you know how to read? http://www.alienetworks.com/srtest.cfm Do you know how to write? http://garbl.home.comcast.net/~garbl/stylemanual/e.htm#e-mail __ 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.
Re: [R] Cross-platforms solution to export R graphs
On Thu, Apr 9, 2009 at 3:04 PM, Philippe Grosjean wrote: > The page is at: > http://wiki.r-project.org/rwiki/doku.php?id=tips:graphics-misc:export. > The article suggests to use Inksacpe for PDF -> SVG conversion. I've recently experimented this, but it seems that the graph loses quality in the way. The resulting SVG seems pixelised and doesn't look very well when zoomed. I searched within Inkscape, but found no relevant options (only the resolution for export). Would there be options to look out for in Inkscape (such as antialias, or else)? Liviu -- Do you know how to read? http://www.alienetworks.com/srtest.cfm Do you know how to write? http://garbl.home.comcast.net/~garbl/stylemanual/e.htm#e-mail __ 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.
Re: [R] Cross-platforms solution to export R graphs
..<°}))>< ) ) ) ) ) ( ( ( ( (Prof. Philippe Grosjean ) ) ) ) ) ( ( ( ( (Numerical Ecology of Aquatic Systems ) ) ) ) ) Mons-Hainaut University, Belgium ( ( ( ( ( .. Liviu Andronic wrote: On Thu, Apr 9, 2009 at 3:04 PM, Philippe Grosjean wrote: The page is at: http://wiki.r-project.org/rwiki/doku.php?id=tips:graphics-misc:export. The article suggests to use Inksacpe for PDF -> SVG conversion. I've recently experimented this, but it seems that the graph loses quality in the way. The resulting SVG seems pixelised and doesn't look very well when zoomed. I searched within Inkscape, but found no relevant options (only the resolution for export). Would there be options to look out for in Inkscape (such as antialias, or else)? Liviu ?? I don't understand what you are doing here. It is not a question of exporting the graph at a given resolution, but to convert it from one vector format (PDF) to another one (SVG). In Inkscape, you use File -> Open... for the first step, and File -> Save as... for the second. Since it is a vector format, your graph should not look pixelised. All the best, PhG __ 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.
Re: [R] Cross-platforms solution to export R graphs
Liviu Andronic wrote: Hello, On Thu, Apr 9, 2009 at 3:04 PM, Philippe Grosjean wrote: "Cross-platforms solution to export R graphs" There is playwith, and latticist, which seem cross-platform (binaries available for both Mac&Win). rattle uses latticist. Yes, right. Rcmdr can be used for saving graphs. It is just a GUI on top of the described R functions. JavaGD (used in JGR) saves PDF and EPS plots, but I was not very happy with the quality of the graphics saved. Yes, I should try. Best, Philippe Liviu __ 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.
Re: [R] Cross-platforms solution to export R graphs
On Sat, Apr 11, 2009 at 3:20 PM, Philippe Grosjean wrote: > format (PDF) to another one (SVG). In Inkscape, you use File -> Open... for > the first step, and File -> Save as... for the second. Since it is a vector > format, your graph should not look pixelised. > Yes, this is what I'm doing, but I still get funny results. I have a PDF graph [1] that renders perfectly on my Linux system (say, using Evince), and the SVG counterpart [2] (converted via Inkscape) that appears with blurry lines at normal zoom level. But I just tried couple of R SVGs in Opera at high zoom-ins (350%), and they render as expected; guess I could only blame my image viewers. Not exactly cross-platform, but there's also pdf2svg [3] for this type of conversion. Thanks, Liviu [1] http://s000.tinyupload.com/index.php?file_id=02313849491005544965 [2] http://s000.tinyupload.com/index.php?file_id=65971482254693721586 [3] http://www.cityinthesky.co.uk/pdf2svg.html -- Do you know how to read? http://www.alienetworks.com/srtest.cfm Do you know how to write? http://garbl.home.comcast.net/~garbl/stylemanual/e.htm#e-mail __ 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.
Re: [R] Cross-platforms solution to export R graphs
Liviu Andronic wrote: On Sat, Apr 11, 2009 at 3:20 PM, Philippe Grosjean wrote: format (PDF) to another one (SVG). In Inkscape, you use File -> Open... for the first step, and File -> Save as... for the second. Since it is a vector format, your graph should not look pixelised. Yes, this is what I'm doing, but I still get funny results. I have a PDF graph [1] that renders perfectly on my Linux system (say, using Evince), and the SVG counterpart [2] (converted via Inkscape) that appears with blurry lines at normal zoom level. But I just tried couple of R SVGs in Opera at high zoom-ins (350%), and they render as expected; guess I could only blame my image viewers. It looks nice at all resolution with Firefox on my Mac. Not exactly cross-platform, but there's also pdf2svg [3] for this type of conversion. Than you for the suggestion. PhG Thanks, Liviu [1] http://s000.tinyupload.com/index.php?file_id=02313849491005544965 [2] http://s000.tinyupload.com/index.php?file_id=65971482254693721586 [3] http://www.cityinthesky.co.uk/pdf2svg.html __ 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.
Re: [R] Cross-platforms solution to export R graphs
Philippe Grosjean wrote: > > > ..I would be happy to receive your comments and suggestions to improve > this document. > All the best, > > PhG > > LaTeX is my personal tool of choice and the vector format I use most often is http://sourceforge.net/projects/pgf/ PGF (Portable Graphics Format), implemented via a LaTeX package written by Till Tantu. There exists a very nice converter called http://sourceforge.net/projects/eps2pgf/ eps2pgf which is written in java and does an excellent job of translating R eps output. The primary advantage of PGF is that figure text gets typeset by the LaTeX engine instead of by R which unifies font choices and gives the final document a very consistent, professional look. LaTeX commands, such as mathematical typesetting, can also be embedded in the figure. Along with a friend of mine, I have been working on a R package that extends Sweave to include pgf graphics output. Currently http://www.rforge.net/pgfSweave pgfSweave uses eps2pgf to perform the conversions but a native R graphics device is planned to help speed up the process. The package is currently very much a beta and has been developed and tested on Mac OS X and runs quite well. Limited testing has been conducted on Linux and Windows and we have produced documents on those systems. Heavy development is expected to take place this summer. PGF is a human-readable format and can be be easily annotated by adding additional commands to the resulting file. However, editing the original content is possible but difficult due to the lack of structure in the eps2pgf output. The LaTeX environment can even be switched from pgfpicture to tikzpicture which allows the use of TiKZ- a high level graphics language built on top of PGF. TiKZ/PGF is easy to learn and the manual is one of the best pieces of software documentation I have seen. Since I came across PGF a couple of years ago, Adobe Illustrator has languished unused on my hard drive except for the occasional application of Live Trace. An excellent showcase of PGF/TiKZ examples along with additional tools is hosted at http://www.texample.net Texample . The end result of the PGF/TiKZ build process is a PDF which makes it very portable. All the best! -Charlie - Charlie Sharpsteen Undergraduate Environmental Resources Engineering Humboldt State University -- View this message in context: http://www.nabble.com/Cross-platforms-solution-to-export-R-graphs-tp22970668p23016682.html Sent from the R help mailing list archive at Nabble.com. __ 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.