Even though they are equivalent, I think there is a pretty good argument that the second form import matplotlib.pyplot as plt
is objectively more readable:
- It is generally customary to use
import matplotlib.pyplot as plt
and suggested in the matplotlib documentation (see http://matplotlib.org/users/pyplot_tutorial.html etc…) so this will be more familiar to most readers. import matplotlib.pyplot as plt
is shorter but no less clear.import matplotlib.pyplot as plt
gives an unfamiliar reader a hint that pyplot is a module, rather than a function which could be incorrectly assumed from the first form.
Related Posts:
- ImportError: DLL load failed: The specified module could not be found
- Python: ‘ModuleNotFoundError’ when trying to import module from imported package
- Purpose of “%matplotlib inline”
- Relative imports in Python 3
- Purpose of “%matplotlib inline”
- RuntimeWarning: invalid value encountered in divide
- Python error “ImportError: No module named”
- _tkinter.TclError: no display name and no $DISPLAY environment variable
- ValueError: operands could not be broadcast together with shapes (5,) (30,)
- _tkinter.TclError: no display name and no $DISPLAY environment variable
- matplotlib savefig() plots different from show()
- ImportError: No module named requests
- Importing modules from parent folder
- Plotting a 2D heatmap with Matplotlib
- `from … import` vs `import .` [duplicate]
- Importing modules from parent folder
- Importing files from different folder
- No handles with labels found to put in legend
- How to plot a histogram using Matplotlib in Python with a list of data?
- In Matplotlib, what does the argument mean in fig.add_subplot(111)?
- How can I plot a confusion matrix? [duplicate]
- Unable to plot Double Bar, Bar plot using pyplot for ndarray
- Importing files from different folder
- matplotlib error – no module named tkinter
- pandas DataFrame “no numeric data to plot” error
- How to import the class within the same directory or sub directory?
- How to change the font size on a matplotlib plot
- Permission denied error by installing matplotlib
- Updating matplotlib in virtualenv with pip
- How do you change the size of figures drawn with Matplotlib?
- How do I set the figure title and axes labels font size in Matplotlib?
- How to import other Python files?
- Is there a list of line styles in matplotlib?
- Matplotlib automatic legend outside plot
- Add Legend to Seaborn point plot
- matplotlib error – no module named tkinter
- Plotting multiple different plots in one figure using Seaborn
- Change figure size and figure format in matplotlib
- Add Legend to Seaborn point plot
- TypeError: ‘DataFrame’ object is not callable
- Improve subplot size/spacing with many subplots in matplotlib
- How do I plot only a table in Matplotlib?
- Python equivalent to ‘hold on’ in Matlab
- Overcome ValueError for empty array
- Using %matplotlib notebook after %matplotlib inline in Jupyter Notebook doesn’t work
- Display image as grayscale using matplotlib
- Create own colormap using matplotlib and plot color scale
- How to fix “Attempted relative import in non-package” even with __init__.py
- Why matplotlib does not plot?
- reducing number of plot ticks
- How to increase plt.title font size?
- How to make a 3D scatter plot in matplotlib
- Modify the legend of pandas bar plot
- Plot a horizontal line using matplotlib
- ImportError: libSM.so.6: cannot open shared object file: No such file or directory
- Remove xticks in a matplotlib plot?
- How to fix “Attempted relative import in non-package” even with __init__.py
- How to add title to seaborn boxplot
- How to import a module given the full path?
- How to update a plot in matplotlib?
- How do I change the figure size with subplots?
- ValueError: x and y must be the same size
- ValueError: Unknown projection ‘3d’ (once again)
- How to change plot background color?
- raise LinAlgError(“SVD did not converge”) LinAlgError: SVD did not converge in matplotlib pca determination
- TypeError: Invalid dimensions for image data when plotting array with imshow()
- matplotlib does not show my drawings although I call pyplot.show()
- Linear regression with matplotlib / numpy
- How to save a Seaborn plot into a file
- Plot correlation matrix using pandas
- Scatter plot colorbar – Matplotlib
- matplotlib: how to draw a rectangle on image
- ImportError: No module named ‘cv2’ Python3
- bbox_to_anchor and loc in matplotlib
- Python, Matplotlib, subplot: How to set the axis range?
- RuntimeError: Invalid DISPLAY variable
- How to plot an array in python?
- NameError: name ‘requests’ is not defined
- When I use matplotlib in jupyter notebook,it always raise ” matplotlib is currently using a non-GUI backend” error?
- Seaborn Lineplot Module Object Has No Attribute ‘Lineplot’
- IndexError: index 2 is out of bounds for axis 0 with size 2
- Matplotlib plots: removing axis, legends and white spaces
- How to load all modules in a folder?
- Label axes on Seaborn Barplot
- Plot a histogram such that the total area of the histogram equals 1
- matplotlib: plot multiple columns of pandas data frame on the bar chart
- How to change legend size with matplotlib.pyplot
- An equivalent function to matplotlib.mlab.bivariate_normal
- Superscript in Python plots
- IPython, “name ‘plt’ not defined”
- Plotting a python dict in order of key values
- Pandas dataframe groupby plot
- MovieWriter ffmpeg unavailable; trying to use class ‘matplotlib.animation.PillowWriter’ instead
- How to plot normal distribution
- How do I tell Matplotlib to create a second (new) plot, then later plot on the old one?
- Installing lxml module in python
- Installing Pylab/Matplotlib
- ModuleNotFoundError: What does it mean __main__ is not a package?
- TypeError: zip argument #2 must support iteration
- numpy/scipy/ipython:Failed to interpret file as a pickle