Bottom Page

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 2D to 3D plots
I'm looking to transverse this 2D plot into a 3D plot. The third axis would be the different sensors so they're not overlapping each other. I'm rather new to python so just looking for ideas for the simplest solution to help me out. Below is the code I used. In my code I wanted to basically just load sensors = data_file[:, 13], data_file[:, 15], data_file[:, 17], data_file[:, 19], data_file [:,21], data_file [:, 23] but this didn't work for me when I went to plot the 2D plot so I had to include all columns from 12-24.
# Numpy (data import, manipulation, export)
# Matplotlib (create trends)
import matplotlib.pyplot as plt
import numpy as np

#load data file
data_file = np.genfromtxt('500Hz_0.txt', delimiter='\t')

# create time vector from imported data (starts from index 0)
time = data_file[:, 0]
# parse good sensor data from imported data
time = time - time[0]
sensors = data_file[:,12:24]

sensors = sensors * -1

# export data
# stack time and avg as column vectors
my_data = np.vstack((time,sensors.T))
# transpose data
my_data = my_data.T
# save text file with tab delimiter


# add text labels to the plot
plt.legend(['Sensor 1','Sensor 2', 'Sensor 3', 'Sensor 4', 'Sensor 5', 'Sensor 6'])
plt.xlabel('Time (sec)')

# show the figure on the screen (pauses execution until closed)
Larz60+ wrote Nov-14-2018, 06:26 PM:
Please post all code, output and errors (it it's entirety) between their respective tags. Refer to BBCode help topic on how to post. Use the "Preview Post" button to make sure the code is presented as you expect before hitting the "Post Reply/Thread" button.

I have added for you this time. Please use tags on future posts.

Top Page

Possibly Related Threads...
Thread Author Replies Views Last Post
  Plots issue shane1236 1 186 Aug-06-2019, 10:00 AM
Last Post: shane1236
  Add space between plots AdWill97 0 181 May-15-2019, 02:04 PM
Last Post: AdWill97
  Three-dimensional Contour Plots minifizikus 1 803 Sep-13-2018, 10:56 PM
Last Post: Larz60+

Forum Jump:

Users browsing this thread: 1 Guest(s)