- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Plot curves in fivethirtyeight stylesheet in Matplotlib
To use fivethirtyeight stylesheet, we can take the following steps −
- Set the figure size and adjust the padding between and around the subplots.
- To use fivethirtyeight, we can use plt.style.use() method.
- Create x data points using numpy.
- Create a figure and a set of subplots using subplots() method.
- Plot three curves using plot() method.
- Set the title of the plot.
- To display the figure, use show() method.
Example
import matplotlib.pyplot as plt import numpy as np plt.rcParams["figure.figsize"] = [7.50, 3.50] plt.rcParams["figure.autolayout"] = True plt.style.use('fivethirtyeight') x = np.linspace(0, 10) fig, ax = plt.subplots() ax.plot(x, np.sin(x) + x + np.random.randn(50)) ax.plot(x, np.sin(x) + 0.5 * x + np.random.randn(50)) ax.plot(x, np.sin(x) + 2 * x + np.random.randn(50)) ax.set_title("'fivethirtyeight' style sheet") plt.show()
Output
- Related Articles
- Plot curves to differentiate antialiasing in Matplotlib
- Find the area between two curves plotted in Matplotlib
- How to shade the regions between the curves in Matplotlib?
- Plot animated text on the plot in Matplotlib
- Plot scatter points using plot method in Matplotlib
- Contour hatching in Matplotlib plot
- Plot parallel coordinates in Matplotlib
- How to a plot stem plot in Matplotlib Python?
- Transparency for Poly3DCollection plot in Matplotlib
- Line plot with arrows in Matplotlib
- Annotate Time Series plot in Matplotlib
- How to plot signal in Matplotlib in Python?
- How to plot cdf in Matplotlib in Python?
- Plotting regression and residual plot in Matplotlib
- Plot mean and standard deviation in Matplotlib

Advertisements