- Trending Categories
- Data Structure
- Operating System
- C Programming
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Which is the recommended way to plot – matplotlib or pylab?
63 Lectures 6 hours
pylab is a module that imports matplotlib.pyplot (for plotting) and numpy (for mathematics and working with arrays) in a single namespace.
Although many examples use pylab, it is no longer recommended. For non-interactive plotting, it is suggested to use pyplot to create the figures and then the OO interface for plotting.
import matplotlib.pyplot as plt import numpy as np x = np.linspace(0, 2, 100) plt.plot(x, x, label='linear') plt.plot(x, x**2, label='quadratic') plt.plot(x, x**3, label='cubic') plt.xlabel('x label') plt.ylabel('y label') plt.title("Simple Plot") plt.legend() plt.show()
- How do I plot a spectrogram the same way that pylab's specgram() does? (Matplotlib)
- How to pause a pylab figure until a key is pressed or mouse is clicked? (Matplotlib)
- How to plot 1D data at a given Y-value with PyLab using Matplotlib?
- How to use different markers for different points in a Pylab scatter plot(Matplotlib)?
- Best way to plot an angle between two lines in Matplotlib
- Draw axis lines or the origin for Matplotlib contour plot.
- What is the preferred way to set Matplotlib figure/axes properties?
- How to check that pylab backend of Matplotlib runs inline?
- What is the difference between drawing plots using plot, axes or figure in matplotlib?
- How to print the Y-axis label horizontally in a Matplotlib/Pylab chart?
- How to plot half or quarter polar plots in Matplotlib?
- Plot animated text on the plot in Matplotlib
- Which is the right way to punish kids when they don't listen to their parents: beating, scolding or both?
- How to plot true/false or active/deactive data in Matplotlib?
- How to plot a non-square Seaborn jointplot or JointGrid? (Matplotlib)