我有一个semilogx情节,我想删除xticks。 我试过了: plt.gca().set_xticks([]) plt.xticks([]) ax.set_xticks([]) 网格消失(好),但小蜱(在主蜱的地方)仍然存在。 如何删除它们?
执行pip install -r requirements.txt ,在安装matplotlib的阶段出现以下错误: REQUIRED DEPENDENCIES AND EXTENSIONS numpy: yes [not found. pip may install it below.] dateutil: yes [dateutil was not found. It is required for date axis support. pip/easy_install may attempt to install it after matplotlib.] tornado: yes [tornado was not found. It is required for the WebAgg backend. pip/easy_install may attempt […]
我有一个两个y轴的情节,使用twinx() 。 我也给线条标签,并想用legend()来显示它们,但是我只能成功得到图例中一个轴的标签: import numpy as np import matplotlib.pyplot as plt from matplotlib import rc rc('mathtext', default='regular') fig = plt.figure() ax = fig.add_subplot(111) ax.plot(time, Swdown, '-', label = 'Swdown') ax.plot(time, Rn, '-', label = 'Rn') ax2 = ax.twinx() ax2.plot(time, temp, '-r', label = 'temp') ax.legend(loc=0) ax.grid() ax.set_xlabel("Time (h)") ax.set_ylabel(r"Radiation ($MJ\,m^{-2}\,d^{-1}$)") ax2.set_ylabel(r"Temperature ($^\circ$C)") ax2.set_ylim(0, 35) ax.set_ylim(-20,100) […]
我有一堆随机的x,y坐标散点图。 目前Y轴从0开始并上升到最大值。 我希望Y轴从最大值开始,然后上升到0。 points = [(10,5), (5,11), (24,13), (7,8)] x_arr = [] y_arr = [] for x,y in points: x_arr.append(x) y_arr.append(y) plt.scatter(x_arr,y_arr)
matplotlib中有哪些可用的颜色可用于绘图? 我可以在matplotlib文档中find一个列表,声明这些是唯一的名字: b: blue g: green r: red c: cyan m: magenta y: yellow k: black w: white 但是,我发现这些颜色也可以使用,至less在这种情况下: scatter(X,Y, color='red') scatter(X,Y, color='orange') scatter(X,Y, color='darkgreen') 但是这些不在上面的列表中。 有没有人知道可用的指定颜色的详尽列表?
简单的问题在这里:我试图让我的传说使用matplotlib.pyplot更小的尺寸(即,文字要小)。 我使用的代码是这样的: plot.figure() plot.scatter(k, sum_cf, color='black', label='Sum of Cause Fractions') plot.scatter(k, data[:, 0], color='b', label='Dis 1: cf = .6, var = .2') plot.scatter(k, data[:, 1], color='r', label='Dis 2: cf = .2, var = .1') plot.scatter(k, data[:, 2], color='g', label='Dis 3: cf = .1, var = .01') plot.legend(loc=2)
我想在matplotlib中做一个散点图,我找不到一个方法来添加标签的点。 例如: scatter1=plt.scatter(data1["x"], data1["y"], marker="o", c="blue", facecolors="white", edgecolors="blue") 我想为“y”中的点标签为“点1”,“点2”等我无法弄清楚。
安装matplotlib软件包后无法导入matplotlib.pyplot作为plt我有问题。 任何build议将不胜感激。 >>> import matplotlib.pyplot as plt Traceback (most recent call last): File "<stdin>", line 1, in <module> File "//anaconda/lib/python2.7/site-packages/matplotlib-1.3.1-py2.7-macosx-10.5-x86_64.egg/matplotlib/pyplot.py", line 98, in <module> _backend_mod, new_figure_manager, draw_if_interactive, _show = pylab_setup() File "//anaconda/lib/python2.7/site-packages/matplotlib-1.3.1-py2.7-macosx-10.5-x86_64.egg/matplotlib/backends/__init__.py", line 28, in pylab_setup globals(),locals(),[backend_name],0) File "//anaconda/lib/python2.7/site-packages/matplotlib-1.3.1-py2.7-macosx-10.5-x86_64.egg/matplotlib/backends/backend_macosx.py", line 21, in <module> from matplotlib.backends import _macosx **RuntimeError**: Python is not installed as a framework. […]
我正在像这样在Matplotlib中创build一个graphics: from matplotlib import pyplot as plt fig = plt.figure() plt.plot(data) fig.suptitle('test title') plt.xlabel('xlabel') plt.ylabel('ylabel') fig.savefig('test.jpg') 我想指定graphics标题和轴标签的字体大小。 我需要所有三个不同的字体大小,所以设置全局字体大小( mpl.rcParams['font.size']=x )是不是我想要的。 如何分别设置graphics标题和轴标签的字体大小?
我有一个简单的问题,但无法find一个好的解决scheme。 我想要一个代表灰度图像的numpy二维数组,并将其转换为RGB PIL图像,同时应用一些matplotlib色彩映射。 我可以通过使用pyplot.figure.figimage命令获得一个合理的PNG输出: dpi = 100.0 w, h = myarray.shape[1]/dpi, myarray.shape[0]/dpi fig = plt.figure(figsize=(w,h), dpi=dpi) fig.figimage(sub, cmap=cm.gist_earth) plt.savefig('out.png') 虽然我可以适应这个来获得我想要的东西(可能使用StringIO来获得PIL图像),但我不知道是否没有更简单的方法来做到这一点,因为它似乎是一个非常自然的图像可视化问题。 比方说,像这样的东西: colored_PIL_image = magic_function(array, cmap) 谢谢阅读!