Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to make a Matplotlib 3D plot bigger

I have this piece of code:

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

fig = plt.figure()
ax = fig.add_subplot(111, projection='3d')

ax.scatter(data.FAC1_1, data.FAC2_1, data.FAC3_1, c='r', marker='o')

ax.set_xlabel('X Label')
ax.set_ylabel('Y Label')
ax.set_zlabel('Z Label')

plt.show()

everything works perfectly fine. The only issue is that the scatter plot that comes out is really tiny. Is there a ay to make it bigger? I looked at the documentation but I wasn't able to find it.

like image 981
Riccardo moroletti Avatar asked Dec 05 '14 23:12

Riccardo moroletti


People also ask

How do you change the size of a 3D plot in Python?

If we want our plots to be bigger or smaller than the default size, we can easily set the size of the plot either when initializing the figure – using the figsize parameter of the plt. figure method, or we can update the size of an existing plot by calling the set_size_inches method on the figure object.

How do I zoom in Matplotlib 3D?

Matplotlib mplot3d toolkit One can rotate the 3D scene by simply clicking-and-dragging the scene. Zooming is done by right-clicking the scene and dragging the mouse up and down. Note that one does not use the zoom button like one would use for regular 2D plots.

How do I increase subplot size in Matplotlib?

To change the size of subplots in Matplotlib, use the plt. subplots() method with the figsize parameter (e.g., figsize=(8,6) ) to specify one size for all subplots — unit in inches — and the gridspec_kw parameter (e.g., gridspec_kw={'width_ratios': [2, 1]} ) to specify individual sizes.


1 Answers

You can make the figure itself bigger using figsize:

fig = plt.figure(figsize=(12,10))

To make the markers from the scatter plot bigger use s:

ax.scatter(data.FAC1_1, data.FAC2_1, data.FAC3_1, s=500, c='r', marker='o')
like image 163
Tim B Avatar answered Sep 19 '22 06:09

Tim B