Results 1 to 7 of 7

Thread: [RESOLVED] Creating a dynamic graph to visualise movement

  1. #1

    Thread Starter
    Member
    Join Date
    Oct 2016
    Posts
    52

    Resolved [RESOLVED] Creating a dynamic graph to visualise movement

    Hey all,

    I'm modelling insects, and I've reached the point of making them migrate (Success!). Unfortunately, It's pretty hard to tell whether the code is working as it should be, as all I see are lists of coordinates. Does anyone know how I could go about making a graphical visualisation of these insects?

    For some details; I have plants and insects, each plant has a patch number and an x, y coordinate. Each insect is on a plant, and it shares the patch/coordinates of its host plant. (These data are stored in a plant and insect array).

    The way I imagine I would go about this is to make a graph, X coordinates on X axis, Y on Y. I would then print the plant data on an excel sheet, and put circles on the graph using the coordinates (different patches would be represented by different colour circles). I'd then do the same for the insects. Then, I'd make a sub where each time an insect moves, the graph is updated to show it's new location/patch. I think that's about it...

    Does anyone see any issues with how this would work, or have any advise as to how to do it effectively?

    Cheers for your help!

  2. #2
    PowerPoster
    Join Date
    Oct 2008
    Location
    Midwest Region, United States
    Posts
    3,574

    Re: Creating a dynamic graph to visualise movement

    Are you able to create the graph as you describe it manually? If so, then you could write code to update it based on some "change event" (not sure how you're making the insects move exactly).

  3. #3

    Thread Starter
    Member
    Join Date
    Oct 2016
    Posts
    52

    Re: Creating a dynamic graph to visualise movement

    I have no clue how to make the graph, but I'm currently reading up on it.

    I don't think a change event would be suitable. What I have is a sub that takes the current location of an insect, does some maths to decide where it moves, then changes its coordinates/patch to those of the new plant. Of course, in the final model this will happen hundreds of times per loop.

    This graph tool won't be a thing that I'm using in any final model though, it's just a tool I need now to ensure that my code is working as intended.

    EDIT: I didn't even address your question haha! By manually do you mean making it manually in excel then manipulating with code? I intend to do everything via VBA.

  4. #4
    PowerPoster
    Join Date
    Oct 2008
    Location
    Midwest Region, United States
    Posts
    3,574

    Re: Creating a dynamic graph to visualise movement

    Yes, I was asking if you are able to manually create it in Excel (before trying to figure out how to code it).

  5. #5
    Don't Panic! Ecniv's Avatar
    Join Date
    Nov 2000
    Location
    Amsterdam...
    Posts
    5,343

    Re: Creating a dynamic graph to visualise movement

    Have a look at a scatter graph. You may need to convert the x,y coordinates depending on the size.
    Add series for the plant locations
    Add series for bug locations... Again you'll need to experiment to see what works best (assuming lots of bugs all moving...
    I guess (having not made a dynamic graph) that there is a refresh method on the graph that could be called either x time or after each update to the positions.... the latter being slow to show but more accurate.

    BOFH Now, BOFH Past, Information on duplicates

    Feeling like a fly on the inside of a closed window (Thunk!)
    If I post a lot, it is because I am bored at work! ;D Or stuck...
    * Anything I post can be only my opinion. Advice etc is up to you to persue...

  6. #6

    Thread Starter
    Member
    Join Date
    Oct 2016
    Posts
    52

    Re: Creating a dynamic graph to visualise movement

    Cheers for your advise guys!

    I ended up spending some time making a scatter graph manually, and at some point I'll just try produce code which will update it, which shouldn't be too difficult.

  7. #7
    Member pike's Avatar
    Join Date
    Jul 2008
    Location
    Alstonville, Australia
    Posts
    52

    Re: [RESOLVED] Creating a dynamic graph to visualise movement

    hope this helps.. you can do some crazy stuff with scattered charts
    Attached Files Attached Files

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width