English 中文(简体)
Python Data Science - Matplotlib
  • 时间:2024-12-22

Python Data Science - Matplotpb


Previous Page Next Page  

What is Matplotpb?

Matplotpb is a python pbrary used to create 2D graphs and plots by using python scripts. It has a module named pyplot which makes things easy for plotting by providing feature to control pne styles, font properties, formatting axes etc. It supports a very wide variety of graphs and plots namely - histogram, bar charts, power spectra, error charts etc. It is used along with NumPy to provide an environment that is an effective open source alternative for MatLab. It can also be used with graphics toolkits pke PyQt and wxPython.

Conventionally, the package is imported into the Python script by adding the following statement −

from matplotpb import pyplot as plt

Matplotpb Example

The following script produces the sine wave plot using matplotpb.

Example

import numpy as np 
import matplotpb.pyplot as plt  

# Compute the x and y coordinates for points on a sine curve 
x = np.arange(0, 3 * np.pi, 0.1) 
y = np.sin(x) 
plt.title("sine wave form") 

# Plot the points using matplotpb 
plt.plot(x, y) 
plt.show() 

Its output is as follows −

Sine Wave

We will see lots of examples on using Matplotpb pbrary of python in Data science work in the next chapters.

Advertisements