Export a graphical plot to pdf file
The group you are posting to is a
Usenet group . Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
Newsgroups: comp.soft-sys.math.mathematica
From:
Szymon Roziewski <szymon.roziew... @gmail.com>
Date: Wed, 7 Nov 2012 05:57:52 +0000 (UTC)
Local: Wed, Nov 7 2012 12:57 am
Subject: Export a graphical plot to pdf file
Hi there,
I have a ContourPlot result which I need to put into pdf file.
The problem is that the filled area is in a mess, I mean there are lots of
thin white stripes on it.
For example, please try out this bunch of code
gr = ContourPlot[x^2 + y^2, {x, -1, 1}, {y, -1, 1}];
Export["file.pdf", gr]
Best regards,
Szymon Roziewski
You must
Sign in before you can post messages.
You do not have the permission required to post.
Newsgroups: comp.soft-sys.math.mathematica
From:
Szymon Roziewski <szymon.roziew... @gmail.com>
Date: Wed, 7 Nov 2012 05:58:02 +0000 (UTC)
Local: Wed, Nov 7 2012 12:58 am
Subject: Re: Export a graphical plot to pdf file
Hello,
I've found such a suggestion
antialias[g_] :=
ImageResize[
Rasterize[g, "Image", ImageResolution -> 600, Background -> White],
Scaled[2]]
g = ContourPlot[x^2 + y^2, {x, -1, 1}, {y, -1, 1}];
img = antialias[Show[g, Axes -> False, Boxed -> False]];
Export["file.pdf", img, "AllowRasterization" -> False]
But the background is lightred although I set it up to be white.
Bes wishes,
Szymon Roziewski
On 6 November 2012 16:03, Szymon Roziewski <szymon.roziew... @gmail.com>wrote:
> Hi there,
> I have a ContourPlot result which I need to put into pdf file.
> The problem is that the filled area is in a mess, I mean there are lots of
> thin white stripes on it.
> For example, please try out this bunch of code
> gr = ContourPlot[x^2 + y^2, {x, -1, 1}, {y, -1, 1}];
> Export["file.pdf", gr]
> Best regards,
> Szymon Roziewski
--
Z wyrazami szacunku,
Szymon Roziewski
You must
Sign in before you can post messages.
You do not have the permission required to post.
Newsgroups: comp.soft-sys.math.mathematica
From:
"Nasser M. Abbasi" <n... @12000.org>
Date: Fri, 9 Nov 2012 00:03:26 +0000 (UTC)
Local: Thurs, Nov 8 2012 7:03 pm
Subject: Re: Export a graphical plot to pdf file
On 11/6/2012 11:57 PM, Szymon Roziewski wrote:
> Hi there,
> I have a ContourPlot result which I need to put into pdf file.
> The problem is that the filled area is in a mess, I mean there are lots of
> thin white stripes on it.
> For example, please try out this bunch of code
> gr = ContourPlot[x^2 + y^2, {x, -1, 1}, {y, -1, 1}];
> Export["file.pdf", gr]
> Best regards,
> Szymon Roziewski
Do not know much about this, but trying few things, I found this
to produce good image in the PDF file (no white stripes on it)
---------------------------
gr = ContourPlot[x^2 + y^2, {x, -1, 1}, {y, -1, 1}]
Export["file.pdf", Rasterize[gr, ImageResolution -> 128]]
--------------------------------
You can change the options to Rasterize to see which gives
you best image in the PDF.
To obtain more information on the pdf file generated by
the export, you can list the Elements. something like:
---------------------------
lis = Import["file.pdf", "Elements"]
Grid[
Table[{lis[[i]], Import["file.pdf", lis[[i]]]}, {i, 1, Length[lis]}],
Frame -> All]
------------------------------
Another thing to try is to issue the command
SetOptions[$FrontEndSession, PrintingStyleEnvironment -> "Working"]
first before exporting. Again, this is something to try.
But the Rasterize'd image in PDF do not have the white stripes
any more.
--Nasser
You must
Sign in before you can post messages.
You do not have the permission required to post.
Newsgroups: comp.soft-sys.math.mathematica
From:
"Kevin J. McCann" <k... @KevinMcCann.com>
Date: Sat, 10 Nov 2012 07:09:41 +0000 (UTC)
Local: Sat, Nov 10 2012 2:09 am
Subject: Re: Export a graphical plot to pdf file
I have not done this; however, I frequently print out entire notebooks
as PDF's, and they appear fine. You could do that and then cut and paste
the PDF version of the plot. Just a suggestion.
Kevin
On 11/8/2012 7:03 PM, Nasser M. Abbasi wrote:
> On 11/6/2012 11:57 PM, Szymon Roziewski wrote:
>> Hi there,
>> I have a ContourPlot result which I need to put into pdf file.
>> The problem is that the filled area is in a mess, I mean there are lots of
>> thin white stripes on it.
>> For example, please try out this bunch of code
>> gr = ContourPlot[x^2 + y^2, {x, -1, 1}, {y, -1, 1}];
>> Export["file.pdf", gr]
>> Best regards,
>> Szymon Roziewski
> Do not know much about this, but trying few things, I found this
> to produce good image in the PDF file (no white stripes on it)
> ---------------------------
> gr = ContourPlot[x^2 + y^2, {x, -1, 1}, {y, -1, 1}]
> Export["file.pdf", Rasterize[gr, ImageResolution -> 128]]
> --------------------------------
> You can change the options to Rasterize to see which gives
> you best image in the PDF.
> To obtain more information on the pdf file generated by
> the export, you can list the Elements. something like:
> ---------------------------
> lis = Import["file.pdf", "Elements"]
> Grid[
> Table[{lis[[i]], Import["file.pdf", lis[[i]]]}, {i, 1, Length[lis]}],
> Frame -> All]
> ------------------------------
> Another thing to try is to issue the command
> SetOptions[$FrontEndSession, PrintingStyleEnvironment -> "Working"]
> first before exporting. Again, this is something to try.
> But the Rasterize'd image in PDF do not have the white stripes
> any more.
> --Nasser
You must
Sign in before you can post messages.
You do not have the permission required to post.
Newsgroups: comp.soft-sys.math.mathematica
From:
RBaillie <bobbail... @frii.com>
Date: Sat, 10 Nov 2012 07:09:51 +0000 (UTC)
Local: Sat, Nov 10 2012 2:09 am
Subject: Re: Export a graphical plot to pdf file
Unfortunately, exporting to pdf has not worked properly since version
5.2. This export works fine in 5.2.
gr = ContourPlot[x^2 + y^2, {x, -1, 1}, {y, -1, 1}];
Export["file.pdf", gr]
Moreover, the file created with version 5.2 is far smaller than with
later versions.
Often, using the
"AllowRasterization" -> False
option greatly improves exports to pdf with version 8, but it does not
work in this case.
You must
Sign in before you can post messages.
You do not have the permission required to post.
Newsgroups: comp.soft-sys.math.mathematica
From:
Kristjan Kannike <kkann... @ut.ee>
Date: Sat, 10 Nov 2012 08:30:47 +0000 (UTC)
Local: Sat, Nov 10 2012 3:30 am
Subject: Re: Export a graphical plot to pdf file
Hello,
The problem is that ContourPlot, DensityPlot etc. compose their plot of
lots of tiny polygons. PDF is a vector format and preserves them all. The
PDF file becomes large and loads and scrolls slowly.
There is a FixPolygons package that merges polygons of the same colour
that results in drastically reduced PDF size:
https://github.com/wspr/mmapkg
This works well with ContourPlot. Unfortunately not so well (sometimes)
with DensityPlot as its polygons are filled with gradients, not one
colour.
Best,
Kristjan Kannike
On Thu, 8 Nov 2012, Nasser M. Abbasi wrote:
> On 11/6/2012 11:57 PM, Szymon Roziewski wrote:
> > Hi there,
> > I have a ContourPlot result which I need to put into pdf file.
> > The problem is that the filled area is in a mess, I mean there are lots of
> > thin white stripes on it.
You must
Sign in before you can post messages.
You do not have the permission required to post.
Newsgroups: comp.soft-sys.math.mathematica
From:
Szymon Roziewski <szymon.roziew... @gmail.com>
Date: Tue, 13 Nov 2012 05:15:00 +0000 (UTC)
Subject: Re: Export a graphical plot to pdf file
Thank you all for your help.
This solution works almost well
antialias[g_] :=
ImageResize[
Rasterize[g, "Image", ImageResolution -> 600, Background -> White],
Scaled[2]]
g = ContourPlot[x^2 + y^2, {x, -1, 1}, {y, -1, 1}];
img = antialias[Show[g, Axes -> False, Boxed -> False]];
Export["file.pdf", img, "AllowRasterization" -> False]
I mean the problem is with its background that is light red but it should
be white.
Best wishes,
Szymon Roziewski
On 12 November 2012 12:06, Szymon Roziewski <szymon.roziew... @gmail.com>wrote:
> Thank you all for your help.
> This solution works almost well
> antialias[g_] :=
> ImageResize[
> Rasterize[g, "Image", ImageResolution -> 600, Background -> White],
> Scaled[2]]
> g = ContourPlot[x^2 + y^2, {x, -1, 1}, {y, -1, 1}];
> img = antialias[Show[g, Axes -> False, Boxed -> False]];
> Export["file.pdf", img, "AllowRasterization" -> False]
> I mean the problem is with its background that is light red but it should
> be white.
> Best wishes,
> Szymon Roziewski
--
Z wyrazami szacunku,
Szymon Roziewski
You must
Sign in before you can post messages.
You do not have the permission required to post.