goinaction / code

Source Code for Go In Action examples
4.13k stars 2.37k forks source link

Color #182

Open Farous00 opened 2 months ago

Farous00 commented 2 months ago

Define colors assuming the closest valid hex codes

color1 = "#f30430" # Adding a 0 at the end color2 = "#0f3043" # Adding a 0 at the beginning

fig, ax = plt.subplots(1, 2, figsize=(6, 3))

Add rectangles filled with the given colors

rect1 = patches.Rectangle((0, 0), 1, 1, color=color1) rect2 = patches.Rectangle((0, 0), 1, 1, color=color2)

ax[0].add_patch(rect1) ax[1].add_patch(rect2)

ax[0].set_title(color1) ax[1].set_title(color2)

Remove axes for better visualization

ax[0].axis('off') ax[1].axis('off')

plt.show()