·

# ColorsReEdit

For the 2nd day of MinaCoding2024 : "ColorTheme" will be coded with Python & Hydra

ColorsReEdit remixes the Python Code of GridToNoise to use different color themes that are further manipulated in Hydra to produce the colors in the animation.

## Poetry

``````The Colors have redefined their scope
As they merge and formed for hope
To be seen
In the ever flowing river of mental streams
They edit to be shown
For their reasons to be flown
``````

## Code

### Hydra

``````s0.initScreen()

src(s0).diff(src(s0).scale([0.55,0.65,0.75,0.85,0.95].smooth())).
modulateScale(s0,1.5).out()
``````

### Python

``````import numpy as np
import seaborn as sns
import matplotlib.pylab as plt

def battle():
#using the 0 & 1 to represent a ship versus the ocean and having a weighted value of 0.8 for ocean, 0.18 for boats and 0.02 for mines
boats = [0,1,2,3,4,5,6,7,8,9,10,11]
prob = [0.025,0.025,0.05,0.05,0.05,0.05,0.1,0.1,0.1,0.1,0.2,0.15]

#by adding the (10,10) instead of 5, able to make an array with the weighted values
shipyard2 = np.random.choice(boats, (16,16), p=prob)
return shipyard2

def plotting(x,color):
letters = ['A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P'] #set for the columns
uniform_data = x
ax = sns.heatmap(uniform_data, linewidth=0.5,cmap=color) #changing it to blue for ocean representation
ax.set_xticklabels(letters) #setting the ticks of the x axis to letters
plt.show()
return x
``````

### Colors Themes in Python

``````plotting(battle(),"Purples")
plotting(battle(),"Oranges")
plotting(battle(),'RdBu_r')
plotting(battle(),'terrain')
plotting(battle(),'terrain')
plotting(battle(),'RdBu_r')
``````