小编Ste*_*man的帖子

matplotlib 0.99 Mplot3d AttributeError:“列表”对象没有属性“ndim”

我正在尝试绘制一个像这样的 3D 图表:

在此输入图像描述

使用此代码并收到一条错误消息:

line 1621, in plot_surface
if Z.ndim != 2:
AttributeError: 'list' object has no attribute 'ndim'
Run Code Online (Sandbox Code Playgroud)
import cobra
import os
from os.path import join
import matplotlib.pyplot as plt
import numpy as np
from matplotlib import cm
from mpl_toolkits.mplot3d import Axes3D
data_dir ='/Users/stephenchapman/Documents/research/FBA_algae_digesate/COBRApy/iCZ843/iCZ843_models'
model = cobra.io.read_sbml_model(join(data_dir, "iCZ843_hetero.xml"))
model.reactions[15].upper_bound = -0 #ammonia
model.reactions[15].lower_bound = -98.3
model.reactions[27].upper_bound = -0 #acetate
model.reactions[27].lower_bound = -3.3
model.reactions[14].upper_bound = -0 #phosphate
model.reactions[14].lower_bound = -10
model.reactions[16].upper_bound = -0 #nitrate
model.reactions[16].lower_bound = -30.3
model.reactions[20].upper_bound = -0 …
Run Code Online (Sandbox Code Playgroud)

matplotlib python-3.x mplot3d

4
推荐指数
1
解决办法
1万
查看次数

标签 统计

matplotlib ×1

mplot3d ×1

python-3.x ×1