4
$\begingroup$

How can I remove the markers with some specific numbers, for example like 2,5,7?

mtps = ResourceFunction["PolygonMarker"][
  "ThreePointedStar", {Offset[7], 0}, {EdgeForm[Red], 
   FaceForm[None]}]; ListPlot[
 Labeled[#, #, Background -> None] & /@ Table[Prime[n], {n, 10}], 
 PlotMarkers -> {mtps}, PlotRange -> {{0, All}, {0, All}}, 
 Joined -> True, GridLines -> Automatic]

Most part of the code is taken from here. EDIT: I want to remove the markers not the numbers. enter image description here

$\endgroup$

1 Answer 1

11
$\begingroup$
data = Table[Prime[n], {n, 10}];    

ListPlot[
 Labeled[#, {#, # /. {2 | 5 | 7 -> None, _ -> mtps}}, {Automatic, 
     Center}, Background -> None] & /@ data, 
 PlotRange -> {{0, All}, {0, All}}, Joined -> True, 
 GridLines -> Automatic]

enter image description here

$\endgroup$
6
  • $\begingroup$ sorry that I meant to remove the markers not the numbers. $\endgroup$
    – hana
    Jun 25 at 20:44
  • 1
    $\begingroup$ @hana, pls try the updated version. $\endgroup$
    – kglr
    Jun 25 at 21:04
  • $\begingroup$ could you help me with my other question I asked yesterday? $\endgroup$
    – hana
    Jun 25 at 21:09
  • $\begingroup$ assume that I don't want labels how can I make it work? I tried this but it doesn't show anything. ListPlot[{#, # /. {2 | 5 | 7 -> None, _ -> mtps}} & /@ data, PlotRange -> {{0, All}, {0, All}}, Joined -> True, GridLines -> Automatic] $\endgroup$
    – hana
    Jun 25 at 21:13
  • 1
    $\begingroup$ try ListPlot[Labeled[#, # /. {2 | 5 | 7 -> None, _ -> mtps}, Center, Background -> None] & /@ data, PlotRange -> {{0, All}, {0, All}}, Joined -> True, GridLines -> Automatic]? $\endgroup$
    – kglr
    Jun 25 at 21:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.