This is a read only copy of the old FEniCS QA forum. Please visit the new QA forum to ask questions

How to use frames in Viper

+3 votes

Hello,

At each time step of a time loop I have a function u that is
updated and plotted with "plot(u)". But each time the method
plot is called a new frame is opened. How can I have everything
plotted in the same frame ?

Thanks.

asked Jun 24, 2013 by micdup FEniCS User (1,120 points)

2 Answers

+2 votes
 
Best answer

You are probably plotting a Function that needs to be projected each time plot is called and as such a new object is created leading to a new frame. With this trick here you are always plotting the same object and thus the frame should remain the same:

V = FunctionSpace(mesh, 'CG', 1)
uplot = Function(V)
for i in range(10):
    uplot.assign(project(u, V))
    plot(uplot)
answered Jun 24, 2013 by mikael-mortensen FEniCS Expert (29,340 points)
selected Jun 26, 2013 by Jan Blechta

Yes I am working with functions in a DG FunctionSpace.
It is working nice with your "trick".

But another problem appeared when trying to plot four different functions
at each time step. At the first time step the four frames were distributed in
such a way that I could see them at a glance. Starting with the second
time step the four frames were overlapped.

Thanks a lot!

+2 votes

Viper is no longer supported or developed.

With recent DOLFIN version (>= 1.2), try

# u is some Function
plotter = VTKPlotter(u)
for i in range(10);
    # Some computation that change u
    plotter.plot()
answered Jun 24, 2013 by Garth N. Wells FEniCS Expert (35,930 points)
edited Jun 24, 2013 by Garth N. Wells

I am still working with dolfin 1.0.0.
I would prefer to wait a bit before making an update.
Is there another way ?

Thanks!

...