ecell / ecell4

An integrated software environment for multi-algorithm, multi-timescale, multi-spatial-representation simulation of various cellular phenomena
https://ecell4.e-cell.org/
GNU General Public License v3.0
17 stars 9 forks source link

ax.set_aspect('equal') doesn't work in the latest matplotlib #52

Closed kaizu closed 5 years ago

kaizu commented 5 years ago
from ecell4 import *
from ecell4_base.core import *

with species_attributes():
    A | {'D': 1, 'location': 'M'}
    M | {'dimension': 2}

surface = Sphere(ones() * 0.5, 0.4).surface()
obs = FixedIntervalTrajectoryObserver(1e-4)

run_simulation(
    0.4, model=m, y0={'A': 10}, structures={'M': surface},
    solver='spatiocyte', observers=obs, return_type=None)

viz.plot_trajectory(obs, interactive=False)

The code above fails:

---------------------------------------------------------------------------
NotImplementedError                       Traceback (most recent call last)
<ipython-input-27-dfdbcd4e632b> in <module>
     13     solver='spatiocyte', observers=obs, return_type=None)
     14 
---> 15 viz.plot_trajectory(obs, interactive=False)

~\Miniconda3\lib\site-packages\ecell4\util\viz.py in plot_trajectory(*args, **kwargs)
    126         plot_trajectory_with_elegans(*args, **kwargs)
    127     else:
--> 128         plot_trajectory_with_matplotlib(*args, **kwargs)
    129 
    130 def plot_number_observer_with_matplotlib(*args, **kwargs):

~\Miniconda3\lib\site-packages\ecell4\util\viz.py in plot_trajectory_with_matplotlib(obs, max_count, figsize, legend, angle, wireframe, grid, noaxis, plot_range, **kwargs)
   1185     fig, ax = __prepare_mplot3d_with_matplotlib(
   1186         __get_range_of_trajectories(data, plot_range),
-> 1187         figsize, grid, wireframe, angle, noaxis)
   1188 
   1189     lines = []

~\Miniconda3\lib\site-packages\ecell4\util\viz.py in __prepare_mplot3d_with_matplotlib(wrange, figsize, grid, wireframe, angle, noaxis)
   1047     fig = plt.figure(figsize=(figsize, figsize))
   1048     ax = fig.gca(projection='3d')
-> 1049     ax.set_aspect('equal')
   1050 
   1051     if wireframe:

~\Miniconda3\lib\site-packages\matplotlib\axes\_base.py in set_aspect(self, aspect, adjustable, anchor, share)
   1279         if (not cbook._str_equal(aspect, 'auto')) and self.name == '3d':
   1280             raise NotImplementedError(
-> 1281                 'It is not currently possible to manually set the aspect '
   1282                 'on 3D axes')
   1283 

NotImplementedError: It is not currently possible to manually set the aspect on 3D axes

The version of matplotlib is matplotlib==3.1.0.

kaizu commented 5 years ago

See https://github.com/matplotlib/matplotlib/issues/1077