To create a legend with different marker sizes in Matlab, you can use the 'MarkerSize' property combined with the 'legend' function. Here's an example:
main.m373 chars19 lines
In this example, the plot
function is used to create two sets of data points with different marker sizes. The 'MarkerSize' property is set to 5 for the first set and 10 for the second set.
After plotting the data, the legend
function is called to create the legend. By default, the legend will have markers with the same size as the ones in the plot.
To adjust the marker sizes in the legend, you can find the Legend
object in the current figure using findobj
and set its MarkerSize
property to an array of values corresponding to the marker sizes in the plot. In this case, the marker sizes are set to [5, 10] to match the marker sizes in the plot.
gistlibby LogSnag