ax.scatter eigenvalues scattergram

Two-dimensional graph

import matplotlib.pyplot as plt

from scipy.io import loadmat

alldata = loadmat('E:\BCI\physionet\mat\s1data\Model_csp3_1\model2\model2_3\Real_fea.mat')

data=alldata['feature_L_R']

ax = plt.subplot()

ax.set_title("Input data")

# Plot the training points

ax.scatter(data[0:35, 0],data[0:35, 1] , c='r',label='left',

edgecolors = 'k') # left eigenvector selection imaginary two-dimensional

ax.scatter(data[35:70, 0],data[35:70, 1] , c='g',label='right',

edgecolors = 'k') # right eigenvector selection imaginary two-dimensional

plt.legend (loc = 'upper right') # icon in the upper right of FIG.

plt.show()

dd

The second painting:

import matplotlib.pyplot as plt

from matplotlib.colors import ListedColormap

cm = plt.cm.RdBu

cm_bright = ListedColormap(['#FF0000', '#0000FF'])

ax = plt.subplot(len(datasets), len(classifiers) + 1, i)

ax.scatter(X_train[:, 0], X_train[:, 1], c=y_train, cmap=cm_bright,

edgecolors='k')

# and testing points

ax.scatter(X_test[:, 0], X_test[:, 1], c=y_test, cmap=cm_bright, alpha=0.6,

edgecolors='k')

plt.show()

Code Description:

cm_bright: representation drawing two colors

X_train: data format is two-dimensional array of 2 * 100, 100 features, each feature and feature two values, corresponding to the scattergram x and y. Y_train corresponding to one-dimensional array 100 has a value of 0 or 1, class represents the training data 100 for one color, as in the scattergram to another in a scatter plot 1 0 a color.

Ibid format of test data.

cc

Three-dimensional representation

import matplotlib.pyplot as plt

from scipy.io import loadmat

alldata = loadmat('E:\BCI\physionet\mat\s1data\Model_csp3_1\model2\model2_3\Real_fea.mat')

data=alldata['feature_L_R']

for i in range(34):

ax = plt.subplot (111, projection = '3d') # create a three-dimensional drawing Engineering

# The data points into three parts painted with the color discrimination

ax.scatter (data [0: 35, i], data [0: 35, i + 1], data [0: 35, i + 2], c = 'r') # plotted data points

ax.scatter(data[35:70,i],data[35:70,i+1],data[35:70,i+2],c='g')

ax.set_zlabel ( 'Z') # axes

ax.set_ylabel('Y')

ax.set_xlabel('X')

plt.show()

Description: data Data is 35 * 36,

dd

Published 46 original articles · won praise 12 · views 30000 +

Guess you like

Origin blog.csdn.net/malingyu/article/details/104036783