27/4/24

DATA VISUAL ART

 
 {Python}

import numpy as np
import matplotlib.pyplot as plt

x = np.linspace(0, 10, 200)
y1 = np.sin(x)
y2 = np.cos(x)

plt.fill_between(x, y1, color="lightblue", alpha=0.5)
plt.fill_between(x, y2, color="orange", alpha=0.5)

plt.grid(False)

plt.axis('off')
plt.show()




 

 {Python}

import numpy as np
import matplotlib.pyplot as plt

fig, ax = plt.subplots(figsize=(6, 6))
ax.set_facecolor('black')

for i in range(1, 100):
   x = np.linspace(0, 1, 100)

   y = np.sin(i * x * np.pi) * 0.2 + 0.5
   ax.plot(x, y, color=plt.cm.cool(i/100), alpha=0.7, linewidth=1)

plt.axis('off')
plt.show()



{R}

library(ggplot2)
set.seed(5)
diamonds.subset <- 100="" br="" diamonds="" nrow="" sample="">

qplot(color, price / carat, data = diamonds, geom = "jitter",
alpha = I(1 / 5), color = color)

(Fuente)

 

  

{Python}

import numpy as np
import matplotlib.pyplot as plt

def cellular_automaton(size, rule):
   grid = np.zeros((size, size))
   grid[0, size // 2] = 1

   for i in range(1, size):
    for j in range(1, size - 1):
     neighborhood = grid[i - 1, j - 1:j + 2]
     key = int("".join(neighborhood.astype(int).astype(str)), 2)
     grid[i, j] = rule[key]
   return grid

rule = np.random.randint(0, 2, 8)
pattern = cellular_automaton(100, rule)

plt.figure(figsize=(8, 8))
plt.imshow(pattern, cmap="binary", interpolation="nearest")
plt.axis("off")
plt.show()

 

 

No hay comentarios:

Publicar un comentario