Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

add rectangle matplotlib

import matplotlib.pyplot as plt
import matplotlib.patches as patches
from PIL import Image

im = Image.open('stinkbug.png')

# Create figure and axes
fig, ax = plt.subplots()

# Display the image
ax.imshow(im)

# Create a Rectangle patch
rect = patches.Rectangle((50, 100), 40, 30, linewidth=1, edgecolor='r', facecolor='none')

# Add the patch to the Axes
ax.add_patch(rect)

plt.show()
Comment

add rectangle matplotlib


import matplotlib.pyplot as plt
import matplotlib.patches as patches
from PIL import Image

im = Image.open('stinkbug.png')

# Create figure and axes
fig, ax = plt.subplots()

# Display the image
ax.imshow(im)

# Create a Rectangle patch
rect = patches.Rectangle((50, 100), 40, 30, linewidth=1, edgecolor='r', facecolor='none')

# Add the patch to the Axes
ax.add_patch(rect)

plt.show()

Comment

PREVIOUS NEXT
Code Example
Python :: Incorrect number of bindings supplied. The current statement uses 1, and there are 3 supplied. 
Python :: python code to open windows command prompt 
Python :: how to write a numpy array to a file in python 
Python :: how to make a infinite loop in python 
Python :: blender python save file 
Python :: how to count in a loop python 
Python :: argparse list 
Python :: how to find the text inside button in tkinter 
Python :: RuntimeWarning: invalid value encountered in true_divide 
Python :: remove spaces from a list python 
Python :: binary search tree iterator python 
Python :: get last element of array python 
Python :: drop column dataframe 
Python :: python cartesian product 
Python :: get classification report sklearn 
Python :: how to draw in pygame 
Python :: get file names in folder python 
Python :: draw a circle in python turtle 
Python :: how to increase bar width in python matplogtlib 
Python :: python - show repeted values in a column 
Python :: check object attributes python 
Python :: find first date python 
Python :: numpy function for calculation inverse of a matrix 
Python :: python get methods of object 
Python :: scrfoll with selenium python 
Python :: python program to find factorial 
Python :: file handling modes in python 
Python :: python program running time 
Python :: tuple with one element python 
Python :: rename index 
ADD CONTENT
Topic
Content
Source link
Name
1+3 =