Legends in MATLAB®
How to configure and style the legend in Plotly with MATLAB®.
Plotly is known for its graphing libraries, but it's also a broader ecosystem for building interactive data apps, AI data analysis tools, and deploying and hosting Dash apps. Explore the full set of tools and platforms designed to help turn data into action. Discover Plotly.
Note: We are retiring documentation for R, MATLAB, Julia, and F#. Learn more about this change here.
Positioning Legends Inside the Plot
fig = figure;
plot([1 2 3 4 5 6 7 8],[1 2 5 6 3 3 2 5]);
hold on
plot([1 2 3 4 5 6 7 8],[1 6 2 3 4 7 7 8]);
legend('blue trace','orange trace');
fig2plotly(fig);
Positioning Legends Outside the Plot
fig = figure;
plot([1 2 3 4 5 6 7 8],[1 2 5 6 3 3 2 5]);
hold on
plot([1 2 3 4 5 6 7 8],[1 6 2 3 4 3 7 8]);
legend('blue trace','orange trace','Location','BestOutside');
fig2plotly(fig);