You will have to import Axes3D
to enable the 3d plotting in matplotlib. The official tutorials on 3d plotting can be found here. So the correct imports and code would look like
import matplotlib.pyplot as plt from mpl_toolkits.mplot3d import Axes3D # <--- This is important for 3d plotting #your code fig = plt.figure() ax = fig.gca(projection='3d')
Related Posts:
- How to make a 3D scatter plot in matplotlib
- ImportError: DLL load failed: The specified module could not be found
- ‘Syntax Error: invalid syntax’ for no apparent reason
- Purpose of “%matplotlib inline”
- Purpose of “%matplotlib inline”
- How do I update Anaconda?
- TypeError: only size-1 arrays can be converted to Python scalars (matplotlib)
- Showing an image with pylab.imshow()
- How do you change the size of figures drawn with Matplotlib?
- RuntimeWarning: invalid value encountered in divide
- _tkinter.TclError: no display name and no $DISPLAY environment variable
- ValueError: operands could not be broadcast together with shapes (5,) (30,)
- ImportError: No module named matplotlib.pyplot
- matplotlib savefig() plots different from show()
- ‘Conda’ is not recognized as internal or external command
- ‘Conda’ is not recognized as internal or external command
- Plotting a 2D heatmap with Matplotlib
- Save plot to image file instead of displaying it using Matplotlib
- ModuleNotFoundError: No module named ‘sklearn’
- No handles with labels found to put in legend
- How can I plot a confusion matrix? [duplicate]
- How to activate an Anaconda environment
- Python Pandas – Missing required dependencies [‘numpy’] 1
- pandas DataFrame “no numeric data to plot” error
- How to change the font size on a matplotlib plot
- Permission denied error by installing matplotlib
- How do I install Python OpenCV through Conda?
- Updating matplotlib in virtualenv with pip
- What is the difference between Spyder and Jupyter?
- How do you change the size of figures drawn with Matplotlib?
- How to run Conda?
- How to customize a scatter matrix to see all titles?
- Matplotlib automatic legend outside plot
- Add Legend to Seaborn point plot
- Matplotlib automatic legend outside plot
- Changing the “tick frequency” on x or y axis in matplotlib?
- matplotlib error – no module named tkinter
- Plot pie chart and table of pandas dataframe
- ModuleNotFoundError: No module named ‘matplotlib’
- Add Legend to Seaborn point plot
- TypeError: ‘DataFrame’ object is not callable
- Removing Conda environment
- Improve subplot size/spacing with many subplots in matplotlib
- how to update spyder on anaconda
- How do I plot only a table in Matplotlib?
- Python equivalent to ‘hold on’ in Matlab
- How to add title to subplots in Matplotlib
- How can I rename a conda environment?
- How to change a ‘LinearSegmentedColormap’ to a different distribution of color?
- Create own colormap using matplotlib and plot color scale
- Anaconda Navigator won’t launch (windows 10)
- Why matplotlib does not plot?
- reducing number of plot ticks
- How to increase plt.title font size?
- How to draw vertical lines on a given plot in matplotlib
- Changing the “tick frequency” on x or y axis in matplotlib
- How can I set the aspect ratio in matplotlib?
- Remove xticks in a matplotlib plot?
- Import Error: No module named numpy Anaconda
- How to install pytorch in windows?
- python SyntaxError: invalid syntax %matplotlib inline
- Spyder Not Launching
- How to make a histogram from a list of data
- How do I change the figure size with subplots?
- ValueError: x and y must be the same size
- How to change plot background color?
- Linear regression with matplotlib / numpy
- ImportError: No module named ‘google’
- 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
- bbox_to_anchor and loc in matplotlib
- Python, Matplotlib, subplot: How to set the axis range?
- Install Plotly in Anaconda
- Can’t update to numpy 1.13 with anaconda?
- How to put the legend out of the plot
- Matplotlib: TypeError: can’t multiply sequence by non-int of type ‘numpy.float64’
- RuntimeError: Invalid DISPLAY variable
- Conda command is not recognized on Windows 10
- 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
- Why do many examples use `fig, ax = plt.subplots()` in Matplotlib/pyplot/python
- Label axes on Seaborn Barplot
- matplotlib: plot multiple columns of pandas data frame on the bar chart
- plot a circle with pyplot
- Superscript in Python plots
- IPython, “name ‘plt’ not defined”
- Pandas dataframe groupby plot
- How to plot normal distribution
- How do I tell Matplotlib to create a second (new) plot, then later plot on the old one?
- A very basic setting issue about spyder and anaconda for python
- spyder – clear variable explorer along with variables from memory
- Equivalent to matlab’s imagesc in matplotlib? [duplicate]
- Installing Pylab/Matplotlib
- TypeError: zip argument #2 must support iteration
- numpy/scipy/ipython:Failed to interpret file as a pickle
- alueError: ordinal must be >= 1