有人会画三维柱状图么?
-
https://wizardforcel.gitbooks.io/matplotlib-intro-tut/content/matplotlib/31.html
把x3y3dz改为你的数据就行,剩下的就是设置图的其他东西了
为啥恢复间隔300s。。。 -
python那个 我缺各种库 到后来 卡到
Traceback (most recent call last): File "./plot.py", line 58, in <module> from mpl_toolkits.mplot3d import Axes3D File "/usr/local/lib/python2.7/dist-packages/mpl_toolkits/mplot3d/__init__.py", line 6, in <module> from .axes3d import Axes3D File "/usr/local/lib/python2.7/dist-packages/mpl_toolkits/mplot3d/axes3d.py", line 24, in <module> import matplotlib.axes as maxes File "/usr/local/lib/python2.7/dist-packages/matplotlib/__init__.py", line 133, in <module> from matplotlib.rcsetup import defaultParams, validate_backend, cycler File "/usr/local/lib/python2.7/dist-packages/matplotlib/rcsetup.py", line 31, in <module> from matplotlib.fontconfig_pattern import parse_fontconfig_pattern File "/usr/local/lib/python2.7/dist-packages/matplotlib/fontconfig_pattern.py", line 28, in <module> from backports.functools_lru_cache import lru_cache ImportError: No module named backports.functools_lru_cache
谷歌了很多办法也没用
@veen 大佬直接给了我一个python的文件
#! /usr/bin/env python import numpy as np import matplotlib.pyplot as plt from scipy.stats import multivariate_normal from mpl_toolkits.mplot3d import Axes3D #Parameters to set mu_x = 0 variance_x = 3 mu_y = 0 variance_y = 15 #Create grid and multivariate normal x = np.linspace(-10,10,500) y = np.linspace(-10,10,500) X, Y = np.meshgrid(x,y) pos = np.empty(X.shape + (2,)) pos[:, :, 0] = X; pos[:, :, 1] = Y rv = multivariate_normal([mu_x, mu_y], [[variance_x, 0], [0, variance_y]]) #Make a 3D plot fig = plt.figure() ax = fig.gca(projection='3d') ax.plot_surface(X, Y, rv.pdf(pos),cmap='viridis',linewidth=0) ax.set_xlabel('X axis') ax.set_ylabel('Y axis') ax.set_zlabel('Z axis') plt.show()
我在复现这篇文章里面的一些数据
Euler–Euler Anisotropic Gaussian Mesoscale Simulation of Homogeneous Cluster-Induced Gas–Particle Turbulence
,文章里面的方程17就是高斯分布。图1散点我搞出来了。但是有点问题。打算画图来debug一下。