Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

change size of plot

fig, ax = plt.subplots(figsize=(width,height))
Comment

change size of plot python

# importing the matplotlib library
import matplotlib.pyplot as plt
  
# values on x-axis
x = [1, 2, 3, 4, 5]
# values on y-axis
y = [1, 2, 3, 4, 5]
  
# naming the x and y axis
plt.xlabel('x - axis')
plt.ylabel('y - axis')
  
# plotting a line plot with it's default size
print("Plot in it's default size: ")
plt.plot(x, y)
plt.show()
  
# plotting a line plot after changing it's width and height
f = plt.figure()
f.set_figwidth(4)
f.set_figheight(1)
  
print("Plot after re-sizing: ")
plt.plot(x, y)
plt.show()
Comment

plot size

fig.set_size_inches(18.5, 10.5, forward=True)
Comment

plot size

from matplotlib.pyplot import figure
figure(num=None, figsize=(8, 6), dpi=80, facecolor='w', edgecolor='k')
Comment

PREVIOUS NEXT
Code Example
Python :: -1 in numpy reshape 
Python :: live plot loss 
Python :: concat dataframes 
Python :: index in list 
Python :: dictionary with double key python 
Python :: python read entire file 
Python :: how to connect wifi using python 
Python :: tensorflow_version 
Python :: how to take input in python 
Python :: py env 
Python :: import math sqrt python 
Python :: convert dictionary keys/values to lowercase in python 
Python :: python regex group 
Python :: float to string python 
Python :: dataframe create 
Python :: python convert to percentage 
Python :: label point matplotlib 
Python :: count number of spaces in string python 
Python :: python spotify player 
Python :: pandas select a row 
Python :: webdriver firefox install 
Python :: __file__ python 
Python :: datetime strptime format 
Python :: python list count() 
Python :: mongo db python 
Python :: pip install python-telegram-bot 
Python :: python date to timestamp 
Python :: user input python 
Python :: loss funfction suited for softmax 
Python :: Python program to draw star 
ADD CONTENT
Topic
Content
Source link
Name
9+6 =