2
$\begingroup$

The following code is the minimal version I managed to create. With my Mathematica 11.0.1.0 on Ubuntu 14.04 I find with the code that there is some background for the Inset graphics that can not be made transparent. Is there a way to do this?

Show[
  Plot[x, {x, 0, 1}], 
  Graphics[
    Inset[
      Graphics[{Green, Disk[]}, Background -> None],
      {0.5, 0.5},
      {0, 0},
      0.2,
      Background -> None
    ],
    Background -> None
  ],
  Background -> None
]

In this specific case it is about removing the white space between the plotted line and the circle.

If I export the graphics as a pdf I get the following result with a gray background that I don't want. In Mathematica itself it manifests itself as a whitespace.

enter image description here

Edit: Happens with the Stylesheet StandardReport and not with a style-less notebook.

$\endgroup$
10
  • $\begingroup$ What white space? Can you make it more clear? $\endgroup$
    – zhk
    Commented Feb 17, 2017 at 11:24
  • $\begingroup$ I don't get any gray background when I export to pdf on Windows 10. MMA version is 10.4 $\endgroup$ Commented Feb 17, 2017 at 11:35
  • $\begingroup$ No problems in v10.1.0 under Windows. Both the standard output and export to .GIF look as they should. $\endgroup$
    – Mr.Wizard
    Commented Feb 17, 2017 at 11:41
  • $\begingroup$ And what about the small whitespace between the circle and the line in Mathematica itself? $\endgroup$
    – Maikel
    Commented Feb 17, 2017 at 12:21
  • $\begingroup$ No problems with version 11.0.0 on Windows 7x64. Acrobat renders exported PDF as expected. $\endgroup$ Commented Feb 17, 2017 at 13:31

1 Answer 1

2
$\begingroup$

You've got background from the stylesheet. Please try to remove it by using BaseStyle directive:

  g = Show[Plot[x, {x, 0, 1}], 
      Graphics[
          Inset[
            Graphics[{Green, Disk[]}, Background -> None], 
            {0.5, 0.5}, {0, 0}, 0.2, Background -> None, 
            BaseStyle -> {Background -> None}], 
   Background -> None], Background -> None]
$\endgroup$

Your Answer

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

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