0
def visualize(goal_x, goal_y, goal_z, epoch_arr): # %% Create Color Map colormap = plt.get_cmap("binary") norm = matplotlib.colors.Normalize(vmin=min(epoch_arr), vmax=max(epoch_arr)) # %% 3D Plot fig = plt.figure() ax3D = fig.add_subplot(111, projection='3d') ax3D.set_facecolor('xkcd:salmon') ax3D.scatter(goal_x, goal_y, goal_z, s=100, c=colormap(norm(epoch_arr.values)), marker='o') plt.show() 

The above code produces the following picture: enter image description here

However, as you can see there is a point in the right side that is clearly still not 100% opaque. You can see the grid lines through the point. How do I make the scatter plot points 100% opaque, no transparency?

2 Answers 2

1

Some tricks will help. Here I plot all the markers in white first, then plot again on top using the intended color.

import matplotlib import numpy as np import matplotlib.pyplot as plt from mpl_toolkits.mplot3d import Axes3D # make-up some data goal_x = list(range(10)) goal_y = list(range(10)) goal_z = list(range(10)) epoch_arr = np.linspace(0,1,10) fig = plt.figure(figsize=(8,8)) ax3D = fig.add_subplot(111, projection='3d') ax3D.set_facecolor('xkcd:salmon') # First plot: all markers are in white color ax3D.scatter(goal_x, goal_y, goal_z, s=500, c='w', marker='o', alpha=1.0, zorder=10) colormap = plt.get_cmap("binary") norm = matplotlib.colors.Normalize(vmin=min(epoch_arr), vmax=max(epoch_arr)) #ax3D.scatter(goal_x, goal_y, goal_z, s=100, c=colormap(norm(epoch_arr.values)), marker='o') # Second plot: use intended colormap ax3D.scatter(goal_x, goal_y, goal_z, s=500, c='b', marker='o', zorder=11) plt.show() 

The resulting plot:

enter image description here

Sign up to request clarification or add additional context in comments.

Comments

0

Setting alpha=1 should be enough.

ax3D.scatter(..., alpha=1) 

Alternatively set depthshade=False

ax3D.scatter(..., depthshade=False) 

The result will be the same in both cases.

enter image description here

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.