-
-
Notifications
You must be signed in to change notification settings - Fork 11.1k
Description
Issue with current documentation:
The current NumPy documentation is robust but could benefit from additional guidance for users transitioning from MATLAB, particularly those who rely on MATLAB’s built-in plotting functions. While NumPy is often paired with Matplotlib for visualizations, this connection is not explicitly outlined in the documentation. Providing clarity on using NumPy arrays directly with Matplotlib for plotting could greatly assist users seeking to replicate MATLAB-like functionalities in Python.
Reference:
For example, the NumPy User Guide could include a section specifically for “Transitioning from MATLAB to NumPy + Matplotlib,” covering introductory visualization needs. This section might provide mappings between common MATLAB commands and equivalent NumPy and Matplotlib approaches.
Example:
In MATLAB, a basic 2D plot for a sine wave might use:
x = 0:0.01:2*pi;
y = sin(x);
plot(x, y);
The equivalent in NumPy + Matplotlib could be shown as:
import numpy as np
import matplotlib.pyplot as plt
x = np.arange(0, 2 * np.pi, 0.01)
y = np.sin(x)
plt.plot(x, y)
plt.show()
Idea or request for content:
Request for New Content:
To better support users accustomed to MATLAB, a dedicated section on “Advanced Visualization Techniques with NumPy and Matplotlib” could be added to the NumPy documentation. This section would guide users through complex plotting needs by demonstrating how NumPy arrays integrate with Matplotlib to produce a variety of plots. Suggested content includes:
- Mapping Common MATLAB Plot Commands to Python: Provide a table comparing MATLAB plotting functions with their NumPy + Matplotlib counterparts. This would give MATLAB users an easy reference for adapting their workflows.

- Examples of 2D and 3D Plotting:
- Motivation for Adding This Content:
This documentation addition would make NumPy more accessible for MATLAB users, who may be considering switching due to MATLAB’s high cost. By showing how NumPy and Matplotlib can provide a free and flexible alternative to MATLAB’s visualization capabilities, users can see the viability of Python as a cost-effective solution.