Matplotlib - 多个表面图,错误的重叠 [英] Matplotlib - multiple surface plots, wrong overlapping

查看:1086
本文介绍了Matplotlib - 多个表面图,错误的重叠的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在绘制两个完全不同的数据集到一个三维表面图。当我绘制每一个独立的,一切工作正常。然而,当我绘制他们于一体,可视化很奇怪。我做的绘制方式如下:

I am currently plotting two completely different datasets into one 3D surface plot. When I am plotting each one independently, everything works fine. However, as soon as I plot them in one, the visualization is strange. I do the plotting the following way:

fig = plt.figure(figsize=(20,10))
ax = fig.add_subplot(111, projection='3d')
ax.plot_surface(X,Y,Z, color=color, antialiased=True)
(get new X,Y, Z values)
ax.plot_surface(X,Y,Z, color=color, antialiased=True)
ax.view_init(30, 360)

输出如下:

正如你所看到的,蓝色的数据是正确的,但绿色的是莫名其妙的背面,而不是正确地显示。如果我单独绘制的绿色的,它完美的作品。

As you can see, the blue data is correct, but the green one is somehow in the backside and not correctly visualized. If I plot the green one alone, it works perfectly.

更改绘图(或ZORDER玩弄)不会改变任何东西的顺序。

Changing the order of plotting (or playing around with zorder) does not change anything.

希望有人能帮助!

推荐答案

Matplotlib只是一个2D绘图库。三维曲线是采用投影三维表面到成像面来实现的。

Matplotlib is just a 2d plotting library. 3d plots are achieved by projecting the 3d surface onto the image plane.

如果您有多个3D表面时,将分别变成一个二维形状,然后计算每个形状的单一的高度,按照这个顺序显示即可。

If you have multiple 3d surfaces, it will turn each into a 2d shape, and then calculate a single height for each shape, and show then in that order.

据我所知,ZORDER选项不工作,所有这将是改变表面的秩序呢。

As far as I'm aware, the zorder option doesn't work, and all it would is change the order of the surfaces anyway.

如果你真的不走运,灰色框构成轴网格可以得到上面的表面绘制了。这是更讨厌。

If you're really unlucky, the grey boxes that make up the axis grids can get plotted above your surface too. That's even more annoying.

中必须使用matplotlib,那么我想你可以你的面分割成许多较小的,但你会遇到一个pretty的大的表现有点这样做,你会覆盖值传说中的太。

Of you must use matplotlib, then i guess you could split up your surface into lots of smaller ones, but you're going to encounter a pretty big performance bit doing this, and you'll to override the values in the legend too.

这篇关于Matplotlib - 多个表面图,错误的重叠的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆