Plot of expression does not update

Bug #1052968 reported by Marie Rognes
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
DOLFIN
Fix Released
Undecided
Joachim Haga

Bug Description

Plots of expressions do not update after changes in the parameter values in the Expression. They should. Reproduce with this:

from dolfin import *

mesh = UnitSquare(2, 2)
f = Expression("t", t=0)

for t in range(10):
    f.t = t
    print "Plotting at t=%s" % t
    plot(f, mesh=mesh)

interactive()

Revision history for this message
Joachim Haga (jobh) wrote : Re: [Bug 1052968] [NEW] Plot of expression does not update

There are at least two potential issues here, I don't know what you are seeing:

1) A problem with constant expressions (or functions),
division-by-zero in scaling. This will also affect the first frame.

2) The mesh may be moved (warped) out of the viewport. Camera was
reset in the first frame, but the whole object moves. Try the 'r' key.

But neither involves parameters (in the Parameters sense).

(1) is fixed in lp:~jobh/dolfin/plot. (2) isn't really fixed, but can
be worked around by setting range_min=0.0, range_max=10.0 (plus, in
trunk only, autorange=False).

On 19 September 2012 17:18, Marie Rognes <email address hidden> wrote:
> Public bug reported:
>
> Plots of expressions do not update after changes in the parameter values
> in the Expression. They should. Reproduce with this:
>
> from dolfin import *
>
> mesh = UnitSquare(2, 2)
> f = Expression("t", t=0)
>
> for t in range(10):
> f.t = t
> print "Plotting at t=%s" % t
> plot(f, mesh=mesh)
>
> interactive()
>
> ** Affects: dolfin
> Importance: Undecided
> Status: New
>
> --
> You received this bug notification because you are a member of DOLFIN
> Team, which is subscribed to DOLFIN.
> https://bugs.launchpad.net/bugs/1052968
>
> Title:
> Plot of expression does not update
>
> Status in DOLFIN:
> New
>
> Bug description:
> Plots of expressions do not update after changes in the parameter
> values in the Expression. They should. Reproduce with this:
>
> from dolfin import *
>
> mesh = UnitSquare(2, 2)
> f = Expression("t", t=0)
>
> for t in range(10):
> f.t = t
> print "Plotting at t=%s" % t
> plot(f, mesh=mesh)
>
> interactive()
>
> To manage notifications about this bug go to:
> https://bugs.launchpad.net/dolfin/+bug/1052968/+subscriptions

Revision history for this message
Marie Rognes (meg-simula) wrote :

I didn't mean parameters in the Parameters sense. I meant that I expected a plot of the constant function 0 in the first iteration (when the parameter t = 0), the function 1 in the second iteration (when the parameter t = 1), etc. With dolfin trunk, all I see is a colorbar with 0 throughout the loop.

Revision history for this message
Joachim Haga (jobh) wrote : Re: [Bug 1052968] Re: Plot of expression does not update

Ok. That is probably the div-by-zero bug. It's in
VTKPlottableGenericFunction.cpp, line 157, when range[1]==range[0].

Next, add "scale=0.0, rescale=True" to stop the scalar-warping from
moving the object out of the viewport and to update the colorbar.

This will all be better soon...

-j.

On 19 September 2012 21:00, Marie Rognes <email address hidden> wrote:
> I didn't mean parameters in the Parameters sense. I meant that I
> expected a plot of the constant function 0 in the first iteration (when
> the parameter t = 0), the function 1 in the second iteration (when the
> parameter t = 1), etc. With dolfin trunk, all I see is a colorbar with
> 0 throughout the loop.
>
> --
> You received this bug notification because you are a member of DOLFIN
> Team, which is subscribed to DOLFIN.
> https://bugs.launchpad.net/bugs/1052968
>
> Title:
> Plot of expression does not update
>
> Status in DOLFIN:
> New
>
> Bug description:
> Plots of expressions do not update after changes in the parameter
> values in the Expression. They should. Reproduce with this:
>
> from dolfin import *
>
> mesh = UnitSquare(2, 2)
> f = Expression("t", t=0)
>
> for t in range(10):
> f.t = t
> print "Plotting at t=%s" % t
> plot(f, mesh=mesh)
>
> interactive()
>
> To manage notifications about this bug go to:
> https://bugs.launchpad.net/dolfin/+bug/1052968/+subscriptions

Joachim Haga (jobh)
Changed in dolfin:
assignee: nobody → Joachim Haga (jobh)
status: New → In Progress
Joachim Haga (jobh)
Changed in dolfin:
status: In Progress → Fix Committed
Changed in dolfin:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Related blueprints

Remote bug watches

Bug watches keep track of this bug in other bug trackers.