当前位置:网站首页>Using Matplotlib to add an external image at the canvas level
Using Matplotlib to add an external image at the canvas level
2022-06-26 04:45:00 【I am a little monster】
import matplotlib.pyplot as plt
from matplotlib.cbook import get_sample_data
from matplotlib.patches import Rectangle
imageArray=plt.imread('D:/ personal /1.jpg')
fig,ax=plt.subplots(1,1)
ai=ax.imshow(imageArray)
patch=Rectangle((1,0),200,3600)# Provide a graphic to crop the picture
ai.set_clip_path(patch)# Use the graphics provided above to crop the picture
ax.set_axis_off()# Eliminate the coordinate axis on the canvas
plt.show()
fig=plt.figure()
imageData1=plt.imread(r'D:\ personal \1.jpg') Read images
'''figimage Add an image to the canvas , And set the status of the image on the canvas
imageData1: Select to display to numpy An image file stored in the form of an array
origin: Set the starting point of the coordinate axis (0,0) Set in the upper left corner of the coordinate axis
alpha: Set transparency
resize: Whether to make the image size fit the canvas size
zorder: Prevent hierarchy of image file on canvas , The greater the numerical , Getting ahead '''
fig.figimage(imageData1,200,100,origin='upper',alpha=0.5,resize=True,zorder=1)
fig.savefig(r'D:\ personal \fig.svg')# Save image Open the saved file according to the saved path to see the effect
边栏推荐
- Multipass Chinese document - use multipass service to authorize the client
- Text horizontal alignment attribute text align and element vertical alignment attribute vertical align
- Tp6 multi table Association (table a is associated with table B, table B is associated with table C, and table d)
- 2022 talent strategic transformation under the development trend of digital economy
- Multipass Chinese document - share data with instances
- Advanced learning of MySQL (learning from Shang Silicon Valley teacher Zhou Yang)
- 202.2.9
- Navicat connects the pit of shardingsphere sub table and sub library plug-ins
- PIP batch complete uninstall package
- Numpy random number
猜你喜欢

2.22.2.14

Multipass中文文档-设置驱动

File upload and security dog

1.17 learning summary

Stm8 MCU ADC sampling function is triggered by timer
![[H5 development] 02 take you to develop H5 list page ~ including query, reset and submission functions](/img/39/64df931d5ec54d7d19ae444fa372ba.jpg)
[H5 development] 02 take you to develop H5 list page ~ including query, reset and submission functions

2020-12-18
![[H5 development] 03- take you hand in hand to improve H5 development - single submission vs batch submission with a common interface](/img/37/84b7d59818e854dac71d6f06700cde.jpg)
[H5 development] 03- take you hand in hand to improve H5 development - single submission vs batch submission with a common interface

ROS 笔记(07)— 客户端 Client 和服务端 Server 的实现

Realize video call and interactive live broadcast in the applet
随机推荐
Solution to composer error could not find package
0622 horse palm fell 9%
2.9 learning summary
1.12 learning summary
排序查询
1.21 learning summary
1.17 learning summary
Anti withdrawal test record
PHP get mobile number operator
Physical design of database design (2)
Sort query
Thinkphp6 parsing QR code
Install Damon database
Nightmare
PSIM software learning ---08 call of C program block
Svn correlation
TP5 distinct method paging problem
Large numbers (C language)
Condition query
1.11 learning summary