prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  Documentation is not reflecting latest changes wrt width-height argument order in Grid()
  As many people start with reading  mesa on readthedocs, the documentation should be inline with the code changes wrt width-height argument order in Grid functions.This is not yet reflected.
  
  
  </issue>
  <code>
  [start of mesa/visualization/modules/CanvasGridVisualization.py]
  1 # -*- coding: utf-8 -*-
  2 """
  3 Modular Canvas Rendering
  4 ========================
  5 
  6 Module for visualizing model objects in grid cells.
  7 
  8 """
  9 from collections import defaultdict
  10 from mesa.visualization.ModularVisualization import VisualizationElement
  11 
  12 
  13 class CanvasGrid(VisualizationElement):
  14     """ A CanvasGrid object uses a user-provided portrayal method to generate a
  15     portrayal for each object. A portrayal is a JSON-ready dictionary which
  16     tells the relevant JavaScript code (GridDraw.js) where to draw what shape.
  17 
  18     The render method returns a dictionary, keyed on layers, with values as
  19     lists of portrayals to draw. Portrayals themselves are generated by the
  20     user-provided portrayal_method, which accepts an object as an input and
  21     produces a portrayal of it.
  22 
  23     A portrayal as a dictionary with the following structure:
  24         "x", "y": Coordinates for the cell in which the object is placed.
  25         "Shape": Can be either "circle" or "rect"
  26             For Circles:
  27                 "r": The radius, defined as a fraction of cell size. r=1 will
  28                      fill the entire cell.
  29             For rectangles:
  30                 "w", "h": The width and height of the rectangle, which are in
  31                           fractions of cell width and height.
  32         "Color": The color to draw the shape in; needs to be a valid HTML
  33                  color, e.g."Red" or "#AA08F8"
  34         "Filled": either "true" or "false", and determines whether the shape is
  35                   filled or not.
  36         "Layer": Layer number of 0 or above; higher-numbered layers are drawn
  37                  above lower-numbered layers.
  38         "text": The text to be inscribed inside the Shape. Normally useful for
  39                 showing the unique_id of the agent.
  40         "text_color": The color to draw the inscribed text. Should be given in
  41                       conjunction of "text" property.
  42 
  43 
  44     Attributes:
  45         portrayal_method: Function which generates portrayals from objects, as
  46                           described above.
  47         grid_height, grid_width: Size of the grid to visualize, in cells.
  48         canvas_height, canvas_width: Size, in pixels, of the grid visualization
  49                                      to draw on the client.
  50         template: "canvas_module.html" stores the module's HTML template.
  51 
  52     """
  53     package_includes = ["GridDraw.js", "CanvasModule.js"]
  54     portrayal_method = None  # Portrayal function
  55     canvas_width = 500
  56     canvas_height = 500
  57 
  58     def __init__(self, portrayal_method, grid_width, grid_height,
  59                  canvas_width=500, canvas_height=500):
  60         """ Instantiate a new CanvasGrid.
  61 
  62         Args:
  63             portrayal_method: function to convert each object on the grid to
  64                               a portrayal, as described above.
  65             grid_width, grid_height: Size of the grid, in cells.
  66             canvas_height, canvas_width: Size of the canvas to draw in the
  67                                          client, in pixels. (default: 500x500)
  68 
  69         """
  70         self.portrayal_method = portrayal_method
  71         self.grid_width = grid_width
  72         self.grid_height = grid_height
  73         self.canvas_width = canvas_width
  74         self.canvas_height = canvas_height
  75 
  76         new_element = ("new CanvasModule({}, {}, {}, {})"
  77             .format(self.canvas_width, self.canvas_height,
  78                 self.grid_width, self.grid_height))
  79 
  80         self.js_code = "elements.push(" + new_element + ");"
  81 
  82     def render(self, model):
  83         grid_state = defaultdict(list)
  84         for x in range(model.grid.width):
  85             for y in range(model.grid.height):
  86                 cell_objects = model.grid.get_cell_list_contents([(x, y)])
  87                 for obj in cell_objects:
  88                     portrayal = self.portrayal_method(obj)
  89                     if portrayal:
  90                         portrayal["x"] = x
  91                         portrayal["y"] = y
  92                         grid_state[portrayal["Layer"]].append(portrayal)
  93 
  94         return grid_state
  95
  [end of mesa/visualization/modules/CanvasGridVisualization.py]
  [start of examples/Basic/basic/server.py]
  1 import random
  2 
  3 from mesa.visualization.modules import CanvasGrid
  4 from mesa.visualization.ModularVisualization import ModularServer
  5 
  6 from basic.model import Walker, ShapesModel
  7 
  8 
  9 def agent_draw(agent):
  10     portrayal = None
  11     if agent is None:
  12         # Actually this if part is unnecessary, but still keeping it for
  13         # aesthetics
  14         pass
  15     elif isinstance(agent, Walker):
  16         print("Uid: {0}, Heading: {1}".format(agent.unique_id, agent.heading))
  17         portrayal = {"Shape": "arrowHead",
  18                      "Filled": "true",
  19                      "Layer": 2,
  20                      "Color": "green",
  21                      "Filled": "true",
  22                      "heading0": agent.heading[0],
  23                      "heading1": agent.heading[1],
  24                      "text": agent.unique_id,
  25                      "text_color": "white",
  26                      "scale": 0.8,
  27                      }
  28     return portrayal
  29 
  30 
  31 def launch_basic():
  32     width = 15
  33     height = 10
  34     num_agents = 2
  35     pixel_ratio = 50
  36     grid = CanvasGrid(agent_draw, width, height,
  37                       width * pixel_ratio, height * pixel_ratio)
  38     server = ModularServer(ShapesModel, [grid], "Basic Example",
  39                            num_agents, width, height)
  40     server.max_steps = 0
  41     server.port = 8888
  42     server.launch()
  43 
  44 if __name__ == "__main__":
  45     random.seed(3)
  46     launch_basic()
  47
  [end of examples/Basic/basic/server.py]
  </code>
  
  I need you to solve this issue by generating a single patch file that I can apply directly to this repository using git apply. Please respond with a single patch file in the following format.
  <patch>
  diff --git a/file.py b/file.py
  --- a/file.py
  +++ b/file.py
  @@ -1,27 +1,35 @@
   def euclidean(a, b):
  -    while b:
  -        a, b = b, a % b
  -    return a
  +    if b == 0:
  +        return a
  +    return euclidean(b, a % b)
   
   
   def bresenham(x0, y0, x1, y1):
       points = []
       dx = abs(x1 - x0)
       dy = abs(y1 - y0)
  -    sx = 1 if x0 < x1 else -1
  -    sy = 1 if y0 < y1 else -1
  -    err = dx - dy
  +    x, y = x0, y0
  +    sx = -1 if x0 > x1 else 1
  +    sy = -1 if y0 > y1 else 1
   
  -    while True:
  -        points.append((x0, y0))
  -        if x0 == x1 and y0 == y1:
  -            break
  -        e2 = 2 * err
  -        if e2 > -dy:
  -            err -= dy
  -            x0 += sx
  -        if e2 < dx:
  -            err += dx
  -            y0 += sy
  +    if dx > dy:
  +        err = dx / 2.0
  +        while x != x1:
  +            points.append((x, y))
  +            err -= dy
  +            if err < 0:
  +                y += sy
  +                err += dx
  +            x += sx
  +    else:
  +        err = dy / 2.0
  +        while y != y1:
  +            points.append((x, y))
  +            err -= dx
  +            if err < 0:
  +                x += sx
  +                err += dy
  +            y += sy
  +
  +    points.append((x, y))
       return points
  
  </patch>
golden_diff: diff --git a/examples/Basic/basic/server.py b/examples/Basic/basic/server.py
  --- a/examples/Basic/basic/server.py
  +++ b/examples/Basic/basic/server.py
  @@ -19,8 +19,8 @@
                        "Layer": 2,
                        "Color": "green",
                        "Filled": "true",
  -                     "heading0": agent.heading[0],
  -                     "heading1": agent.heading[1],
  +                     "heading_x": agent.heading[0],
  +                     "heading_y": agent.heading[1],
                        "text": agent.unique_id,
                        "text_color": "white",
                        "scale": 0.8,
  diff --git a/mesa/visualization/modules/CanvasGridVisualization.py b/mesa/visualization/modules/CanvasGridVisualization.py
  --- a/mesa/visualization/modules/CanvasGridVisualization.py
  +++ b/mesa/visualization/modules/CanvasGridVisualization.py
  @@ -22,13 +22,17 @@
   
       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" or "rect"
  +        "Shape": Can be either "circle", "rect" or "arrowHead"
               For Circles:
                   "r": The radius, defined as a fraction of cell size. r=1 will
                        fill the entire cell.
  -            For rectangles:
  +            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.
           "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
  
verification_info: {"golden_diff": "diff --git a/examples/Basic/basic/server.py b/examples/Basic/basic/server.py\n--- a/examples/Basic/basic/server.py\n+++ b/examples/Basic/basic/server.py\n@@ -19,8 +19,8 @@\n                      \"Layer\": 2,\n                      \"Color\": \"green\",\n                      \"Filled\": \"true\",\n-                     \"heading0\": agent.heading[0],\n-                     \"heading1\": agent.heading[1],\n+                     \"heading_x\": agent.heading[0],\n+                     \"heading_y\": agent.heading[1],\n                      \"text\": agent.unique_id,\n                      \"text_color\": \"white\",\n                      \"scale\": 0.8,\ndiff --git a/mesa/visualization/modules/CanvasGridVisualization.py b/mesa/visualization/modules/CanvasGridVisualization.py\n--- a/mesa/visualization/modules/CanvasGridVisualization.py\n+++ b/mesa/visualization/modules/CanvasGridVisualization.py\n@@ -22,13 +22,17 @@\n \n     A portrayal as a dictionary with the following structure:\n         \"x\", \"y\": Coordinates for the cell in which the object is placed.\n-        \"Shape\": Can be either \"circle\" or \"rect\"\n+        \"Shape\": Can be either \"circle\", \"rect\" or \"arrowHead\"\n             For Circles:\n                 \"r\": The radius, defined as a fraction of cell size. r=1 will\n                      fill the entire cell.\n-            For rectangles:\n+            For Rectangles:\n                 \"w\", \"h\": The width and height of the rectangle, which are in\n                           fractions of cell width and height.\n+            For arrowHead:\n+            \"scale\": Proportion scaling as a fraction of cell size.\n+            \"heading_x\": represents x direction unit vector.\n+            \"heading_y\": represents y direction unit vector.\n         \"Color\": The color to draw the shape in; needs to be a valid HTML\n                  color, e.g.\"Red\" or \"#AA08F8\"\n         \"Filled\": either \"true\" or \"false\", and determines whether the shape is\n", "issue": "Documentation is not reflecting latest changes wrt width-height argument order in Grid()\nAs many people start with reading  mesa on readthedocs, the documentation should be inline with the code changes wrt width-height argument order in Grid functions.This is not yet reflected.\n\n", "before_files": [{"content": "# -*- coding: utf-8 -*-\n\"\"\"\nModular Canvas Rendering\n========================\n\nModule for visualizing model objects in grid cells.\n\n\"\"\"\nfrom collections import defaultdict\nfrom mesa.visualization.ModularVisualization import VisualizationElement\n\n\nclass CanvasGrid(VisualizationElement):\n    \"\"\" A CanvasGrid object uses a user-provided portrayal method to generate a\n    portrayal for each object. A portrayal is a JSON-ready dictionary which\n    tells the relevant JavaScript code (GridDraw.js) where to draw what shape.\n\n    The render method returns a dictionary, keyed on layers, with values as\n    lists of portrayals to draw. Portrayals themselves are generated by the\n    user-provided portrayal_method, which accepts an object as an input and\n    produces a portrayal of it.\n\n    A portrayal as a dictionary with the following structure:\n        \"x\", \"y\": Coordinates for the cell in which the object is placed.\n        \"Shape\": Can be either \"circle\" or \"rect\"\n            For Circles:\n                \"r\": The radius, defined as a fraction of cell size. r=1 will\n                     fill the entire cell.\n            For rectangles:\n                \"w\", \"h\": The width and height of the rectangle, which are in\n                          fractions of cell width and height.\n        \"Color\": The color to draw the shape in; needs to be a valid HTML\n                 color, e.g.\"Red\" or \"#AA08F8\"\n        \"Filled\": either \"true\" or \"false\", and determines whether the shape is\n                  filled or not.\n        \"Layer\": Layer number of 0 or above; higher-numbered layers are drawn\n                 above lower-numbered layers.\n        \"text\": The text to be inscribed inside the Shape. Normally useful for\n                showing the unique_id of the agent.\n        \"text_color\": The color to draw the inscribed text. Should be given in\n                      conjunction of \"text\" property.\n\n\n    Attributes:\n        portrayal_method: Function which generates portrayals from objects, as\n                          described above.\n        grid_height, grid_width: Size of the grid to visualize, in cells.\n        canvas_height, canvas_width: Size, in pixels, of the grid visualization\n                                     to draw on the client.\n        template: \"canvas_module.html\" stores the module's HTML template.\n\n    \"\"\"\n    package_includes = [\"GridDraw.js\", \"CanvasModule.js\"]\n    portrayal_method = None  # Portrayal function\n    canvas_width = 500\n    canvas_height = 500\n\n    def __init__(self, portrayal_method, grid_width, grid_height,\n                 canvas_width=500, canvas_height=500):\n        \"\"\" Instantiate a new CanvasGrid.\n\n        Args:\n            portrayal_method: function to convert each object on the grid to\n                              a portrayal, as described above.\n            grid_width, grid_height: Size of the grid, in cells.\n            canvas_height, canvas_width: Size of the canvas to draw in the\n                                         client, in pixels. (default: 500x500)\n\n        \"\"\"\n        self.portrayal_method = portrayal_method\n        self.grid_width = grid_width\n        self.grid_height = grid_height\n        self.canvas_width = canvas_width\n        self.canvas_height = canvas_height\n\n        new_element = (\"new CanvasModule({}, {}, {}, {})\"\n            .format(self.canvas_width, self.canvas_height,\n                self.grid_width, self.grid_height))\n\n        self.js_code = \"elements.push(\" + new_element + \");\"\n\n    def render(self, model):\n        grid_state = defaultdict(list)\n        for x in range(model.grid.width):\n            for y in range(model.grid.height):\n                cell_objects = model.grid.get_cell_list_contents([(x, y)])\n                for obj in cell_objects:\n                    portrayal = self.portrayal_method(obj)\n                    if portrayal:\n                        portrayal[\"x\"] = x\n                        portrayal[\"y\"] = y\n                        grid_state[portrayal[\"Layer\"]].append(portrayal)\n\n        return grid_state\n", "path": "mesa/visualization/modules/CanvasGridVisualization.py"}, {"content": "import random\n\nfrom mesa.visualization.modules import CanvasGrid\nfrom mesa.visualization.ModularVisualization import ModularServer\n\nfrom basic.model import Walker, ShapesModel\n\n\ndef agent_draw(agent):\n    portrayal = None\n    if agent is None:\n        # Actually this if part is unnecessary, but still keeping it for\n        # aesthetics\n        pass\n    elif isinstance(agent, Walker):\n        print(\"Uid: {0}, Heading: {1}\".format(agent.unique_id, agent.heading))\n        portrayal = {\"Shape\": \"arrowHead\",\n                     \"Filled\": \"true\",\n                     \"Layer\": 2,\n                     \"Color\": \"green\",\n                     \"Filled\": \"true\",\n                     \"heading0\": agent.heading[0],\n                     \"heading1\": agent.heading[1],\n                     \"text\": agent.unique_id,\n                     \"text_color\": \"white\",\n                     \"scale\": 0.8,\n                     }\n    return portrayal\n\n\ndef launch_basic():\n    width = 15\n    height = 10\n    num_agents = 2\n    pixel_ratio = 50\n    grid = CanvasGrid(agent_draw, width, height,\n                      width * pixel_ratio, height * pixel_ratio)\n    server = ModularServer(ShapesModel, [grid], \"Basic Example\",\n                           num_agents, width, height)\n    server.max_steps = 0\n    server.port = 8888\n    server.launch()\n\nif __name__ == \"__main__\":\n    random.seed(3)\n    launch_basic()\n", "path": "examples/Basic/basic/server.py"}]}