New answers tagged

2

I reproduce the problem with versions 13.0.0 and 12.3.1 on Windows 10 x64, but not with version 8.0.4 on the same machine. The issue happens when we Export to PDF a Graphics object containing a Rectangle or Polygon primitive with Opacity directive. A minimal example: gr = Graphics[{Opacity[0.5], Rectangle[]}]; Export["test.pdf", gr] // SystemOpen ...


4

It can't be done easily with lines and polygons (because you'd have to construct gradients but subdividing the objects), but it could be done with points, as in your example. Are you only interested in ListPlot of points? vcRules[vc_] := { HoldPattern[Point[p_List, VertexColors -> Automatic]] :> ({RGBColor @@ vc[[#]], Point[#]} & /@ p), ...


5

How about getting rid of the Opacity in the filling?: Plot[Sin[x], {x, 0, 2 Pi}, Filling -> Top, FillingStyle -> Blend[{White, ColorData[97][1]}, 0.2]] Export[FileNameJoin[{$TemporaryDirectory, "test.pdf"}], %]; First@Import[%]


2

For merging PDF files one can use the PyMuPdf library for Python as shown here. First, install PyMuPdf (it requires Python 3.6 or later): python -m pip install --upgrade pip python -m pip install --upgrade pymupdf Define mergePDFs via ExternalEvaluate: mergePDFs[files : {__String}, output_String] := ExternalEvaluate["Python", <|"Command&...


1

Some time ago I had a need to export PDFs with multiple pages each containing only one plot occupying the whole page. I wasn't able to find a way to do this using Mathematica, and was forced to export them one-by-one as PDF, and then to merge produced PDFs into one file using pdfunite from Poppler utils: gf = Table[Plot[Sin[a x], {x, -10, 10}], {a, 1, 10}] ...


5

Here's the easy way. We build a Notebook where each Cell contains one plot and has PageBreakBelow->True. If you want the things to fill up the page, use ImageSize->Full. gf = Table[Plot[Sin[a x], {x, -10, 10}], {a, 1, 10}]; nb = Notebook[ Table[ Cell[BoxData[ToBoxes@Show[g, ImageSize -> Full]], "Output", PageBreakBelow -> True], ...


2

I don't know how to make them each take up a page There might be a way to do this in Mathematica directly. I do not know now. But this is how I would do it. The idea is to just generate the Latex directly, then go to the folder and compile that to pdf. Free Latex compilers are available for windows, Linux and mac. Here is a link to the generated PDF I ...


1

The reason for undesirable filling and rasterization on Export is that the points are partially reversed, what results in a polygon with self-intersections. Fixing this: g3 = Graphics[{Opacity[0.5], Red, Polygon[Join[data[[;; 251]], Reverse@data[[252 ;;]]]]}, Frame -> True]; Export["sector.pdf", g3] // SystemOpen The file is exported in ...


1

That's the edge you see if you plot Line@data. Workaround: reg = CanonicalizePolygon[Polygon@data] g3 = Graphics[{Opacity[0.5], Red, reg, } , Frame -> True ] Export["C:/sector.pdf", g3]


0

For those interested, here is a workaround using matplotlib of Python. import numpy as np import matplotlib.pyplot as plt mm = 1 / 25.4 #Array size nx = 10 ny = 40 #Cell size cx = 20*mm cy = 6*mm #relative position (left-center justified) of text in cell npx = 0.25 npy = 0.7 plt.figure(figsize=(cx*nx, cy*ny)) for x in (np.arange(nx)+1): for y in (np....


3

First of all, as chuy correctly points out in the comments, you should set PrintingStyleEnvironment to "Working" in order to avoid magnification problems discussed here: SetOptions[$FrontEndSession, PrintingStyleEnvironment -> "Working"] Then, I suggest to use Grid instead of GraphicsGrid (the value -.11 is found by trial and error): ...


Top 50 recent answers are included