[Tutor] 3D plotting
jack.lambert at gmail.com
Mon May 29 16:40:19 EDT 2017
I am very new to python and am using it for some astronomy data analysis.
What I am trying to is plot a 3D scatter plot of three variables that are
being read from a file. I've tried using code from other examples of 3d
plots but, having little idea how the code functions, I have had very
little luck. Here is the relevant code I am hoping to augment.
import numpy as np
import scipy as sp
from astropy.io import fits
import matplotlib.pyplot as plot
from pylab import *
import matplotlib as mpl
from mpl_toolkits.mplot3d import Axes3D
hdulist = fits.open(infile)
tdata = hdulist.data
ra = tdata['ra'] # degrees
dec = tdata['dec'] # degree
p = tdata['parallax'] # mas
ra,dec,p = sread('TgasSource_000-000-001.fits')
for i in range(len(ra)):
if ra[i] > 164 and ra[i] < 166 and dec[i] > 49 and dec[i] < 51 :
so I'm hoping to plot ra and dec on the x and y axes with p on the z axis.
Any way you can give me an idea how to implement this?
More information about the Tutor