- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Controlling the alpha value on a 3D scatter plot using Python and Matplotlib
To control the alpha value on a 3D scatter plot using Python and Matplotlib, we can set the facecolor and edgecolors value.
- Set the figure size and adjust the padding between and around the subplots.
- Create a new figure or activate an existing figure using figure() method.
- Add an '~.axes.Axes' to the figure as part of a subplot arrangement.
- Create x, y and z data points using numpy.
- Plot x, y and z points using scatter() method.
- Set the facecolors and edgecolors.
- To display the figure, use show() method.
Example
import numpy as np import matplotlib.pyplot as plt plt.rcParams["figure.figsize"] = [7.50, 3.50] plt.rcParams["figure.autolayout"] = True fig = plt.figure() ax = fig.add_subplot(projection='3d') x = np.random.sample(20) y = np.random.sample(20) z = np.random.sample(20) s = ax.scatter(x, y, z, c="r") s._set_facecolors, s._set_edgecolors = s.set_facecolors, s.set_edgecolors plt.show()
Output
- Related Articles
- Connecting two points on a 3D scatter plot in Python and Matplotlib
- Plot scatter points on 3d plot without axes and grids in Matplotlib
- Plot scatter points on a 3D projection with varying marker size in Matplotlib
- Plot a 3D surface from {x,y,z}-scatter data in Python Matplotlib
- How to make a 3D scatter plot in Python?
- How to plot 3D graphs using Python Matplotlib?
- Plot scatter points using plot method in Matplotlib
- How to plot scatter points in a 3D figure with a colorbar in Matplotlib?
- Adding a line to a scatter plot using Python's Matplotlib
- How to turn off transparency in Matplotlib's 3D Scatter plot?
- Plot scatter points on polar axis in Matplotlib
- How to plot additional points on the top of a scatter plot in Matplotlib?
- How to plot gamma distribution with alpha and beta parameters in Python using Matplotlib?
- How to plot a point on 3D axes in Matplotlib?
- Adding caption below X-axis for a scatter plot using Matplotlib

Advertisements