python - Adding labels to a matplotlib graph -
To keep the following code:
Import nppy as import matplotlib.pyplot plt Imported Matplotlib.dates as mdates days, impressions = np.loadtxt ('results_history.csv', unpack = true, delimiter = ',', usecols = (0,1), converters = {0: mdates .strpdate2num ('% d-Plt.title' ("load test result") # param = {'legend.labelsize': 500, "% ‧" = "% s")% plt.plot_date (x = days, y = # 'Legend.handlelength': 2, # 'legend.loc': 'top left', # 'labelpacing': 0.25, # ' Linewidth ': 50} # plt.rcParams .updates (params) plt.legend ("response time") plt.ylabel (" The graph is generated but I do not understand how I can add some xy labels to the generated graph:
Img src = "https://i.stack.imgur.com/YWCwo.jpg" alt = "Enter image details here">
Also tried to increase the legend text size, but the text Is not displayed. And labels overlap with X axis. CSV file:
01-05-14, 55494, Build 1 10-05-14, 55000, Build 2 15-05-14, 55500, Build 3 20-05-14, 57482 How can I add xytext from CSV and also change format for legend and x axis? Should be, such as:
plt.annotate ('some text', xy = (x [0], impression [0]))
X axis To adjust the text you can add:
fig = plt.figure () # below the import statement ... fig.autofmt_xdate () # after placing
To change legend text, use the label parameter in your plot function:
Plt.plot_date (x = day, y = impression, fmt = "r - ", label =" response time ")
that To increase the font size of the code, do this:
plt.legend (fontsize = 'x-large')
Comments
Post a Comment