Legend (working with previous version) does not work in R2018b

Hi everyone!
I am trying to make a figure in Matlab R2018b with 4 different plots and a legend. However, Legend entries are not coherent, as you can see from the LineStyle.
FH1 = figure;
plot(n_values, Shann(1) .* ones(size(n_values,2)),'LineStyle','--', 'LineWidth', 1.5); grid on, hold on
plot(n_values, Pol(1, n_values, 1e-3),'LineStyle','-', 'LineWidth', 2); grid on, hold on
plot(n_values, Pol(1, n_values, 1e-4),'LineStyle','-', 'LineWidth', 2); grid on, hold on
plot(n_values, Pol(1, n_values, 1e-5),'LineStyle','-', 'LineWidth', 2); grid on, hold on
FH1.CurrentAxes.XLabel.String = 'Blocklength';
FH1.CurrentAxes.XLabel.FontSize= 15;
FH1.CurrentAxes.YLabel.String = 'MCR [bit per ch. use]';
FH1.CurrentAxes.YLabel.FontSize= 15;
FH1.CurrentAxes.FontSize = 18;
FH1.CurrentAxes.XLim= [80 1500];
FH1.CurrentAxes.YLim= [0.3 1.05];
LH = legend({'Shannon Capacity: C(\gamma) = log_{2}(1+\gamma)', 'Maximum Coding Rate with \epsilon = 10^{-3}','Maximum Coding Rate with \epsilon = 10^{-4}', 'Maximum Coding Rate with \epsilon = 10^{-5}'});
LH.Location = 'Southeast';
Figure1.jpg
Thanks in advance!

1 Comment

Try to make a MWE so we can run your code without any other dependencies and can reproduce your issue.
In the release notes you can see the behavior of the legend function was changed slightly. It may be the case that this introduced a bug. Have you checked the bug tracker if there was something reported?

Sign in to comment.

Answers (1)

I was not able to reprodcue that in 2018b it's better to contact Mathworks Support Team by clicking the Contact Us button on the top right corner of this page.

Products

Release

R2018b

Asked:

on 17 Jan 2019

Answered:

on 17 Jan 2019

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!