问题
How to plot a figure like the one given below?
Here the legend (green/blue) is plotted with some values (0.10 to 0.40) on each curve. Is there any possible solution or hints to do this?
Figure Reference:

回答1:
Plotting data labels within lines is possible with clabel (contour labels), although this requires that you to plot your data with the contour command.
Although if you can't plot it as a contour plot then you should be able to convert your plot data to a contour matrix format, see the matrix definition at the bottom of the help page on the contour algorithm. This is a simple 2 row vector defining your data points, you should be able to feed this matrix into the clabel function to print the data labels inline.
For the example below - I plotted the 3 lines using the plot command, saving the line handles in the array h. I then created a contour matrix from the plotted data, so for example if the red line had 50 data points then
C(1,1)=0.44; % data value to plot on the line
C(2,1)=50; % number of data points
C(1,2:51)=line1x; % x data points for the red line
C(2,2:51)=line1y; % y data points for the red line
I did it manually to test the idea but I'm sure you could write a simple function to create this matrix automatically from your data if required. Anyway repeat adding the other line data to the contour matrix then use the contour label command
clabel(C,h)
Which gives me this plot

来源:https://stackoverflow.com/questions/19319455/matlab-graph-plotting-legend-and-curves-with-labels