How can I remove lines connecting markers?

Hello everyone,
I would like to remove the lines connecting markers and keeping just the markers (triangles,circles and asterisks). How can I do it?
Thank you.

 Akzeptierte Antwort

Star Strider
Star Strider am 19 Nov. 2021

0 Stimmen

I am not certain what the problem actually is.
One option is instead of plotting lines (the default for the plot function), specify it to plot only the markers, for example —
plot(giulia_daily.Time(:,1),[giulia_daily.Var5(:,1) med], '.');
↑ ← SPECIFY MARKER TO PLOT ONLY THE MARKER WITHOUT CONNECTING LINES
See if that gives the desired result.
.

8 Kommentare

Thank you, but I don't get anything.
plot(DYMAR(21:end), DATIMARannuali.SMB_mp_mm(21:end,1),'--co', 'MarkerEdgeColor','k','MarkerFaceColor','c', 'DisplayName','.');
The end operator must be used within an array index expression.
Star Strider
Star Strider am 19 Nov. 2021
This is wrong, and is throwing the error because it is a scalar, not an array:
DYMAR = datetime(DATIMARannuali.Year,1,1);
This works —
DYMAR = DATIMARannuali.Year;
plot(DYMAR(21:end), DATIMARannuali.SMB_mp_mm(21:end,1),'--co', 'MarkerEdgeColor','k','MarkerFaceColor','c', 'DisplayName','.');
Re-define ‘DYMAR’ as I did and that should solve that particular problem.
.
Pul
Pul am 24 Nov. 2021
Sorry for the late reply. I still see the link between markers, as you can see in the image below.
Thank you.
Star Strider
Star Strider am 24 Nov. 2021
My impression is that including the lines connecting the markers — rather than just the markers themselves — was the desired result.
Just change the line style to whatever works to produce the desired plot.
.
Pul
Pul am 24 Nov. 2021
I would like to have just markers, without the connecting lines.
Then just define the LineStyle differently —
DYMAR = DATIMARannuali.Year;
plot(DYMAR(21:end), DATIMARannuali.SMB_mp_mm(21:end,1),'co', 'MarkerEdgeColor','k','MarkerFaceColor','c', 'DisplayName','.');
That should work.
.
Pul
Pul am 25 Nov. 2021
Okay, thank you!
Star Strider
Star Strider am 25 Nov. 2021
As always, my pleasure! .

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Line Plots finden Sie in Hilfe-Center und File Exchange

Gefragt:

Pul
am 19 Nov. 2021

Bearbeitet:

Pul
am 25 Nov. 2021

Community Treasure Hunt

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

Start Hunting!

Translated by