Matplotlib Tutorial
Matplotlib Useful Resources
Selected Reading
- Matplotlib - Transforms
- Matplotlib - Working with Images
- Mathematical Expressions
- Matplotlib - Working With Text
- Matplotlib - 3D Surface plot
- Matplotlib - 3D Wireframe plot
- Matplotlib - 3D Contour Plot
- Three-dimensional Plotting
- Matplotlib - Violin Plot
- Matplotlib - Box Plot
- Matplotlib - Quiver Plot
- Matplotlib - Contour Plot
- Matplotlib - Scatter Plot
- Matplotlib - Pie Chart
- Matplotlib - Histogram
- Matplotlib - Bar Plot
- Matplotlib - Twin Axes
- Setting Ticks and Tick Labels
- Matplotlib - Setting Limits
- Matplotlib - Formatting Axes
- Matplotlib - Grids
- Matplotlib - Subplot2grid() Function
- Matplotlib - Subplots() Function
- Matplotlib - Multiplots
- Matplotlib - Axes Class
- Matplotlib - Figure Class
- Object-oriented Interface
- Matplotlib - PyLab module
- Matplotlib - Simple Plot
- Matplotlib - Pyplot API
- Matplotlib - Jupyter Notebook
- Matplotlib - Anaconda distribution
- Matplotlib - Environment Setup
- Matplotlib - Introduction
- Matplotlib - Home
Matplotlib Useful Resources
Selected Reading
- Who is Who
- Computer Glossary
- HR Interview Questions
- Effective Resume Writing
- Questions and Answers
- UPSC IAS Exams Notes
Matplotlib - Setting Limits
Matplotpb - Setting Limits
Matplotpb automatically arrives at the minimum and maximum values of variables to be displayed along x, y (and z axis in case of 3D plot) axes of a plot. However, it is possible to set the pmits exppcitly by using set_xpm() and set_ypm() functions.
In the following plot, the autoscaled pmits of x and y axes are shown −
import matplotpb.pyplot as plt fig = plt.figure() a1 = fig.add_axes([0,0,1,1]) import numpy as np x = np.arange(1,10) a1.plot(x, np.exp(x)) a1.set_title( exp ) plt.show()
Now we format the pmits on x axis to (0 to 10) and y axis (0 to 10000) −
import matplotpb.pyplot as plt fig = plt.figure() a1 = fig.add_axes([0,0,1,1]) import numpy as np x = np.arange(1,10) a1.plot(x, np.exp(x), r ) a1.set_title( exp ) a1.set_ypm(0,10000) a1.set_xpm(0,10) plt.show()Advertisements