pySpherepts > Jupyter > 결과의 좌표를 구면에 표시하는 구현 v0.1 > 여분의 점이 보인다 (안쪽의 점과 같다)

운영 환경
GeForce GTX 1070 (8GB)
ASRock Z170M Pro4S [Intel Z170chipset]
Ubuntu 16.04 LTS desktop amd64
TensorFlow v1.2.1
cuDNN v5.1 for Linux
CUDA v8.0
Python 3.5.2
IPython 6.0.0 -- An enhanced Interactive Python.
gcc (Ubuntu 5.4.0-6ubuntu1~16.04.4) 5.4.0 20160609
GNU bash, version 4.3.48(1)-release (x86_64-pc-linux-gnu)
scipy v0.19.1
geopandas v0.3.0
MATLAB R2017b (Home Edition)

pySpherepts > spherepts의 Numpy, Scipy 구현 > 결과 : spherepts와 동일한 것을 얻었다.
Numpy + Scipy의 처리 결과를 Jupyter로 표시하고 싶습니다.

참고



데이터 예



읽는 데이터는 pySpherepts에서 생성한 좌표 데이터.
$ head res_trisectTri_171126.txt 
[[-0.98302355 -0.18347941  0.        ]
 [-0.98302355  0.18347941  0.        ]
 [-0.93417236  0.         -0.35682209]
 [-0.93417236  0.          0.35682209]
 [-0.85198102 -0.39551069 -0.34307382]
 [-0.85198102 -0.39551069  0.34307382]
 [-0.85198102  0.39551069 -0.34307382]
 [-0.85198102  0.39551069  0.34307382]
 [-0.85065081 -0.52573111  0.        ]
 [-0.85065081  0.52573111  0.        ]

code



상기의 링크처 코드로부터 이하 등을 변경하였다.
  • 점의 위치를 ​​radial direction 외부로 이동
  • 기초 구의 색상 변경
  • figsize 변경

  • plotSphNodes_171126.ipynb
    import matplotlib.pyplot as plt
    from matplotlib import cm, colors
    from mpl_toolkits.mplot3d import Axes3D
    import numpy as np
    from pylab import rcParams
    
    # https://stackoverflow.com/questions/31768031/plotting-points-on-the-surface-of-a-sphere-in-pythons-matplotlib
    
    rcParams['figure.figsize'] = 10,10
    
    # Create a sphere
    r = 1
    pi = np.pi
    cos = np.cos
    sin = np.sin
    phi, theta = np.mgrid[0.0:pi:100j, 0.0:2.0*pi:100j]
    x = r*sin(phi)*cos(theta)
    y = r*sin(phi)*sin(theta)
    z = r*cos(phi)
    
    #Import data
    data = np.genfromtxt('res_IcodsNodes_4_0_171126.txt')
    data = data * 1.0005
    xx, yy, zz = np.hsplit(data, 3) 
    
    
    #Set colours and render
    fig = plt.figure()
    ax = fig.add_subplot(111, projection='3d')
    
    ax.plot_surface(
        x, y, z,  rstride=1, cstride=1, color='y', alpha=1.0, linewidth=0)
    
    ax.scatter(xx,yy,zz,color="k",s=15)
    
    ax.set_xlim([-1,1])
    ax.set_ylim([-1,1])
    ax.set_zlim([-1,1])
    ax.set_aspect("equal")
    plt.tight_layout()
    plt.show()
    



    아래 그림 (MATLAB에서 spherepts의 plotSphNodes 사용)에 비해 보기 좋지 않다. 분포의 느낌이 잡기 어렵다.
    본래 보이지 않는 안쪽의 점도 보이는 것 같다.
    점의 그림자가 비치고 있을지도 모른다.
    중앙의 구를 지웠을 때와 지워지지 않는 경우로 같은 점이 보이고 있기 때문에, 안쪽의 점이 보이고 있는 것일지도 모른다.

    좋은 웹페이지 즐겨찾기