inkscape will do the job. Also I save all plots from R as SVGs as this gives the most flexibility for later use.
EDIT: I just read your post in full. Sorry. I still think inkscape can do what you want though.
In R I often plot multiple plots to a single file as it makes storing, accessing and viewing the visualizations easier. So I may have a multi page pdf or png of various visualizations.
Now here's the question is there a program (probably not actually R) that can break the pdf or png up into individual pic files. ie how can I extract just one page from a pdf or png and put that pic in a latex or MS word document?
Some may say well output them as single files, true I could dot hat but I don't want to. If you're dealing with hundreds of files it becomes a pain to open them all up and look through them in that way. I'm using inkscape to edit one pdf/png/svg file maybe it can break them apart too? Don't know.
I'm sure I could find one on my own with a google search but people's recommendations here tend to be spot on.
Here's the succint question(s):
- Is there a program/method that works with both pdf/png etc to break them apart into singular pictures for use in a write up? What is it?
- If not what would work for pdfs?
- What would work for pngs?
One restriction the answer must be open source![]()
"If you torture the data long enough it will eventually confess."
-Ronald Harry Coase -
inkscape will do the job. Also I save all plots from R as SVGs as this gives the most flexibility for later use.
EDIT: I just read your post in full. Sorry. I still think inkscape can do what you want though.
trinker (08-23-2012)
Hi Trinker,
I am not sure I understand your question. "Multiple plots to a single file" does this mean that using mfrow/mfcol ( in base graphics) right? or this mean you save the figures as a page in pdf?
In latex, there is an option for crop option(trim=) in the includegraphics ( for png file). If you wanted to specify particular page of pdf, that is also possible in includegraphics (like \includegraphics[page=n]{trpdf})
Good question vinux (I can't upload an example due to very limited internet access but can post code to make an example:
Which raises another question. Why does this not produce multiple pages like the pdf does? Is multi page png possible?Code:pdf("testerooni.pdf", 8, 8) lapply(2:ncol(mtcars), function(i) { #dev.new() plot(mtcars[, 1], mtcars[, i], main=colnames(mtcars)[i]) } ) dev.off()
Code:png("testerooni.png", 800, 800) lapply(2:ncol(mtcars), function(i) { #dev.new() plot(mtcars[, 1], mtcars[, i], main=colnames(mtcars)[i]) } ) dev.off()
"If you torture the data long enough it will eventually confess."
-Ronald Harry Coase -
as far as i know multipage is not possible in png. It may possible in gif.
In linux, convert function can split the pdf to multiple png files
A png is just a single image. Usually I create an image book pdf for a given output. If I want the individual graphics, I may also run it again having it create the folder (if necessary) and storing all the images with that image book. I name the image book and folder the same. That way if they want to view them all in one document, they can view the pdf, or if they want the individual pictures, they can view the png's. The problem is setting parameters correctly as they come out with different qualities. I'm doing some pretty big plots (hundreds of thousands of points) and it crashed Adobe! I suspect the pdf was saving them as SVG, which makes sense, but can be a pain because it has to draw them whenever you move the document ... and that takes forever!!
Is there a way to produce "low quality" SVGs?? lol
|
|