- 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 to differentiate antialiasing in Matplotlib
To differentiate antialiasing through curves, we can take the following Steps −
Add a subplot to the current figure, using the subplot() method, where nrows=1, ncols=2 and index=1.
Plot the curve using the plot() method, where antialiased flag is false and color is red.
Place the legend at the upper-left corner using the legend() method.
Add a subplot to the current figure, using the subplot() method, where nrows=1, ncols=2 and index=2.
Plot the curve using the plot() method, where antialiased flag is true and color is green.
Place the legend at the upper-right corner using the legend() method.
To display the figure, use the show() method.
Example
import numpy as np from matplotlib import pyplot as plt plt.rcParams["figure.figsize"] = [7.50, 3.50] plt.rcParams["figure.autolayout"] = True plt.subplot(1, 2, 1) plt.plot(range(10), np.sin(range(10)), antialiased=False, label='Antialiasing Off', c="red") plt.legend(loc="upper left") plt.subplot(1, 2, 2) plt.plot(range(10), np.cos(range(10)), antialiased=True, label='Antialiasing On', c="green") plt.legend(loc="upper right") plt.show()
Output
- Related Articles
- Plot curves in fivethirtyeight stylesheet in Matplotlib
- How to change the strength of antialiasing in Matplotlib?
- How to shade the regions between the curves in Matplotlib?
- Find the area between two curves plotted in Matplotlib
- How to a plot stem plot in Matplotlib Python?
- How to plot matplotlib contour?
- How to plot blurred points in Matplotlib?
- How to plot categorical variables in Matplotlib?
- How to plot overlapping lines in Matplotlib?
- How to plot hexbin histogram in Matplotlib?
- How to plot multiple graphs in Matplotlib?
- How to plot a circle in Matplotlib?
- Plot animated text on the plot in Matplotlib
- Plot scatter points using plot method in Matplotlib
- How to apply antialiasing in HTML5 canvas drawImage()?

Advertisements