2017-02-01 62 views
2

3軸が可能な極座標投影に微調整はありますか?おそらく3Dの散布図が2Dに傾いているように見えるので、このように並んでいますか?Matplotlib/plotly/bokehでの3軸のポーラー投影(Python用)? (ハイブプロット)

私は最近、約Hive Plotsを見つけました。私はそれをより擬似的にthese guysのように見せるために、より自由な範囲を持つことができます。私は1つを作ろうとし始めましたが、私がそれを行うと考えることができる唯一の方法は、このような極座標を使用することでした。

私の質問: matplotlib、plotly、bokehの3軸極座標を取得する方法はありますか? またはそうでない場合 このタイプの構造を持つように3Dプロットを修正する方法はありますか?多分

fig = plt.figure(figsize=(10,10)) 
ax = plt.subplot(111, polar=True) 
ax.plot(2*[np.pi/2], [0,1], color="black", linewidth=3) 
ax.plot(2*[5*np.pi/4], [0,1], color="black", linewidth=3) 
ax.plot(2*[7*np.pi/4], [0,1], color="black", linewidth=3) 

enter image description here

答えて

0

開始、私は3Dは今

import numpy as np 

from mpl_toolkits.mplot3d import Axes3D 
import matplotlib.pyplot as plt 

def Lin3dSeg(a,b): 
    ''' 
    if a, b are spherical coordinate vector tuples, then it 
    returns list of spherical coordinate points of a linear in r, theta, phi 
    3D spiral segment connecting them 
    ''' 
    return [np.linspace(start, stop) for start, stop in zip(a,b)] 

def Sphere2Cart(sphere_pt): # no particular convention, just thrown together 
    x = sphere_pt[0] * np.sin(sphere_pt[1]) 
    y = sphere_pt[0] * np.cos(sphere_pt[1]) 
    z = sphere_pt[0] * np.cos(sphere_pt[2]) 
    return (x, y, z) 

def SphereSegCarts(seg): 
    return [Sphere2Cart(pt) for pt in zip(*Lin3dSeg(*seg))] 

seg_a =((10, 0, 0),(5, np.pi/2, 0)) 
seg_b =((10, np.pi/2, 0),(1, 0, np.pi/2)) 
seg_c =((3, 0, np.pi/2),(10, np.pi/2, np.pi/2)) 


fig = plt.figure() 
ax = fig.add_subplot(111, projection='3d') 
ax.view_init(elev=45, azim=45) 

ax.plot(*zip(*SphereSegCarts(seg_a)), c='r') 
ax.plot(*zip(*SphereSegCarts(seg_b)), c='g') 
ax.plot(*zip(*SphereSegCarts(seg_c)), c='b') 

plt.show() 

enter image description here

優れているかどうかを確認するためにmatplotlibの2.0をチェックアウトします
関連する問題