Python 如何增加平面';绘声绘色

Python 如何增加平面';绘声绘色,python,python-3.x,google-colaboratory,plotly-python,Python,Python 3.x,Google Colaboratory,Plotly Python,得到 可以在GoogleColab中打开它,它生成以下输出 如您所见,这些平面并没有填满整个轴空间,它们应该尊重轴范围。换句话说,飞机 z=66.5-应存在于x中的[0,31.38]和y中的[0,110]之间 x=15.59-应存在于y中的[0,110]和z中的[0,133]之间 y=55-应存在于x中的[0,31.38]和z中的[0,133]之间 如何做到这一点 有了这个, 几乎完成了任务,但平面x=15.59和y=55在浸没状态下不会达到最大值 问题是我绘制的阵列形状不正确 通过正确

得到

可以在GoogleColab中打开它,它生成以下输出

如您所见,这些平面并没有填满整个轴空间,它们应该尊重轴范围。换句话说,飞机

  • z=66.5-应存在于x中的[0,31.38]和y中的[0,110]之间
  • x=15.59-应存在于y中的[0,110]和z中的[0,133]之间
  • y=55-应存在于x中的[0,31.38]和z中的[0,133]之间
如何做到这一点


有了这个,

几乎完成了任务,但平面x=15.59和y=55在浸没状态下不会达到最大值


问题是我绘制的阵列形状不正确

通过正确地分割创建输入数组和打印的位,我们能够发现这一点,从而使输入数组(用于打印)具有正确的大小和适当的内容

import pandas as pd
import plotly.graph_objects as go
import numpy as np

df = pd.read_csv('https://raw.githubusercontent.com/tiago-peres/immersion/master/Platforms_dataset.csv')

fig = px.scatter_3d(df, x='Functionality ', y='Accessibility', z='Immersion', color='Platforms')

grey = [[0,'#C0C0C0'],[1,'#C0C0C0']]

zero_pt = pd.Series([0])
z = zero_pt.append(df['Immersion'], ignore_index = True).reset_index(drop = True)
y = zero_pt.append(df['Accessibility'], ignore_index = True).reset_index(drop = True)
x = zero_pt.append(df['Functionality '], ignore_index = True).reset_index(drop = True)

length_data = len(z)
z_plane_pos = 66.5*np.ones((length_data,length_data))

fig.add_trace(go.Surface(x=x, y=y, z=z_plane_pos, colorscale=grey,  showscale=False))
fig.add_trace(go.Surface(x=x.apply(lambda x: 15.69), y=y, z = np.array([z]*length_data), colorscale= grey, showscale=False))
fig.add_trace(go.Surface(x=x, y= y.apply(lambda x: 55), z =  np.array([z]*length_data).transpose(), colorscale=grey, showscale=False))

fig.update_layout(scene = dict(
        xaxis = dict(nticks=4, range=[0,31.38],),
        yaxis = dict(nticks=4, range=[0,110],),
        zaxis = dict(nticks=4, range=[0,133],),),
        legend_orientation="h",margin=dict(l=0, r=0, b=0, t=0))
import plotly.express as px
import pandas as pd
import plotly.graph_objects as go
import numpy as np

df = pd.read_csv('https://raw.githubusercontent.com/tiago-peres/immersion/master/Platforms_dataset.csv')

fig = px.scatter_3d(df, x='Functionality ', y='Accessibility', z='Immersion', color='Platforms')

grey = [[0,'#C0C0C0'],[1,'#C0C0C0']]

zero_pt = pd.Series([0])
z1 = np.arange(0, 134, 1)
print(z1)
y1 = np.arange(0, 111, 1)
print(z1)
x1 = np.arange(0, 32.38, 1)
print(z1)
z = zero_pt.append(df['Immersion'], ignore_index = True).reset_index(drop = True)
y = zero_pt.append(df['Accessibility'], ignore_index = True).reset_index(drop = True)
x = zero_pt.append(df['Functionality '], ignore_index = True).reset_index(drop = True)
print(zero_pt)
print(z)

test1 = pd.Series([133])
test = z.append(test1)

length_data1 = len(z1)
z_plane_pos = 66.5*np.ones((length_data1,length_data1))


length_data2 = len(y1)
y_plane_pos = 55*np.ones((length_data2,length_data2))


length_data3 = len(x1)
x_plane_pos = 15.69*np.ones((length_data3,length_data3))

fig.add_trace(go.Surface(x=x1, y=y1, z=z_plane_pos, colorscale=grey,  showscale=False))
fig.add_trace(go.Surface(x=x.apply(lambda x: 15.69), y=y1, z = np.array([test]*length_data1), colorscale= grey, showscale=False))
fig.add_trace(go.Surface(x=x1, y= y.apply(lambda x: 55), z =  np.array([test]*length_data1).transpose(), colorscale=grey, showscale=False))

fig.update_layout(scene = dict(
        xaxis = dict(nticks=4, range=[0,31.38],),
        yaxis = dict(nticks=4, range=[0,110],),
        zaxis = dict(nticks=4, range=[0,133],),),
        legend_orientation="h",margin=dict(l=0, r=0, b=0, t=0))
import plotly.express as px
import pandas as pd
import plotly.graph_objects as go
import numpy as np

df = pd.read_csv('https://raw.githubusercontent.com/tiago-peres/immersion/master/Platforms_dataset.csv')

zero_pt = pd.Series([0])
z1 = np.arange(0, 134, 1)
y1 = np.arange(0, 111, 1)
x1 = np.arange(0, 32.38, 1)
z = zero_pt.append(df['Immersion'], ignore_index = True).reset_index(drop = True)
y = zero_pt.append(df['Accessibility'], ignore_index = True).reset_index(drop = True)
x = zero_pt.append(df['Functionality '], ignore_index = True).reset_index(drop = True)

test1 = pd.Series([133])
test = z.append(test1)

length_data1 = len(z1)
z_plane_pos = 66.5*np.ones((length_data1,length_data1))
length_data2 = len(y1)
y_plane_pos = 55*np.ones((length_data2,length_data2))
length_data3 = len(x1)
x_plane_pos = 15.69*np.ones((length_data3,length_data3))

xvals = x.apply(lambda x: 15.69)
xvals2 = x1
yvals = y1
yvals2 = y.apply(lambda x: 55)
zvals = np.zeros((len(yvals), len(xvals)))
zvals[:, -1] = 133 #  np.array([test]*length_data2)
zvals2 = np.zeros((len(yvals2), len(xvals2)))
zvals2[-1, :] = 133

fig = px.scatter_3d(df, x='Functionality ', y='Accessibility', z='Immersion', color='Platforms')
grey = [[0,'#C0C0C0'],[1,'#C0C0C0']]

fig.add_trace(go.Surface(x=x1, y=y1, z=z_plane_pos, colorscale=grey,  showscale=False))
fig.add_trace(go.Surface(x=xvals, y=yvals, z = zvals, colorscale= grey, showscale=False))
fig.add_trace(go.Surface(x=xvals2, y=yvals2, z = zvals2, colorscale=grey, showscale=False))

fig.update_layout(scene = dict(
        xaxis = dict(nticks=4, range=[0,31.38],),
        yaxis = dict(nticks=4, range=[0,110],),
        zaxis = dict(nticks=4, range=[0,133],),),
        legend_orientation="h",margin=dict(l=0, r=0, b=0, t=0))