How to pass rgb color values to python’s matplotlib eventplot?

Hello Guys, How are you all? Hope You all Are Fine. Today We Are Going To learn about How to pass rgb color values to python’s matplotlib eventplot in Python. So Here I am Explain to you all the possible Methods here.

How to pass rgb color values to python’s matplotlib eventplot?

1. How to pass rgb color values to python's matplotlib eventplot?

you can pass an (r, g, b) or (r, g, b, a) tuple, where each of r, g, b and a are in the range [0,1].

2. pass rgb color values to python's matplotlib eventplot

you can pass an (r, g, b) or (r, g, b, a) tuple, where each of r, g, b and a are in the range [0,1].

Method 1

According to the docs:

you can pass an (r, g, b) or (r, g, b, a) tuple, where each of r, g, b and a are in the range [0,1].

import numpy as np
import matplotlib.pyplot as plt

spikes = 100*np.random.random(100)
plt.eventplot(spikes, orientation='horizontal', linelengths=0.9, color = [(0.3,0.3,0.5)])

plt.show()

Method 2

# for a list of three plotted variables

df = data[['x', 'y', 'z']]
color_theme=[(52/235, 235/235, 86/235), (52/235, 70/235, 235/235),
(165/235, 52/235, 235/235)]
df.plot(color=color_theme)

# where numerators are the R,G,B numbers
# python only uses RGB in numbers <1
# denominator is obviously the max RGB quantity on a normal RGB scale

Summery

It’s all About this issue. Hope all Methods helped you a lot. Comment below Your thoughts and your queries. Also, Comment below which Method worked for you? Thank You.