Python中文
首页
教程
问答
标签
搜索
登录
注册
AttributeError:“Figure”对象没有“plot”属性
回答此问题可获得
20
贡献值,回答如果被采纳可获得
50
分。
<p>我的代码</p> <pre><code>import matplotlib.pyplot as plt plt.style.use("ggplot") import numpy as np from mtspec import mtspec from mtspec.util import _load_mtdata data = np.loadtxt('262_V01_C00_R000_TEx_BL_4096H.dat') spec,freq,jackknife,f_statistics,degrees_of_f = mtspec(data=data, delta= 4930.0, time_bandwidth=4 ,number_of_tapers=5, nfft= 4194304, statistics=True) fig = plt.figure() ax2 = fig ax2.plot(freq, spec, color='black') ax2.fill_between(freq, jackknife[:, 0], jackknife[:, 1],color="red", alpha=0.3) ax2.set_xlim(freq[0], freq[-1]) ax2.set_ylim(0.1E1, 1E5) ax2.set_xlabel("Frequency $") ax2.set_ylabel("Power Spectral Density $)") plt.tight_layout() plt.show() </code></pre> <p>问题是我的代码的绘图部分。我应该更改什么?我在Ubuntu上使用Python 2.7。</p>
0 条评论
分类:
Python问答
请先
登录
后评论
默认排序
时间排序
1 个回答
匿名
1天前
擅长:python、mysql、java
<p>而不是用以下方式调用图:</p> <pre><code>ax2 = fig #which just references the figure </code></pre> <p>尝试使用<code>gca()</code>提取轴:</p> <pre><code>ax2 = fig.gca() #which is used to extract the axes </code></pre>
请先
登录
后评论
针对此问题:
更多的回答
关注
89
关注
收藏
1
收藏,
216
浏览
网友 提问于 2天前
相关Python问题
如何用if条件捕获函数返回值
10 回答
如何用if语句判断列表中是否存在该索引?
9 回答
如何用if语句向量化numpy数组中的最大值?
5 回答
如何用IF语句有条件地保存零碎的结果?
2 回答
如何用if语句测试异常对象?
9 回答
如何用IF语句编写二元函数
5 回答
如何用igraph在python中创建顶点权重的图?
6 回答
如何用ijson和python解析json
2 回答
如何用iloc求子矩阵
10 回答
如何用Imagemagick或PIL绘制高质量的图像笔划(边框)?
8 回答
如何用importlib在python中动态导入模块?
5 回答
如何用import语句重写python内置函数?
9 回答
如何用imshow混合裁剪的强度并显示正确的混合强度?
8 回答
如何用in dictionary解析havin dictionary中的json文件
3 回答
如何用in-Django URL替换%20
1 回答
如何用in\op正确构造查询
4 回答
如何用inbuild对象替换文件
8 回答
如何用inheritan类实现flask restful
8 回答
如何用intersphinx正确地编写对外部文档的交叉引用?
3 回答
如何用int修改LpVariable?
6 回答