Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

how to increase the figure size in matplotlib

import matplotlib.pyplot as plt

plt.figure(figsize=(14,7)) 
plt.bar(x,y) 

# if you have plotted you graph directly using dataframe like this ↓
data.plot(kind='bar')

# then use this
plt.rcParams["figure.figsize"] = (14,7)

Comment

change plot size matplotlib python

plt.figure(figsize=(14,7))
Comment

plt.plot figure size

import matplotlib.pyplot as plt
plt.rcParams["figure.figsize"] = (20,3)
Comment

change plot size matplotlib

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

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

how to change plot size in matplotlib

# Import Library

import matplotlib.pyplot as plt

# Increase size of plot in jupyter

plt.rcParams["figure.figsize"] = (8,5.5)

# Define Data

x = [2, 4, 6, 8]
y = [5, 10, 15, 20]

# Plot

plt.plot(x, y, '-.')

# Display

plt.show()
Comment

PREVIOUS NEXT
Code Example
Python :: pandas Unnamed: 0 
Python :: flask sqlalchemy query specific columns 
Python :: how to use the random module in python 
Python :: accept user input in python 
Python :: get a colomn of csv in pandas 
Python :: python check if all caps 
Python :: python chrome 
Python :: python delete key from dictionary 
Python :: numpy count occurrences in array 
Python :: qlistwidget item clicked event pyqt 
Python :: python get desktop directory 
Python :: python send http request 
Python :: smallest program to make diamond python 
Python :: django get group users 
Python :: pandas change to first day 
Python :: list directory in python 
Python :: create a dictionary in python 
Python :: py declare type list 
Python :: convert array to set python 
Python :: dataframe from dict 
Python :: list with numbers between 2 values by 
Python :: python kivy 
Python :: merge two series by index 
Python :: converting decimal to hex in python 
Python :: access google transalte pandas 
Python :: Clear All the Chat in Discord Channel With Bot Python COde 
Python :: tkinter entry 
Python :: PYTHON 3.0 MAKE A HEART 
Python :: append in a for loop python 
Python :: time py 
ADD CONTENT
Topic
Content
Source link
Name
4+2 =