X=np.array([0]), opts=dict(xlabel='Index', ylabel='Targeted Class', title="Detected samples in class " + TARGET_CLASS)) features_line = vis.line( X=np.column_stack([0] * nb_columns), Y=np.column_stack(dataframe_features_values[0][:]), opts=dict(legend=dataframe_features_values_columns, xlabel='Index', ylabel='Feature Value', title='Values of extracted features for each sample')) if alg.type == 'classification' or alg.type == 'clustering': statistic_pie = vis.pie(X=classes_stats, opts=dict(legend=classes, title='Classification results')) # ------------------------------------------------------------- count = 0 for x in range(nb_rows): vis.line(X=np.column_stack([count] * nb_columns), Y=np.column_stack(dataframe_features_values[x][:]), win=features_line, update='append') if alg.type == 'regression': match = (int(float(dataframe_predictions_values[x])) == int( float(TARGET_CLASS))) if match: message = "%s\n" % (dataframe_idx_values[x]) vis.text(message, win=list_detected_samples_text, append=True)
# quiver plot X = np.arange(0, 2.1, .2) Y = np.arange(0, 2.1, .2) X = np.broadcast_to(np.expand_dims(X, axis=1), (len(X), len(X))) Y = np.broadcast_to(np.expand_dims(Y, axis=0), (len(Y), len(Y))) U = np.multiply(np.cos(X), Y) V = np.multiply(np.sin(X), Y) viz.quiver( X=U, Y=V, opts=dict(normalize=0.9), ) # pie chart X = np.asarray([19, 26, 55]) viz.pie(X=X, opts=dict(legend=['Residential', 'Non-Residential', 'Utility'])) # scatter plot example with various type of updates colors = np.random.randint(0, 255, ( 2, 3, )) win = viz.scatter( X=np.random.rand(255, 2), Y=(np.random.rand(255) + 1.5).astype(int), opts=dict(markersize=10, markercolor=colors, legend=['1', '2']), ) viz.scatter(X=np.random.rand(255), Y=np.random.rand(255), opts=dict(
opts=dict(legend=['Men', 'Women']) ) # stemplot Y = np.linspace(0, 2 * math.pi, 70) X = np.column_stack((np.sin(Y), np.cos(Y))) viz.stem( X=X, Y=Y, opts=dict(legend=['Sine', 'Cosine']) ) # pie chart X = np.asarray([19, 26, 55]) viz.pie( X=X, opts=dict(legend=['Residential', 'Non-Residential', 'Utility']) ) # mesh plot x = [0, 0, 1, 1, 0, 0, 1, 1] y = [0, 1, 1, 0, 0, 1, 1, 0] z = [0, 0, 0, 0, 1, 1, 1, 1] X = np.c_[x, y, z] i = [7, 0, 0, 0, 4, 4, 6, 6, 4, 0, 3, 2] j = [3, 4, 1, 2, 5, 6, 5, 2, 0, 1, 6, 3] k = [0, 7, 2, 3, 6, 7, 1, 1, 5, 5, 7, 6] Y = np.c_[i, j, k] viz.mesh(X=X, Y=Y, opts=dict(opacity=0.5)) # SVG plotting svgstr = """