From 8d3a42cdd48c8949126fc4db9eda452d3522f39e Mon Sep 17 00:00:00 2001 From: Adam Kulidjian Date: Fri, 19 Aug 2016 16:41:21 -0400 Subject: [PATCH 1/4] added appropriate colorbar max and min values, edges_color to param for line coloring, and making code more clear --- plotly/tools.py | 55 ++++++++++++++++++++++++++++++++----------------- 1 file changed, 36 insertions(+), 19 deletions(-) diff --git a/plotly/tools.py b/plotly/tools.py index f1177f3945f..8bfc67dab7e 100644 --- a/plotly/tools.py +++ b/plotly/tools.py @@ -3269,9 +3269,9 @@ def _map_face2color(face, colormap, vmin, vmax): return face_color @staticmethod - def _trisurf(x, y, z, simplices, show_colorbar, colormap=None, - color_func=None, plot_edges=False, x_edge=None, y_edge=None, - z_edge=None, facecolor=None): + def _trisurf(x, y, z, simplices, show_colorbar, edges_color, + colormap=None, color_func=None, plot_edges=False, + x_edge=None, y_edge=None, z_edge=None, facecolor=None): """ Refer to FigureFactory.create_trisurf() for docstring """ @@ -3305,7 +3305,7 @@ def _trisurf(x, y, z, simplices, show_colorbar, colormap=None, color_func[index] = FigureFactory._label_rgb(foo) mean_dists = np.asarray(color_func) - else: + elif hasattr(color_func, '__call__'): # apply user inputted function to calculate # custom coloring for triangle vertices mean_dists = [] @@ -3333,30 +3333,39 @@ def _trisurf(x, y, z, simplices, show_colorbar, colormap=None, max_mean_dists) facecolor.append(color) - # Make sure we have arrays to speed up plotting + # Make sure facecolor is a list so output is consistent across Pythons facecolor = list(facecolor) ii, jj, kk = simplices.T - # make a colorscale from the colors - colorscale = FigureFactory._make_colorscale(colormap) - colorscale = FigureFactory._convert_colorscale_to_rgb(colorscale) - triangles = graph_objs.Mesh3d(x=x, y=y, z=z, facecolor=facecolor, i=ii, j=jj, k=kk, name='') - colorbar = graph_objs.Mesh3d(x=[0, 1], y=[0, 1], z=[0, 1], - colorscale=colorscale, - intensity=[0, 1], - showscale=True) + if not isinstance(mean_dists[0], str) and show_colorbar is True: + # make a colorscale from the colors + colorscale = FigureFactory._make_colorscale(colormap) + colorscale = FigureFactory._convert_colorscale_to_rgb(colorscale) + + colorbar = graph_objs.Scatter3d( + x=x[:2], + y=y[:2], + z=z[:2], + mode='markers', + marker=dict( + size=0.1, + color=[min_mean_dists, max_mean_dists], + colorscale=colorscale, + showscale=True), + hoverinfo='None', + showlegend=False + ) # the triangle sides are not plotted - if plot_edges is not True: - if show_colorbar is True: + if plot_edges is False: + if not isinstance(mean_dists[0], str) and show_colorbar is True: return graph_objs.Data([triangles, colorbar]) else: return graph_objs.Data([triangles]) - # define the lists x_edge, y_edge and z_edge, of x, y, resp z # coordinates of edge end points for each triangle # None separates data corresponding to two consecutive triangles @@ -3392,10 +3401,14 @@ def _trisurf(x, y, z, simplices, show_colorbar, colormap=None, # define the lines for plotting lines = graph_objs.Scatter3d( x=x_edge, y=y_edge, z=z_edge, mode='lines', - line=graph_objs.Line(color='rgb(50, 50, 50)', - width=1.5) + line=graph_objs.Line( + color=edges_color, + width=1.5 + ), + showlegend=False ) - if show_colorbar is True: + + if not isinstance(mean_dists[0], str) and show_colorbar is True: return graph_objs.Data([triangles, lines, colorbar]) else: return graph_objs.Data([triangles, lines]) @@ -3407,6 +3420,7 @@ def create_trisurf(x, y, z, simplices, colormap=None, show_colorbar=True, backgroundcolor='rgb(230, 230, 230)', gridcolor='rgb(255, 255, 255)', zerolinecolor='rgb(255, 255, 255)', + edges_color='rgb(50, 50, 50)', height=800, width=800, aspectratio=dict(x=1, y=1, z=1)): """ @@ -3440,6 +3454,7 @@ def create_trisurf(x, y, z, simplices, colormap=None, show_colorbar=True, inclusive :param (str) zerolinecolor: color of the axes. Takes a string of the form 'rgb(x,y,z)' x,y,z are between 0 and 255 inclusive + :param (str) edges_color: color of the edges, if plot_edges is True :param (int|float) height: the height of the plot (in pixels) :param (int|float) width: the width of the plot (in pixels) :param (dict) aspectratio: a dictionary of the aspect ratio values for @@ -3622,6 +3637,7 @@ def dist_origin(x, y, z): x, y, z, simplices, color_func=colors, show_colorbar=True, + edges_color='rgb(2,85,180)', title=' Modern Art' ) @@ -3637,6 +3653,7 @@ def dist_origin(x, y, z): show_colorbar=show_colorbar, color_func=color_func, colormap=colormap, + edges_color=edges_color, plot_edges=plot_edges) axis = dict( showbackground=showbackground, From 9f8554d6d60fcbff32cb68b102a52717e91909bd Mon Sep 17 00:00:00 2001 From: Adam Kulidjian Date: Mon, 22 Aug 2016 10:48:56 -0400 Subject: [PATCH 2/4] Andrew's comments + update exp_trisurf in tests for colorbar param --- plotly/tests/test_optional/temp-plot.html | 2 +- .../test_optional/test_figure_factory.py | 101 +++++++++--------- plotly/tools.py | 40 ++++--- 3 files changed, 74 insertions(+), 69 deletions(-) diff --git a/plotly/tests/test_optional/temp-plot.html b/plotly/tests/test_optional/temp-plot.html index 90d4bc46fb7..2eccb96195e 100644 --- a/plotly/tests/test_optional/temp-plot.html +++ b/plotly/tests/test_optional/temp-plot.html @@ -57,4 +57,4 @@ t.exit().remove(),t.text(a.text).attr({"class":"slicetext",transform:"","data-bb":"","text-anchor":"middle",x:0,y:0}).call(d.font,"outside"===C?m.outsidetextfont:m.insidetextfont).call(p.convertToTspans),t.selectAll("tspan.line").attr({x:0,y:0});var e,r=d.bBox(t.node());"outside"===C?e=o(r,a):(e=n(r,a,u),"auto"===C&&e.scale<1&&(t.call(d.font,m.outsidetextfont),m.outsidetextfont.family===m.insidetextfont.family&&m.outsidetextfont.size===m.insidetextfont.size||(t.attr({"data-bb":""}),r=d.bBox(t.node())),e=o(r,a)));var i=M+a.pxmid[0]*e.rCenter+(e.x||0),s=k+a.pxmid[1]*e.rCenter+(e.y||0);e.outside&&(a.yLabelMin=s-r.height/2,a.yLabelMid=s,a.yLabelMax=s+r.height/2,a.labelExtraX=0,a.labelExtraY=0,g=!0),t.attr("transform","translate("+i+","+s+")"+(e.scale<1?"scale("+e.scale+")":"")+(e.rotate?"rotate("+e.rotate+")":"")+"translate("+-(r.left+r.right)/2+","+-(r.top+r.bottom)/2+")")})}),g&&a(l,m),s.each(function(t){if(t.labelExtraX||t.labelExtraY){var e=c.select(this),r=e.select("g.slicetext text");r.attr("transform","translate("+t.labelExtraX+","+t.labelExtraY+")"+r.attr("transform"));var n=t.cxFinal+t.pxmid[0],i=t.cyFinal+t.pxmid[1],o="M"+n+","+i,a=(t.yLabelMax-t.yLabelMin)*(t.pxmid[0]<0?-1:1)/4;if(t.labelExtraX){var s=t.labelExtraX*t.pxmid[1]/t.pxmid[0],l=t.yLabelMid+t.labelExtraY-(t.cyFinal+t.pxmid[1]);o+=Math.abs(s)>Math.abs(l)?"l"+l*t.pxmid[0]/t.pxmid[1]+","+l+"H"+(n+t.labelExtraX+a):"l"+t.labelExtraX+","+s+"v"+(l-s)+"h"+a}else o+="V"+(t.yLabelMid+t.labelExtraY)+"h"+a;e.append("path").classed("textline",!0).call(f.stroke,m.outsidetextfont.color).attr({"stroke-width":Math.min(2,m.outsidetextfont.size/8),d:o,fill:"none"})}})})}),setTimeout(function(){u.selectAll("tspan").each(function(){var t=c.select(this);t.attr("dy")&&t.attr("dy",t.attr("dy"))})},0)}},{"../../components/color":483,"../../components/drawing":506,"../../lib/svg_text_utils":581,"../../plots/cartesian/graph_interact":599,"./helpers":742,d3:119}],747:[function(t,e,r){"use strict";var n=t("d3"),i=t("./style_one");e.exports=function(t){t._fullLayout._pielayer.selectAll(".trace").each(function(t){var e=t[0],r=e.trace,o=n.select(this);o.style({opacity:r.opacity}),o.selectAll(".top path.surface").each(function(t){n.select(this).call(i,t,r)})})}},{"./style_one":748,d3:119}],748:[function(t,e,r){"use strict";var n=t("../../components/color");e.exports=function(t,e,r){var i=r.marker.line.color;Array.isArray(i)&&(i=i[e.i]||n.defaultLine);var o=r.marker.line.width||0;Array.isArray(o)&&(o=o[e.i]||0),t.style({"stroke-width":o,fill:e.color}).call(n.stroke,i)}},{"../../components/color":483}],749:[function(t,e,r){"use strict";var n=t("../../lib");e.exports=function(t){var e=t[0].trace,r=e.marker;if(n.mergeArray(e.text,t,"tx"),n.mergeArray(e.textposition,t,"tp"),e.textfont&&(n.mergeArray(e.textfont.size,t,"ts"),n.mergeArray(e.textfont.color,t,"tc"),n.mergeArray(e.textfont.family,t,"tf")),r&&r.line){var i=r.line;n.mergeArray(r.opacity,t,"mo"),n.mergeArray(r.symbol,t,"mx"),n.mergeArray(r.color,t,"mc"),n.mergeArray(i.color,t,"mlc"),n.mergeArray(i.width,t,"mlw")}}},{"../../lib":568}],750:[function(t,e,r){"use strict";var n=t("../../components/colorscale/color_attributes"),i=t("../../components/drawing"),o=(t("./constants"),t("../../lib/extend").extendFlat);e.exports={x:{valType:"data_array"},x0:{valType:"any",dflt:0},dx:{valType:"number",dflt:1},y:{valType:"data_array"},y0:{valType:"any",dflt:0},dy:{valType:"number",dflt:1},text:{valType:"string",dflt:"",arrayOk:!0},mode:{valType:"flaglist",flags:["lines","markers","text"],extras:["none"]},hoveron:{valType:"flaglist",flags:["points","fills"]},line:{color:{valType:"color"},width:{valType:"number",min:0,dflt:2},shape:{valType:"enumerated",values:["linear","spline","hv","vh","hvh","vhv"],dflt:"linear"},smoothing:{valType:"number",min:0,max:1.3,dflt:1},dash:{valType:"string",values:["solid","dot","dash","longdash","dashdot","longdashdot"],dflt:"solid"}},connectgaps:{valType:"boolean",dflt:!1},fill:{valType:"enumerated",values:["none","tozeroy","tozerox","tonexty","tonextx","toself","tonext"],dflt:"none"},fillcolor:{valType:"color"},marker:o({},{symbol:{valType:"enumerated",values:i.symbolList,dflt:"circle",arrayOk:!0},opacity:{valType:"number",min:0,max:1,arrayOk:!0},size:{valType:"number",min:0,dflt:6,arrayOk:!0},maxdisplayed:{valType:"number",min:0,dflt:0},sizeref:{valType:"number",dflt:1},sizemin:{valType:"number",min:0,dflt:0},sizemode:{valType:"enumerated",values:["diameter","area"],dflt:"diameter"},showscale:{valType:"boolean",dflt:!1},line:o({},{width:{valType:"number",min:0,arrayOk:!0}},n("marker.line"))},n("marker")),textposition:{valType:"enumerated",values:["top left","top center","top right","middle left","middle center","middle right","bottom left","bottom center","bottom right"],dflt:"middle center",arrayOk:!0},textfont:{family:{valType:"string",noBlank:!0,strict:!0,arrayOk:!0},size:{valType:"number",min:1,arrayOk:!0},color:{valType:"color",arrayOk:!0}},r:{valType:"data_array"},t:{valType:"data_array"},_nestedModules:{error_y:"ErrorBars",error_x:"ErrorBars","marker.colorbar":"Colorbar"}}},{"../../components/colorscale/color_attributes":491,"../../components/drawing":506,"../../lib/extend":563,"./constants":755}],751:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),i=t("../../plots/cartesian/axes"),o=t("../../lib"),a=t("./subtypes"),s=t("./colorscale_calc");e.exports=function(t,e){var r,l,u,c=i.getFromId(t,e.xaxis||"x"),h=i.getFromId(t,e.yaxis||"y"),f=c.makeCalcdata(e,"x"),d=h.makeCalcdata(e,"y"),p=Math.min(f.length,d.length);c._minDtick=0,h._minDtick=0,f.length>p&&f.splice(p,f.length-p),d.length>p&&d.splice(p,d.length-p);var v={padded:!0},m={padded:!0};if(a.hasMarkers(e)){if(r=e.marker,l=r.size,Array.isArray(l)){var g={type:"linear"};i.setConvert(g),l=g.makeCalcdata(e.marker,"size"),l.length>p&&l.splice(p,l.length-p)}var y,b=1.6*(e.marker.sizeref||1);y="area"===e.marker.sizemode?function(t){return Math.max(Math.sqrt((t||0)/b),3)}:function(t){return Math.max((t||0)/b,3)},v.ppad=m.ppad=Array.isArray(l)?l.map(y):y(l)}s(e),!("tozerox"===e.fill||"tonextx"===e.fill&&t.firstscatter)||f[0]===f[p-1]&&d[0]===d[p-1]?e.error_y.visible||-1===["tonexty","tozeroy"].indexOf(e.fill)&&(a.hasMarkers(e)||a.hasText(e))||(v.padded=!1,v.ppad=0):v.tozero=!0,!("tozeroy"===e.fill||"tonexty"===e.fill&&t.firstscatter)||f[0]===f[p-1]&&d[0]===d[p-1]?-1!==["tonextx","tozerox"].indexOf(e.fill)&&(m.padded=!1):m.tozero=!0,i.expand(c,f,v),i.expand(h,d,m);var x=new Array(p);for(u=0;p>u;u++)x[u]=n(f[u])&&n(d[u])?{x:f[u],y:d[u]}:{x:!1,y:!1};return void 0!==typeof l&&o.mergeArray(l,x,"ms"),t.firstscatter=!1,x}},{"../../lib":568,"../../plots/cartesian/axes":592,"./colorscale_calc":754,"./subtypes":769,"fast-isnumeric":123}],752:[function(t,e,r){"use strict";e.exports=function(t){var e,r,n,i,o;for(e=0;e=0;i--)if(o=t[i],"scatter"===o.type&&o.xaxis===r.xaxis&&o.yaxis===r.yaxis){o.opacity=void 0;break}}},{}],753:[function(t,e,r){"use strict";var n=t("d3"),i=t("fast-isnumeric"),o=t("../../lib"),a=t("../../plots/plots"),s=t("../../components/colorscale/get_scale"),l=t("../../components/colorbar/draw");e.exports=function(t,e){var r=e[0].trace,u=r.marker,c="cb"+r.uid;if(t._fullLayout._infolayer.selectAll("."+c).remove(),void 0===u||!u.showscale)return void a.autoMargin(t,c);var h=s(u.colorscale),f=u.color,d=u.cmin,p=u.cmax;i(d)||(d=o.aggNums(Math.min,null,f)),i(p)||(p=o.aggNums(Math.max,null,f));var v=e[0].t.cb=l(t,c);v.fillcolor(n.scale.linear().domain(h.map(function(t){return d+t[0]*(p-d)})).range(h.map(function(t){return t[1]}))).filllevels({start:d,end:p,size:(p-d)/254}).options(u.colorbar)()}},{"../../components/colorbar/draw":486,"../../components/colorscale/get_scale":495,"../../lib":568,"../../plots/plots":648,d3:119,"fast-isnumeric":123}],754:[function(t,e,r){"use strict";var n=t("../../components/colorscale/has_colorscale"),i=t("../../components/colorscale/calc"),o=t("./subtypes");e.exports=function(t){o.hasLines(t)&&n(t,"line")&&i(t,t.line.color,"line","c"),o.hasMarkers(t)&&(n(t,"marker")&&i(t,t.marker.color,"marker","c"),n(t,"marker.line")&&i(t,t.marker.line.color,"marker.line","c"))}},{"../../components/colorscale/calc":490,"../../components/colorscale/has_colorscale":496,"./subtypes":769}],755:[function(t,e,r){"use strict";e.exports={PTS_LINESONLY:20}},{}],756:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("./attributes"),o=t("./constants"),a=t("./subtypes"),s=t("./xy_defaults"),l=t("./marker_defaults"),u=t("./line_defaults"),c=t("./line_shape_defaults"),h=t("./text_defaults"),f=t("./fillcolor_defaults"),d=t("../../components/errorbars/defaults");e.exports=function(t,e,r,p){function v(r,o){return n.coerce(t,e,i,r,o)}var m=s(t,e,v),g=mU!=C>=U&&(z=S[T-1][0],I=S[T][0],L=z+(I-z)*(U-P)/(C-P),F=Math.min(F,L),j=Math.max(j,L));F=Math.max(F,0),j=Math.min(j,f._length);var V=l.defaultLine;return l.opacity(h.fillcolor)?V=h.fillcolor:l.opacity((h.line||{}).color)&&(V=h.line.color),n.extendFlat(t,{distance:o.MAXDIST+10,x0:F,x1:j,y0:U,y1:U,color:V}),delete t.index,h.text&&!Array.isArray(h.text)?t.text=String(h.text):t.text=h.name,[t]}}}},{"../../components/color":483,"../../components/errorbars":512,"../../lib":568,"../../plots/cartesian/constants":597,"../../plots/cartesian/graph_interact":599,"./get_trace_color":758}],760:[function(t,e,r){"use strict";var n={},i=t("./subtypes");n.hasLines=i.hasLines,n.hasMarkers=i.hasMarkers,n.hasText=i.hasText,n.isBubble=i.isBubble,n.attributes=t("./attributes"),n.supplyDefaults=t("./defaults"),n.cleanData=t("./clean_data"),n.calc=t("./calc"),n.arraysToCalcdata=t("./arrays_to_calcdata"),n.plot=t("./plot"),n.colorbar=t("./colorbar"),n.style=t("./style"),n.hoverPoints=t("./hover"),n.selectPoints=t("./select"),n.moduleType="trace",n.name="scatter",n.basePlotModule=t("../../plots/cartesian"),n.categories=["cartesian","symbols","markerColorscale","errorBarsOK","showLegend"],n.meta={},e.exports=n},{"../../plots/cartesian":600,"./arrays_to_calcdata":749,"./attributes":750,"./calc":751,"./clean_data":752,"./colorbar":753,"./defaults":756,"./hover":759,"./plot":766,"./select":767,"./style":768,"./subtypes":769}],761:[function(t,e,r){"use strict";var n=t("../../components/colorscale/has_colorscale"),i=t("../../components/colorscale/defaults");e.exports=function(t,e,r,o,a){var s=(t.marker||{}).color;if(a("line.color",r),n(t,"line"))i(t,e,o,a,{prefix:"line.",cLetter:"c"});else{var l=(Array.isArray(s)?!1:s)||r;a("line.color",l)}a("line.width"),a("line.dash")}},{"../../components/colorscale/defaults":493,"../../components/colorscale/has_colorscale":496}],762:[function(t,e,r){"use strict";var n=t("../../plots/cartesian/axes");e.exports=function(t,e){function r(e){var r=w.c2p(t[e].x),n=M.c2p(t[e].y);return r===S||n===S?!1:[r,n]}function i(t){var e=t[0]/w._length,r=t[1]/M._length;return(1+10*Math.max(0,-e,e-1,-r,r-1))*A}function o(t,e){var r=t[0]-e[0],n=t[1]-e[1];return Math.sqrt(r*r+n*n)}var a,s,l,u,c,h,f,d,p,v,m,g,y,b,x,_,w=e.xaxis,M=e.yaxis,k=e.connectGaps,A=e.baseTolerance,T=e.linear,E=[],S=n.BADNUM,L=.2,z=new Array(t.length),I=0;for(a=0;ai(h))break;l=h,y=v[0]*p[0]+v[1]*p[1],y>m?(m=y,u=h,d=!1):g>y&&(g=y,c=h,d=!0)}if(d?(z[I++]=u,l!==c&&(z[I++]=c)):(c!==s&&(z[I++]=c),l!==u&&(z[I++]=u)),z[I++]=l,a>=t.length||!h)break;z[I++]=h,s=h}}else z[I++]=u}E.push(z.slice(0,I))}return E}},{"../../plots/cartesian/axes":592}],763:[function(t,e,r){"use strict";e.exports=function(t,e,r){var n=r("line.shape");"spline"===n&&r("line.smoothing")}},{}],764:[function(t,e,r){"use strict";var n=t("fast-isnumeric");e.exports=function(t){var e=t.marker,r=e.sizeref||1,i=e.sizemin||0,o="area"===e.sizemode?function(t){return Math.sqrt(t/r)}:function(t){return t/r};return function(t){var e=o(t/2);return n(e)&&e>0?Math.max(e,i):0}}},{"fast-isnumeric":123}],765:[function(t,e,r){"use strict";var n=t("../../components/color"),i=t("../../components/colorscale/has_colorscale"),o=t("../../components/colorscale/defaults"),a=t("./subtypes");e.exports=function(t,e,r,s,l){var u,c=a.isBubble(t),h=(t.line||{}).color;h&&(r=h),l("marker.symbol"),l("marker.opacity",c?.7:1),l("marker.size"),l("marker.color",r),i(t,"marker")&&o(t,e,s,l,{prefix:"marker.",cLetter:"c"}),u=h&&!Array.isArray(h)&&e.marker.color!==h?h:c?n.background:n.defaultLine,l("marker.line.color",u),i(t,"marker.line")&&o(t,e,s,l,{prefix:"marker.line.",cLetter:"c"}),l("marker.line.width",c?1:0),c&&(l("marker.sizeref"),l("marker.sizemin"),l("marker.sizemode"))}},{"../../components/color":483,"../../components/colorscale/defaults":493,"../../components/colorscale/has_colorscale":496,"./subtypes":769}],766:[function(t,e,r){"use strict";function n(t,e,r){var n=e.x(),o=e.y(),a=i.extent(n.range.map(n.l2c)),s=i.extent(o.range.map(o.l2c));r.forEach(function(t,e){var n=t[0].trace;if(u.hasMarkers(n)){var i=n.marker.maxdisplayed;if(0!==i){var o=t.filter(function(t){return t.x>=a[0]&&t.x<=a[1]&&t.y>=s[0]&&t.y<=s[1]}),l=Math.ceil(o.length/i),c=0;r.forEach(function(t,r){var n=t[0].trace;u.hasMarkers(n)&&n.marker.maxdisplayed>0&&e>r&&c++});var h=Math.round(c*l/3+Math.floor(c/3)*l/7.1);t.forEach(function(t){delete t.vis}),o.forEach(function(t,e){0===Math.round((e+h)%l)&&(t.vis=!0)})}}})}var i=t("d3"),o=t("../../lib"),a=t("../../components/drawing"),s=t("../../components/errorbars"),l=t("../../lib/polygon").tester,u=t("./subtypes"),c=t("./arrays_to_calcdata"),h=t("./line_points");e.exports=function(t,e,r){function f(t){return t.filter(function(t){return t.vis})}n(t,e,r);var d=e.x(),p=e.y(),v=e.plot.select(".scatterlayer").selectAll("g.trace.scatter").data(r);v.enter().append("g").attr("class","trace scatter").style("stroke-miterlimit",2),v.call(s.plot,e);var m,g,y,b,x="",_=[];v.each(function(t){var e=t[0].trace,r=e.line,n=i.select(this);if(e.visible===!0&&(g=e.fill.charAt(e.fill.length-1),"x"!==g&&"y"!==g&&(g=""),t[0].node3=n,c(t),u.hasLines(e)||"none"!==e.fill)){var o,s,f,v,w,M="",k="";m="tozero"===e.fill.substr(0,6)||"toself"===e.fill||"to"===e.fill.substr(0,2)&&!x?n.append("path").classed("js-fill",!0):null,b&&(y=b.datum(t)),b=n.append("path").classed("js-fill",!0),-1!==["hv","vh","hvh","vhv"].indexOf(r.shape)?(f=a.steps(r.shape),v=a.steps(r.shape.split("").reverse().join(""))):f=v="spline"===r.shape?function(t){var e=t[t.length-1];return t[0][0]===e[0]&&t[0][1]===e[1]?a.smoothclosed(t.slice(1),r.smoothing):a.smoothopen(t,r.smoothing)}:function(t){return"M"+t.join("L")},w=function(t){return v(t.reverse())};var A,T=h(t,{xaxis:d,yaxis:p,connectGaps:e.connectgaps,baseTolerance:Math.max(r.width||1,3)/4,linear:"linear"===r.shape}),E=e._polygons=new Array(T.length);for(A=0;A1&&n.append("path").classed("js-line",!0).style("vector-effect","non-scaling-stroke").attr("d",o)}m?S&&z&&(g?("y"===g?S[1]=z[1]=p.c2p(0,!0):"x"===g&&(S[0]=z[0]=d.c2p(0,!0)),m.attr("d",M+"L"+z+"L"+S+"Z")):m.attr("d",M+"Z")):"tonext"===e.fill.substr(0,6)&&M&&x&&("tonext"===e.fill?y.attr("d",M+"Z"+x+"Z"):y.attr("d",M+"L"+x.substr(1)+"Z"),e._polygons=e._polygons.concat(_)),x=k,_=E}}}),v.selectAll("path:not([d])").remove(),v.append("g").attr("class","points").each(function(t){var e=t[0].trace,r=i.select(this),n=u.hasMarkers(e),s=u.hasText(e);!n&&!s||e.visible!==!0?r.remove():(n&&r.selectAll("path.point").data(e.marker.maxdisplayed?f:o.identity).enter().append("path").classed("point",!0).call(a.translatePoints,d,p),s&&r.selectAll("g").data(e.marker.maxdisplayed?f:o.identity).enter().append("g").append("text").call(a.translatePoints,d,p))})}},{"../../components/drawing":506,"../../components/errorbars":512,"../../lib":568,"../../lib/polygon":574,"./arrays_to_calcdata":749,"./line_points":762,"./subtypes":769,d3:119}],767:[function(t,e,r){"use strict";var n=t("./subtypes"),i=.2;e.exports=function(t,e){var r,o,a,s,l=t.cd,u=t.xaxis,c=t.yaxis,h=[],f=l[0].trace,d=f.index,p=f.marker,v=!n.hasMarkers(f)&&!n.hasText(f);if(f.visible===!0&&!v){var m=Array.isArray(p.opacity)?1:p.opacity;if(e===!1)for(r=0;rs;s++){for(var l=[[0,0,0],[0,0,0]],u=0;3>u;u++)if(r[u])for(var c=0;2>c;c++)l[c][u]=r[u][s][c];a[s]=l}return a}var a=t("../../components/errorbars/compute_error");e.exports=o},{"../../components/errorbars/compute_error":510}],775:[function(t,e,r){"use strict";function n(t,e){this.scene=t,this.uid=e,this.linePlot=null,this.scatterPlot=null,this.errorBars=null,this.textMarkers=null,this.delaunayMesh=null,this.color=null,this.mode="",this.dataPoints=[],this.axesBounds=[[-(1/0),-(1/0),-(1/0)],[1/0,1/0,1/0]],this.textLabels=null,this.data=null}function i(t,e,r){var n,i=(r+1)%3,o=(r+2)%3,a=[],s=[];for(n=0;ni;i++){var o=t[i];o&&o.copy_zstyle!==!1&&(o=t[2]),o&&(e[i]=o.width/2,r[i]=b(o.color),n=o.thickness)}return{capSize:e,color:r,lineWidth:n}}function a(t){var e=[0,0];return Array.isArray(t)?[0,-1]:(t.indexOf("bottom")>=0&&(e[1]+=1),t.indexOf("top")>=0&&(e[1]-=1),t.indexOf("left")>=0&&(e[0]-=1),t.indexOf("right")>=0&&(e[0]+=1),e)}function s(t,e){return e(4*t)}function l(t){return M[t]}function u(t,e,r,n,i){var o=null;if(Array.isArray(t)){o=[];for(var a=0;e>a;a++)void 0===t[a]?o[a]=n:o[a]=r(t[a],i)}else o=r(t,y.identity);return o}function c(t,e){var r,n,i,c,h,f,d=[],p=t.fullSceneLayout,v=t.dataScale,m=p.xaxis,g=p.yaxis,w=p.zaxis,M=e.marker,A=e.line,T=e.x||[],E=e.y||[],S=e.z||[],L=T.length;for(n=0;L>n;n++)i=m.d2l(T[n])*v[0],c=g.d2l(E[n])*v[1],h=w.d2l(S[n])*v[2],d[n]=[i,c,h];if(Array.isArray(e.text))f=e.text;else if(void 0!==e.text)for(f=new Array(L),n=0;L>n;n++)f[n]=e.text;if(r={position:d,mode:e.mode,text:f},"line"in e&&(r.lineColor=x(A,1,L),r.lineWidth=A.width,r.lineDashes=A.dash),"marker"in e){var z=_(e);r.scatterColor=x(M,1,L),r.scatterSize=u(M.size,L,s,20,z),r.scatterMarker=u(M.symbol,L,l,"\u25cf"),r.scatterLineWidth=M.line.width,r.scatterLineColor=x(M.line,1,L),r.scatterAngle=0}"textposition"in e&&(r.textOffset=a(e.textposition),r.textColor=x(e.textfont,1,L),r.textSize=u(e.textfont.size,L,y.identity,12),r.textFont=e.textfont.family,r.textAngle=0);var I=["x","y","z"];for(r.project=[!1,!1,!1],r.projectScale=[1,1,1],r.projectOpacity=[1,1,1],n=0;3>n;++n){var P=e.projection[I[n]];(r.project[n]=P.show)&&(r.projectOpacity[n]=P.opacity,r.projectScale[n]=P.scale)}r.errorBounds=k(e,v);var C=o([e.error_x,e.error_y,e.error_z]);return r.errorColor=C.color,r.errorLineWidth=C.lineWidth,r.errorCapSize=C.capSize,r.delaunayAxis=e.surfaceaxis,r.delaunayColor=b(e.surfacecolor),r}function h(t){if(Array.isArray(t)){var e=t[0];return Array.isArray(e)&&(t=e),"rgb("+t.slice(0,3).map(function(t){return Math.round(255*t)})+")"}return null}function f(t,e){var r=new n(t,e.uid);return r.update(e),r}var d=t("gl-line3d"),p=t("gl-scatter3d"),v=t("gl-error3d"),m=t("gl-mesh3d"),g=t("delaunay-triangulate"),y=t("../../lib"),b=t("../../lib/str2rgbarray"),x=t("../../lib/gl_format_color"),_=t("../scatter/make_bubble_size_func"),w=t("../../constants/gl3d_dashes"),M=t("../../constants/gl_markers"),k=t("./calc_errors"),A=n.prototype;A.handlePick=function(t){if(t.object&&(t.object===this.linePlot||t.object===this.delaunayMesh||t.object===this.textMarkers||t.object===this.scatterPlot)){t.object.highlight&&t.object.highlight(null),this.scatterPlot&&(t.object=this.scatterPlot,this.scatterPlot.highlight(t.data)),this.textLabels&&void 0!==this.textLabels[t.data.index]?t.textLabel=this.textLabels[t.data.index]:t.textLabel="";var e=t.data.index;return t.traceCoordinate=[this.data.x[e],this.data.y[e],this.data.z[e]],!0}},A.update=function(t){var e,r,n,o,a=this.scene.glplot.gl,s=w.solid;this.data=t;var l=c(this.scene,t);"mode"in l&&(this.mode=l.mode),"lineDashes"in l&&l.lineDashes in w&&(s=w[l.lineDashes]),this.color=h(l.scatterColor)||h(l.lineColor),this.dataPoints=l.position,e={gl:a,position:l.position,color:l.lineColor,lineWidth:l.lineWidth||1,dashes:s[0],dashScale:s[1],opacity:t.opacity,connectGaps:t.connectgaps},-1!==this.mode.indexOf("lines")?this.linePlot?this.linePlot.update(e):(this.linePlot=d(e),this.scene.glplot.add(this.linePlot)):this.linePlot&&(this.scene.glplot.remove(this.linePlot),this.linePlot.dispose(),this.linePlot=null);var u=t.opacity;if(t.marker&&t.marker.opacity&&(u*=t.marker.opacity),r={gl:a,position:l.position,color:l.scatterColor,size:l.scatterSize,glyph:l.scatterMarker,opacity:u,orthographic:!0,lineWidth:l.scatterLineWidth,lineColor:l.scatterLineColor,project:l.project,projectScale:l.projectScale,projectOpacity:l.projectOpacity},-1!==this.mode.indexOf("markers")?this.scatterPlot?this.scatterPlot.update(r):(this.scatterPlot=p(r),this.scatterPlot.highlightScale=1,this.scene.glplot.add(this.scatterPlot)):this.scatterPlot&&(this.scene.glplot.remove(this.scatterPlot),this.scatterPlot.dispose(),this.scatterPlot=null),o={gl:a,position:l.position,glyph:l.text,color:l.textColor,size:l.textSize,angle:l.textAngle,alignment:l.textOffset,font:l.textFont,orthographic:!0,lineWidth:0,project:!1,opacity:t.opacity},this.textLabels=l.text,-1!==this.mode.indexOf("text")?this.textMarkers?this.textMarkers.update(o):(this.textMarkers=p(o),this.textMarkers.highlightScale=1,this.scene.glplot.add(this.textMarkers)):this.textMarkers&&(this.scene.glplot.remove(this.textMarkers),this.textMarkers.dispose(),this.textMarkers=null),n={gl:a,position:l.position,color:l.errorColor,error:l.errorBounds,lineWidth:l.errorLineWidth,capSize:l.errorCapSize,opacity:t.opacity},this.errorBars?l.errorBounds?this.errorBars.update(n):(this.scene.glplot.remove(this.errorBars),this.errorBars.dispose(),this.errorBars=null):l.errorBounds&&(this.errorBars=v(n),this.scene.glplot.add(this.errorBars)),l.delaunayAxis>=0){var f=i(l.position,l.delaunayColor,l.delaunayAxis);f.opacity=t.opacity,this.delaunayMesh?this.delaunayMesh.update(f):(f.gl=a,this.delaunayMesh=m(f),this.scene.glplot.add(this.delaunayMesh))}else this.delaunayMesh&&(this.scene.glplot.remove(this.delaunayMesh),this.delaunayMesh.dispose(),this.delaunayMesh=null)},A.dispose=function(){this.linePlot&&(this.scene.glplot.remove(this.linePlot),this.linePlot.dispose()),this.scatterPlot&&(this.scene.glplot.remove(this.scatterPlot),this.scatterPlot.dispose()),this.errorBars&&(this.scene.glplot.remove(this.errorBars),this.errorBars.dispose()),this.textMarkers&&(this.scene.glplot.remove(this.textMarkers),this.textMarkers.dispose()),this.delaunayMesh&&(this.scene.glplot.remove(this.delaunayMesh),this.delaunayMesh.dispose())},e.exports=f},{"../../constants/gl3d_dashes":553,"../../constants/gl_markers":554,"../../lib":568,"../../lib/gl_format_color":566,"../../lib/str2rgbarray":580,"../scatter/make_bubble_size_func":764,"./calc_errors":774,"delaunay-triangulate":120,"gl-error3d":127,"gl-line3d":133,"gl-mesh3d":156,"gl-scatter3d":199}],776:[function(t,e,r){"use strict";function n(t,e,r){var n=0,i=r("x"),o=r("y"),a=r("z");return i&&o&&a&&(n=Math.min(i.length,o.length,a.length),n=0&&f("surfacecolor",p||v);for(var m=["x","y","z"],g=0;3>g;++g){var y="projection."+m[g];f(y+".show")&&(f(y+".opacity"),f(y+".scale"))}u(t,e,r,{axis:"z"}),u(t,e,r,{axis:"y",inherit:"z"}),u(t,e,r,{axis:"x",inherit:"z"})}},{"../../components/errorbars/defaults":511,"../../lib":568,"../scatter/line_defaults":761,"../scatter/marker_defaults":765,"../scatter/subtypes":769,"../scatter/text_defaults":770,"./attributes":772}],777:[function(t,e,r){"use strict";var n={};n.plot=t("./convert"),n.attributes=t("./attributes"),n.markerSymbols=t("../../constants/gl_markers"),n.supplyDefaults=t("./defaults"),n.colorbar=t("../scatter/colorbar"),n.calc=t("./calc"),n.moduleType="trace",n.name="scatter3d",n.basePlotModule=t("../../plots/gl3d"),n.categories=["gl3d","symbols","markerColorscale","showLegend"],n.meta={},e.exports=n},{"../../constants/gl_markers":554,"../../plots/gl3d":628, "../scatter/colorbar":753,"./attributes":772,"./calc":773,"./convert":775,"./defaults":776}],778:[function(t,e,r){"use strict";var n=t("../scatter/attributes"),i=t("../../plots/attributes"),o=t("../../components/colorscale/color_attributes"),a=t("../../lib/extend").extendFlat,s=n.marker,l=n.line,u=s.line;e.exports={lon:{valType:"data_array"},lat:{valType:"data_array"},locations:{valType:"data_array"},locationmode:{valType:"enumerated",values:["ISO-3","USA-states","country names"],dflt:"ISO-3"},mode:a({},n.mode,{dflt:"markers"}),text:a({},n.text,{}),line:{color:l.color,width:l.width,dash:l.dash},marker:a({},{symbol:s.symbol,opacity:s.opacity,size:s.size,sizeref:s.sizeref,sizemin:s.sizemin,sizemode:s.sizemode,showscale:s.showscale,line:a({},{width:u.width},o("marker.line"))},o("marker")),textfont:n.textfont,textposition:n.textposition,hoverinfo:a({},i.hoverinfo,{flags:["lon","lat","location","text","name"]}),_nestedModules:{"marker.colorbar":"Colorbar"}}},{"../../components/colorscale/color_attributes":491,"../../lib/extend":563,"../../plots/attributes":590,"../scatter/attributes":750}],779:[function(t,e,r){"use strict";var n=t("../scatter/colorscale_calc");e.exports=function(t,e){var r=[{x:!1,y:!1,trace:e,t:{}}];return n(e),r}},{"../scatter/colorscale_calc":754}],780:[function(t,e,r){"use strict";function n(t,e,r){var n,i,o=0,a=r("locations");return a?(r("locationmode"),o=a.length):(n=r("lon")||[],i=r("lat")||[],o=Math.min(n.length,i.length),on;n++)r[n]=[t.lon[n],t.lat[n]];return{type:"LineString",coordinates:r,trace:t}}function o(t,e){function r(e){var r=t.mockAxis;return u.tickText(r,r.c2l(e),"hover").text+"\xb0"}var n=e.hoverinfo;if("none"===n)return function(t){delete t.textLabel};var i="all"===n?m.hoverinfo.flags:n.split("+"),o=-1!==i.indexOf("location")&&Array.isArray(e.locations),a=-1!==i.indexOf("lon"),s=-1!==i.indexOf("lat"),l=-1!==i.indexOf("text");return function(t){var n=[];o?n.push(t.location):a&&s?n.push("("+r(t.lon)+", "+r(t.lat)+")"):a?n.push("lon: "+r(t.lon)):s&&n.push("lat: "+r(t.lat)),l&&n.push(t.tx||e.text),t.textLabel=n.join("
")}}function a(t){var e=Array.isArray(t.locations);return function(r,n){return{points:[{data:t._input,fullData:t,curveNumber:t.index,pointNumber:n,lon:r.lon,lat:r.lat,location:e?r.location:null}]}}}var s=t("d3"),l=t("../../plots/cartesian/graph_interact"),u=t("../../plots/cartesian/axes"),c=t("../../lib/topojson_utils").getTopojsonFeatures,h=t("../../lib/geo_location_utils").locationToFeature,f=t("../../lib/array_to_calc_item"),d=t("../../components/color"),p=t("../../components/drawing"),v=t("../scatter/subtypes"),m=t("./attributes"),g=e.exports={};g.calcGeoJSON=function(t,e){var r,i,o,a,s=[],l=Array.isArray(t.locations);l?(a=t.locations,r=a.length,i=c(t,e),o=function(t,e){var r=h(t.locationmode,a[e],i);return void 0!==r?r.properties.ct:void 0}):(r=t.lon.length,o=function(t,e){return[t.lon[e],t.lat[e]]});for(var u=0;r>u;u++){var f=o(t,u);if(f){var d={lon:f[0],lat:f[1],location:l?t.locations[u]:null};n(t,d,u),s.push(d)}}return s.length>0&&(s[0].trace=t),s},g.plot=function(t,e){var r=t.framework.select(".scattergeolayer").selectAll("g.trace.scattergeo").data(e,function(t){return t.uid});r.enter().append("g").attr("class","trace scattergeo"),r.exit().remove(),r.selectAll("*").remove(),r.each(function(t){var e=s.select(this);v.hasLines(t)&&e.selectAll("path.js-line").data([i(t)]).enter().append("path").classed("js-line",!0)}),r.each(function(e){function r(r,n){if(t.showHover){var i=t.projection([r.lon,r.lat]);f(r),l.loneHover({x:i[0],y:i[1],name:m?e.name:void 0,text:r.textLabel,color:r.mc||(e.marker||{}).color},{container:t.hoverContainer.node()}),y=d(r,n),t.graphDiv.emit("plotly_hover",y)}}function n(e,r){t.graphDiv.emit("plotly_click",d(e,r))}var i=s.select(this),u=v.hasMarkers(e),c=v.hasText(e);if(u||c){var h=g.calcGeoJSON(e,t.topojson),f=o(t,e),d=a(e),p=e.hoverinfo,m="all"===p||-1!==p.indexOf("name"),y=null;u&&i.selectAll("path.point").data(h).enter().append("path").classed("point",!0).on("mouseover",r).on("click",n).on("mouseout",function(){l.loneUnhover(t.hoverContainer),t.graphDiv.emit("plotly_unhover",y)}).on("mousedown",function(){l.loneUnhover(t.hoverContainer)}).on("mouseup",r),c&&i.selectAll("g").data(h).enter().append("g").append("text")}}),g.style(t)},g.style=function(t){var e=t.framework.selectAll("g.trace.scattergeo");e.style("opacity",function(t){return t.opacity}),e.each(function(t){s.select(this).selectAll("path.point").call(p.pointStyle,t),s.select(this).selectAll("text").call(p.textPointStyle,t)}),e.selectAll("path.js-line").style("fill","none").each(function(t){var e=t.trace,r=e.line||{};s.select(this).call(d.stroke,r.color).call(p.dashLine,r.dash||"",r.width||0)})}},{"../../components/color":483,"../../components/drawing":506,"../../lib/array_to_calc_item":559,"../../lib/geo_location_utils":565,"../../lib/topojson_utils":582,"../../plots/cartesian/axes":592,"../../plots/cartesian/graph_interact":599,"../scatter/subtypes":769,"./attributes":778,d3:119}],783:[function(t,e,r){"use strict";var n=t("../scatter/attributes"),i=t("../../components/colorscale/color_attributes"),o=t("../../constants/gl2d_dashes"),a=t("../../constants/gl_markers"),s=t("../../lib/extend").extendFlat,l=t("../../lib/extend").extendDeep,u=n.line,c=n.marker,h=c.line;e.exports={x:n.x,x0:n.x0,dx:n.dx,y:n.y,y0:n.y0,dy:n.dy,text:s({},n.text,{}),mode:{valType:"flaglist",flags:["lines","markers"],extras:["none"]},line:{color:u.color,width:u.width,dash:{valType:"enumerated",values:Object.keys(o),dflt:"solid"}},marker:l({},i("marker"),{symbol:{valType:"enumerated",values:Object.keys(a),dflt:"circle",arrayOk:!0},size:c.size,sizeref:c.sizeref,sizemin:c.sizemin,sizemode:c.sizemode,opacity:c.opacity,showscale:c.showscale,line:l({},i("marker.line"),{width:h.width})}),connectgaps:n.connectgaps,fill:s({},n.fill,{values:["none","tozeroy","tozerox"]}),fillcolor:n.fillcolor,_nestedModules:{error_x:"ErrorBars",error_y:"ErrorBars","marker.colorbar":"Colorbar"}}},{"../../components/colorscale/color_attributes":491,"../../constants/gl2d_dashes":552,"../../constants/gl_markers":554,"../../lib/extend":563,"../scatter/attributes":750}],784:[function(t,e,r){"use strict";function n(t,e){this.scene=t,this.uid=e,this.pickXData=[],this.pickYData=[],this.xData=[],this.yData=[],this.textLabels=[],this.color="rgb(0, 0, 0)",this.name="",this.hoverinfo="all",this.connectgaps=!0,this.idToIndex=[],this.bounds=[0,0,0,0],this.hasLines=!1,this.lineOptions={positions:new Float32Array(0),color:[0,0,0,1],width:1,fill:[!1,!1,!1,!1],fillColor:[[0,0,0,1],[0,0,0,1],[0,0,0,1],[0,0,0,1]],dashes:[1]},this.line=d(t.glplot,this.lineOptions),this.line._trace=this,this.hasErrorX=!1,this.errorXOptions={positions:new Float32Array(0),errors:new Float32Array(0),lineWidth:1,capSize:0,color:[0,0,0,1]},this.errorX=p(t.glplot,this.errorXOptions),this.errorX._trace=this,this.hasErrorY=!1,this.errorYOptions={positions:new Float32Array(0),errors:new Float32Array(0),lineWidth:1,capSize:0,color:[0,0,0,1]},this.errorY=p(t.glplot,this.errorYOptions),this.errorY._trace=this,this.hasMarkers=!1,this.scatterOptions={positions:new Float32Array(0),sizes:[],colors:[],glyphs:[],borderWidths:[],borderColors:[],size:12,color:[0,0,0,1],borderSize:1,borderColor:[0,0,0,1]},this.scatter=h(t.glplot,this.scatterOptions),this.scatter._trace=this,this.fancyScatter=f(t.glplot,this.scatterOptions),this.fancyScatter._trace=this}function i(t,e,r){return Array.isArray(e)||(e=[e]),o(t,e,r)}function o(t,e,r){for(var n=new Array(r),i=e[0],o=0;r>o;++o)n[o]=t(o>=e.length?i:e[o]);return n}function a(t,e,r){return l(L(t,r),S(e,r),r)}function s(t,e,r,n){var i=x(t,e,n);return i=Array.isArray(i[0])?i:o(m.identity,[i],n),l(i,S(r,n),n)}function l(t,e,r){for(var n=new Array(4*r),i=0;r>i;++i){for(var o=0;3>o;++o)n[4*i+o]=t[i][o];n[4*i+3]=t[i][3]*e[i]}return n}function u(t,e){if(void 0===Float32Array.slice){for(var r=new Float32Array(e),n=0;e>n;n++)r[n]=t[n];return r}return t.slice(0,e)}function c(t,e){var r=new n(t,e.uid);return r.update(e),r}var h=t("gl-scatter2d"),f=t("gl-scatter2d-fancy"),d=t("gl-line2d"),p=t("gl-error2d"),v=t("fast-isnumeric"),m=t("../../lib"),g=t("../../plots/cartesian/axes"),y=t("../../components/errorbars"),b=t("../../lib/str2rgbarray"),x=t("../../lib/gl_format_color"),_=t("../scatter/subtypes"),w=t("../scatter/make_bubble_size_func"),M=t("../scatter/get_trace_color"),k=t("../../constants/gl_markers"),A=t("../../constants/gl2d_dashes"),T=["xaxis","yaxis"],E=n.prototype;E.handlePick=function(t){var e=t.pointId;return(t.object!==this.line||this.connectgaps)&&(e=this.idToIndex[t.pointId]),{trace:this,dataCoord:t.dataCoord,traceCoord:[this.pickXData[e],this.pickYData[e]],textLabel:Array.isArray(this.textLabels)?this.textLabels[e]:this.textLabels,color:Array.isArray(this.color)?this.color[e]:this.color,name:this.name,hoverinfo:this.hoverinfo}},E.isFancy=function(t){if("linear"!==this.scene.xaxis.type)return!0;if("linear"!==this.scene.yaxis.type)return!0;if(!t.x||!t.y)return!0;if(this.hasMarkers){var e=t.marker||{};if(Array.isArray(e.symbol)||"circle"!==e.symbol||Array.isArray(e.size)||Array.isArray(e.color)||Array.isArray(e.line.width)||Array.isArray(e.line.color)||Array.isArray(e.opacity))return!0}return this.hasLines&&!this.connectgaps?!0:this.hasErrorX?!0:!!this.hasErrorY};var S=i.bind(null,function(t){return+t}),L=i.bind(null,b),z=i.bind(null,function(t){return k[t]||"\u25cf"});E.update=function(t){t.visible!==!0?(this.hasLines=!1,this.hasErrorX=!1,this.hasErrorY=!1,this.hasMarkers=!1):(this.hasLines=_.hasLines(t),this.hasErrorX=t.error_x.visible===!0,this.hasErrorY=t.error_y.visible===!0,this.hasMarkers=_.hasMarkers(t)),this.textLabels=t.text,this.name=t.name,this.hoverinfo=t.hoverinfo,this.bounds=[1/0,1/0,-(1/0),-(1/0)],this.connectgaps=!!t.connectgaps,this.isFancy(t)?this.updateFancy(t):this.updateFast(t),this.color=M(t,{})},E.updateFast=function(t){for(var e,r,n=this.xData=this.pickXData=t.x,i=this.yData=this.pickYData=t.y,o=n.length,a=new Array(o),s=new Float32Array(2*o),l=this.bounds,c=0,h=0,f=0;o>f;++f)e=n[f],r=i[f],v(e)&&v(r)&&(a[c++]=f,s[h++]=e,s[h++]=r,l[0]=Math.min(l[0],e),l[1]=Math.min(l[1],r),l[2]=Math.max(l[2],e),l[3]=Math.max(l[3],r));s=u(s,h),this.idToIndex=a,this.updateLines(t,s),this.updateError("X",t),this.updateError("Y",t);var d;if(this.hasMarkers){this.scatterOptions.positions=s;var p=b(t.marker.color),m=b(t.marker.line.color),g=t.opacity*t.marker.opacity;p[3]*=g,this.scatterOptions.color=p,m[3]*=g,this.scatterOptions.borderColor=m,d=t.marker.size,this.scatterOptions.size=d,this.scatterOptions.borderSize=t.marker.line.width,this.scatter.update(this.scatterOptions)}else this.scatterOptions.positions=new Float32Array(0),this.scatterOptions.glyphs=[],this.scatter.update(this.scatterOptions);this.scatterOptions.positions=new Float32Array(0),this.scatterOptions.glyphs=[],this.fancyScatter.update(this.scatterOptions),this.expandAxesFast(l,d)},E.updateFancy=function(t){var e=this.scene,r=e.xaxis,n=e.yaxis,o=this.bounds,a=this.pickXData=r.makeCalcdata(t,"x").slice(),l=this.pickYData=n.makeCalcdata(t,"y").slice();this.xData=a.slice(),this.yData=l.slice();var c,h,f,d,p,v,m,g,b=y.calcFromTrace(t,e.fullLayout),x=a.length,_=new Array(x),M=new Float32Array(2*x),k=new Float32Array(4*x),A=new Float32Array(4*x),T=0,E=0,L=0,I=0,P="log"===r.type?function(t){return r.d2l(t)}:function(t){return t},C="log"===n.type?function(t){return n.d2l(t)}:function(t){return t};for(c=0;x>c;++c)this.xData[c]=f=P(a[c]),this.yData[c]=d=C(l[c]),isNaN(f)||isNaN(d)||(_[T++]=c,M[E++]=f,M[E++]=d,p=k[L++]=f-b[c].xs||0,v=k[L++]=b[c].xh-f||0,k[L++]=0,k[L++]=0,A[I++]=0,A[I++]=0,m=A[I++]=d-b[c].ys||0,g=A[I++]=b[c].yh-d||0,o[0]=Math.min(o[0],f-p),o[1]=Math.min(o[1],d-m),o[2]=Math.max(o[2],f+v),o[3]=Math.max(o[3],d+g));M=u(M,E),this.idToIndex=_,this.updateLines(t,M),this.updateError("X",t,M,k),this.updateError("Y",t,M,A);var R;if(this.hasMarkers){this.scatterOptions.positions=M,this.scatterOptions.sizes=new Array(T),this.scatterOptions.glyphs=new Array(T),this.scatterOptions.borderWidths=new Array(T),this.scatterOptions.colors=new Array(4*T),this.scatterOptions.borderColors=new Array(4*T);var D,O=w(t),F=t.marker,j=F.opacity,N=t.opacity,B=s(F,j,N,x),U=z(F.symbol,x),V=S(F.line.width,x),q=s(F.line,j,N,x);for(R=i(O,F.size,x),c=0;T>c;++c)for(D=_[c],this.scatterOptions.sizes[c]=4*R[D],this.scatterOptions.glyphs[c]=U[D],this.scatterOptions.borderWidths[c]=.5*V[D],h=0;4>h;++h)this.scatterOptions.colors[4*c+h]=B[4*D+h],this.scatterOptions.borderColors[4*c+h]=q[4*D+h];this.fancyScatter.update(this.scatterOptions)}else this.scatterOptions.positions=new Float32Array(0),this.scatterOptions.glyphs=[],this.fancyScatter.update(this.scatterOptions);this.scatterOptions.positions=new Float32Array(0),this.scatterOptions.glyphs=[],this.scatter.update(this.scatterOptions),this.expandAxesFancy(a,l,R)},E.updateLines=function(t,e){var r;if(this.hasLines){var n=e;if(!t.connectgaps){var i=0,o=this.xData,s=this.yData;for(n=new Float32Array(2*o.length),r=0;ra;a++)r=this.scene[T[a]],n=r._min,n||(n=[]),n.push({val:t[a],pad:o}),i=r._max,i||(i=[]),i.push({val:t[a+2],pad:o})},E.expandAxesFancy=function(t,e,r){var n=this.scene,i={padded:!0,ppad:r};g.expand(n.xaxis,t,i),g.expand(n.yaxis,e,i)},E.dispose=function(){this.line.dispose(),this.errorX.dispose(),this.errorY.dispose(),this.scatter.dispose(),this.fancyScatter.dispose()},e.exports=c},{"../../components/errorbars":512,"../../constants/gl2d_dashes":552,"../../constants/gl_markers":554,"../../lib":568,"../../lib/gl_format_color":566,"../../lib/str2rgbarray":580,"../../plots/cartesian/axes":592,"../scatter/get_trace_color":758,"../scatter/make_bubble_size_func":764,"../scatter/subtypes":769,"fast-isnumeric":123,"gl-error2d":125,"gl-line2d":131,"gl-scatter2d":196,"gl-scatter2d-fancy":191}],785:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("../scatter/constants"),o=t("../scatter/subtypes"),a=t("../scatter/xy_defaults"),s=t("../scatter/marker_defaults"),l=t("../scatter/line_defaults"),u=t("../scatter/fillcolor_defaults"),c=t("../../components/errorbars/defaults"),h=t("./attributes");e.exports=function(t,e,r,f){function d(r,i){return n.coerce(t,e,h,r,i)}var p=a(t,e,d);return p?(d("text"),d("mode",px;x++){var _=e.lon[x],w=e.lat[x];if(n(_)&&n(w)){var M={};if(b++,M.lonlat=[+_,+w],h){if(f){var k=c.color[x];M.mc=k,M.mcc=m(k)}if(d){var A=c.size[x];M.ms=A,M.mrc=g(A)}if(p){var T=c.symbol[x];M.mx="string"==typeof T?T:"circle"}}if(v){var E=e.text[x];M.tx="string"==typeof E?E:""}y.push(M)}else b>0&&(y[b-1].gapAfter=!0)}return y}},{"../../components/colorscale/has_colorscale":496,"../../components/colorscale/make_scale_function":500,"../../lib":568,"../scatter/colorscale_calc":754,"../scatter/make_bubble_size_func":764,"../scatter/subtypes":769,"fast-isnumeric":123}],789:[function(t,e,r){"use strict";function n(){return{geojson:i(),layout:{visibility:"none"},paint:{}}}function i(){return{type:"Point",coordinates:[]}}function o(t,e){return{type:"Polygon",coordinates:e}}function a(t,e){return{type:"MultiLineString",coordinates:e}}function s(t,e){function r(t,r,n,i){void 0===e[r][n]&&(e[r][n]=i),t[r]=e[r][n]}for(var n=t[0].trace,i=n.marker,o=Array.isArray(i.color),a=Array.isArray(i.size),s=[],l=0;l0&&(n.push(i),i=[])}return n.push(i),n}function f(t){return Array.isArray(t)?function(t){return t}:t?function(){return t}:d}function d(){return""}var p=t("../../lib"),v=t("../scatter/subtypes"),m=t("../../plots/mapbox/convert_text_opts"),g="circle-color",y="circle-radius";e.exports=function(t){var e=t[0].trace,r=e.visible===!0,i="none"!==e.fill,f=v.hasLines(e),d=v.hasMarkers(e),b=v.hasText(e),x=d&&"circle"===e.marker.symbol,_=d&&"circle"!==e.marker.symbol,w=n(),M=n(),k=n(),A=n(),T={fill:w,line:M,circle:k,symbol:A};if(!r)return T;var E;if((i||f)&&(E=h(t)),i&&(w.geojson=o(t,E),w.layout.visibility="visible",p.extendFlat(w.paint,{"fill-color":e.fillcolor})),f&&(M.geojson=a(t,E),M.layout.visibility="visible",p.extendFlat(M.paint,{"line-width":e.line.width,"line-color":e.line.color,"line-opacity":e.opacity})),x){var S={};S[g]={},S[y]={},k.geojson=s(t,S),k.layout.visibility="visible",p.extendFlat(k.paint,{"circle-opacity":e.opacity*e.marker.opacity,"circle-color":u(e,S),"circle-radius":c(e,S)})}if((_||b)&&(A.geojson=l(t),p.extendFlat(A.layout,{visibility:"visible","icon-image":"{symbol}-15","text-field":"{text}"}),_&&(p.extendFlat(A.layout,{"icon-size":e.marker.size/10}),p.extendFlat(A.paint,{"icon-opacity":e.opacity*e.marker.opacity,"icon-color":e.marker.color})),b)){var L=(e.marker||{}).size,z=m(e.textposition,L);p.extendFlat(A.layout,{"text-size":e.textfont.size,"text-anchor":z.anchor,"text-offset":z.offset}),p.extendFlat(A.paint,{"text-color":e.textfont.color,"text-opacity":e.opacity})}return T}},{"../../lib":568,"../../plots/mapbox/convert_text_opts":642,"../scatter/subtypes":769}],790:[function(t,e,r){"use strict";function n(t,e,r){var n=r("lon")||[],i=r("lat")||[],o=Math.min(n.length,i.length);return o")}var i=t("../../plots/cartesian/graph_interact"),o=t("../scatter/get_trace_color");e.exports=function(t,e,r){function a(t){var e=t.lonlat,n=Math.abs(u.c2p(e)-u.c2p([d,e[1]])),i=Math.abs(c.c2p(e)-c.c2p([e[0],r])),o=Math.max(3,t.mrc||0);return Math.max(Math.sqrt(n*n+i*i)-o,1-3/o)}var s=t.cd,l=s[0].trace,u=t.xa,c=t.ya,h=e>=0?Math.floor((e+180)/360):Math.ceil((e-180)/360),f=360*h,d=e-f;if(i.getClosest(s,a,t),t.index!==!1){var p=s[t.index],v=p.lonlat,m=[v[0]+f,v[1]],g=u.c2p(m),y=c.c2p(m),b=p.mrc||1;return t.x0=g-b,t.x1=g+b,t.y0=y-b,t.y1=y+b,t.color=o(l,p),t.extraText=n(l,p),[t]}}},{"../../plots/cartesian/graph_interact":599,"../scatter/get_trace_color":758}],792:[function(t,e,r){"use strict";var n={};n.attributes=t("./attributes"),n.supplyDefaults=t("./defaults"),n.colorbar=t("../scatter/colorbar"),n.calc=t("./calc"),n.hoverPoints=t("./hover"),n.plot=t("./plot"),n.moduleType="trace",n.name="scattermapbox",n.basePlotModule=t("../../plots/mapbox"),n.categories=["mapbox","gl","symbols","markerColorscale","showLegend"],n.meta={},e.exports=n},{"../../plots/mapbox":643,"../scatter/colorbar":753,"./attributes":787,"./calc":788,"./defaults":790,"./hover":791,"./plot":793}],793:[function(t,e,r){"use strict";function n(t,e){this.mapbox=t,this.map=t.map,this.uid=e,this.idSourceFill=e+"-source-fill",this.idSourceLine=e+"-source-line",this.idSourceCircle=e+"-source-circle",this.idSourceSymbol=e+"-source-symbol",this.idLayerFill=e+"-layer-fill",this.idLayerLine=e+"-layer-line",this.idLayerCircle=e+"-layer-circle",this.idLayerSymbol=e+"-layer-symbol",this.sourceFill=t.createGeoJSONSource(),this.map.addSource(this.idSourceFill,this.sourceFill),this.sourceLine=t.createGeoJSONSource(),this.map.addSource(this.idSourceLine,this.sourceLine),this.sourceCircle=t.createGeoJSONSource(),this.map.addSource(this.idSourceCircle,this.sourceCircle),this.sourceSymbol=t.createGeoJSONSource(),this.map.addSource(this.idSourceSymbol,this.sourceSymbol),this.map.addLayer({id:this.idLayerFill,source:this.idSourceFill,type:"fill"}),this.map.addLayer({id:this.idLayerLine,source:this.idSourceLine,type:"line"}),this.map.addLayer({id:this.idLayerCircle,source:this.idSourceCircle,type:"circle"}),this.map.addLayer({id:this.idLayerSymbol,source:this.idSourceSymbol,type:"symbol"})}function i(t){return"visible"===t.layout.visibility}var o=t("./convert"),a=n.prototype;a.update=function(t){var e=this.mapbox,r=o(t);e.setOptions(this.idLayerFill,"setLayoutProperty",r.fill.layout),e.setOptions(this.idLayerLine,"setLayoutProperty",r.line.layout),e.setOptions(this.idLayerCircle,"setLayoutProperty",r.circle.layout),e.setOptions(this.idLayerSymbol,"setLayoutProperty",r.symbol.layout),i(r.fill)&&(this.sourceFill.setData(r.fill.geojson),e.setOptions(this.idLayerFill,"setPaintProperty",r.fill.paint)),i(r.line)&&(this.sourceLine.setData(r.line.geojson),e.setOptions(this.idLayerLine,"setPaintProperty",r.line.paint)),i(r.circle)&&(this.sourceCircle.setData(r.circle.geojson),e.setOptions(this.idLayerCircle,"setPaintProperty",r.circle.paint)),i(r.symbol)&&(this.sourceSymbol.setData(r.symbol.geojson),e.setOptions(this.idLayerSymbol,"setPaintProperty",r.symbol.paint))},a.dispose=function(){var t=this.map;t.removeLayer(this.idLayerFill),t.removeLayer(this.idLayerLine),t.removeLayer(this.idLayerCircle),t.removeLayer(this.idLayerSymbol),t.removeSource(this.idSourceFill),t.removeSource(this.idSourceLine),t.removeSource(this.idSourceCircle),t.removeSource(this.idSourceSymbol)},e.exports=function(t,e){var r=e[0].trace,i=new n(t,r.uid);return i.update(e),i}},{"./convert":789}],794:[function(t,e,r){"use strict";var n=t("../scatter/attributes"),i=t("../../plots/attributes"),o=t("../../components/colorscale/color_attributes"),a=t("../../lib/extend").extendFlat,s=n.marker,l=n.line,u=s.line;e.exports={a:{valType:"data_array"},b:{valType:"data_array"},c:{valType:"data_array"},sum:{valType:"number",dflt:0,min:0},mode:a({},n.mode,{dflt:"markers"}),text:a({},n.text,{}),line:{color:l.color,width:l.width,dash:l.dash,shape:a({},l.shape,{values:["linear","spline"]}),smoothing:l.smoothing},connectgaps:n.connectgaps,fill:a({},n.fill,{values:["none","toself","tonext"]}),fillcolor:n.fillcolor,marker:a({},{symbol:s.symbol,opacity:s.opacity,maxdisplayed:s.maxdisplayed,size:s.size,sizeref:s.sizeref,sizemin:s.sizemin,sizemode:s.sizemode,showscale:s.showscale,line:a({},{width:u.width},o("marker".line))},o("marker")),textfont:n.textfont,textposition:n.textposition,hoverinfo:a({},i.hoverinfo,{flags:["a","b","c","text","name"]}),hoveron:n.hoveron,_nestedModules:{"marker.colorbar":"Colorbar"}}},{"../../components/colorscale/color_attributes":491,"../../lib/extend":563,"../../plots/attributes":590,"../scatter/attributes":750}],795:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),i=t("../../plots/cartesian/axes"),o=t("../../lib"),a=t("../scatter/subtypes"),s=t("../scatter/colorscale_calc"),l=["a","b","c"],u={a:["b","c"],b:["a","c"],c:["a","b"]};e.exports=function(t,e){var r,c,h,f,d,p,v=t._fullLayout[e.subplot],m=v.sum,g=e.sum||m;for(r=0;rr;r++)y=e.a[r],b=e.b[r],x=e.c[r],n(y)&&n(b)&&n(x)?(y=+y,b=+b,x=+x,_=m/(y+b+x),1!==_&&(y*=_,b*=_,x*=_),M=y,w=x-b,A[r]={x:w,y:M,a:y,b:b,c:x}):A[r]={x:!1,y:!1};var T,E;if(a.hasMarkers(e)&&(T=e.marker,E=T.size,Array.isArray(E))){var S={type:"linear"};i.setConvert(S),E=S.makeCalcdata(e.marker,"size"),E.length>k&&E.splice(k,E.length-k)}return s(e),void 0!==typeof E&&o.mergeArray(E,A,"ms"),A}},{"../../lib":568,"../../plots/cartesian/axes":592,"../scatter/colorscale_calc":754,"../scatter/subtypes":769,"fast-isnumeric":123}],796:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("../scatter/constants"),o=t("../scatter/subtypes"),a=t("../scatter/marker_defaults"),s=t("../scatter/line_defaults"),l=t("../scatter/line_shape_defaults"),u=t("../scatter/text_defaults"),c=t("../scatter/fillcolor_defaults"),h=t("./attributes");e.exports=function(t,e,r,f){function d(r,i){return n.coerce(t,e,h,r,i)}var p,v=d("a"),m=d("b"),g=d("c");if(v?(p=v.length,m?(p=Math.min(p,m.length),g&&(p=Math.min(p,g.length))):p=g?Math.min(p,g.length):0):m&&g&&(p=Math.min(m.length,g.length)),!p)return void(e.visible=!1);v&&p"),s}}},{"../../plots/cartesian/axes":592,"../scatter/hover":759}],798:[function(t,e,r){"use strict";var n={};n.attributes=t("./attributes"),n.supplyDefaults=t("./defaults"),n.colorbar=t("../scatter/colorbar"),n.calc=t("./calc"),n.plot=t("./plot"),n.style=t("./style"),n.hoverPoints=t("./hover"),n.selectPoints=t("./select"),n.moduleType="trace",n.name="scatterternary",n.basePlotModule=t("../../plots/ternary"),n.categories=["ternary","symbols","markerColorscale","showLegend"],n.meta={},e.exports=n},{"../../plots/ternary":655,"../scatter/colorbar":753,"./attributes":794,"./calc":795,"./defaults":796,"./hover":797,"./plot":799,"./select":800,"./style":801}],799:[function(t,e,r){"use strict";var n=t("../scatter/plot");e.exports=function(t,e){var r=t.plotContainer;r.select(".scatterlayer").selectAll("*").remove();for(var i={x:function(){return t.xaxis},y:function(){return t.yaxis},plot:r},o=new Array(e.length),a=t.graphDiv.calcdata,s=0;se){for(var r=v/e,n=[0|Math.floor(t[0].shape[0]*r+1),0|Math.floor(t[0].shape[1]*r+1)],i=n[0]*n[1],a=0;ar;++r)this.showContour[r]&&(e=!0,t[r]=this.scene.contourLevels[r]);e&&this.surface.update({levels:t})},m.update=function(t){var e,r=this.scene,n=r.fullSceneLayout,o=this.surface,s=t.opacity,l=i(t.colorscale,s),c=t.z,f=t.x,d=t.y,v=n.xaxis,m=n.yaxis,g=n.zaxis,y=r.dataScale,b=c[0].length,x=c.length,_=[u(new Float32Array(b*x),[b,x]),u(new Float32Array(b*x),[b,x]),u(new Float32Array(b*x),[b,x])],w=_[0],M=_[1],k=r.contourLevels;this.data=t,h(_[2],function(t,e){return g.d2l(c[e][t])*y[2]}),Array.isArray(f[0])?h(w,function(t,e){return v.d2l(f[e][t])*y[0]}):h(w,function(t){return v.d2l(f[t])*y[0]}),Array.isArray(d[0])?h(M,function(t,e){return m.d2l(d[e][t])*y[1]}):h(M,function(t,e){return m.d2l(d[e])*y[1]});var A={colormap:l,levels:[[],[],[]],showContour:[!0,!0,!0],showSurface:!t.hidesurface,contourProject:[[!1,!1,!1],[!1,!1,!1],[!1,!1,!1]],contourWidth:[1,1,1],contourColor:[[1,1,1,1],[1,1,1,1],[1,1,1,1]],contourTint:[1,1,1],dynamicColor:[[1,1,1,1],[1,1,1,1],[1,1,1,1]],dynamicWidth:[1,1,1],dynamicTint:[1,1,1],opacity:1};if(A.intensityBounds=[t.cmin,t.cmax],t.surfacecolor){var T=u(new Float32Array(b*x),[b,x]);h(T,function(e,r){return t.surfacecolor[r][e]}),_.push(T)}else A.intensityBounds[0]*=y[2],A.intensityBounds[1]*=y[2];this.dataScale=a(_),t.surfacecolor&&(A.intensity=_.pop()),"opacity"in t&&t.opacity<1&&(A.opacity=.25*t.opacity);var E=[!0,!0,!0],S=["x","y","z"];for(e=0;3>e;++e){var L=t.contours[S[e]];E[e]=L.highlight,A.showContour[e]=L.show||L.highlight,A.showContour[e]&&(A.contourProject[e]=[L.project.x,L.project.y,L.project.z],L.show?(this.showContour[e]=!0,A.levels[e]=k[e],o.highlightColor[e]=A.contourColor[e]=p(L.color),L.usecolormap?o.highlightTint[e]=A.contourTint[e]=0:o.highlightTint[e]=A.contourTint[e]=1,A.contourWidth[e]=L.width):this.showContour[e]=!1,L.highlight&&(A.dynamicColor[e]=p(L.highlightcolor),A.dynamicWidth[e]=L.highlightwidth))}A.coords=_,o.update(A),o.visible=t.visible,o.enableDynamic=E,o.snapToData=!0,"lighting"in t&&(o.ambientLight=t.lighting.ambient,o.diffuseLight=t.lighting.diffuse,o.specularLight=t.lighting.specular,o.roughness=t.lighting.roughness,o.fresnel=t.lighting.fresnel),"lightposition"in t&&(o.lightPosition=[t.lightposition.x,t.lightposition.y,t.lightposition.z]),s&&1>s&&(o.supportsTransparency=!0)},m.dispose=function(){this.scene.glplot.remove(this.surface),this.surface.dispose()},e.exports=s},{"../../lib/str2rgbarray":580,"gl-surface3d":227,ndarray:433,"ndarray-fill":426,"ndarray-homography":431,"ndarray-ops":432,tinycolor2:454}],806:[function(t,e,r){"use strict";function n(t,e,r){e in t&&!(r in t)&&(t[r]=t[e])}var i=t("../../lib"),o=t("../../components/colorscale/defaults"),a=t("./attributes");e.exports=function(t,e,r,s){function l(r,n){return i.coerce(t,e,a,r,n)}var u,c,h=l("z");if(!h)return void(e.visible=!1);var f=h[0].length,d=h.length;if(l("x"),l("y"),!Array.isArray(e.x))for(e.x=[],u=0;f>u;++u)e.x[u]=u;if(l("text"),!Array.isArray(e.y))for(e.y=[],u=0;d>u;++u)e.y[u]=u;["lighting.ambient","lighting.diffuse","lighting.specular","lighting.roughness","lighting.fresnel","lightposition.x","lightposition.y","lightposition.z","hidesurface","opacity"].forEach(function(t){l(t)});var p=l("surfacecolor");l("colorscale");var v=["x","y","z"];for(u=0;3>u;++u){var m="contours."+v[u],g=l(m+".show"),y=l(m+".highlight");if(g||y)for(c=0;3>c;++c)l(m+".project."+v[c]);g&&(l(m+".color"),l(m+".width"),l(m+".usecolormap")),y&&(l(m+".highlightcolor"),l(m+".highlightwidth"))}p||(n(t,"zmin","cmin"),n(t,"zmax","cmax"),n(t,"zauto","cauto")),o(t,e,s,l,{prefix:"",cLetter:"c"})}},{"../../components/colorscale/defaults":493,"../../lib":568,"./attributes":802}],807:[function(t,e,r){"use strict";var n={};n.attributes=t("./attributes"),n.supplyDefaults=t("./defaults"),n.colorbar=t("./colorbar"),n.calc=t("./calc"),n.plot=t("./convert"),n.moduleType="trace",n.name="surface",n.basePlotModule=t("../../plots/gl3d"),n.categories=["gl3d","noOpacity"],n.meta={},e.exports=n},{"../../plots/gl3d":628,"./attributes":802,"./calc":803,"./colorbar":804,"./convert":805,"./defaults":806}]},{},[12])(12)}); -
\ No newline at end of file +
\ No newline at end of file diff --git a/plotly/tests/test_optional/test_figure_factory.py b/plotly/tests/test_optional/test_figure_factory.py index 6e837e1f6af..df122a1ab7b 100644 --- a/plotly/tests/test_optional/test_figure_factory.py +++ b/plotly/tests/test_optional/test_figure_factory.py @@ -842,29 +842,28 @@ def test_trisurf_all_args(self): ) exp_trisurf_plot = { - 'data': [{'facecolor': np.array( - ['rgb(144, 94, 132)', - 'rgb(23, 190, 207)', - 'rgb(144, 94, 132)', - 'rgb(31, 119, 180)', - 'rgb(144, 94, 132)', - 'rgb(31, 119, 180)', - 'rgb(144, 94, 132)', - 'rgb(23, 190, 207)'] - ), - 'i': np.array([3, 1, 1, 5, 7, 3, 5, 7]), - 'j': np.array([1, 3, 5, 1, 3, 7, 7, 5]), - 'k': np.array([4, 0, 4, 2, 4, 6, 4, 8]), - 'name': '', - 'type': 'mesh3d', - 'x': np.array([-1., 0., 1., -1., 0., 1., - -1., 0., 1.]), - 'y': np.array([-1., -1., -1., 0., 0., 0., - 1., 1., 1.]), - 'z': np.array([1., -0., -1., -0., 0., 0., - -1., 0., 1.])}, + 'data': [{'facecolor': ['rgb(144, 94, 132)', + 'rgb(23, 190, 207)', + 'rgb(144, 94, 132)', + 'rgb(31, 119, 180)', + 'rgb(144, 94, 132)', + 'rgb(31, 119, 180)', + 'rgb(144, 94, 132)', + 'rgb(23, 190, 207)'], + 'i': np.array([3, 1, 1, 5, 7, 3, 5, 7]), + 'j': np.array([1, 3, 5, 1, 3, 7, 7, 5]), + 'k': np.array([4, 0, 4, 2, 4, 6, 4, 8]), + 'name': '', + 'type': 'mesh3d', + 'x': np.array([-1., 0., 1., -1., 0., + 1., -1., 0., 1.]), + 'y': np.array([-1., -1., -1., 0., 0., + 0., 1., 1., 1.]), + 'z': np.array([1., -0., -1., -0., 0., + 0., -1., 0., 1.])}, {'line': {'color': 'rgb(50, 50, 50)', 'width': 1.5}, 'mode': 'lines', + 'showlegend': False, 'type': 'scatter3d', 'x': np.array([-1.0, 0.0, 0.0, -1.0, None, 0.0, -1.0, -1.0, 0.0, None, 0.0, 1.0, 0.0, 0.0, @@ -884,43 +883,43 @@ def test_trisurf_all_args(self): -0.0, 0.0, 0.0, None, -0.0, 0.0, -1.0, -0.0, None, 0.0, 0.0, 0.0, 0.0, None, 0.0, 0.0, 1.0, 0.0, None])}, - {'colorscale': [[0.0, 'rgb(31, 119, 180)'], - [0.1111111111111111, 'rgb(255, 127, 14)'], - [0.2222222222222222, 'rgb(44, 160, 44)'], - [0.3333333333333333, 'rgb(214, 39, 40)'], - [0.4444444444444444, 'rgb(148, 103, 189)'], - [0.5555555555555556, 'rgb(140, 86, 75)'], - [0.6666666666666666, 'rgb(227, 119, 194)'], - [0.7777777777777778, 'rgb(127, 127, 127)'], - [0.8888888888888888, 'rgb(188, 189, 34)'], - [1.0, 'rgb(23, 190, 207)']], - 'intensity': [0, 1], - 'showscale': True, - 'type': 'mesh3d', - 'x': [0, 1], - 'y': [0, 1], - 'z': [0, 1]}], + {'hoverinfo': 'None', + 'marker': {'color': [-0.33333333333333331, + 0.33333333333333331], + 'colorscale': [ + [0.0, 'rgb(31, 119, 180)'], + [0.1111111111111111, 'rgb(255, 127, 14)'], + [0.2222222222222222, 'rgb(44, 160, 44)'], + [0.3333333333333333, 'rgb(214, 39, 40)'], + [0.4444444444444444, 'rgb(148, 103, 189)'], + [0.5555555555555556, 'rgb(140, 86, 75)'], + [0.6666666666666666, 'rgb(227, 119, 194)'], + [0.7777777777777778, 'rgb(127, 127, 127)'], + [0.8888888888888888, 'rgb(188, 189, 34)'], + [1.0, 'rgb(23, 190, 207)'] + ], + 'showscale': True, + 'size': 0.1}, + 'mode': 'markers', + 'showlegend': False, + 'type': 'scatter3d', + 'x': -1.0, + 'y': -1.0, + 'z': 1.0}], 'layout': {'height': 800, 'scene': {'aspectratio': {'x': 1, 'y': 1, 'z': 1}, - 'xaxis': {'backgroundcolor': - 'rgb(230, 230, 230)', - 'gridcolor': - 'rgb(255, 255, 255)', + 'xaxis': {'backgroundcolor': 'rgb(230, 230, 230)', + 'gridcolor': 'rgb(255, 255, 255)', 'showbackground': True, - 'zerolinecolor': - 'rgb(255, 255, 255)'}, - 'yaxis': {'backgroundcolor': - 'rgb(230, 230, 230)', + 'zerolinecolor': 'rgb(255, 255, 255)'}, + 'yaxis': {'backgroundcolor': 'rgb(230, 230, 230)', 'gridcolor': 'rgb(255, 255, 255)', 'showbackground': True, - 'zerolinecolor': - 'rgb(255, 255, 255)'}, - 'zaxis': {'backgroundcolor': - 'rgb(230, 230, 230)', + 'zerolinecolor': 'rgb(255, 255, 255)'}, + 'zaxis': {'backgroundcolor': 'rgb(230, 230, 230)', 'gridcolor': 'rgb(255, 255, 255)', 'showbackground': True, - 'zerolinecolor': - 'rgb(255, 255, 255)'}}, + 'zerolinecolor': 'rgb(255, 255, 255)'}}, 'title': 'Trisurf Plot', 'width': 800} } diff --git a/plotly/tools.py b/plotly/tools.py index 8bfc67dab7e..f7342c6447a 100644 --- a/plotly/tools.py +++ b/plotly/tools.py @@ -3297,15 +3297,19 @@ def _trisurf(x, y, z, simplices, show_colorbar, edges_color, raise ValueError("If color_func is a list/array, it must " "be the same length as simplices.") - # convert all colors to rgb + # convert all colors in color_func to rgb for index in range(len(color_func)): if isinstance(color_func[index], str): if '#' in color_func[index]: foo = FigureFactory._hex_to_rgb(color_func[index]) color_func[index] = FigureFactory._label_rgb(foo) + if isinstance(color_func[index], tuple): + foo = FigureFactory._convert_to_RGB_255(color_func[index]) + color_func[index] = FigureFactory._label_rgb(foo) + mean_dists = np.asarray(color_func) - elif hasattr(color_func, '__call__'): + else: # apply user inputted function to calculate # custom coloring for triangle vertices mean_dists = [] @@ -3340,15 +3344,17 @@ def _trisurf(x, y, z, simplices, show_colorbar, edges_color, triangles = graph_objs.Mesh3d(x=x, y=y, z=z, facecolor=facecolor, i=ii, j=jj, k=kk, name='') - if not isinstance(mean_dists[0], str) and show_colorbar is True: + mean_dists_are_numbers = not isinstance(mean_dists[0], str) + + if mean_dists_are_numbers and show_colorbar is True: # make a colorscale from the colors colorscale = FigureFactory._make_colorscale(colormap) colorscale = FigureFactory._convert_colorscale_to_rgb(colorscale) colorbar = graph_objs.Scatter3d( - x=x[:2], - y=y[:2], - z=z[:2], + x=x[0], + y=y[0], + z=z[0], mode='markers', marker=dict( size=0.1, @@ -3361,7 +3367,7 @@ def _trisurf(x, y, z, simplices, show_colorbar, edges_color, # the triangle sides are not plotted if plot_edges is False: - if not isinstance(mean_dists[0], str) and show_colorbar is True: + if mean_dists_are_numbers and show_colorbar is True: return graph_objs.Data([triangles, colorbar]) else: return graph_objs.Data([triangles]) @@ -3408,7 +3414,7 @@ def _trisurf(x, y, z, simplices, show_colorbar, edges_color, showlegend=False ) - if not isinstance(mean_dists[0], str) and show_colorbar is True: + if mean_dists_are_numbers and show_colorbar is True: return graph_objs.Data([triangles, lines, colorbar]) else: return graph_objs.Data([triangles, lines]) @@ -3442,7 +3448,7 @@ def create_trisurf(x, y, z, simplices, colormap=None, show_colorbar=True, :param (function|list) color_func: The parameter that determines the coloring of the surface. Takes either a function with 3 arguments x, y, z or a list/array of color values the same length as - simplices. If set to None, color will only depend on the z axis + simplices. If None, coloring will only depend on the z axis :param (str) title: title of the plot :param (bool) plot_edges: determines if the triangles on the trisurf are visible @@ -3490,7 +3496,7 @@ def create_trisurf(x, y, z, simplices, colormap=None, show_colorbar=True, colormap="Blues", simplices=simplices) # Plot the data - py.iplot(fig1, filename='Trisurf Plot - Sphere') + py.iplot(fig1, filename='trisurf-plot-sphere') ``` Example 2: Torus @@ -3520,10 +3526,10 @@ def create_trisurf(x, y, z, simplices, colormap=None, show_colorbar=True, # Create a figure fig1 = FF.create_trisurf(x=x, y=y, z=z, - colormap="Portland", + colormap="Greys", simplices=simplices) # Plot the data - py.iplot(fig1, filename='Trisurf Plot - Torus') + py.iplot(fig1, filename='trisurf-plot-torus') ``` Example 3: Mobius Band @@ -3554,10 +3560,10 @@ def create_trisurf(x, y, z, simplices, colormap=None, show_colorbar=True, # Create a figure fig1 = FF.create_trisurf(x=x, y=y, z=z, - colormap=[(0.2, 0.4, 0.6),(1, 1, 1)], + colormap=[(0.2, 0.4, 0.6), (1, 1, 1)], simplices=simplices) # Plot the data - py.iplot(fig1, filename='Trisurf Plot - Mobius Band') + py.iplot(fig1, filename='trisurf-plot-mobius-band') ``` Example 4: Using a Custom Colormap Function with Light Cone @@ -3597,7 +3603,7 @@ def dist_origin(x, y, z): simplices=simplices, color_func=dist_origin) # Plot the data - py.iplot(fig1, filename='Trisurf Plot - Custom Coloring') + py.iplot(fig1, filename='trisurf-plot-custom-coloring') ``` Example 5: Enter color_func as a list of colors @@ -3637,11 +3643,11 @@ def dist_origin(x, y, z): x, y, z, simplices, color_func=colors, show_colorbar=True, - edges_color='rgb(2,85,180)', + edges_color='rgb(2, 85, 180)', title=' Modern Art' ) - py.iplot(fig, filename="Modern Art") + py.iplot(fig, filename="trisurf-plot-modern-art") ``` """ from plotly.graph_objs import graph_objs From dc9e42c7ce88bb99a86e74692ee2ab640697ddc8 Mon Sep 17 00:00:00 2001 From: Adam Kulidjian Date: Mon, 22 Aug 2016 11:04:38 -0400 Subject: [PATCH 3/4] Increase version number to 1.12.9 --- plotly/version.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plotly/version.py b/plotly/version.py index b43b314ed53..713337ad951 100644 --- a/plotly/version.py +++ b/plotly/version.py @@ -1 +1 @@ -__version__ = '1.12.8' +__version__ = '1.12.9' From 1165bec7a4e30ddc23952198c6193d7d7818f6ee Mon Sep 17 00:00:00 2001 From: Adam Kulidjian Date: Mon, 22 Aug 2016 13:45:17 -0400 Subject: [PATCH 4/4] delete temp-plot.html --- plotly/tests/test_optional/temp-plot.html | 60 ----------------------- 1 file changed, 60 deletions(-) delete mode 100644 plotly/tests/test_optional/temp-plot.html diff --git a/plotly/tests/test_optional/temp-plot.html b/plotly/tests/test_optional/temp-plot.html deleted file mode 100644 index 2eccb96195e..00000000000 --- a/plotly/tests/test_optional/temp-plot.html +++ /dev/null @@ -1,60 +0,0 @@ -
\ No newline at end of file