0

I want to save my plot in python with size 1920* 1080 pixel. The way that I am doing now is

plt.subplots(figsize=(10, 12))

Could you please help me with that? Thank you so much.

I tried to change the dpi and etc. However, it does not work for me.

1 Answers1

0

You can use fig.set_size_inches(19.20, 10.80) to make your plots 1920*1080 pixels at 100 dpi.

There are a lot of resources that shows how to change fig size;

A stackoverflow thread- How do I change the size of figures drawn with Matplotlib?

A FreeCodeCamp page

  • Thank you. I will check this. However, the first step gives me the error, 'tuple' object has no attribute 'set_size_inches'. I use 'plt.subplots' for my figure. – Jessica trevor Mar 21 '23 at 05:01
  • @Jessicatrevor `'tuple' object has no attribute 'set_size_inches'` means what you think is `fig` is in reality a tuple. You probably did `fig = plt.subplots(...)` instead of `fig, ax = plt.subplots(...)`. – JohanC Mar 21 '23 at 07:59