Skip to content

Commit

Permalink
Add information on image as agent portrayal shape
Browse files Browse the repository at this point in the history
At first I was wondering if it was possible to fill the grid with a custom image, but this was not clearly stated. Just recently I found out that it was already implemented! It is a shame not to use this feature. Could you consider also adding it to CanvasGridVisualization.py?
  • Loading branch information
rebeccadavidsson authored Feb 1, 2020
1 parent 0c06c69 commit 6f8617f
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions mesa/visualization/modules/CanvasGridVisualization.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,21 @@ class CanvasGrid(VisualizationElement):
A portrayal as a dictionary with the following structure:
"x", "y": Coordinates for the cell in which the object is placed.
"Shape": Can be either "circle", "rect" or "arrowHead"
"Shape": Can be either "circle", "rect", "arrowHead" or a custom image.
For Circles:
"r": The radius, defined as a fraction of cell size. r=1 will
fill the entire cell.
For Rectangles:
"w", "h": The width and height of the rectangle, which are in
fractions of cell width and height.
For arrowHead:
"scale": Proportion scaling as a fraction of cell size.
"heading_x": represents x direction unit vector.
"heading_y": represents y direction unit vector.
"scale": Proportion scaling as a fraction of cell size.
"heading_x": represents x direction unit vector.
"heading_y": represents y direction unit vector.
For an image:
The image must be placed in the same directory from which the
server is runned. An image has the attributes "x", "y",
"scale", "text" and "text_color".
"Color": The color to draw the shape in; needs to be a valid HTML
color, e.g."Red" or "#AA08F8"
"Filled": either "true" or "false", and determines whether the shape is
Expand Down

0 comments on commit 6f8617f

Please sign in to comment.