Mathematica Asked on December 28, 2020
I use this code
ListPlot[Table[{n, Sin[2 n^2]}, {n, 1, 10}],
Frame -> True,
Joined -> True,
PlotStyle -> Directive[Blue, LineColor -> LightRed],
Mesh -> All,
PlotRange -> All,
Axes -> None]
and I get
Is it possible to change the ●
to ◆
using MeshStyle
?
I can get the desired result by
ListPlot[Table[{n, Sin[2 n^2]}, {n, 1, 10}],
Frame -> True,
Joined -> True,
PlotStyle -> Directive[Blue, LineColor -> LightRed],
PlotMarkers -> {"◆"},
PlotRange -> All,
Axes -> None]
but this does not help me, since in the domain I need to plot, some undesirable space arises between plot markers and the joined line.
Instead of a font glyph, you can use a graphics object as plot marker.
ChartElementData["FilledMarkers"]
gives the list of filled markers:
ChartElementData["FilledMarkers"] // Row
The third one is what we need:
filleddiamond = ChartElementData["FilledMarkers"][[3, 1, 1]];
ListPlot[Table[{n, Sin[2 n^2]}, {n, 1, 10}], Frame -> True, Joined -> True,
PlotStyle -> Directive[Blue, LineColor -> LightRed],
PlotMarkers -> {Graphics @ filleddiamond, .05},
PlotRange -> All, Axes -> None]
Correct answer by kglr on December 28, 2020
You could just replace points to diamonds:
ListPlot[Table[{n, Sin[2 n^2]}, {n, 1, 10}], Frame -> True,
Joined -> True, PlotStyle -> Directive[Blue, LineColor -> LightRed],
Mesh -> 20, PlotRange -> All,
Axes -> None] /. {Point[
pts_] :> (Inset["◆", #] & /@ pts)}
Answered by halmir on December 28, 2020
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP