Skip to content

Problems with the legend when plotting multiple charts on same figure #195

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
xarico10 opened this issue Jul 26, 2021 · 0 comments
Open
Assignees

Comments

@xarico10
Copy link
Contributor

When placing a legend on a figure with multiple charts, only one of them is correctly labeled.
For example,

y2010 = [50 0 100 95];
y2011 = [65 22 97 120];
labels = {'Investments','Cash','Operations','Sales'};

t = tiledlayout(1,2,'TileSpacing','compact');

% Create pie charts
ax1 = nexttile;
pie(ax1,y2010)
title('2010')

ax2 = nexttile;
pie(ax2,y2011)
title('2011')

% Create legend
lgd = legend(labels);
lgd.Layout.Tile = 'east';

fig2plotly();

Expected and generated () plots:

Captura de Pantalla 2021-07-26 a la(s) 4 34 21 p  m

Captura de Pantalla 2021-07-26 a la(s) 4 34 46 p  m

As you can see, the two legends are pretty different.

The previous example can be found on:
https://www.mathworks.com/help/matlab/ref/pie.html#responsive_offcanvas

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants