
- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Plot scatter points on a 3D projection with varying marker size in Matplotlib
To plot scatter points on a 3D projection with varying marker size, we can take the following steps
- Set the figure size and adjust the padding between and around the subplots.
- Create xs, ys and zs data points using numpy
- Initialize a variable 's' for varying size of marker.
- Create a figure or activate an existing figure using figure() method.
- Add an axes to the current figure as a subplot arrangement using subplots() method.
- Plot the xs, ys, and zs data points using scatter() method.
- To display the figure, use show() method.
Example
import numpy as np from matplotlib import pyplot as plt plt.rcParams["figure.figsize"] = [7.50, 3.50] plt.rcParams["figure.autolayout"] = True xs = np.random.randint(low=8, high=30, size=35) ys = np.random.randint(130, 195, 35) zs = np.random.randint(30, 160, 35) s = zs / ((ys * 0.01) ** 2) fig = plt.figure() ax = fig.add_subplot(111, projection='3d') ax.scatter(ys, zs, xs, s=s * 5, c=xs, cmap='copper') plt.show()
Output
- Related Questions & Answers
- How to plot scatter points with increasing size of marker in Matplotlib?
- Plot scatter points on 3d plot without axes and grids in Matplotlib
- Connecting two points on a 3D scatter plot in Python and Matplotlib
- Plot Matplotlib 3D plot_surface with contour plot projection
- How to plot scatter points in a 3D figure with a colorbar in Matplotlib?
- Plot scatter points on polar axis in Matplotlib
- Plot scatter points using plot method in Matplotlib
- How to plot additional points on the top of a scatter plot in Matplotlib?
- Controlling the alpha value on a 3D scatter plot using Python and Matplotlib
- How to annotate the points on a scatter plot with automatically placed arrows in Matplotlib?
- Add a legend in a 3D scatterplot with scatter() in Matplotlib
- Plot a 3D surface from {x,y,z}-scatter data in Python Matplotlib
- Plotting scatter points with clover symbols in Matplotlib
- How to turn off transparency in Matplotlib's 3D Scatter plot?
- How to make a 3D scatter plot in Python?
Advertisements