Thursday 15 August 2013

python 2.7 - Boundaries of rectangles / plots in matplotlib -



python 2.7 - Boundaries of rectangles / plots in matplotlib -

i attempting create set of graphs using patches.rectangle in matplotlib, seems blur in boundaries of rectangle cause overlap. example, if utilize these 2 greenish rectangles:

http://puu.sh/cpzfw/fe6ed8834d.png

(i didn't have rep straight insert image)

i not sure how remove boundaries. in addition, how adapt subplot coordinates well, plot too.

thanks!

edit: sorry, here illustration code:

in range(nrows): (count, num) in enumerate(listx[2 * + 1]): if count == 0: rect_start = count elif num == listx[2 * + 1][count-1]: length += 1 elif listx[2 * + 1][count] != listx[2 * + 1][count-1]: if listx[2 * + 1][count-1] == '0': r1 = ptch.rectangle((rect_start,i), length, 1, color="blue", fill=true) rect.add_patch(r1) length = 1 rect_start = count if listx[2 * + 1][count-1] == '1': r1 = ptch.rectangle((rect_start,i), length, 1, color="black", fill=true) rect.add_patch(r1) length = 1 rect_start = count if listx[2 * + 1][count-1] == '2': r1 = ptch.rectangle((rect_start,i), length, 1, color="red", fill=true) rect.add_patch(r1) length = 1 rect_start = count if listx[2 * + 1][count-1] == '3': r1 = ptch.rectangle((rect_start,i), length, 1, color="green", fill=true) rect.add_patch(r1) length = 1 rect_start = count if not listx[2 * + 1][count-1].isdigit(): r1 = ptch.rectangle((rect_start,i), length, 1, color="yellow", fill=true) rect.add_patch(r1) length = 1 rect_start = count

i've had luck setting ec='none'. border drawn line (which has thickness in points), cause imprecise overlap. btw: if want precise size , edge-like effect, can set smaller colored rectangle on top of rectangle of different color (both ec='none').

python-2.7 matplotlib matplotlib-basemap

No comments:

Post a Comment