1
$\begingroup$

I'm doing some solar system animations with Mathematica. I'm wondering if it's possible to somehow change the background of the result of a plot function so that whenever I paste it in a movie editor, it will be transparent (not white). An example code is:

Animate[Plot[Sin[x t], {x, 0, 2 Pi }], {t, 0, 1}]

Here, the background is white. I would like it to be transparent.

EDIT

I tried (simplified example code):

test=Plot[Sin[2 t], {x, 0, 2 Pi },Background-> None]
Export['test.jpg',test]

this resulted in:

planets

Is there any way of saving the file with a transparent background? Maybe the file extension is wrong?

$\endgroup$
  • 4
    $\begingroup$ Animate[Plot[Sin[x t], {x, 0, 2 Pi}, Background -> None], {t, 0, 1}] ? $\endgroup$ – Mr.Wizard Jun 21 at 4:22
  • 1
    $\begingroup$ does this give what you need: testframe = RemoveBackground[Plot[Sin[2 x], {x, 0, 2 Pi}]] Export["testframe.png", testframe]? $\endgroup$ – kglr Jun 21 at 23:35
  • $\begingroup$ @kglr Yes, this is perfect, thank you! $\endgroup$ – Michał Kuczynski Jun 21 at 23:41
1
$\begingroup$

I'm wondering if it's possible to somehow change the background of the result of a plot function

one option is to use Background option

Plot[Sin[x ], {x, 0, 2 Pi}, Background -> LightGray]

Mathematica graphics

Adjust the color as needed.

You can add Opacity as follows

 Plot[Sin[x ], {x, 0, 2 Pi}, Background -> Directive[Opacity[.2], Red]]

Mathematica graphics

| improve this answer | |
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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