0

I would like to be able to change the size of a chart in matplotlib. I have so far only been able to change the size of the window, but not the chart. I haven't been able to locate anything about this in documentation.

My Code so far:

import matplotlib.pyplot as plt
plt.rcParams['figure.figsize'] = 5,2

1 Answer 1

1

You don't need to modify your rcParams if you don't want to, you can pass the figsize as a keyword when you make the figure. For changing the size of the Axes (I believe that's what you mean by 'chart'), the position keyword is what you're looking for if you use add_subplot, or just the input parameter if you use add_axes. You specify it as [left, bottom, width, height]. The relevant documentation is here.

import matplotlib.pyplot as plt
fig = plt.figure(figsize=(5,2))
ax = fig.add_subplot(111, position=[0.01, 0.01, 0.98, 0.98])
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.