Weird vertical lines with plot function

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))
Warning: Graphics acceleration hardware is unavailable. Graphics quality and performance might be diminished. See MATLAB System Requirements.
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

Stephen23
Stephen23 2026년 5월 22일 13:02
편집: Stephen23 2026년 5월 22일 13:03
What OS ?
version
ans = '26.1.0.3203278 (R2026a)'
S = load('elpenon.mat')
S = struct with fields:
elpenon: [3594×3 double]
M = S.elpenon
M = 3594×3
12.0700 0 -4.5500 12.1100 0.4000 -3.5100 12.1600 0.8000 -4.0400 12.2000 1.2000 -4.6700 12.2500 1.6000 -4.9600 12.2900 2.0000 -5.3800 12.3400 2.4000 -5.0600 12.3800 2.8000 -5.3200 12.4300 3.2000 -5.3900 12.5200 4.0000 -5.3000 12.5600 4.4000 -5.1700 12.6100 4.8000 -5.3100 12.6500 5.2000 -5.5400 12.7000 5.6000 -5.4400 12.7400 6.0000 -5.6800
<mw-icon class=""></mw-icon>
<mw-icon class=""></mw-icon>
scatter(M(:,1)*1000,M(:,3),10,'k')
plot(M(:,1)*1000,M(:,3))
Olivier
Olivier 2026년 5월 22일 13:09
Dear Stephen23
MacOS Tahoe V 26.4.1
Walter Roberson
Walter Roberson 2026년 5월 22일 18:47
Datapoint:
I obtain normal plots with R2025b on MacOS Intel Tahoe 26.5
Olivier
Olivier 2026년 5월 27일 7:18
I updated both matlab and OS and still have the same result.
Could it come from some settings?
Torsten
Torsten 2026년 5월 27일 10:21
편집: Torsten 2026년 5월 27일 10:25
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
Olivier 2026년 5월 28일 6:43
Apple silicon.
It may be or not related but I now have weird lines within contour plot that used to work fine in a previous laptop.
I will try the support! Thanks for your help
Olivier
Olivier 2026년 5월 28일 8:37
Also, I realized that this happens when I have in the data several consecutive lines with a single x value but different y value.
Torsten
Torsten 2026년 5월 28일 13:59
Include a link to this question in your support request. Then you don't need to supply all the material twice.

댓글을 달려면 로그인하십시오.

답변 (2개)

Olivier
Olivier 2026년 6월 2일 14:13

0 개 추천

No actual solution was found.
I do have the same issue using Matlab online.
Although, using R2024a solved the problem.
Euhanne Reign
Euhanne Reign 2026년 6월 2일 15:20

0 개 추천

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

load elpenon
min(elpenon(:,3))
ans = -12.6800
max(elpenon(:,3))
ans = -1.3800
find(~isfinite(elpenon(:,3)))
ans = 0×1 empty double column vector
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
Euhanne Reign 2026년 6월 2일 16:36
good evening thank you for correcting me walter robinson I highly appreciate your feedback!
Euhanne Reign
Euhanne Reign 2026년 6월 2일 16:37
편집: Euhanne Reign 2026년 6월 2일 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!

댓글을 달려면 로그인하십시오.

카테고리

제품

릴리스

R2026a

태그

질문:

2026년 5월 22일 12:39

편집:

2026년 6월 2일 16:39

Community Treasure Hunt

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

Start Hunting!

Translated by