python - Matplotlib draw boxes -


I have a set of data, where each value has one (x, y) coordinate, the coordination of the different values May be. And I want to draw them in a rectangular collection of boxes. For example, if I have data:

  A -> (0, 0) b -> gt; (0, 1) C - & gt; (1, 2) D -> (0, 1)  

I have to get the following drawing:

  0 1 2+++++++++++++ 0 + A + B + + +++++++++++++++++++++++++++++++++++++++ ++++++++++++++++++++++++++++++++++++++++++++ +++++++++++  

thanks

< Pre> # like x = {'a': (0,0), 'b': (0, 1), 'c': (1,2), 'd': (0,1) } # Grid xi = Map size (Tupal .__Getitim __, X Properties (), [1] * Lane (x)) Yi = Map (Tupal .__millingum___, X.values ​​(), [0] ] * Lane (x) xrng = (min (xi), max (xi) +1) yrng = (min (yi), max (yi) 1) range in y (yrng): # lines St '+' * ((xrng [1] -xrng [0]) * 3) + '+' k = {} # Each item is k [x] x in the list of elements in x (xrng) To: In this cell, # list of items in k [x] = [u for x in. Key () if x [u] == (y, x)] h = max (map (lane, k.value ()) for height # line height (h): row # (* xrng) ) * Line for x = c] = # S if k [x]: c.append (k [x] [0]) del k [x] [0] and: c.append ('') # small cell = "+" + "+". (C) + "Print Print" + "* ((XRNG [1] -xrng [0]) * 3) + '+'

Comments