Problem with plotting - sorry there was an error in the code I copied

17 views
Skip to first unread message

Chitnis, Ajay (NIH/NICHD) [E]

unread,
May 8, 2024, 1:58:29 PMMay 8
to netlog...@googlegroups.com

Hi ,

I have what seems to be a trivial problem with plotting speed of a different individuals in a breed but I can’t figure out what I am doing wrong.

 

I have a breed called HCPs  (Hair Cell Precursors)

 

To name individual HCPs I gave them a variable called PNM (ProtoNeuroMast) which I could then specify 1-5

 

ask HCP
  [
   
if xcor  = min-pxcor + ( 1 * inter-PNM-distance )[  set PNM 1 ]
   
if xcor  = min-pxcor + ( 2 * inter-PNM-distance )[  set PNM 2 ]
   
if xcor  = min-pxcor + ( 3 * inter-PNM-distance )[  set PNM 3 ]
   
if xcor  = min-pxcor + ( 4 * inter-PNM-distance )[  set PNM 4 ]
   
if xcor  = min-pxcor + ( 5 * inter-PNM-distance )[  set PNM 5 ]
  ]

 

Now I need to individually plot speed of each of these HCPs whose PNM is set as 1, 2, 3, 3, 4 etc

 

So in the plot window for each pen I have

plot  [dx] of HCP with [PNM = 1]

 

But I get the following Runtime error

 

Runtime Error: PLOT expected input to be a number but got the list [-0.9659……] instead.

 

Graphical user interface, text, application, email

Description automatically generated

Steve Railsback

unread,
May 8, 2024, 3:00:28 PMMay 8
to netlogo-users
If you look up `of` you will see that it produces a list of the values of `dx` for all the HCP agents with PNM of 1.
And if you look up `plot` you will see that requires a number as an input, not a list.

It is not clear what you really want to plot. If you want to plot the mean speed, then use:
`plot mean [dx] of HCP with ...`

If you want each HCP agent to plot its dx, then use:
`ask HCP with [PNM = 1] [plot dx]`

But I think you will find that your plot doesn't make much sense. The X values don't mean anything (they just increase by 1 each time you plot a point) and you won't know the values of PNM for each point. I would offer suggestions but again I'm not sure what exactly you want.
Reply all
Reply to author
Forward
0 new messages