diff --git a/_posts/python/style/images/2015-06-30-images.html b/_posts/python/style/images/2015-06-30-images.html index ecf576010e54..cf103d6b4519 100644 --- a/_posts/python/style/images/2015-06-30-images.html +++ b/_posts/python/style/images/2015-06-30-images.html @@ -346,7 +346,7 @@

Zoom on Static Imagesyaxis = go.layout.YAxis( visible=False, range = [0, img_height*scale_factor], -# the scaleanchor attribute ensures that the aspect ratio stays constant + # the scaleanchor attribute ensures that the aspect ratio stays constant scaleanchor = 'x'), width = img_width*scale_factor, height = img_height*scale_factor, @@ -387,7 +387,7 @@

Zoom on Static Images - + @@ -427,6 +427,7 @@

Interactive Facial Recognition import numpy as np import dlib + #load dlib's pretrained face detector cnn_human_detector = dlib.cnn_face_detection_model_v1('mmod_human_face_detector.dat') @@ -442,31 +443,36 @@

Interactive Facial Recognition dog_dets = cnn_dog_detector(img, 1) layout= go.Layout( - xaxis = go.layout.XAxis(showticklabels = False, - showgrid=False, - zeroline=False, - range = [0,img.shape[1]] - ), - yaxis = go.layout.YAxis(showticklabels = False, - showgrid=False, - zeroline=False, - range = [0,img.shape[0]] - ), - autosize=False, - height=img.shape[0], - width=img.shape[1], - images= [dict( - source= "https://raw.githubusercontent.com/michaelbabyn/plot_data/master/beethoven.jpg", - xref= "paper", - yref= "paper", - x= 0, - y= 1, - sizex= 1, - sizey= 1, - sizing= "stretch", - opacity= 1, - layer= "below")] - ) + xaxis = go.layout.XAxis( + showticklabels = False, + showgrid=False, + zeroline=False, + range = [0, img.shape[1]] + ), + yaxis = go.layout.YAxis( + showticklabels = False, + showgrid=False, + zeroline=False, + range = [0, img.shape[0]], + scaleanchor = 'x' + ), + autosize=False, + height=img.shape[0], + width=img.shape[1], + margin = {'l': 0, 'r': 0, 't': 0, 'b': 0}, + images= [dict( + source= "https://raw.githubusercontent.com/michaelbabyn/plot_data/master/beethoven.jpg", + x=0, + sizex=img.shape[1], + y=img.shape[0], + sizey=img.shape[0], + xref="x", + yref="y", + opacity=1.0, + layer="below", + sizing="stretch" + )] +) humans=[ go.Scatter( @@ -512,7 +518,7 @@

Interactive Facial Recognition
- +
diff --git a/_posts/python/style/images/images.ipynb b/_posts/python/style/images/images.ipynb index 95a2a607cd93..58346c16221e 100644 --- a/_posts/python/style/images/images.ipynb +++ b/_posts/python/style/images/images.ipynb @@ -288,7 +288,7 @@ { "data": { "text/html": [ - "" + "" ], "text/plain": [ "" @@ -314,7 +314,7 @@ " yaxis = go.layout.YAxis(\n", " visible=False,\n", " range = [0, img_height*scale_factor],\n", - "# the scaleanchor attribute ensures that the aspect ratio stays constant\n", + " # the scaleanchor attribute ensures that the aspect ratio stays constant\n", " scaleanchor = 'x'),\n", " width = img_width*scale_factor,\n", " height = img_height*scale_factor,\n", @@ -368,7 +368,7 @@ { "data": { "text/html": [ - "" + "" ], "text/plain": [ "" @@ -386,6 +386,7 @@ "import numpy as np\n", "import dlib\n", "\n", + "\n", "#load dlib's pretrained face detector\n", "cnn_human_detector = dlib.cnn_face_detection_model_v1('mmod_human_face_detector.dat')\n", "\n", @@ -401,31 +402,36 @@ "dog_dets = cnn_dog_detector(img, 1)\n", "\n", "layout= go.Layout(\n", - " xaxis = go.layout.XAxis(showticklabels = False,\n", - " showgrid=False,\n", - " zeroline=False,\n", - " range = [0,img.shape[1]]\n", - " ),\n", - " yaxis = go.layout.YAxis(showticklabels = False,\n", - " showgrid=False,\n", - " zeroline=False,\n", - " range = [0,img.shape[0]]\n", - " ),\n", - " autosize=False,\n", - " height=img.shape[0], \n", - " width=img.shape[1],\n", - " images= [dict(\n", - " source= \"https://raw.githubusercontent.com/michaelbabyn/plot_data/master/beethoven.jpg\",\n", - " xref= \"paper\",\n", - " yref= \"paper\",\n", - " x= 0,\n", - " y= 1,\n", - " sizex= 1,\n", - " sizey= 1,\n", - " sizing= \"stretch\",\n", - " opacity= 1,\n", - " layer= \"below\")]\n", - " )\n", + " xaxis = go.layout.XAxis(\n", + " showticklabels = False,\n", + " showgrid=False,\n", + " zeroline=False,\n", + " range = [0, img.shape[1]]\n", + " ),\n", + " yaxis = go.layout.YAxis(\n", + " showticklabels = False,\n", + " showgrid=False,\n", + " zeroline=False,\n", + " range = [0, img.shape[0]],\n", + " scaleanchor = 'x'\n", + " ),\n", + " autosize=False,\n", + " height=img.shape[0], \n", + " width=img.shape[1],\n", + " margin = {'l': 0, 'r': 0, 't': 0, 'b': 0},\n", + " images= [dict(\n", + " source= \"https://raw.githubusercontent.com/michaelbabyn/plot_data/master/beethoven.jpg\",\n", + " x=0,\n", + " sizex=img.shape[1],\n", + " y=img.shape[0],\n", + " sizey=img.shape[0],\n", + " xref=\"x\",\n", + " yref=\"y\",\n", + " opacity=1.0,\n", + " layer=\"below\",\n", + " sizing=\"stretch\"\n", + " )]\n", + ")\n", "\n", "humans=[\n", " go.Scatter(\n",