logo

How to Make a Transparent Background in Graphics with Julia 📂Julia

How to Make a Transparent Background in Graphics with Julia

Code 1

example.png

If the browser is in dark mode, you can clearly see that the background has been rendered transparent.

20210728_163903.png

You just need to insert the :transparent symbol into the background_color option. It saves well as *.png, but it is said that it doesn’t save well as *.pdf.

using Plots
plot(rand(10), background_color = :transparent)
png("example")

As you can guess from the option name, if you put in a color symbol, it will be output in that color. For example, a picture drawn with :yellow looks like this.

example2.png

Environment

  • OS: Windows
  • julia: v1.6.2