使用 python 获取所有可能的三维可视化的映射

Get mappings of all possible three-dimensional visualisations with python

我有一个包含五列的数据框。我从中写了一个三列三维散点的代码:

from mpl_toolkits import mplot3d

%matplotlib inline
import numpy as np
import matplotlib.pyplot as plt

fig = plt.figure()
ax = plt.axes(projection='3d')

ax = plt.axes(projection='3d')
ax.scatter(df[['col1']],df[['col2']],df[['col3']], cmap='viridis', linewidth=0.5)

它给了我这样的散点:

但我有 5 列,我想从中查看所有可能的 3D 散点图:(col1, col4, col5), (col2, col3, col5), ....

我该怎么做?

使用 itertools 怎么样?

from itertools import combinations 
com = combinations(['col1','col2','col3','col4','col5'], 3)  
for i in com:  
    print(i)

类似于:

from itertools import combinations 
comb = combinations(['col1','col2','col3','col4','col5'], 3)  
for i in list(comb): 
    fig = plt.figure()
    ax = plt.axes(projection='3d')
    ax.scatter(df[[i[0]]],df[[i[1]]],df[[i[2]]], cmap='viridis', linewidth=0.5)