Message Boards Message Boards

GROUPS:

[✓] Use Epilog in Manipulate?

Posted 4 months ago
586 Views
|
2 Replies
|
3 Total Likes
|

Hello,

Epilog with "No Points" in Manipulate are not working as it should be. Does anyone know what's wrong?

data2 = {{1, 10}, {2, 11}, {3, 20}, {4, 30}};
Manipulate[
 ListLinePlot[data2
  , Epilog -> If[points == "No Points", None
    , If[points == "Points", {PointSize[0.04], Red, Point[data2]}]
    ]]
 , {points, {"No Points", "Points"}}
 ]

Thank you in advance !

Regards,....Jos

2 Replies
Posted 4 months ago

Jos,

None is an option value, it cannot be used as a graphics primitive. Use an empty list instead.

Manipulate[
 ListLinePlot[data2, 
  Epilog -> 
   If[points == "No Points", {}, 
    If[points == "Points", {PointSize[0.04], Red, 
      Point[data2]}]]], {points, {"No Points", "Points"}}]

For this situation, I find it easier to read using Which rather than nested If.

Manipulate[
 ListLinePlot[data2, 
  Epilog -> 
   Which[points == "No Points", {}, 
         points == "Points", {PointSize[0.04], Red, Point[data2]}]], 
 {points, {"No Points", "Points"}}]

Dear Rohit Namjoshi,

Thanks for your quick reply and help.

I was not aware that the function "Which" could be used in this type of plot and also that the function "None" could not be used as a graphics primitive.

My plots with over 55,000 raw data are now working perfectly.

Thanks again for your help, this is very much appreciated.

Best Regards,....Jos

Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract