Để vẽ một mảng trong Python, chúng ta có thể thực hiện các bước sau -
- Đặt kích thước hình và điều chỉnh phần đệm giữa và xung quanh các ô con.
- Tạo hai mảng, x và y, sử dụng numpy.x and y, using numpy.
- Đặt tiêu đề của đường cong bằng phương thức Tiêu đề [].title[] method.
- Vẽ các điểm dữ liệu X và Y, với màu đỏ.x and y data points, with red color.
- Để hiển thị hình, sử dụng phương thức show [].show[] method.
Thí dụ
import numpy as np import matplotlib.pyplot as plt plt.rcParams["figure.figsize"] = [7.50, 3.50] plt.rcParams["figure.autolayout"] = True x = np.array[[5, 4, 1, 4, 5]] y = np.sort[x] plt.title["Line graph"] plt.plot[x, y, color="red"] plt.show[]
Đầu ra
Cập nhật vào ngày 07 tháng 3 năm 2021 11:22:47
- Câu hỏi và câu trả lời liên quan
- Làm thế nào để vẽ một phổ góc bằng cách sử dụng matplotlib trong python?
- Làm thế nào để vẽ các vectơ trong python bằng matplotlib?
- Làm thế nào để vẽ MFCC trong Python bằng cách sử dụng matplotlib?
- Làm thế nào để vẽ đồ thị 3D bằng python matplotlib?
- Làm thế nào để một cốt truyện cốt truyện trong matplotlib python?
- Làm thế nào để vẽ sơ đồ phổ cường độ theo chiều dọc trong matplotlib bằng cách sử dụng python?
- Làm thế nào để vẽ sơ đồ bộ sưu tập. Biểu đồ bằng cách sử dụng matplotlib?
- Làm thế nào để vẽ dữ liệu CSV bằng cách sử dụng matplotlib và pandas trong Python?
- Làm thế nào để vẽ một khu vực trong khung dữ liệu gấu trúc trong matplotlib python?
- Làm thế nào để vẽ CDF trong matplotlib trong python?
- Làm thế nào để vẽ tín hiệu trong matplotlib trong python?
- Biểu đồ tần số trong khung dữ liệu Python/Pandas bằng cách sử dụng matplotlib
- Làm thế nào để vẽ một ma trận hình ảnh hoạt hình trong matplotlib?
- Matplotlib - âm mưu trên nền hình ảnh trong Python
- Làm thế nào để vẽ một tệp wav bằng matplotlib?
Bạn có thể in các mảng trong Python không?
import matplotlib.pyplot as plt
import numpy as np
import glob
import os, sys
fpath ="/home/user/Desktop/OutFileTraces.npy"
npyfilespath="/home/user/Desktop/test"
os.chdir[npyfilespath]
npfiles= glob.glob["*.npy"]
npfiles.sort[]
all_arrays = []
with open[fpath,'ab'] as f_handle:
for npfile in npfiles:
#Find the path of the file and Load file
all_arrays.append[np.load[os.path.join[npyfilespath, npfile]]]
np.save[f_handle, all_arrays]
data = np.load[fpath]
print data
Để in một mảng trong python, hãy sử dụng hàm in []. Bản in [] là một hàm Python tích hợp có tên của mảng chứa các giá trị và in nó. Để tạo một mảng trong Python, hãy sử dụng thư viện Numpy và tạo một mảng bằng NP. Hàm mảng [], và sau đó in mảng đó trong bảng điều khiển.
[[[[-0.00824758 -0.0081808 -0.00811402 ..., -0.0077236 -0.00765425
-0.00762086]]]
[[[-0.00141527 -0.00160791 -0.00176716 ..., -0.00821419 -0.00822446
-0.0082296 ]]]
[[[ 0.01028957 0.01005326 0.0098298 ..., -0.01043341 -0.01050019
-0.01059523]]]
...,
[[[ 0.00614908 0.00581004 0.00549154 ..., -0.00814741 -0.00813457
-0.00809347]]]
[[[-0.00291786 -0.00309509 -0.00329287 ..., -0.00809861 -0.00797789
-0.00784175]]]
[[[-0.00379887 -0.00410453 -0.00438963 ..., -0.03497837 -0.0353842
-0.03575151]]]]
Tôi theo liên kết này cách nối nhiều tệp numpy vào một tệp numpy trong Python để đặt tất cả các tệp numpy của tôi trong một tệp. Bây giờ, tôi cần vẽ tệp của mình có chứa nhiều mảng, mỗi mảng chứa một số số float: đây là mã cuối cùng của tôi để nối các mảng trong một mảng lớn:
import matplotlib.pyplot as plt
import numpy as np
dataArray1= np.load[r'/home/user/Desktop/OutFileTraces.npy']
print[dataArray1]
plt.plot[dataArray1.T ]
plt.show[]
Mã này cho tôi kết quả như thế này:
Tôi cần vẽ sơ đồ cốt truyện tệp cuối cùng OutfileTraces.npy chứa mảng lớn. Vì vậy, tôi sử dụng mã này:
Nó cho tôi lỗi này:
[[-0.00824758 -0.0081808 -0.00811402 ..., -0.0077236 -0.00765425
-0.00762086]
[-0.00141527 -0.00160791 -0.00176716 ..., -0.00821419 -0.00822446
-0.0082296 ]
[ 0.01028957 0.01005326 0.0098298 ..., -0.01043341 -0.01050019
-0.01059523]
...,
[0.00614908 0.00581004 0.00549154 ..., -0.00814741 -0.00813457
-0.00809347]
[-0.00291786 -0.00309509 -0.00329287 ..., -0.00809861 -0.00797789
-0.00784175]
[-0.00379887 -0.00410453 -0.00438963 ..., -0.03497837 -0.0353842
-0.03575151]]
Tăng giá trị HERROR ["X và Y có thể không lớn hơn 2-D"] ValueError: X và Y có thể không lớn hơn 2-D
Tất cả các giá trị đó đại diện cho y_axe, tuy nhiên x-trục của tôi đại diện cho các điểm từ 1 đến 8000. Vì vậy, theo tôi hiểu, để vẽ sơ đồ mảng lớn cuối cùng của tôi, nó phải trông như thế này [sự khác biệt là trên ____55]:
Tôi có thể dễ dàng vẽ tệp này.
Bạn có thể in các mảng trong Python không?
Để in một mảng trong python, hãy sử dụng hàm in []. Bản in [] là một hàm Python tích hợp có tên của mảng chứa các giá trị và in nó. Để tạo một mảng trong Python, hãy sử dụng thư viện Numpy và tạo một mảng bằng NP. Hàm mảng [], và sau đó in mảng đó trong bảng điều khiển.
Apyplot[], which is used to plot two-dimensional data.
Các chức năng khác nhau được sử dụng được giải thích dưới đây:
- np.arange [bắt đầu, kết thúc]: hàm này trả về các giá trị cách đều nhau từ khoảng [bắt đầu, kết thúc].This function returns equally spaced values from the interval [start, end].
- plt.title []: Nó được sử dụng để đưa ra một tiêu đề cho biểu đồ. Tiêu đề được truyền làm tham số cho hàm này.It is used to give a title to the graph. Title is passed as the parameter to this function.
- plt.xlabel []: Nó đặt tên nhãn tại trục x. Tên của trục x được truyền làm đối số cho hàm này.It sets the label name at X-axis. Name of X-axis is passed as argument to this function.
- plt.ylabel []: Nó đặt tên nhãn tại trục y. Tên của trục y được truyền như là đối số cho hàm này.It sets the label name at Y-axis. Name of Y-axis is passed as argument to this function.
- plt.plot []: Nó biểu thị các giá trị của các tham số được truyền cho nó cùng nhau.It plots the values of parameters passed to it together.
- plt.show []: Nó hiển thị tất cả các biểu đồ cho bảng điều khiển.It shows all the graph to the console.
Ví dụ 1 :
Python3
import
numpy as np
import
matplotlib.pyplot as plt
____10
import matplotlib.pyplot as plt
import numpy as np
import glob
import os, sys
fpath ="/home/user/Desktop/OutFileTraces.npy"
npyfilespath="/home/user/Desktop/test"
os.chdir[npyfilespath]
npfiles= glob.glob["*.npy"]
npfiles.sort[]
all_arrays = []
with open[fpath,'ab'] as f_handle:
for npfile in npfiles:
#Find the path of the file and Load file
all_arrays.append[np.load[os.path.join[npyfilespath, npfile]]]
np.save[f_handle, all_arrays]
data = np.load[fpath]
print data
1 import matplotlib.pyplot as plt
import numpy as np
import glob
import os, sys
fpath ="/home/user/Desktop/OutFileTraces.npy"
npyfilespath="/home/user/Desktop/test"
os.chdir[npyfilespath]
npfiles= glob.glob["*.npy"]
npfiles.sort[]
all_arrays = []
with open[fpath,'ab'] as f_handle:
for npfile in npfiles:
#Find the path of the file and Load file
all_arrays.append[np.load[os.path.join[npyfilespath, npfile]]]
np.save[f_handle, all_arrays]
data = np.load[fpath]
print data
2import matplotlib.pyplot as plt
import numpy as np
import glob
import os, sys
fpath ="/home/user/Desktop/OutFileTraces.npy"
npyfilespath="/home/user/Desktop/test"
os.chdir[npyfilespath]
npfiles= glob.glob["*.npy"]
npfiles.sort[]
all_arrays = []
with open[fpath,'ab'] as f_handle:
for npfile in npfiles:
#Find the path of the file and Load file
all_arrays.append[np.load[os.path.join[npyfilespath, npfile]]]
np.save[f_handle, all_arrays]
data = np.load[fpath]
print data
3import matplotlib.pyplot as plt
import numpy as np
import glob
import os, sys
fpath ="/home/user/Desktop/OutFileTraces.npy"
npyfilespath="/home/user/Desktop/test"
os.chdir[npyfilespath]
npfiles= glob.glob["*.npy"]
npfiles.sort[]
all_arrays = []
with open[fpath,'ab'] as f_handle:
for npfile in npfiles:
#Find the path of the file and Load file
all_arrays.append[np.load[os.path.join[npyfilespath, npfile]]]
np.save[f_handle, all_arrays]
data = np.load[fpath]
print data
4import matplotlib.pyplot as plt
import numpy as np
import glob
import os, sys
fpath ="/home/user/Desktop/OutFileTraces.npy"
npyfilespath="/home/user/Desktop/test"
os.chdir[npyfilespath]
npfiles= glob.glob["*.npy"]
npfiles.sort[]
all_arrays = []
with open[fpath,'ab'] as f_handle:
for npfile in npfiles:
#Find the path of the file and Load file
all_arrays.append[np.load[os.path.join[npyfilespath, npfile]]]
np.save[f_handle, all_arrays]
data = np.load[fpath]
print data
5import matplotlib.pyplot as plt
import numpy as np
import glob
import os, sys
fpath ="/home/user/Desktop/OutFileTraces.npy"
npyfilespath="/home/user/Desktop/test"
os.chdir[npyfilespath]
npfiles= glob.glob["*.npy"]
npfiles.sort[]
all_arrays = []
with open[fpath,'ab'] as f_handle:
for npfile in npfiles:
#Find the path of the file and Load file
all_arrays.append[np.load[os.path.join[npyfilespath, npfile]]]
np.save[f_handle, all_arrays]
data = np.load[fpath]
print data
6import matplotlib.pyplot as plt
import numpy as np
import glob
import os, sys
fpath ="/home/user/Desktop/OutFileTraces.npy"
npyfilespath="/home/user/Desktop/test"
os.chdir[npyfilespath]
npfiles= glob.glob["*.npy"]
npfiles.sort[]
all_arrays = []
with open[fpath,'ab'] as f_handle:
for npfile in npfiles:
#Find the path of the file and Load file
all_arrays.append[np.load[os.path.join[npyfilespath, npfile]]]
np.save[f_handle, all_arrays]
data = np.load[fpath]
print data
7import matplotlib.pyplot as plt
import numpy as np
import glob
import os, sys
fpath ="/home/user/Desktop/OutFileTraces.npy"
npyfilespath="/home/user/Desktop/test"
os.chdir[npyfilespath]
npfiles= glob.glob["*.npy"]
npfiles.sort[]
all_arrays = []
with open[fpath,'ab'] as f_handle:
for npfile in npfiles:
#Find the path of the file and Load file
all_arrays.append[np.load[os.path.join[npyfilespath, npfile]]]
np.save[f_handle, all_arrays]
data = np.load[fpath]
print data
1 import matplotlib.pyplot as plt
import numpy as np
import glob
import os, sys
fpath ="/home/user/Desktop/OutFileTraces.npy"
npyfilespath="/home/user/Desktop/test"
os.chdir[npyfilespath]
npfiles= glob.glob["*.npy"]
npfiles.sort[]
all_arrays = []
with open[fpath,'ab'] as f_handle:
for npfile in npfiles:
#Find the path of the file and Load file
all_arrays.append[np.load[os.path.join[npyfilespath, npfile]]]
np.save[f_handle, all_arrays]
data = np.load[fpath]
print data
0__ [[[[-0.00824758 -0.0081808 -0.00811402 ..., -0.0077236 -0.00765425
-0.00762086]]]
[[[-0.00141527 -0.00160791 -0.00176716 ..., -0.00821419 -0.00822446
-0.0082296 ]]]
[[[ 0.01028957 0.01005326 0.0098298 ..., -0.01043341 -0.01050019
-0.01059523]]]
...,
[[[ 0.00614908 0.00581004 0.00549154 ..., -0.00814741 -0.00813457
-0.00809347]]]
[[[-0.00291786 -0.00309509 -0.00329287 ..., -0.00809861 -0.00797789
-0.00784175]]]
[[[-0.00379887 -0.00410453 -0.00438963 ..., -0.03497837 -0.0353842
-0.03575151]]]]
1[[[[-0.00824758 -0.0081808 -0.00811402 ..., -0.0077236 -0.00765425
-0.00762086]]]
[[[-0.00141527 -0.00160791 -0.00176716 ..., -0.00821419 -0.00822446
-0.0082296 ]]]
[[[ 0.01028957 0.01005326 0.0098298 ..., -0.01043341 -0.01050019
-0.01059523]]]
...,
[[[ 0.00614908 0.00581004 0.00549154 ..., -0.00814741 -0.00813457
-0.00809347]]]
[[[-0.00291786 -0.00309509 -0.00329287 ..., -0.00809861 -0.00797789
-0.00784175]]]
[[[-0.00379887 -0.00410453 -0.00438963 ..., -0.03497837 -0.0353842
-0.03575151]]]]
2[[[[-0.00824758 -0.0081808 -0.00811402 ..., -0.0077236 -0.00765425
-0.00762086]]]
[[[-0.00141527 -0.00160791 -0.00176716 ..., -0.00821419 -0.00822446
-0.0082296 ]]]
[[[ 0.01028957 0.01005326 0.0098298 ..., -0.01043341 -0.01050019
-0.01059523]]]
...,
[[[ 0.00614908 0.00581004 0.00549154 ..., -0.00814741 -0.00813457
-0.00809347]]]
[[[-0.00291786 -0.00309509 -0.00329287 ..., -0.00809861 -0.00797789
-0.00784175]]]
[[[-0.00379887 -0.00410453 -0.00438963 ..., -0.03497837 -0.0353842
-0.03575151]]]]
3import matplotlib.pyplot as plt
import numpy as np
import glob
import os, sys
fpath ="/home/user/Desktop/OutFileTraces.npy"
npyfilespath="/home/user/Desktop/test"
os.chdir[npyfilespath]
npfiles= glob.glob["*.npy"]
npfiles.sort[]
all_arrays = []
with open[fpath,'ab'] as f_handle:
for npfile in npfiles:
#Find the path of the file and Load file
all_arrays.append[np.load[os.path.join[npyfilespath, npfile]]]
np.save[f_handle, all_arrays]
data = np.load[fpath]
print data
6[[[[-0.00824758 -0.0081808 -0.00811402 ..., -0.0077236 -0.00765425
-0.00762086]]]
[[[-0.00141527 -0.00160791 -0.00176716 ..., -0.00821419 -0.00822446
-0.0082296 ]]]
[[[ 0.01028957 0.01005326 0.0098298 ..., -0.01043341 -0.01050019
-0.01059523]]]
...,
[[[ 0.00614908 0.00581004 0.00549154 ..., -0.00814741 -0.00813457
-0.00809347]]]
[[[-0.00291786 -0.00309509 -0.00329287 ..., -0.00809861 -0.00797789
-0.00784175]]]
[[[-0.00379887 -0.00410453 -0.00438963 ..., -0.03497837 -0.0353842
-0.03575151]]]]
5[[[[-0.00824758 -0.0081808 -0.00811402 ..., -0.0077236 -0.00765425
-0.00762086]]]
[[[-0.00141527 -0.00160791 -0.00176716 ..., -0.00821419 -0.00822446
-0.0082296 ]]]
[[[ 0.01028957 0.01005326 0.0098298 ..., -0.01043341 -0.01050019
-0.01059523]]]
...,
[[[ 0.00614908 0.00581004 0.00549154 ..., -0.00814741 -0.00813457
-0.00809347]]]
[[[-0.00291786 -0.00309509 -0.00329287 ..., -0.00809861 -0.00797789
-0.00784175]]]
[[[-0.00379887 -0.00410453 -0.00438963 ..., -0.03497837 -0.0353842
-0.03575151]]]]
6import matplotlib.pyplot as plt
import numpy as np
import glob
import os, sys
fpath ="/home/user/Desktop/OutFileTraces.npy"
npyfilespath="/home/user/Desktop/test"
os.chdir[npyfilespath]
npfiles= glob.glob["*.npy"]
npfiles.sort[]
all_arrays = []
with open[fpath,'ab'] as f_handle:
for npfile in npfiles:
#Find the path of the file and Load file
all_arrays.append[np.load[os.path.join[npyfilespath, npfile]]]
np.save[f_handle, all_arrays]
data = np.load[fpath]
print data
6[[[[-0.00824758 -0.0081808 -0.00811402 ..., -0.0077236 -0.00765425
-0.00762086]]]
[[[-0.00141527 -0.00160791 -0.00176716 ..., -0.00821419 -0.00822446
-0.0082296 ]]]
[[[ 0.01028957 0.01005326 0.0098298 ..., -0.01043341 -0.01050019
-0.01059523]]]
...,
[[[ 0.00614908 0.00581004 0.00549154 ..., -0.00814741 -0.00813457
-0.00809347]]]
[[[-0.00291786 -0.00309509 -0.00329287 ..., -0.00809861 -0.00797789
-0.00784175]]]
[[[-0.00379887 -0.00410453 -0.00438963 ..., -0.03497837 -0.0353842
-0.03575151]]]]
8[[[[-0.00824758 -0.0081808 -0.00811402 ..., -0.0077236 -0.00765425
-0.00762086]]]
[[[-0.00141527 -0.00160791 -0.00176716 ..., -0.00821419 -0.00822446
-0.0082296 ]]]
[[[ 0.01028957 0.01005326 0.0098298 ..., -0.01043341 -0.01050019
-0.01059523]]]
...,
[[[ 0.00614908 0.00581004 0.00549154 ..., -0.00814741 -0.00813457
-0.00809347]]]
[[[-0.00291786 -0.00309509 -0.00329287 ..., -0.00809861 -0.00797789
-0.00784175]]]
[[[-0.00379887 -0.00410453 -0.00438963 ..., -0.03497837 -0.0353842
-0.03575151]]]]
9import matplotlib.pyplot as plt
import numpy as np
import glob
import os, sys
fpath ="/home/user/Desktop/OutFileTraces.npy"
npyfilespath="/home/user/Desktop/test"
os.chdir[npyfilespath]
npfiles= glob.glob["*.npy"]
npfiles.sort[]
all_arrays = []
with open[fpath,'ab'] as f_handle:
for npfile in npfiles:
#Find the path of the file and Load file
all_arrays.append[np.load[os.path.join[npyfilespath, npfile]]]
np.save[f_handle, all_arrays]
data = np.load[fpath]
print data
6import matplotlib.pyplot as plt
import numpy as np
dataArray1= np.load[r'/home/user/Desktop/OutFileTraces.npy']
print[dataArray1]
plt.plot[dataArray1.T ]
plt.show[]
1import matplotlib.pyplot as plt
import numpy as np
import glob
import os, sys
fpath ="/home/user/Desktop/OutFileTraces.npy"
npyfilespath="/home/user/Desktop/test"
os.chdir[npyfilespath]
npfiles= glob.glob["*.npy"]
npfiles.sort[]
all_arrays = []
with open[fpath,'ab'] as f_handle:
for npfile in npfiles:
#Find the path of the file and Load file
all_arrays.append[np.load[os.path.join[npyfilespath, npfile]]]
np.save[f_handle, all_arrays]
data = np.load[fpath]
print data
1import matplotlib.pyplot as plt
import numpy as np
dataArray1= np.load[r'/home/user/Desktop/OutFileTraces.npy']
print[dataArray1]
plt.plot[dataArray1.T ]
plt.show[]
3import matplotlib.pyplot as plt
import numpy as np
import glob
import os, sys
fpath ="/home/user/Desktop/OutFileTraces.npy"
npyfilespath="/home/user/Desktop/test"
os.chdir[npyfilespath]
npfiles= glob.glob["*.npy"]
npfiles.sort[]
all_arrays = []
with open[fpath,'ab'] as f_handle:
for npfile in npfiles:
#Find the path of the file and Load file
all_arrays.append[np.load[os.path.join[npyfilespath, npfile]]]
np.save[f_handle, all_arrays]
data = np.load[fpath]
print data
6import matplotlib.pyplot as plt
import numpy as np
dataArray1= np.load[r'/home/user/Desktop/OutFileTraces.npy']
print[dataArray1]
plt.plot[dataArray1.T ]
plt.show[]
5& nbsp; đầu ra: & nbsp;
Output :
Ví dụ 2:
Python3
import
numpy as np
import
matplotlib.pyplot as plt
____10
import matplotlib.pyplot as plt
import numpy as np
import glob
import os, sys
fpath ="/home/user/Desktop/OutFileTraces.npy"
npyfilespath="/home/user/Desktop/test"
os.chdir[npyfilespath]
npfiles= glob.glob["*.npy"]
npfiles.sort[]
all_arrays = []
with open[fpath,'ab'] as f_handle:
for npfile in npfiles:
#Find the path of the file and Load file
all_arrays.append[np.load[os.path.join[npyfilespath, npfile]]]
np.save[f_handle, all_arrays]
data = np.load[fpath]
print data
1 import matplotlib.pyplot as plt
import numpy as np
import glob
import os, sys
fpath ="/home/user/Desktop/OutFileTraces.npy"
npyfilespath="/home/user/Desktop/test"
os.chdir[npyfilespath]
npfiles= glob.glob["*.npy"]
npfiles.sort[]
all_arrays = []
with open[fpath,'ab'] as f_handle:
for npfile in npfiles:
#Find the path of the file and Load file
all_arrays.append[np.load[os.path.join[npyfilespath, npfile]]]
np.save[f_handle, all_arrays]
data = np.load[fpath]
print data
2import matplotlib.pyplot as plt
import numpy as np
import glob
import os, sys
fpath ="/home/user/Desktop/OutFileTraces.npy"
npyfilespath="/home/user/Desktop/test"
os.chdir[npyfilespath]
npfiles= glob.glob["*.npy"]
npfiles.sort[]
all_arrays = []
with open[fpath,'ab'] as f_handle:
for npfile in npfiles:
#Find the path of the file and Load file
all_arrays.append[np.load[os.path.join[npyfilespath, npfile]]]
np.save[f_handle, all_arrays]
data = np.load[fpath]
print data
3import matplotlib.pyplot as plt
import numpy as np
import glob
import os, sys
fpath ="/home/user/Desktop/OutFileTraces.npy"
npyfilespath="/home/user/Desktop/test"
os.chdir[npyfilespath]
npfiles= glob.glob["*.npy"]
npfiles.sort[]
all_arrays = []
with open[fpath,'ab'] as f_handle:
for npfile in npfiles:
#Find the path of the file and Load file
all_arrays.append[np.load[os.path.join[npyfilespath, npfile]]]
np.save[f_handle, all_arrays]
data = np.load[fpath]
print data
4import matplotlib.pyplot as plt
import numpy as np
import glob
import os, sys
fpath ="/home/user/Desktop/OutFileTraces.npy"
npyfilespath="/home/user/Desktop/test"
os.chdir[npyfilespath]
npfiles= glob.glob["*.npy"]
npfiles.sort[]
all_arrays = []
with open[fpath,'ab'] as f_handle:
for npfile in npfiles:
#Find the path of the file and Load file
all_arrays.append[np.load[os.path.join[npyfilespath, npfile]]]
np.save[f_handle, all_arrays]
data = np.load[fpath]
print data
5import matplotlib.pyplot as plt
import numpy as np
import glob
import os, sys
fpath ="/home/user/Desktop/OutFileTraces.npy"
npyfilespath="/home/user/Desktop/test"
os.chdir[npyfilespath]
npfiles= glob.glob["*.npy"]
npfiles.sort[]
all_arrays = []
with open[fpath,'ab'] as f_handle:
for npfile in npfiles:
#Find the path of the file and Load file
all_arrays.append[np.load[os.path.join[npyfilespath, npfile]]]
np.save[f_handle, all_arrays]
data = np.load[fpath]
print data
6import matplotlib.pyplot as plt
import numpy as np
import glob
import os, sys
fpath ="/home/user/Desktop/OutFileTraces.npy"
npyfilespath="/home/user/Desktop/test"
os.chdir[npyfilespath]
npfiles= glob.glob["*.npy"]
npfiles.sort[]
all_arrays = []
with open[fpath,'ab'] as f_handle:
for npfile in npfiles:
#Find the path of the file and Load file
all_arrays.append[np.load[os.path.join[npyfilespath, npfile]]]
np.save[f_handle, all_arrays]
data = np.load[fpath]
print data
7import matplotlib.pyplot as plt
import numpy as np
import glob
import os, sys
fpath ="/home/user/Desktop/OutFileTraces.npy"
npyfilespath="/home/user/Desktop/test"
os.chdir[npyfilespath]
npfiles= glob.glob["*.npy"]
npfiles.sort[]
all_arrays = []
with open[fpath,'ab'] as f_handle:
for npfile in npfiles:
#Find the path of the file and Load file
all_arrays.append[np.load[os.path.join[npyfilespath, npfile]]]
np.save[f_handle, all_arrays]
data = np.load[fpath]
print data
1 import matplotlib.pyplot as plt
import numpy as np
import glob
import os, sys
fpath ="/home/user/Desktop/OutFileTraces.npy"
npyfilespath="/home/user/Desktop/test"
os.chdir[npyfilespath]
npfiles= glob.glob["*.npy"]
npfiles.sort[]
all_arrays = []
with open[fpath,'ab'] as f_handle:
for npfile in npfiles:
#Find the path of the file and Load file
all_arrays.append[np.load[os.path.join[npyfilespath, npfile]]]
np.save[f_handle, all_arrays]
data = np.load[fpath]
print data
0__ [[[[-0.00824758 -0.0081808 -0.00811402 ..., -0.0077236 -0.00765425
-0.00762086]]]
[[[-0.00141527 -0.00160791 -0.00176716 ..., -0.00821419 -0.00822446
-0.0082296 ]]]
[[[ 0.01028957 0.01005326 0.0098298 ..., -0.01043341 -0.01050019
-0.01059523]]]
...,
[[[ 0.00614908 0.00581004 0.00549154 ..., -0.00814741 -0.00813457
-0.00809347]]]
[[[-0.00291786 -0.00309509 -0.00329287 ..., -0.00809861 -0.00797789
-0.00784175]]]
[[[-0.00379887 -0.00410453 -0.00438963 ..., -0.03497837 -0.0353842
-0.03575151]]]]
1[[[[-0.00824758 -0.0081808 -0.00811402 ..., -0.0077236 -0.00765425
-0.00762086]]]
[[[-0.00141527 -0.00160791 -0.00176716 ..., -0.00821419 -0.00822446
-0.0082296 ]]]
[[[ 0.01028957 0.01005326 0.0098298 ..., -0.01043341 -0.01050019
-0.01059523]]]
...,
[[[ 0.00614908 0.00581004 0.00549154 ..., -0.00814741 -0.00813457
-0.00809347]]]
[[[-0.00291786 -0.00309509 -0.00329287 ..., -0.00809861 -0.00797789
-0.00784175]]]
[[[-0.00379887 -0.00410453 -0.00438963 ..., -0.03497837 -0.0353842
-0.03575151]]]]
2[[[[-0.00824758 -0.0081808 -0.00811402 ..., -0.0077236 -0.00765425
-0.00762086]]]
[[[-0.00141527 -0.00160791 -0.00176716 ..., -0.00821419 -0.00822446
-0.0082296 ]]]
[[[ 0.01028957 0.01005326 0.0098298 ..., -0.01043341 -0.01050019
-0.01059523]]]
...,
[[[ 0.00614908 0.00581004 0.00549154 ..., -0.00814741 -0.00813457
-0.00809347]]]
[[[-0.00291786 -0.00309509 -0.00329287 ..., -0.00809861 -0.00797789
-0.00784175]]]
[[[-0.00379887 -0.00410453 -0.00438963 ..., -0.03497837 -0.0353842
-0.03575151]]]]
3import matplotlib.pyplot as plt
import numpy as np
import glob
import os, sys
fpath ="/home/user/Desktop/OutFileTraces.npy"
npyfilespath="/home/user/Desktop/test"
os.chdir[npyfilespath]
npfiles= glob.glob["*.npy"]
npfiles.sort[]
all_arrays = []
with open[fpath,'ab'] as f_handle:
for npfile in npfiles:
#Find the path of the file and Load file
all_arrays.append[np.load[os.path.join[npyfilespath, npfile]]]
np.save[f_handle, all_arrays]
data = np.load[fpath]
print data
6[[[[-0.00824758 -0.0081808 -0.00811402 ..., -0.0077236 -0.00765425
-0.00762086]]]
[[[-0.00141527 -0.00160791 -0.00176716 ..., -0.00821419 -0.00822446
-0.0082296 ]]]
[[[ 0.01028957 0.01005326 0.0098298 ..., -0.01043341 -0.01050019
-0.01059523]]]
...,
[[[ 0.00614908 0.00581004 0.00549154 ..., -0.00814741 -0.00813457
-0.00809347]]]
[[[-0.00291786 -0.00309509 -0.00329287 ..., -0.00809861 -0.00797789
-0.00784175]]]
[[[-0.00379887 -0.00410453 -0.00438963 ..., -0.03497837 -0.0353842
-0.03575151]]]]
5[[[[-0.00824758 -0.0081808 -0.00811402 ..., -0.0077236 -0.00765425
-0.00762086]]]
[[[-0.00141527 -0.00160791 -0.00176716 ..., -0.00821419 -0.00822446
-0.0082296 ]]]
[[[ 0.01028957 0.01005326 0.0098298 ..., -0.01043341 -0.01050019
-0.01059523]]]
...,
[[[ 0.00614908 0.00581004 0.00549154 ..., -0.00814741 -0.00813457
-0.00809347]]]
[[[-0.00291786 -0.00309509 -0.00329287 ..., -0.00809861 -0.00797789
-0.00784175]]]
[[[-0.00379887 -0.00410453 -0.00438963 ..., -0.03497837 -0.0353842
-0.03575151]]]]
6import matplotlib.pyplot as plt
import numpy as np
import glob
import os, sys
fpath ="/home/user/Desktop/OutFileTraces.npy"
npyfilespath="/home/user/Desktop/test"
os.chdir[npyfilespath]
npfiles= glob.glob["*.npy"]
npfiles.sort[]
all_arrays = []
with open[fpath,'ab'] as f_handle:
for npfile in npfiles:
#Find the path of the file and Load file
all_arrays.append[np.load[os.path.join[npyfilespath, npfile]]]
np.save[f_handle, all_arrays]
data = np.load[fpath]
print data
6[[[[-0.00824758 -0.0081808 -0.00811402 ..., -0.0077236 -0.00765425
-0.00762086]]]
[[[-0.00141527 -0.00160791 -0.00176716 ..., -0.00821419 -0.00822446
-0.0082296 ]]]
[[[ 0.01028957 0.01005326 0.0098298 ..., -0.01043341 -0.01050019
-0.01059523]]]
...,
[[[ 0.00614908 0.00581004 0.00549154 ..., -0.00814741 -0.00813457
-0.00809347]]]
[[[-0.00291786 -0.00309509 -0.00329287 ..., -0.00809861 -0.00797789
-0.00784175]]]
[[[-0.00379887 -0.00410453 -0.00438963 ..., -0.03497837 -0.0353842
-0.03575151]]]]
8[[[[-0.00824758 -0.0081808 -0.00811402 ..., -0.0077236 -0.00765425
-0.00762086]]]
[[[-0.00141527 -0.00160791 -0.00176716 ..., -0.00821419 -0.00822446
-0.0082296 ]]]
[[[ 0.01028957 0.01005326 0.0098298 ..., -0.01043341 -0.01050019
-0.01059523]]]
...,
[[[ 0.00614908 0.00581004 0.00549154 ..., -0.00814741 -0.00813457
-0.00809347]]]
[[[-0.00291786 -0.00309509 -0.00329287 ..., -0.00809861 -0.00797789
-0.00784175]]]
[[[-0.00379887 -0.00410453 -0.00438963 ..., -0.03497837 -0.0353842
-0.03575151]]]]
9import matplotlib.pyplot as plt
import numpy as np
import glob
import os, sys
fpath ="/home/user/Desktop/OutFileTraces.npy"
npyfilespath="/home/user/Desktop/test"
os.chdir[npyfilespath]
npfiles= glob.glob["*.npy"]
npfiles.sort[]
all_arrays = []
with open[fpath,'ab'] as f_handle:
for npfile in npfiles:
#Find the path of the file and Load file
all_arrays.append[np.load[os.path.join[npyfilespath, npfile]]]
np.save[f_handle, all_arrays]
data = np.load[fpath]
print data
6import matplotlib.pyplot as plt
import numpy as np
dataArray1= np.load[r'/home/user/Desktop/OutFileTraces.npy']
print[dataArray1]
plt.plot[dataArray1.T ]
plt.show[]
1import matplotlib.pyplot as plt
import numpy as np
import glob
import os, sys
fpath ="/home/user/Desktop/OutFileTraces.npy"
npyfilespath="/home/user/Desktop/test"
os.chdir[npyfilespath]
npfiles= glob.glob["*.npy"]
npfiles.sort[]
all_arrays = []
with open[fpath,'ab'] as f_handle:
for npfile in npfiles:
#Find the path of the file and Load file
all_arrays.append[np.load[os.path.join[npyfilespath, npfile]]]
np.save[f_handle, all_arrays]
data = np.load[fpath]
print data
1import
1import matplotlib.pyplot as plt
import numpy as np
import glob
import os, sys
fpath ="/home/user/Desktop/OutFileTraces.npy"
npyfilespath="/home/user/Desktop/test"
os.chdir[npyfilespath]
npfiles= glob.glob["*.npy"]
npfiles.sort[]
all_arrays = []
with open[fpath,'ab'] as f_handle:
for npfile in npfiles:
#Find the path of the file and Load file
all_arrays.append[np.load[os.path.join[npyfilespath, npfile]]]
np.save[f_handle, all_arrays]
data = np.load[fpath]
print data
6import matplotlib.pyplot as plt
import numpy as np
dataArray1= np.load[r'/home/user/Desktop/OutFileTraces.npy']
print[dataArray1]
plt.plot[dataArray1.T ]
plt.show[]
5& nbsp; đầu ra: & nbsp;
Output
: