export_fig with transparent background and fixed size?

20 次查看(过去 30 天)
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?

采纳的回答

Tim Hilt
Tim Hilt 2020-2-14
编辑:Tim Hilt 2020-2-14
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')

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Lighting, Transparency, and Shading 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by