Question

I used the command below to create a 3D scatter plot:

from mpl_toolkits.mplot3d import Axes3D
import matplotlib.pyplot as plt

sizeseq = 2
colorseq = "k"

fig = plt.figure(1, (5,5), dpi=300)
ax = Axes3D(fig)
ax.view_init(20, -45)

x, y, z = [1,2,3,4,5,6,7,8,9,10], [1,2,3,4,5,6,7,8,9,10], [1,2,3,4,5,6,7,8,9,10]
ax.scatter(x, y, z, c=colorseq, s=sizeseq, lw=0, alpha=.8)

plt.show()

But the color of the dots look so light even when I set alpha to 1. They almost look like being behind a mask. It also seems dependent on the 3D position of the individual sots. Is there a way to make all of the dots look really dark and opaque?

Was it helpful?

Solution

This appears to be scatter using a fancy 3d effect so you can distinguish between dots in the foreground and dots in the background. You might have to hack mplot3d to get it to stop doing that.

Alternatively, you may be able to use plot3D which doesn't show this behaviour.

ax.plot3D(x, y, z, 'k.', alpha=.8)

OTHER TIPS

With alpha=0.8 dots already look very transparent. Don't use alpha.
In addition you can give a darker look to your dots by drawing their edgelines in a darker color than their respective facecolor.
Use scatter keyword parameter edgecolor/edgecolors or set after scatter creation(for example to bold all the points with a black border) with myscatterplot.set_edgecolors(color)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top