def prueba_interactivo(): def animate(i, x, y, gf): x.append(i) y.append(random.randint(0, 1)) gf.g2d_graficar(0, x, y) gf = Graficador(["0,0"], 1, 1, estilo="seaborn") y = [] x = [] gf.set_real_time_on(animate, 1000, fargs=(x, y, gf))
def tabla_interactiva(): def animate(i, graficador): def turn_white_and_black(vector): return ["#4f4f4f" if x < 0.5 else "#f6f6f6" for x in vector] def turn_blank(vector): return ["" for _ in vector] matrix = np.random.rand(5, 5) black_and_white_matrix = np.array( list(map(turn_white_and_black, matrix))) empty_string_matrix = np.array(np.array(list(map(turn_blank, matrix)))) graficador.tabla(0, empty_string_matrix, c_celdas=black_and_white_matrix) graficador = Graficador(["0,0"], filas=1, col=1, estilo="seaborn") graficador.set_real_time_on(animate, 4000, fargs=[graficador]) graficador.display_graficos()