我在%matplotlib行内模式下使用IPython notebook和绘图命令plt.plot(I,'o')绘制了一个NumPy值数组I。
结果输出为:
<matplotlib.figure.Figure at 0x119e6ead0>
Out[159]:
[<matplotlib.lines.Line2D at 0x11ac57090>,
<matplotlib.lines.Line2D at 0x11ac57310>,
<matplotlib.lines.Line2D at 0x11ac57510>,
<mat
假设我有一个图形列表(figList),如下所示(用iPython生成的输出):
In [25]: figList
Out[25]: [<matplotlib.figure.Figure at 0x63a8d90>,
<matplotlib.figure.Figure at 0x638e3f0>,
<matplotlib.figure.Figure at 0x6669710>,
<matplotlib.figure.Figure at 0x69daeb0>,
<matplotlib.figure.Figure at 0x63a43f
我想使用matplotlib中的draw()方法动态更新绘图。我试着简单地使用,
import matplotlib.pyplot as plt
import time
plt.plot(range(10))
plt.draw()
但从字面上看,这并不能做任何事情。该程序执行,然后关闭,没有显示任何绘图。我运行了下面的程序,希望show方法将生成一个带有后端的绘图窗口,然后进行更新,但我得到的结果是,后端使用第一个show命令绘制绘图,并且随后再也没有更新过。我认为show()方法会挂起会话,直到窗口关闭。
import matplotlib.pyplot as plt
import tim
在使用matplotlib的以下代码中,我还想旋转x轴的次要刻度标签。不幸的是,两者都没有
plt.setp(axes.xaxis.get_minorticklabels(), rotation=90)
nor
for text in axes.get_xminorticklabels():
print("text rotated")
text.set_rotation(90)
有效果。如何在此设置中控制这些标签的方向?
import matplotlib
matplotlib.use('TkAgg')
import matplotlib.py
我正在尝试运行Github中matterport提供的Mask-RCNN存储库。。当我在anaconda中运行演示时,它显示了"C:\Anaconda\lib\site-packages\matplotlib\figure.py:445: UserWarning: Matplotlib is currently using agg, which is a non-GUI backend, so cannot show the figure. % get_backend()) "。有没有人遇到过类似的问题?
当我从ipython shell或ipython笔记本运行文件时,通常会显示绘图,但是当我从bash终端运行文件时,它们不会显示出来--从bash终端运行时,其他一切都运行得很好。
python脚本示例(trial.py):
import matplotlib.pyplot as plt
print 'please, show my graph'
plt.plot([1,2,3], [1,2,3])
plt.show()
这就是我得到的(plot没有显示):
[~/Desktop]$ python trial.py
please, show my graph
[~/Des
当在jupyter notebook中生成pdf时,一切都运行得很好,但我希望将内联图形保留在pdf中,以及笔记本中。
下面是我的代码:
%matplotlib notebook
import matplotlib.pyplot as plt
import numpy as np
from IPython.display import set_matplotlib_formats
set_matplotlib_formats('png', 'pdf')
save_figures = True
x = np.arange(0, 20, 0.1)
y = np.
我想在Notebook中更新每个timestep的单个Matplotlib图形。我在StackOverflow上引用了许多API resources和examples论坛的答案,然而,所有提议的代码要么是did not graph,要么是每个时间步长都显示了一个新的图形,比如this answer, import matplotlib.pyplot as plt
import time
import random
from collections import deque
import numpy as np
# simulates input from serial port
def r
在matplotlib中有没有自动操作图例的方法来避免重叠数据点和图例?我有很多数据点和固定的y轴范围,如果图例在数据点上,我可以指示matplotlib向左或向下移动图例吗?谢谢
import numpy as np
import matplotlib.pyplot as plt
x = np.arange(1, 100)
y = -1/x
plt.plot(x,y, label='x and y', linewidth=30)
plt.legend()
plt.show()
亲爱的所有人,我正在尝试将kaggle教程代码应用于Iris数据集。
不幸的是,当我执行图形的代码时,我只能看到这个输出,而没有看到任何图形:
matplotlib.axes._subplots.AxesSubplot at 0x9abf9b0
有什么想法吗?
这是代码
import warnings # current version of seaborn generates a bunch of warnings that we'll ignore
warnings.filterwarnings("ignore")
import seaborn as sns
imp
我正在使用python和matplotlib,我正在尝试在Google Colab中创建一个交互式的绘图。我可以生成图,但它是静态的。我当前的代码如下:
%matplotlib notebook
%config InlineBackend.figure_format = 'retina'
from __future__ import print_function, division
import sys
import numpy as np
import astropy.units as u
import matplotlib.pyplot as plt
import os
%
我对Tkinter非常陌生,我正在尝试用两个不同的FigureCanvasTkAgg (一个在另一个之上)来构建一个窗口,我就是想不明白为什么其中一个不会出现。此外,当我尝试调整窗口大小时,它只是冻结。有人能给我一些见解吗?谢谢! 我试着创建了三个不同的框架,并将比例放在顶部,两个画布放在中间和底部。 from tkinter import *
from tkinter.filedialog import askopenfilename
from Decoder import *
import matplotlib
matplotlib.use("TkAgg")
from m