Skip to content

zoom_to_contents() forces a window to be displayed #21

@tdeck

Description

@tdeck

I was working on the following code, which displays a window despite calling vpl.save_fig() with off_screen=True, when I discovered that the real culprit is the call to zoom_to_contents() displaying the window.

Looking at the code, I believe it's because of a call to screenshot_fig(). Perhaps it would be better to pass off_screen=True to this call, although I don't know if there are any implications if the plot is already on screen.

import vtkplotlib as vpl
from stl.mesh import Mesh

mesh = Mesh.from_file(vpl.data.get_rabbit_stl())
vpl.mesh_plot(mesh, color='orange')
vpl.view(up_view=(0, 0, 1), camera_position=(0, -1, 0))
vpl.reset_camera()
vpl.zoom_to_contents()
vpl.save_fig(pixels=600, off_screen=True, path='/tmp/rabbit.png')

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions