Hi Jonathan,

Thanks for the quick response. I tried your suggestion but it appears that
the only thing that gets rescaled is the window of the graph and not the
graph itself.
I added the picture that I obtain. When I run the code I get the following
warnings. Maybe this has something to do with it?

MatplotlibDeprecationWarning:
The set_norm function was deprecated in Matplotlib 3.1 and will be removed
in 3.3. Use ScalarMappable.set_norm instead.
  self._cb.set_norm(value)

UserWarning: sweep() or solve() are likely to produce erroneous results
when `var` does not contain floats.
  solver = self._prepareLinearSystem(var, solver, boundaryConditions, dt)

MatplotlibDeprecationWarning:
The set_norm function was deprecated in Matplotlib 3.1 and will be removed
in 3.3. Use ScalarMappable.set_norm instead.
  self._cb.set_norm(self.viewer.norm)

Cheers,

Davide

Il giorno lun 23 mar 2020 alle ore 17:49 Guyer, Jonathan E. Dr. (Fed) via
fipy <fipy@nist.gov> ha scritto:

> Welcome to FiPy, Davide.
>
> The Matplotlib viewers accept a `figaspect` argument, so in your case, you
> would write:
>
>     viewer = Matplotlib2DViewer(vars=(phi,), figaspect=1.)
>
> On Mar 23, 2020, at 12:26 PM, Davide Cretti <davide.cre...@gmail.com>
> wrote:
>
> Dear developers,
>
> I am new to fipy and at the moment I am trying to implement it for a 2D
> convection-diffusion problem. The package is great and rather easy to use.
> Nonetheless, I have an issue that might sound trivial to you. The issue
> regards the plot of the 2D mesh. When I implement a value for the length of
> the x-axis that is much smaller than the value for the length of the
> y-axis, the viewer does not scale the axes to obtain a more or less
> "square" plot, but displays a very squashed plot instead. I was wondering
> if you could give me a hand in solving this problem. I added a simplified
> version of the code below.
>
> Thanks in advance.
>
> Kind regards,
>
> Davide Cretti
>
> N=100
> Lx=0.1
> Ly=1
>
> dt=1
> steps=1
>
> alpha=1
>
> mesh = Grid2D(dx=Lx/N, dy=Ly/N, nx=N, ny=N)
> phi = CellVariable(mesh=mesh, value=1)
>
> eq = TransientTerm() == DiffusionTerm(coeff=alpha)
>
> viewer = Viewer(phi, mesh)
>
>
>
> for steps in range(steps):
>     eq.solve(var = phi, dt=dt)
>     viewer.plot()
>
> if __name__ == '__main__':
>     input()
> _______________________________________________
> fipy mailing list
> fipy@nist.gov
> http://www.ctcms.nist.gov/fipy
>  [ NIST internal ONLY: https://email.nist.gov/mailman/listinfo/fipy ]
>
>
> _______________________________________________
> fipy mailing list
> fipy@nist.gov
> http://www.ctcms.nist.gov/fipy
>   [ NIST internal ONLY: https://email.nist.gov/mailman/listinfo/fipy ]
>
_______________________________________________
fipy mailing list
fipy@nist.gov
http://www.ctcms.nist.gov/fipy
  [ NIST internal ONLY: https://email.nist.gov/mailman/listinfo/fipy ]

Reply via email to