In this article, the example for you to share the Python call Matplotlib to plot the distribution of points to add labels of the specific code for your reference, the specific content is as follows
- Purpose of adding labels
- coding
- screenshot (computing)
goal
The above article describes the plotting of distribution points based on the size of the image as coordinates. My boss gave me another task, I plotted it, saved the graph each time, and sent it to her, but the coordinates of the points in the image were not displayable, so she asked me to add a label to each point, and the label was the horizontal and vertical coordinates of that point.
coding
import as plt from import rand import numpy import os import cv2 #setting plt (xmax=100,xmin=0) (ymax=100,ymin=0) ("height") ("width") path_1 = r'D:\zhangjichao\view\V7_scale_2\path_1' x = [] y = [] files = (path_1) for f in files: img = (path_1 + '\\' + f) ([0]) ([1]) (x,y,'ro',color='red',label='path_1') path_2 = r'D:\zhangjichao\view\V7_scale_2\path_2' x = [] y = [] files = (path_2) for f in files: img = (path_2 + '\\' + f) ([0]) ([1]) (x,y,'ro',color='red',label='path_2') path_3 = r'D:\zhangjichao\view\V7_scale_2\path_3' x = [] y = [] files = (path_3) for f in files: img = (path_3 + '\\' + f) ([0]) ([1]) (x,y,'ro',color='red',label='path_3') path_4 = r'D:\zhangjichao\view\V7_scale_2\path_4' x = [] y = [] files = (path_4) for f in files: img = (path_4 + '\\' + f) ([0]) ([1]) (x,y,'ro',color='red',label='path_4') yujing = r'D:\zhangjichao\view\V7_scale_2\xujing_org_scale_2' x = [] y = [] files = (yujing) for f in files: img = (yujing + '\\' + f) ([0]) ([1]) (x,y,'ro',color='green' , label='xujing') for i in range(1,len(x)): (x[i],y[i],str((x[i],y[i])), family='serif', style='italic', ha='right', wrap=True) (loc='upper center', shadow=True, fontsize='x-large') (True) ()
screenshot (computing)
This is the whole content of this article.