     if  node == null
       node = d3.select(@el).append('svg')
         .attr('id', @tag_id('mainsvg'))
-    node.attr('width', @mget('width')).attr("height", @mget('height'))
-
-  render_mainbox : ->
-    node = @tag_d3('mainbox')
-    if node == null
-      node = @tag_d3('mainsvg').append('rect').attr('id', @tag_id('mainbox'))
-    node.attr('fill', @model.get('background-color'))
+      node.append('g')
+          .attr('id', @tag_id('flipY'))
+          .append('g')
+          .attr('id', @tag_id('plotcontent'))
+
+    node.attr('width', @mget('outerwidth')).attr("height", @mget('outerheight'))
+    #svg puts origin in the top left, we want it on the bottom left
+    @tag_d3('flipY')
+      .attr('transform',
+        _.template('translate(0, {{h}} scale(1, -1)',
+          {'h' : @mget('outerheight')}))
+    @tag_d3('plotcontent').attr('transform',
+      _.template('translate({{s}}, {{s}})', {'s' : @mget('border_space')}))
+
+  render_frames : ->
+    innernode = @tag_d3('innerbox')
+    outernode = @tag_d3('outerbox')
+    if innernode == null
+      innernode = @tag_d3('plotcontent')
+        .append('rect').attr('id', @tag_id('innerbox'))
+      outernode = @tag_d3('flipY')
+        .append('rect').attr('id', @tag_id('outerbox'))
+
+    outernode.attr('fill', 'none')
+  		.attr('stroke', @model.get('foreground-color'))
+      .attr('width', @mget('outerwidth')).attr("height", @mget('outerheight'))
+
+    innernode.attr('fill', 'none')
   		.attr('stroke', @model.get('foreground-color'))
       .attr('width', @mget('width')).attr("height", @mget('height'))
 
   render : ->
     @render_mainsvg();
-    @render_mainbox();
+    @render_frames();
     for own key, view of @renderers
       view.render()
     if not @model.get_ref('parent')

  map_screen : (data) ->
    return @scale(data)

class ScatterRendererView extends BokehView
  render : ->
    svg = d3.select(@el).select('svg').append('g')
      .attr('id', @tag_id('g'))
      .selectAll(@model.get('mark'))
      .data(@model.get_ref('data_source').get('data'))

  initialize : (options) ->
    if not _.has(options, 'id')
      this.id = _.uniqueId('BokehView')
  tag_id : (tag, id) ->
    if not id
      id = this.id
    tag + "-" + id
  tag_el : (tag, id) ->
    @$el.find("#" + this.tag_id(tag, id))
  tag_d3 : (tag, id) ->
    val = d3.select(this.el).select("#" + this.tag_id(tag, id))
    if val[0][0] == null
      return null
    else
