Skip to main content



# Packages
import numpy as np
import matplotlib.pyplot as plt
from matplotlib import cm

# Use LaTeX font
plt.rcParams.update({'text.usetex': True})

# Figure font config
label_font = {'fontfamily': 'Arial Black', 'fontsize': 14}
title_font = {'fontfamily': 'Arial Black', 'fontsize': 14}

# Load data
value = np.load('../data/single-3dplot-2.npy')

x, y, z = np.meshgrid(
    np.linspace(0, 1, num=64, endpoint=True),
    np.linspace(0, 1, num=64, endpoint=True),
    np.linspace(0, 1, num=64, endpoint=True)
)

# Plot
ax = plt.figure(figsize=(6, 6)).add_subplot(projection='3d')
ax.scatter(x, y, z, s=3, c=value, cmap=cm.inferno, alpha=0.1)

ax.set_xlabel('x', fontdict=label_font)
ax.set_ylabel('y', fontdict=label_font)
ax.set_zlabel('z', fontdict=label_font)
ax.set_title('Single 3D Plot 2', fontdict=title_font)

ax.tick_params(axis='both', which='major', labelsize=12)
ax.tick_params(axis='both', which='minor', labelsize=12)

labels = ax.get_xticklabels() + ax.get_yticklabels() + ax.get_zticklabels()
[label.set_fontname('serif') for label in labels]

plt.tight_layout()
plt.savefig('../fig/single-3dplot-2.jpg', dpi=300)