Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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 = '^')

1 Answers

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.

like image 146
Paul Gowder Avatar answered Sep 02 '25 16:09

Paul Gowder



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!