A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://python-graph-gallery.com/available-colors-in-matplotlib/ below:

Website Navigation


Available colors in Matplotlib

import matplotlib.pyplot as plt
import numpy as np

random_data = np.random.randn(1000)

# Create a figure and a set of 4 subplots
fig, axs = plt.subplots(nrows=2, ncols=2, figsize=(10, 10), dpi=200)

# Hexadecimal color codes
color = "#FF5733"
axs[0,0].hist(
    random_data,
    bins=30,
    density=True,
    color=color
)
axs[0,0].set_title(f"color = {color}")

# Pre-defined color names
color = "skyblue"
axs[0,1].hist(
    random_data,
    bins=30,
    density=True,
    color=color
)
axs[0,1].set_title(f"color = {color}")

# RGB tuple
color = (0.1, 0.2, 0.5)
axs[1,0].hist(
    random_data,
    bins=30,
    density=True,
    color=color
)
axs[1,0].set_title(f"color = {color}")

# RGBA tuple
color = (0.1, 0.2, 0.5, 0.4)
axs[1,1].hist(
    random_data,
    bins=30,
    density=True,
    color=color
)
axs[1,1].set_title(f"color = {color}")

plt.show()

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4