English 中文(简体)
带有空白地区的Matplotlib contour
原标题:Matplotlib contour with blank areas

I have a set of data that comprises x and y coordinates and a calculated value for each coordinate. The grid is irregular so for now i have been creating a scatter plot and separating the values into bins to display as a contour as on the img at the link below. https://i.stack.imgur.com/m7XHm.png

I want to refine this method by using the imshow/contour functionality in matplotlib by using meshgrid and then interpolating the calculated values. I can get this to work fine but I end up with a problem that it loses the areas of the image with no data (voids in real life) and joins them up as shown on the image at the link below for the same data. https://i.stack.imgur.com/ZCRog.png

我试图找到这样做的最佳途径,但我没有发现这方面的任何帮助。 是否有任何人提出建议?

我认为,在网球阶段我需要修改这种方法,但我不相信这一点。 其价值如下:

    x=nodalData[:,1] #array of x values from input file
    y=nodalData[:,2] #array of y values from input file

    #define the linear grid
    xi, yi = np.linspace(x.min(), x.max(), 100), np.linspace(y.min(), y.max(), 100) 
    xi, yi = np.meshgrid(xi, yi)

    z=Rres #array calculated elsewhere corresponding to x,y pair

    #interpolate
    zi = scipy.interpolate.griddata((x, y), z, (xi, yi), method= cubic )
    #plot    
    plt.imshow(zi, vmin=z.min(), vmax=z.max(), origin= lower , extent=[x.min(), x.max(), y.min(), y.max()]) 
问题回答

它是一个奇怪的问题,因为干预点是为数据不足的地区寻找合理的估计。 我建议要么接受新地块污染了价值,这样,如果数据区不再存在,就会出现ok。 或者,在进行干涉之后,你可以将“<代码>数据空白”重新定位,例如,用你的首块土地作掩护。





相关问题
Can Django models use MySQL functions?

Is there a way to force Django models to pass a field to a MySQL function every time the model data is read or loaded? To clarify what I mean in SQL, I want the Django model to produce something like ...

An enterprise scheduler for python (like quartz)

I am looking for an enterprise tasks scheduler for python, like quartz is for Java. Requirements: Persistent: if the process restarts or the machine restarts, then all the jobs must stay there and ...

How to remove unique, then duplicate dictionaries in a list?

Given the following list that contains some duplicate and some unique dictionaries, what is the best method to remove unique dictionaries first, then reduce the duplicate dictionaries to single ...

What is suggested seed value to use with random.seed()?

Simple enough question: I m using python random module to generate random integers. I want to know what is the suggested value to use with the random.seed() function? Currently I am letting this ...

How can I make the PyDev editor selectively ignore errors?

I m using PyDev under Eclipse to write some Jython code. I ve got numerous instances where I need to do something like this: import com.work.project.component.client.Interface.ISubInterface as ...

How do I profile `paster serve` s startup time?

Python s paster serve app.ini is taking longer than I would like to be ready for the first request. I know how to profile requests with middleware, but how do I profile the initialization time? I ...

Pragmatically adding give-aways/freebies to an online store

Our business currently has an online store and recently we ve been offering free specials to our customers. Right now, we simply display the special and give the buyer a notice stating we will add the ...

Converting Dictionary to List? [duplicate]

I m trying to convert a Python dictionary into a Python list, in order to perform some calculations. #My dictionary dict = {} dict[ Capital ]="London" dict[ Food ]="Fish&Chips" dict[ 2012 ]="...

热门标签