title: postgresql and python
body: <p>I need to visualize spatial data (20 polygons) from "postgis" database (postgresql), with python. I know how to connect postgresql database with python only, but I don`t how to visualize those polygons. It is project for my university. We need to use for example matplotlib and create application in python which will visualize shapefiles (.shp) from postgresql database. </p>
  
  <p>I started with this code but I dont know how to continue:</p>
  
  <pre><code>import psycopg2
  conn = psycopg2.connect("dbname='***' user='***' host='***' password='***'")
  print 'Succesfully connected'
  
  cur = conn.cursor()
  cur.execute("""SELECT astext(the_geom) from buildings;""")
  listpoly = cur.fetchall()
  conn.close()
  </code></pre>