tommytwoeyes
tommytwoeyes

Reputation: 483

Changing Figure Size in Sympy.mpmath.plot

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?

Upvotes: 4

Views: 3085

Answers (1)

Sergey Bushmanov
Sergey Bushmanov

Reputation: 25189

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

Upvotes: 5

Related Questions