2
$\begingroup$

I am trying to save the following plot as a pdf, so that I can import it into LaTeX:

Grid[{{RegionPlot[{x<y,x>y},{x,-2-1/10,2+1/10},{y,-1/10,3+1/10},PlotPoints->20,PlotStyle->{Texture[Graphics[Table[Circle[{i,j},1/4],{i,20},{j,20}]]],Texture[Graphics[Table[Polygon[{{1+i,0+j},{0+i,Sqrt[3]+j},{-1+i,0+j}}],{i,2,80,4},{j,2,80,4}]]]},BoundaryStyle->Black,PlotRange->{{-2,2},{0,3}},ImageSize->350],Grid[{{Graphics[Table[Circle[{i,j},1/4],{i,3},{j,3}],ImageSize->30,Frame->True,FrameTicks->None],"(Min, Min) & (Mix, Max)"},{Graphics[Table[Polygon[{{1+i,0+j},{0+i,Sqrt[3]+j},{-1+i,0+j}}],{i,2,10,4},{j,2,10,4}],ImageSize->30,Frame->True,FrameTicks->None],"(Mix, Max)"}},Spacings->{1,1/2}]}},Spacings->{2,1}]

However, if I right-click on the output and click 'save selection as', the pdf I get changes the RegionPlot into a image (probably jpeg). However, it does manage to keep the Graphics, to the right of the RegionPlot, as a non-image pdf code.

I believe this is due to the function Texture, which turns the Graphics inside Texture into an image.

How can I get the full output into non-image pdf code?

$\endgroup$
2
  • 2
    $\begingroup$ As you say, it's because of Texture. The reason is that Texture always rasterizes its input. So this is not a problem with Save Selection but with the way the original RegionPlot is created. You have to choose a different approach to create the main plot. This would probably involve the answers here: Filling a polygon with a pattern of insets. $\endgroup$
    – Jens
    May 26, 2014 at 19:49
  • $\begingroup$ Thanks! I managed by making clever use of polygons. $\endgroup$
    – LBogaardt
    May 27, 2014 at 16:43

1 Answer 1

-1
$\begingroup$

plt1 = Grid[{{RegionPlot[{x < y, x > y}, {x, -2 - 1/10, 2 + 1/10}, {y, -1/10, 3 + 1/10}, PlotPoints -> 20, PlotStyle -> {Texture[ Graphics[Table[Circle[{i, j}, 1/4], {i, 20}, {j, 20}]]], Texture[Graphics[ Table[Polygon[{{1 + i, 0 + j}, {0 + i, Sqrt[3] + j}, {-1 + i, 0 + j}}], {i, 2, 80, 4}, {j, 2, 80, 4}]]]}, BoundaryStyle -> Black, PlotRange -> {{-2, 2}, {0, 3}}, ImageSize -> 350], Grid[{{Graphics[Table[Circle[{i, j}, 1/4], {i, 3}, {j, 3}], ImageSize -> 30, Frame -> True, FrameTicks -> None], "(Min, Min) & (Mix, Max)"}, {Graphics[ Table[Polygon[{{1 + i, 0 + j}, {0 + i, Sqrt[3] + j}, {-1 + i, 0 + j}}], {i, 2, 10, 4}, {j, 2, 10, 4}], ImageSize -> 30, Frame -> True, FrameTicks -> None], "(Mix, Max)"}}, Spacings -> {1, 1/2}]}}, Spacings -> {2, 1}];

Export["Desktop/example.pdf", plt1]

$\endgroup$
1
  • 1
    $\begingroup$ Nope, doesn't work. $\endgroup$
    – LBogaardt
    May 26, 2014 at 18:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.