This example shows how to add multiple legends to a matplotlib plot. First, we plot two lines and save their references. Then, we create the first legend for the first line and add it to the axes using add_artist() to keep it visible. Next, we create the second legend for the second line. Finally, we display the plot with both legends visible at different locations. This method prevents the second legend from replacing the first. Variables like line1, line2, leg1, and leg2 track the plot elements and legends. Key points include the need for add_artist() to keep multiple legends and assigning legends to variables for control.