Thread Subject: Printing Plots in PDF format

Subject: Printing Plots in PDF format

From: Naveen

Date: 25 Jul, 2008 18:48:02

Message: 1 of 7

Hi,
Iam trying to create a bunch of plots, and print them to
pdf file. I am saving all my plots in figs() and if i
print them one by one into PDF file it works. But i like
to append them all together into one PDF file. I am unable
to do this. Any help is appreciated very much. Thanks in
advance. Best, Naveen

% Print each of the 10 plots in a separate PDF document.

print(figs(1),'-dpdf','-r600','-painters','test1.pdf')
print(figs(2),'-dpdf','-r600','-painters','test2.pdf')
print(figs(3),'-dpdf','-r600','-painters','test3.pdf')
print(figs(4),'-dpdf','-r600','-painters','test4.pdf')
print(figs(5),'-dpdf','-r600','-painters','test5.pdf')
print(figs(6),'-dpdf','-r600','-painters','test6.pdf')
print(figs(7),'-dpdf','-r600','-painters','test7.pdf')
print(figs(8),'-dpdf','-r600','-painters','test8.pdf')
print(figs(9),'-dpdf','-r600','-painters','test9.pdf')
print(figs(10),'-dpdf','-r600','-painters','test10.pdf')

% Print all the 10 plots into one PDF document.

print(figs(1),'-dpdf','-r600','-painters','test.pdf');
for i=2:length(figs)
        print(figs(i),'-append','-dpdf','-r600','-
painters','test.pdf');
end

Subject: Printing Plots in PDF format

From: hrh1818

Date: 25 Jul, 2008 19:27:35

Message: 2 of 7

On Jul 25, 1:48 pm, "Naveen " <nku...@bloomberg.net> wrote:
> Hi,
> Iam trying to create a bunch of plots, and print them to
> pdf file. I am saving all my plots in figs() and if i
> print them one by one into PDF file it works. But i like
> to append them all together into one PDF file. I am unable
> to do this. Any help is appreciated very much. Thanks in
> advance. Best, Naveen
>
> % Print each of the 10 plots in a separate PDF document.
>
> print(figs(1),'-dpdf','-r600','-painters','test1.pdf')
> print(figs(2),'-dpdf','-r600','-painters','test2.pdf')
> print(figs(3),'-dpdf','-r600','-painters','test3.pdf')
> print(figs(4),'-dpdf','-r600','-painters','test4.pdf')
> print(figs(5),'-dpdf','-r600','-painters','test5.pdf')
> print(figs(6),'-dpdf','-r600','-painters','test6.pdf')
> print(figs(7),'-dpdf','-r600','-painters','test7.pdf')
> print(figs(8),'-dpdf','-r600','-painters','test8.pdf')
> print(figs(9),'-dpdf','-r600','-painters','test9.pdf')
> print(figs(10),'-dpdf','-r600','-painters','test10.pdf')
>
> % Print all the 10 plots into one PDF document.
>
> print(figs(1),'-dpdf','-r600','-painters','test.pdf');
> for i=2:length(figs)
> print(figs(i),'-append','-dpdf','-r600','-
> painters','test.pdf');
> end

An alternate approach is to use a desk top publishing program to
combine your 10 individual documents into one document. Scribus is a
free desktop publishing program that can handle this task. See:
http://www.scribus.net/

Howard

Subject: Printing Plots in PDF format

From: Naveen

Date: 25 Jul, 2008 19:58:04

Message: 3 of 7

Howard, thanks for your reply. But you didnot answer my
question, there is got to be a simpler method which only
deals with Matlab code. Appreciate if you can help with a
straight forward solution with the code.
Best regards,

hrh1818 <hrhan@att.net> wrote in message <13efc0b1-46de-
476e-a2fe-d132cd64d527@d45g2000hsc.googlegroups.com>...
> On Jul 25, 1:48 pm, "Naveen " <nku...@bloomberg.net>
wrote:
> > Hi,
> > Iam trying to create a bunch of plots, and print them
to
> > pdf file. I am saving all my plots in figs() and if i
> > print them one by one into PDF file it works. But i
like
> > to append them all together into one PDF file. I am
unable
> > to do this. Any help is appreciated very much. Thanks
in
> > advance. Best, Naveen
> >
> > % Print each of the 10 plots in a separate PDF
document.
> >
> > print(figs(1),'-dpdf','-r600','-painters','test1.pdf')
> > print(figs(2),'-dpdf','-r600','-painters','test2.pdf')
> > print(figs(3),'-dpdf','-r600','-painters','test3.pdf')
> > print(figs(4),'-dpdf','-r600','-painters','test4.pdf')
> > print(figs(5),'-dpdf','-r600','-painters','test5.pdf')
> > print(figs(6),'-dpdf','-r600','-painters','test6.pdf')
> > print(figs(7),'-dpdf','-r600','-painters','test7.pdf')
> > print(figs(8),'-dpdf','-r600','-painters','test8.pdf')
> > print(figs(9),'-dpdf','-r600','-painters','test9.pdf')
> > print(figs(10),'-dpdf','-r600','-
painters','test10.pdf')
> >
> > % Print all the 10 plots into one PDF document.
> >
> > print(figs(1),'-dpdf','-r600','-painters','test.pdf');
> > for i=2:length(figs)
> > print(figs(i),'-append','-dpdf','-r600','-
> > painters','test.pdf');
> > end
>
> An alternate approach is to use a desk top publishing
program to
> combine your 10 individual documents into one document.
Scribus is a
> free desktop publishing program that can handle this
task. See:
> http://www.scribus.net/
>
> Howard

Subject: Printing Plots in PDF format

From: hrh1818

Date: 26 Jul, 2008 00:46:21

Message: 4 of 7

On Jul 25, 2:58 pm, "Naveen " <nku...@bloomberg.net> wrote:
> Howard, thanks for your reply. But you didnot answer my
> question, there is got to be a simpler method which only
> deals with Matlab code. Appreciate if you can help with a
> straight forward solution with the code.
> Best regards,
>
> hrh1818 <hr...@att.net> wrote in message <13efc0b1-46de-
>
> 476e-a2fe-d132cd64d...@d45g2000hsc.googlegroups.com>...
>
> > On Jul 25, 1:48 pm, "Naveen " <nku...@bloomberg.net>
> wrote:
> > > Hi,
> > > Iam trying to create a bunch of plots, and print them
> to
> > > pdf file. I am saving all my plots in figs() and if i
> > > print them one by one into PDF file it works. But i
> like
> > > to append them all together into one PDF file. I am
> unable
> > > to do this. Any help is appreciated very much. Thanks
> in
> > > advance. Best, Naveen

I know I didn't answer your original question. That is why I labeled
my solution as an alternate approach. Sometimes the easiest approach
to solving a problem is to try a different approach. My only other
suggestion is after you write your first image to a file is the next
time time you need to write data you use fopen to open the file in
append mode. It looks like your problem is caused by Matlab is over
writing your old data with new data. If that don't work there is
always the brute force method. Make 10 PDF files with a figure in
file. Then create an M file that reads each file and writes the data
to a eleventh file that was open in the append mode.

No guarantees I have not tried either of these these last approaches
before making suggestions. I have used a desktop publishing program
in the past to combine PDF files into one file.

Howard


>
> > > % Print each of the 10 plots in a separate PDF
> document.
>
> > > print(figs(1),'-dpdf','-r600','-painters','test1.pdf')
> > > print(figs(2),'-dpdf','-r600','-painters','test2.pdf')
> > > print(figs(3),'-dpdf','-r600','-painters','test3.pdf')
> > > print(figs(4),'-dpdf','-r600','-painters','test4.pdf')
> > > print(figs(5),'-dpdf','-r600','-painters','test5.pdf')
> > > print(figs(6),'-dpdf','-r600','-painters','test6.pdf')
> > > print(figs(7),'-dpdf','-r600','-painters','test7.pdf')
> > > print(figs(8),'-dpdf','-r600','-painters','test8.pdf')
> > > print(figs(9),'-dpdf','-r600','-painters','test9.pdf')
> > > print(figs(10),'-dpdf','-r600','-
>
> painters','test10.pdf')
>
>
>
> > > % Print all the 10 plots into one PDF document.
>
> > > print(figs(1),'-dpdf','-r600','-painters','test.pdf');
> > > for i=2:length(figs)
> > > print(figs(i),'-append','-dpdf','-r600','-
> > > painters','test.pdf');
> > > end
>
> > An alternate approach is to use a desk top publishing
> program to
> > combine your 10 individual documents into one document.
> Scribus is a
> > free desktop publishing program that can handle this
> task. See:
> >http://www.scribus.net/
>
> > Howard

Subject: Printing Plots in PDF format

From: aasim Azooz

Date: 26 Jul, 2008 18:24:02

Message: 5 of 7

"Naveen " <nkunam@bloomberg.net> wrote in message <g6d752
$3oa$1@fred.mathworks.com>...
> Hi,
> Iam trying to create a bunch of plots, and print them to
> pdf file. I am saving all my plots in figs() and if i
> print them one by one into PDF file it works. But i like
> to append them all together into one PDF file. I am
unable
> to do this. Any help is appreciated very much. Thanks in
> advance. Best, Naveen
>
> % Print each of the 10 plots in a separate PDF document.
>
> print(figs(1),'-dpdf','-r600','-painters','test1.pdf')
> print(figs(2),'-dpdf','-r600','-painters','test2.pdf')
> print(figs(3),'-dpdf','-r600','-painters','test3.pdf')
> print(figs(4),'-dpdf','-r600','-painters','test4.pdf')
> print(figs(5),'-dpdf','-r600','-painters','test5.pdf')
> print(figs(6),'-dpdf','-r600','-painters','test6.pdf')
> print(figs(7),'-dpdf','-r600','-painters','test7.pdf')
> print(figs(8),'-dpdf','-r600','-painters','test8.pdf')
> print(figs(9),'-dpdf','-r600','-
painters','test9.pdf')
> print(figs(10),'-dpdf','-r600','-painters','test10.pdf')
>
> % Print all the 10 plots into one PDF document.
>
> print(figs(1),'-dpdf','-r600','-painters','test.pdf');
> for i=2:length(figs)
> print(figs(i),'-append','-dpdf','-r600','-
> painters','test.pdf');
> end

Dear Naveen
MATLAB is very powerful but at times, it is more easy to do
things outside matlab. For a problem like the one you
presented, I will copy all my figures, paste them to an
office word text document, and use the pdf995 program to
convert the file to pdf. the 995 can be freely downloded.

Aasim Azooz

Subject: Printing Plots in PDF format

From: Richard Quist

Date: 4 Aug, 2008 14:47:28

Message: 6 of 7

Naveen wrote:
> Hi,
> Iam trying to create a bunch of plots, and print them to
> pdf file. I am saving all my plots in figs() and if i
> print them one by one into PDF file it works. But i like
> to append them all together into one PDF file. I am unable
> to do this. Any help is appreciated very much. Thanks in
> advance. Best, Naveen
>
> % Print each of the 10 plots in a separate PDF document.
>
> print(figs(1),'-dpdf','-r600','-painters','test1.pdf')
> print(figs(2),'-dpdf','-r600','-painters','test2.pdf')
> print(figs(3),'-dpdf','-r600','-painters','test3.pdf')
> print(figs(4),'-dpdf','-r600','-painters','test4.pdf')
> print(figs(5),'-dpdf','-r600','-painters','test5.pdf')
> print(figs(6),'-dpdf','-r600','-painters','test6.pdf')
> print(figs(7),'-dpdf','-r600','-painters','test7.pdf')
> print(figs(8),'-dpdf','-r600','-painters','test8.pdf')
> print(figs(9),'-dpdf','-r600','-painters','test9.pdf')
> print(figs(10),'-dpdf','-r600','-painters','test10.pdf')
>
> % Print all the 10 plots into one PDF document.
>
> print(figs(1),'-dpdf','-r600','-painters','test.pdf');
> for i=2:length(figs)
> print(figs(i),'-append','-dpdf','-r600','-
> painters','test.pdf');
> end

The -append option in MATLAB is only supported for postscript output. Take a
look at my ps2pdf function, available from the File Exchange
here:http://www.mathworks.com/matlabcentral/fileexchange/loadAuthor.do?objectId=1097474&objectType=author

It will let you take a postscript file (including a multi-page file generated
from MATLAB with the -append option) and convert it to PDF.

Hope that helps.

--

Richard Quist
Software Developer
The MathWorks, Inc.

Subject: Printing Plots in PDF format

From: Naveen

Date: 4 Aug, 2008 16:50:04

Message: 7 of 7

Richard, Thanks a lot. This program works. Appreciate your
help. Thank you all others who tried to help. Cheers.

Tags for this Thread

Everyone's Tags:

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Tag Activity for This Thread
Tag Applied By Date/Time
pdf Naveen 25 Jul, 2008 14:50:23
plots Naveen 25 Jul, 2008 14:50:23
plotting Naveen 25 Jul, 2008 14:50:23
print Naveen 25 Jul, 2008 14:50:23
rssFeed for this Thread
 

MATLAB Central Terms of Use

NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content. Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available via MATLAB Central. Read the complete Terms prior to use.

Contact us at files@mathworks.com