user10449636
user10449636

Reputation:

figsize does not work for matplotlib 3d plot

I plotted 2 figures, here is the screenshot

figsize

the one (2D) on top is rendered as expected. the one (3D) on bottom is not, the figure is so small!

setting the value of figsize does not work.

figsize=(3,3) and figsize=(13,13) give the same result!

%matplotlib inline rendered same way.

I tried different browsers, clear the cache, dose not work either.

I guess some rcParams control this, because this is reproducible only on my mac, but I don't have a clue to find it!

any clue will be appreciated.

whole coding:

%pylab inline
from mpl_toolkits.mplot3d import Axes3D
fig = plt.figure(figsize=(3,3))
ax = fig.gca(projection='3d')
ax.scatter(0.5, 0.5, 0.5, marker = '^')

Upvotes: 4

Views: 3074

Answers (3)

Mateusz Bawaj
Mateusz Bawaj

Reputation: 1

Upgrading matplotlib from version 3.0.0 to 3.0.2 solved the problem. If you use pip type:

pip install --upgrade matplotlib

I verified the case with Jupyter version 4.4.0.

Upvotes: 0

Paul Gowder
Paul Gowder

Reputation: 2539

As of notebook version 5.7.4, on MacOS 10.14.2 and Chrome 71.0.3578.98, this problem persists but can be fixed with %matplotlib inline setting by using the magic command

%config InlineBackend.print_figure_kwargs = {'bbox_inches':None}

as given in the documentation here.

Correctly funcitoning example.

Upvotes: 3

NF997
NF997

Reputation: 1

It appears to be a bug in Jupyter. As a quick fix, you can use the notebook- instead of the inline-backend for matplotlib. To do so, replace %matplotlib inline with %matplotlib notebook.

Upvotes: 0

Related Questions