export_fig with transparent background and fixed size?

10 Ansichten (letzte 30 Tage)
Tim Hilt
Tim Hilt am 14 Feb. 2020
Bearbeitet: Tim Hilt am 14 Feb. 2020
I try to create a .gif with transparent background. This is achieveable by exporting .png figures with transparent background for every frame i want to include in the .gif. This works great with export_fig (export_fig(sprintf('out/sensor1/%03d_sensor1', i), '-transparent', '-png')), however, i think that export_fig only exports the area with filled content, which leads to different image-sizes, because my plots are surf-plots without any axis and with changing content. When i then try to combine them into a transparent .gif with ImageMagick, the different sizes of the single frames lead to a shifting-effect along the y-direction of the animation.
Pythons Matplotlib exports with a fixed figure-size. How can i tell export_fig the specific image-size i want the exported .png graphics to have?

Akzeptierte Antwort

Tim Hilt
Tim Hilt am 14 Feb. 2020
Bearbeitet: Tim Hilt am 14 Feb. 2020
Somebody should have given me an RTFM: There is the -nocrop-option which enables export_fig to do exactly what i wanted to achieve. I'm calling the function like:
export_fig(sprintf('out/sensor1/%03d_sensor1', i), '-nocrop', '-transparent', '-png')

Weitere Antworten (0)

Kategorien

Mehr zu Lighting, Transparency, and Shading finden Sie in Help Center und File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by