pbw
pbw

Reputation: 1

Setting edgecolor with color and alpha in matplotlib histogram

I would like to set the edgecolor with the tuple (color, alpha) in a matplotlib histogram. However this doesn't seem to work and gives the ValueError: RGBA sequence should have length 3 or 4. Is this a bug? Is there a workaround?

Here is my code example:

import matplotlib.pyplot as plt import numpy as np

# Generate random data for the histogram data = np.random.randn(1000)

# Plotting a basic histogram plt.hist(data, bins=30, color="blue", edgecolor=[('black', 0.5)])

# Adding labels and title plt.xlabel('Values') plt.ylabel('Frequency') plt.title('Basic Histogram')

# Display the plot plt.show()`

Upvotes: 0

Views: 11

Answers (0)

Related Questions