如何在Python中像这个图像一样绘制2D地图

时间:2016-02-22 15:09:48

标签: python dictionary matplotlib

Plot that I want to achieve using the data that I post here

我正在尝试使用data attached here创建一个类似于图像的图,但是当我尝试绘制网格数据时,我遇到了内存错误。

我只能使用matplotlib中的scatter选项绘制文件,如下面的示例所示:

%matplotlib inline

import matplotlib.pyplot as plt
import pandas as pd
import numpy as np
from scipy.interpolate import griddata

dffold = pd.read_csv('foldmap.toc', delimiter='\t',encoding='latin1',usecols=['Inline','Crossline','X','Y','Fold'])
x1 = np.array(dffold.X)
y1 = np.array(dffold.Y)
zf = np.array(dffold.Fold)
xi = np.linspace(min(x1), max(x1))
yi = np.linspace(min(y1), max(y1))
A, B = np.meshgrid(xi, yi, copy=False)
zi = griddata((x1, y1), zf , (xi, yi), method='nearest')
plt.scatter(x1,y1,zf)
plt.show()

0 个答案:

没有答案