

- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to pass RGB color values to Python's Matplotlib eventplot?
To pass RGB color values to Python's Matplotlib eventplot, we can take the following steps
Steps
- Set the figure size and adjust the padding between and around the subplots.
- Create a 1D array, pos, to define the positions of one sequence of events
- Make a list of color tuple r, g, b.
- Plot identical parallel lines at the given positions.
- To display the figure, use show() method.
Example
import numpy as np import matplotlib.pyplot as plt plt.rcParams["figure.figsize"] = [7.50, 3.50] plt.rcParams["figure.autolayout"] = True pos = 10 * np.random.random(100) colors = [(0.75, 0.50, 0.25)] plt.eventplot(pos, orientation='horizontal', linelengths=0.75, color=colors) plt.show()
Output
You can change the R, G, B values inside colors to get different colors in the plot.
- Related Questions & Answers
- Hexadecimal color to RGB color JavaScript
- RGB color to hexadecimal color JavaScript
- How to set the border color of the dots in matplotlib's scatterplots?
- How to use rgb color codes in tkinter?
- How can RGB color space be converted to a different color space in Python?
- C Program to Change RGB color model to HSV color model
- How to update matplotlib's imshow() window interactively?
- How can I pass arguments to Tkinter button's callback command?
- Equivalent to matlab's imagesc in Matplotlib
- How to convert data values into color information for Matplotlib?
- How to delete all children's elements using Python's Tkinter?
- How do I redraw an image using Python's Matplotlib?
- Adding a line to a scatter plot using Python's Matplotlib
- How to change an HTML5 input's placeholder color with CSS?
- How to pass arguments to animation.FuncAnimation() in Matplotlib?
Advertisements