Weird vertical lines with plot function
Mostrar comentarios más antiguos
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
8 comentarios
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
el 22 de Mayo de 2026 a las 13:09
Walter Roberson
el 22 de Mayo de 2026 a las 18:47
Datapoint:
I obtain normal plots with R2025b on MacOS Intel Tahoe 26.5
Olivier
el 27 de Mayo de 2026 a las 7:18
Contact support:
They can open a remote session on your computer and have a better chance to find what the problem is.
Do you have an Apple Silicon Mac or an Intel-based Mac ?
Olivier
el 28 de Mayo de 2026 a las 6:43
Olivier
el 28 de Mayo de 2026 a las 8:37
Respuestas (2)
Olivier
el 2 de Jun. de 2026 a las 14:13
0 votos
Euhanne Reign
el 2 de Jun. de 2026 a las 15:20
0 votos
hi good evening. when you have data at the same x value your concurrent value corresponding to differtiating y values will possibly make a spike since there might or might not be data in one subposition or nan position to the data corresponding to the chart. Which sets the value to negatives or higher than the data that is given, the only way for this problem is to fix the data manually at that certain point or fix the value of the chart data, that would fix the spike output in the output. This could also be fixed to downgrading to older version since some versions of matlab have the advantages on canceling out nan data(bugged data) please correct me if im wrong thank you have a good time!
3 comentarios
load elpenon
min(elpenon(:,3))
max(elpenon(:,3))
find(~isfinite(elpenon(:,3)))
figure(1)
x = elpenon(:,1)*1000;
plot(x, elpenon(:,3))
figure(2);
mask = x >= 2e4 & x <= 2.5e4;
plot(x(mask), elpenon(mask,3))
You can see from this that there are no spikes in the data, and no non-finite values.
Euhanne Reign
el 2 de Jun. de 2026 a las 16:36
good evening thank you for correcting me walter robinson I highly appreciate your feedback!
Euhanne Reign
el 2 de Jun. de 2026 a las 16:37
Editada: Euhanne Reign
el 2 de Jun. de 2026 a las 16:39
it’s a high disregard of my mistake of thinking its a chart non finite number error but and mistake of not checking it first in the plot thank you very much once again!
Categorías
Más información sobre Blackman en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!






