# Using Graphics to plot data

I am trying to plot a 2D data as points using Graphics function. I would like to plot the points as six or five-pointed star; how to do that using Graphics? Also I would like to plot these points using a plotrange kind of thing, e.g. I have a dataset where x-column values range from 0.8 to 4.5 and y-values range from 0 to 4.5; I would like to plot the data using a plotrange: {{0.8,2.1},{0,2.0}} and I am using Graphics[Points[Most#@]]&/@data, when I am doing this all data points are being plotted beyond the plotrange I want them to be plotted for. How do I use a PlotRange like function to use in graphics. Any help will be appreciated, thank you.

• Please post a complete example. Jan 18, 2022 at 9:25
• What do you mean by x=(0,100)? Are you looking for something like this? over some range? Please load your data.
– Syed
Jan 18, 2022 at 10:06
• ListPlot[data, PlotMarkers -> Style[\[FivePointedStar], 14]] or with Style[\[SixPointedStar], 14] Jan 18, 2022 at 15:16

Using PolygonMarker:

datasets = RandomReal[{0 , 2.5}, {4, 20, 2}];

Graphics[{FaceForm[], EdgeForm[{AbsoluteThickness[1], JoinForm["Miter"]}],
EdgeForm[Blue],
ResourceFunction["PolygonMarker"]["SixPointedStarSlim", Offset[7], datasets[[1]]],
EdgeForm[Red],
ResourceFunction["PolygonMarker"]["FivePointedStarThick", Offset[7], datasets[[2]]],
EdgeForm[Darker@Green],
ResourceFunction["PolygonMarker"]["SixPointedStar", Offset[7], datasets[[3]]],
EdgeForm[Darker@Yellow],
ResourceFunction["PolygonMarker"]["FivePointedStar", Offset[7], datasets[[4]]]},
AspectRatio -> 1/2, ImageSize -> 550, Frame -> True, PlotRange -> {{0.8, 2.1}, {0, 2.0}},
PlotRangeClipping -> True]


• Thanks Alexey, this is working well
– mjm
Jan 19, 2022 at 15:27
• @mjm You are welcome! Jan 19, 2022 at 15:32

Something like:

Clear["Global*"]
dat = RandomReal[{0, 1}, {10, 2}];
t1 = 0.02 Table[{Cos[p], Sin[p]}, {p, 0, 2 Pi, 2 Pi/5}];
t2 = 0.005 Table[{Cos[p], Sin[p]}, {p, 2 Pi/10, 2 Pi, 2 Pi/5}];
star[r_] := Line[(r + #) & /@ Riffle[t1, t2]]
Graphics[star /@ dat]
`