Weird vertical lines with plot function
Show older comments
Dear all,
While trying to plot a specific dataset, I encouter a weird behavior:
load elpenon
figure; scatter(elpenon(:,1)*1000,elpenon(:,3),10,'k')
gives the appropriate plot

However, when calling :
figure; plot(elpenon(:,1)*1000,elpenon(:,3))
I obtain this :

These weird vertical lines appears. No data support this as shown in the scatter plot.
max(elpenon(:,3))=-1.3800
so nothing above 0 but stil shown in the plot
changing linejoin properties does not solve the issue. The plot although is correct when setting linewidth to .1.
When using the pan tool in the figure window to move the plot around, the vertical lines diseappear when the origin of the extra line is outside of the x and y lims.


Can anyone explain this and propose a workaround?
Thanks
3 Comments
What OS ?
version
S = load('elpenon.mat')
M = S.elpenon
scatter(M(:,1)*1000,M(:,3),10,'k')
plot(M(:,1)*1000,M(:,3))
Olivier
6 minutes ago
Walter Roberson
9 minutes ago
Datapoint:
I obtain normal plots with R2025b on MacOS Intel Tahoe 26.5
Answers (1)
I am unable to reproduce that here.
This appears to produce the expected result --
LD = load(' elpenon.mat')
elpenon = LD.elpenon;
figure
plot(elpenon)
grid
legend(compose('Column #%d', 1:size(elpenon,2)), Location='best')
figure
plot(elpenon(:,1)*1E+3, elpenon(:,3))
grid
.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!




