4

I hope this question isn't too elementary. I've searched extensively for a solution but haven't discovered one yet.

I've recently begun using Jupyter Notebook with Sympy to take notes and do my homework in my Calculus II class (and what a HUGE BENEFIT this has been!).

However, my sole problem with it is that I'm unable to figure out how to configure the size (i.e. the dimensions in pixels) of the plot figure.

It's easy enough to do using matplotlib directly (matplotlib.pyplot.figure() specifically), but I'm using the Sympy.mpmath.plotmodule because Sympy works much better for the symbolic manipulation we're doing in this course. I know Sympy has its own plotting module, but the one in mpmath seems easier to use so far (with the exception of this one issue, of course).

However, I've looked through the mpmath documentation and have googled the problem repeatedly, without a solution.

How can you change the size of the image that results from plotting a function using the mpmath API?

tommytwoeyes
  • 483
  • 5
  • 19

1 Answers1

5

You may try changing the size of sympy's plots via pyplot's rcParams:

import sympy
import matplotlib.pyplot as plt
%matplotlib inline

plt.rcParams['figure.figsize'] = 10, 3
sympy.mpmath.plot([cos, sin], [-4, 4])

enter image description here

Sergey Bushmanov
  • 23,310
  • 7
  • 53
  • 72