masumhabib / PlotPub

Publication quality plot in MATLAB.
http://masumhabib.com/projects/publication-quality-graphs-matlab/plotpub-v2-0-documentation/
BSD 2-Clause "Simplified" License
288 stars 90 forks source link

Issue with Markers and Legends #31

Open free41 opened 5 years ago

free41 commented 5 years ago

I am seeing an issue when a legend is created with markers. Whenever a line includes a marker, the text in the legend corresponding to that line turns gray. I am using R2018a. The problem can be reproduced with:

% generate the signal
f = 50;  % frequency
Vm = 10; % peak
phi = 45; % phase
t = [0:0.0001:3/f];
th = 2*pi*f*t;
v1 = Vm*sin(th);
v2 = Vm*sin(th - phi);
v3 = Vm*sin(th - phi*2);

% plot them
plt = Plot(t*1E3, v1, t*1E3, v2, t*1E3, v3);

plt.LineStyle = {'-', '-', '-'}; % three line styles
plt.Markers = {'o', '', 's'};
plt.LegendBox = 'on';
plt.Legend = {'\theta = 0^o', '\theta = 45^o', '\theta = 90^o'}; % legends
dvcorreia commented 5 years ago

Having the same issue with the legend but with different problems in the markers. I'm using R2018b and the library is skipping some markers. The markers problem happens with and without legend. I've tried to mess with the MarkerSpacing but without success. The Plot properties and export can be seen bellow.

    plt = Plot(k, e(1, :), k, e(2, :));
    plt.LineStyle = {'--', '-'};
    plt.Markers = {'s', 'o'};
    plt.LegendBox = 'on';
    plt.MarkerSpacing = [0, 0];
    plt.Legend = {'Test Data', 'Training Data'};
    plt.XLabel = 'K';
    plt.YLabel = 'Misclassification rate';
    plt.Title = 'Misclassification rate';

lab1ex1_misclassificationrate