I am trying to make a 3D surface plot showing voltage vs. temp vs. power, and to scale the colour of each point to another array of values, known as bifurWidth.
Below is my code.
Problems with my code:
- I cannot make my code run for a 'bifurWidth'
numpy.ndarraygenerated usingloadtxt. The error in this case isColor array must be two-dimensional. However it does run if I generate a dummy set of bifurWidth values usingnp.arange(). Why does this happen when both arenumpy.ndarrays? - I have no idea how to get this working, with a legend visible, for a 3D surface plot.
Any ideas?
Here's my code:
from glob import glob
from pylab import *
import numpy as np
from matplotlib import cm
import os
fs = 22
# Import data.
voltage = np.loadtxt('NonLorentzianData.txt',usecols=[0])
power = np.loadtxt('NonLorentzianData.txt',usecols=[1])
bifurWidth = arange(len(voltage))#np.loadtxt('LorentzianData.txt',usecols=[3])
temp = np.loadtxt('NonLorentzianData.txt',usecols=[4])
path = np.loadtxt('NonLorentzianData.txt',usecols=[5],dtype='S16')
c = np.abs(bifurWidth)
#Plot a 3D pot showing Temperature/Voltage/Power and intensity of colour showing bifurcation size.
fig = figure()
ax = fig.add_subplot(111, projection='3d')
cmhot = get_cmap("hot")
ax.scatter(voltage,temp,power,bifurWidth,s=35,c=c,cmap=cmhot)
ax.set_ylabel('Temperature (mK)',fontsize=fs)
ax.set_xlabel('Voltage (V)',fontsize=fs)
ax.set_zlabel('Power (dB)',fontsize=fs)
ax.set_title('Locating bifurcations.',fontsize=fs)
fig.tight_layout()
fig.set_size_inches(25,15)
fig.savefig('TEST.PNG',dpi=300)
