plotly
Advanced tools
Sorry, the diff of this file is too big to display
| var _JUPYTERLAB;(()=>{"use strict";var e,r,t={987:(e,r,t)=>{var o={"./index":()=>t.e(340).then((()=>()=>t(340))),"./mimeExtension":()=>t.e(340).then((()=>()=>t(340)))},a=(e,r)=>(t.R=r,r=t.o(o,e)?o[e]():Promise.resolve().then((()=>{throw new Error('Module "'+e+'" does not exist in container.')})),t.R=void 0,r),n=(e,r)=>{if(t.S){var o="default",a=t.S[o];if(a&&a!==e)throw new Error("Container initialization failed as it has already been initialized with a different share scope");return t.S[o]=e,t.I(o,r)}};t.d(r,{get:()=>a,init:()=>n})}},o={};function a(e){var r=o[e];if(void 0!==r)return r.exports;var n=o[e]={exports:{}};return t[e](n,n.exports,a),n.exports}a.m=t,a.c=o,a.amdO={},a.d=(e,r)=>{for(var t in r)a.o(r,t)&&!a.o(e,t)&&Object.defineProperty(e,t,{enumerable:!0,get:r[t]})},a.f={},a.e=e=>Promise.all(Object.keys(a.f).reduce(((r,t)=>(a.f[t](e,r),r)),[])),a.u=e=>e+".6ef45c5e0eac9143a6d4.js?v=6ef45c5e0eac9143a6d4",a.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),a.o=(e,r)=>Object.prototype.hasOwnProperty.call(e,r),e={},r="jupyterlab-plotly:",a.l=(t,o,n,i)=>{if(e[t])e[t].push(o);else{var l,u;if(void 0!==n)for(var p=document.getElementsByTagName("script"),s=0;s<p.length;s++){var c=p[s];if(c.getAttribute("src")==t||c.getAttribute("data-webpack")==r+n){l=c;break}}l||(u=!0,(l=document.createElement("script")).charset="utf-8",l.timeout=120,a.nc&&l.setAttribute("nonce",a.nc),l.setAttribute("data-webpack",r+n),l.src=t),e[t]=[o];var d=(r,o)=>{l.onerror=l.onload=null,clearTimeout(f);var a=e[t];if(delete e[t],l.parentNode&&l.parentNode.removeChild(l),a&&a.forEach((e=>e(o))),r)return r(o)},f=setTimeout(d.bind(null,void 0,{type:"timeout",target:l}),12e4);l.onerror=d.bind(null,l.onerror),l.onload=d.bind(null,l.onload),u&&document.head.appendChild(l)}},a.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},(()=>{a.S={};var e={},r={};a.I=(t,o)=>{o||(o=[]);var n=r[t];if(n||(n=r[t]={}),!(o.indexOf(n)>=0)){if(o.push(n),e[t])return e[t];a.o(a.S,t)||(a.S[t]={});var i=a.S[t],l="jupyterlab-plotly",u=[];return"default"===t&&((e,r,t,o)=>{var n=i[e]=i[e]||{},u=n[r];(!u||!u.loaded&&(1!=!u.eager?o:l>u.from))&&(n[r]={get:()=>a.e(340).then((()=>()=>a(340))),from:l,eager:!1})})("jupyterlab-plotly","6.0.1"),e[t]=u.length?Promise.all(u).then((()=>e[t]=1)):1}}})(),(()=>{var e;a.g.importScripts&&(e=a.g.location+"");var r=a.g.document;if(!e&&r&&(r.currentScript&&"SCRIPT"===r.currentScript.tagName.toUpperCase()&&(e=r.currentScript.src),!e)){var t=r.getElementsByTagName("script");if(t.length)for(var o=t.length-1;o>-1&&(!e||!/^http(s?):/.test(e));)e=t[o--].src}if(!e)throw new Error("Automatic publicPath is not supported in this browser");e=e.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),a.p=e})(),(()=>{var e={80:0};a.f.j=(r,t)=>{var o=a.o(e,r)?e[r]:void 0;if(0!==o)if(o)t.push(o[2]);else{var n=new Promise(((t,a)=>o=e[r]=[t,a]));t.push(o[2]=n);var i=a.p+a.u(r),l=new Error;a.l(i,(t=>{if(a.o(e,r)&&(0!==(o=e[r])&&(e[r]=void 0),o)){var n=t&&("load"===t.type?"missing":t.type),i=t&&t.target&&t.target.src;l.message="Loading chunk "+r+" failed.\n("+n+": "+i+")",l.name="ChunkLoadError",l.type=n,l.request=i,o[1](l)}}),"chunk-"+r,r)}};var r=(r,t)=>{var o,n,[i,l,u]=t,p=0;if(i.some((r=>0!==e[r]))){for(o in l)a.o(l,o)&&(a.m[o]=l[o]);u&&u(a)}for(r&&r(t);p<i.length;p++)n=i[p],a.o(e,n)&&e[n]&&e[n][0](),e[n]=0},t=self.webpackChunkjupyterlab_plotly=self.webpackChunkjupyterlab_plotly||[];t.forEach(r.bind(null,0)),t.push=r.bind(null,t.push.bind(t))})();var n=a(987);(_JUPYTERLAB=void 0===_JUPYTERLAB?{}:_JUPYTERLAB)["jupyterlab-plotly"]=n})(); |
| import matplotlib | ||
| matplotlib.use("Agg") | ||
| import matplotlib.pyplot as plt |
| import matplotlib.pyplot as plt | ||
| import plotly.tools as tls | ||
| def test_native_legend_enabled_when_matplotlib_legend_present(): | ||
| """Test that when matplotlib legend is present, Plotly uses native legend.""" | ||
| fig, ax = plt.subplots() | ||
| ax.plot([0, 1], [0, 1], label="Line 1") | ||
| ax.plot([0, 1], [1, 0], label="Line 2") | ||
| ax.legend() | ||
| plotly_fig = tls.mpl_to_plotly(fig) | ||
| # Should enable native legend | ||
| assert plotly_fig.layout.showlegend == True | ||
| # Should have 2 traces with names | ||
| assert len(plotly_fig.data) == 2 | ||
| assert plotly_fig.data[0].name == "Line 1" | ||
| assert plotly_fig.data[1].name == "Line 2" | ||
| def test_no_fake_legend_shapes_with_native_legend(): | ||
| """Test that fake legend shapes are not created when using native legend.""" | ||
| fig, ax = plt.subplots() | ||
| ax.plot([0, 1], [0, 1], "o-", label="Data with markers") | ||
| ax.legend() | ||
| plotly_fig = tls.mpl_to_plotly(fig) | ||
| # Should use native legend | ||
| assert plotly_fig.layout.showlegend == True | ||
| # Should not create fake legend elements | ||
| assert len(plotly_fig.layout.shapes) == 0 | ||
| assert len(plotly_fig.layout.annotations) == 0 | ||
| def test_legend_disabled_when_no_matplotlib_legend(): | ||
| """Test that legend is not enabled when no matplotlib legend is present.""" | ||
| fig, ax = plt.subplots() | ||
| ax.plot([0, 1], [0, 1], label="Line 1") # Has label but no legend() call | ||
| plotly_fig = tls.mpl_to_plotly(fig) | ||
| # Should not have showlegend explicitly set to True | ||
| # (Plotly's default behavior when no legend elements exist) | ||
| assert ( | ||
| not hasattr(plotly_fig.layout, "showlegend") | ||
| or plotly_fig.layout.showlegend != True | ||
| ) | ||
| def test_legend_disabled_when_matplotlib_legend_not_visible(): | ||
| """Test that legend is not enabled when no matplotlib legend is not visible.""" | ||
| fig, ax = plt.subplots() | ||
| ax.plot([0, 1], [0, 1], label="Line 1") | ||
| legend = ax.legend() | ||
| legend.set_visible(False) # Hide the legend | ||
| plotly_fig = tls.mpl_to_plotly(fig) | ||
| # Should not enable legend when matplotlib legend is hidden | ||
| assert ( | ||
| not hasattr(plotly_fig.layout, "showlegend") | ||
| or plotly_fig.layout.showlegend != True | ||
| ) | ||
| def test_multiple_traces_native_legend(): | ||
| """Test native legend works with multiple traces of different types.""" | ||
| fig, ax = plt.subplots() | ||
| ax.plot([0, 1, 2], [0, 1, 0], "-", label="Line") | ||
| ax.plot([0, 1, 2], [1, 0, 1], "o", label="Markers") | ||
| ax.plot([0, 1, 2], [0.5, 0.5, 0.5], "s-", label="Line+Markers") | ||
| ax.legend() | ||
| plotly_fig = tls.mpl_to_plotly(fig) | ||
| assert plotly_fig.layout.showlegend == True | ||
| assert len(plotly_fig.data) == 3 | ||
| assert plotly_fig.data[0].name == "Line" | ||
| assert plotly_fig.data[1].name == "Markers" | ||
| assert plotly_fig.data[2].name == "Line+Markers" | ||
| # Verify modes are correct | ||
| assert plotly_fig.data[0].mode == "lines" | ||
| assert plotly_fig.data[1].mode == "markers" | ||
| assert plotly_fig.data[2].mode == "lines+markers" |
+1
-1
| Metadata-Version: 2.4 | ||
| Name: plotly | ||
| Version: 6.3.0 | ||
| Version: 6.3.1 | ||
| Summary: An open-source interactive data visualization library for Python | ||
@@ -5,0 +5,0 @@ Author-email: Chris P <chris@plot.ly> |
| Metadata-Version: 2.4 | ||
| Name: plotly | ||
| Version: 6.3.0 | ||
| Version: 6.3.1 | ||
| Summary: An open-source interactive data visualization library for Python | ||
@@ -5,0 +5,0 @@ Author-email: Chris P <chris@plot.ly> |
+37
-11
@@ -749,5 +749,16 @@ # Constants | ||
| _configure_shared_axes(layout, grid_ref, specs, "x", shared_xaxes, row_dir) | ||
| _configure_shared_axes(layout, grid_ref, specs, "y", shared_yaxes, row_dir) | ||
| _configure_shared_axes(layout, grid_ref, specs, "x", shared_xaxes, row_dir, False) | ||
| _configure_shared_axes(layout, grid_ref, specs, "y", shared_yaxes, row_dir, False) | ||
| any_secondary_y = any( | ||
| spec["secondary_y"] | ||
| for spec_row in specs | ||
| for spec in spec_row | ||
| if spec is not None | ||
| ) | ||
| if any_secondary_y: | ||
| _configure_shared_axes( | ||
| layout, grid_ref, specs, "y", shared_yaxes, row_dir, True | ||
| ) | ||
| # Build inset reference | ||
@@ -883,3 +894,5 @@ # --------------------- | ||
| def _configure_shared_axes(layout, grid_ref, specs, x_or_y, shared, row_dir): | ||
| def _configure_shared_axes( | ||
| layout, grid_ref, specs, x_or_y, shared, row_dir, secondary_y | ||
| ): | ||
| rows = len(grid_ref) | ||
@@ -895,2 +908,9 @@ cols = len(grid_ref[0]) | ||
| if secondary_y: | ||
| cols_iter = range(cols - 1, -1, -1) | ||
| axis_index = 1 | ||
| else: | ||
| cols_iter = range(cols) | ||
| axis_index = 0 | ||
| def update_axis_matches(first_axis_id, subplot_ref, spec, remove_label): | ||
@@ -919,3 +939,3 @@ if subplot_ref is None: | ||
| if shared == "columns" or (x_or_y == "x" and shared is True): | ||
| for c in range(cols): | ||
| for c in cols_iter: | ||
| first_axis_id = None | ||
@@ -926,3 +946,5 @@ ok_to_remove_label = x_or_y == "x" | ||
| continue | ||
| subplot_ref = grid_ref[r][c][0] | ||
| if axis_index >= len(grid_ref[r][c]): | ||
| continue | ||
| subplot_ref = grid_ref[r][c][axis_index] | ||
| spec = specs[r][c] | ||
@@ -937,6 +959,8 @@ first_axis_id = update_axis_matches( | ||
| ok_to_remove_label = x_or_y == "y" | ||
| for c in range(cols): | ||
| for c in cols_iter: | ||
| if not grid_ref[r][c]: | ||
| continue | ||
| subplot_ref = grid_ref[r][c][0] | ||
| if axis_index >= len(grid_ref[r][c]): | ||
| continue | ||
| subplot_ref = grid_ref[r][c][axis_index] | ||
| spec = specs[r][c] | ||
@@ -949,11 +973,13 @@ first_axis_id = update_axis_matches( | ||
| first_axis_id = None | ||
| for c in range(cols): | ||
| for ri, r in enumerate(rows_iter): | ||
| for ri, r in enumerate(rows_iter): | ||
| for c in cols_iter: | ||
| if not grid_ref[r][c]: | ||
| continue | ||
| subplot_ref = grid_ref[r][c][0] | ||
| if axis_index >= len(grid_ref[r][c]): | ||
| continue | ||
| subplot_ref = grid_ref[r][c][axis_index] | ||
| spec = specs[r][c] | ||
| if x_or_y == "y": | ||
| ok_to_remove_label = c > 0 | ||
| ok_to_remove_label = c < cols - 1 if secondary_y else c > 0 | ||
| else: | ||
@@ -960,0 +986,0 @@ ok_to_remove_label = ri > 0 if row_dir > 0 else r < rows - 1 |
@@ -385,3 +385,3 @@ import plotly.colors as clrs | ||
| linecolor="rgb(150,150,150)", | ||
| interp_mode="llr", | ||
| interp_mode="ilr", | ||
| coloring=None, | ||
@@ -388,0 +388,0 @@ v_min=0, |
@@ -524,3 +524,4 @@ # --- THIS FILE IS AUTO-GENERATED --- | ||
| Specifies the data URI of the image to be visualized. The URI | ||
| consists of "data:image/[<media subtype>][;base64],<data>" | ||
| consists of "data:image/[<media | ||
| subtype\\>][;base64\\],<data\\>" | ||
@@ -1025,3 +1026,3 @@ The 'source' property is a string and must be specified as: | ||
| The URI consists of "data:image/[<media | ||
| subtype>][;base64],<data>" | ||
| subtype\\>][;base64\\],<data\\>" | ||
| stream | ||
@@ -1299,3 +1300,3 @@ :class:`plotly.graph_objects.image.Stream` instance or | ||
| The URI consists of "data:image/[<media | ||
| subtype>][;base64],<data>" | ||
| subtype\\>][;base64\\],<data\\>" | ||
| stream | ||
@@ -1302,0 +1303,0 @@ :class:`plotly.graph_objects.image.Stream` instance or |
@@ -252,10 +252,10 @@ # --- THIS FILE IS AUTO-GENERATED --- | ||
| here applies when hovering over dimensions. Note that | ||
| `*categorycount`, "colorcount" and "bandcolorcount" are only | ||
| available when `hoveron` contains the "color" flagFinally, the | ||
| template string has access to variables `count`, `probability`, | ||
| `category`, `categorycount`, `colorcount` and `bandcolorcount`. | ||
| Anything contained in tag `<extra>` is displayed in the | ||
| secondary box, for example `<extra>%{fullData.name}</extra>`. | ||
| To hide the secondary box completely, use an empty tag | ||
| `<extra></extra>`. | ||
| "categorycount", "colorcount" and "bandcolorcount" are only | ||
| available when `hoveron` contains the "color" flag. Finally, | ||
| the template string has access to variables `count`, | ||
| `probability`, `category`, `categorycount`, `colorcount` and | ||
| `bandcolorcount`. Anything contained in tag `<extra>` is | ||
| displayed in the secondary box, for example | ||
| `<extra>%{fullData.name}</extra>`. To hide the secondary box | ||
| completely, use an empty tag `<extra></extra>`. | ||
@@ -623,5 +623,5 @@ The 'hovertemplate' property is a string and must be specified as: | ||
| are available. This value here applies when hovering | ||
| over dimensions. Note that `*categorycount`, | ||
| over dimensions. Note that "categorycount", | ||
| "colorcount" and "bandcolorcount" are only available | ||
| when `hoveron` contains the "color" flagFinally, the | ||
| when `hoveron` contains the "color" flag. Finally, the | ||
| template string has access to variables `count`, | ||
@@ -807,5 +807,5 @@ `probability`, `category`, `categorycount`, | ||
| are available. This value here applies when hovering | ||
| over dimensions. Note that `*categorycount`, | ||
| over dimensions. Note that "categorycount", | ||
| "colorcount" and "bandcolorcount" are only available | ||
| when `hoveron` contains the "color" flagFinally, the | ||
| when `hoveron` contains the "color" flag. Finally, the | ||
| template string has access to variables `count`, | ||
@@ -812,0 +812,0 @@ `probability`, `category`, `categorycount`, |
@@ -382,3 +382,3 @@ # --- THIS FILE IS AUTO-GENERATED --- | ||
| "fill" and "symbol". With `sourcetype` set to "raster" or | ||
| `*image*`, only the "raster" value is allowed. | ||
| "image", only the "raster" value is allowed. | ||
@@ -514,3 +514,3 @@ The 'type' property is an enumeration that may be specified as: | ||
| and "symbol". With `sourcetype` set to "raster" or | ||
| `*image*`, only the "raster" value is allowed. | ||
| "image", only the "raster" value is allowed. | ||
| visible | ||
@@ -646,3 +646,3 @@ Determines whether this layer is displayed | ||
| and "symbol". With `sourcetype` set to "raster" or | ||
| `*image*`, only the "raster" value is allowed. | ||
| "image", only the "raster" value is allowed. | ||
| visible | ||
@@ -649,0 +649,0 @@ Determines whether this layer is displayed |
@@ -384,3 +384,3 @@ # --- THIS FILE IS AUTO-GENERATED --- | ||
| "fill" and "symbol". With `sourcetype` set to "raster" or | ||
| `*image*`, only the "raster" value is allowed. | ||
| "image", only the "raster" value is allowed. | ||
@@ -517,3 +517,3 @@ The 'type' property is an enumeration that may be specified as: | ||
| and "symbol". With `sourcetype` set to "raster" or | ||
| `*image*`, only the "raster" value is allowed. | ||
| "image", only the "raster" value is allowed. | ||
| visible | ||
@@ -650,3 +650,3 @@ Determines whether this layer is displayed | ||
| and "symbol". With `sourcetype` set to "raster" or | ||
| `*image*`, only the "raster" value is allowed. | ||
| "image", only the "raster" value is allowed. | ||
| visible | ||
@@ -653,0 +653,0 @@ Determines whether this layer is displayed |
@@ -379,3 +379,21 @@ import os | ||
| # TODO: Refactor to make it possible to use a shared Kaleido instance here | ||
| width = ( | ||
| width | ||
| or fig_dict.get("layout", {}).get("width") | ||
| or fig_dict.get("layout", {}) | ||
| .get("template", {}) | ||
| .get("layout", {}) | ||
| .get("width") | ||
| or defaults.default_width | ||
| ) | ||
| height = ( | ||
| height | ||
| or fig_dict.get("layout", {}).get("height") | ||
| or fig_dict.get("layout", {}) | ||
| .get("template", {}) | ||
| .get("layout", {}) | ||
| .get("height") | ||
| or defaults.default_height | ||
| ) | ||
| img_bytes = kaleido.calc_fig_sync( | ||
@@ -385,4 +403,4 @@ fig_dict, | ||
| format=format or defaults.default_format, | ||
| width=width or defaults.default_width, | ||
| height=height or defaults.default_height, | ||
| width=width, | ||
| height=height, | ||
| scale=scale or defaults.default_scale, | ||
@@ -389,0 +407,0 @@ ), |
@@ -488,3 +488,3 @@ import textwrap | ||
| default_renderer = env_renderer | ||
| elif ipython: | ||
| elif ipython and ipython.get_ipython(): | ||
| # Try to detect environment so that we can enable a useful | ||
@@ -491,0 +491,0 @@ # default renderer |
@@ -22,3 +22,3 @@ { | ||
| "lodash-es": "^4.17.21", | ||
| "plotly.js": "3.1.0", | ||
| "plotly.js": "3.1.1", | ||
| "@lumino/widgets": "~2.4.0" | ||
@@ -36,3 +36,3 @@ }, | ||
| "_build": { | ||
| "load": "static/remoteEntry.38ea05461c254e327731.js", | ||
| "load": "static/remoteEntry.6e6831fa75252e0d6206.js", | ||
| "mimeExtension": "./mimeExtension" | ||
@@ -39,0 +39,0 @@ } |
@@ -0,3 +1,4 @@ | ||
| import matplotlib.pyplot as plt | ||
| from numpy.testing import assert_allclose, assert_equal | ||
| from . import plt | ||
| from .. import utils | ||
@@ -4,0 +5,0 @@ |
@@ -63,2 +63,4 @@ """ | ||
| self.msg = "Initialized PlotlyRenderer\n" | ||
| self._processing_legend = False | ||
| self._legend_visible = False | ||
@@ -112,3 +114,2 @@ def open_figure(self, fig, props): | ||
| """ | ||
| self.plotly_fig["layout"]["showlegend"] = False | ||
| self.msg += "Closing figure\n" | ||
@@ -203,2 +204,33 @@ | ||
| def open_legend(self, legend, props): | ||
| """Enable Plotly's native legend when matplotlib legend is detected. | ||
| This method is called when a matplotlib legend is found. It enables | ||
| Plotly's showlegend only if the matplotlib legend is visible. | ||
| Positional arguments: | ||
| legend -- matplotlib.legend.Legend object | ||
| props -- legend properties dictionary | ||
| """ | ||
| self.msg += " Opening legend\n" | ||
| self._processing_legend = True | ||
| self._legend_visible = props.get("visible", True) | ||
| if self._legend_visible: | ||
| self.msg += ( | ||
| " Enabling native plotly legend (matplotlib legend is visible)\n" | ||
| ) | ||
| self.plotly_fig["layout"]["showlegend"] = True | ||
| else: | ||
| self.msg += " Not enabling legend (matplotlib legend is not visible)\n" | ||
| def close_legend(self, legend): | ||
| """Finalize legend processing. | ||
| Positional arguments: | ||
| legend -- matplotlib.legend.Legend object | ||
| """ | ||
| self.msg += " Closing legend\n" | ||
| self._processing_legend = False | ||
| self._legend_visible = False | ||
| def draw_bars(self, bars): | ||
@@ -305,3 +337,3 @@ # sort bars according to bar containers | ||
| self.msg += " Heck yeah, I drew that bar chart\n" | ||
| (self.plotly_fig.add_trace(bar),) | ||
| self.plotly_fig.add_trace(bar) | ||
| if bar_gap is not None: | ||
@@ -316,79 +348,2 @@ self.plotly_fig["layout"]["bargap"] = bar_gap | ||
| def draw_legend_shapes(self, mode, shape, **props): | ||
| """Create a shape that matches lines or markers in legends. | ||
| Main issue is that path for circles do not render, so we have to use 'circle' | ||
| instead of 'path'. | ||
| """ | ||
| for single_mode in mode.split("+"): | ||
| x = props["data"][0][0] | ||
| y = props["data"][0][1] | ||
| if single_mode == "markers" and props.get("markerstyle"): | ||
| size = shape.pop("size", 6) | ||
| symbol = shape.pop("symbol") | ||
| # aligning to "center" | ||
| x0 = 0 | ||
| y0 = 0 | ||
| x1 = size | ||
| y1 = size | ||
| markerpath = props["markerstyle"].get("markerpath") | ||
| if markerpath is None and symbol != "circle": | ||
| self.msg += ( | ||
| "not sure how to handle this marker without a valid path\n" | ||
| ) | ||
| return | ||
| # marker path to SVG path conversion | ||
| path = " ".join( | ||
| [f"{a} {t[0]},{t[1]}" for a, t in zip(markerpath[1], markerpath[0])] | ||
| ) | ||
| if symbol == "circle": | ||
| # symbols like . and o in matplotlib, use circle | ||
| # plotly also maps many other markers to circle, such as 1,8 and p | ||
| path = None | ||
| shape_type = "circle" | ||
| x0 = -size / 2 | ||
| y0 = size / 2 | ||
| x1 = size / 2 | ||
| y1 = size + size / 2 | ||
| else: | ||
| # triangles, star etc | ||
| shape_type = "path" | ||
| legend_shape = go.layout.Shape( | ||
| type=shape_type, | ||
| xref="paper", | ||
| yref="paper", | ||
| x0=x0, | ||
| y0=y0, | ||
| x1=x1, | ||
| y1=y1, | ||
| xsizemode="pixel", | ||
| ysizemode="pixel", | ||
| xanchor=x, | ||
| yanchor=y, | ||
| path=path, | ||
| **shape, | ||
| ) | ||
| elif single_mode == "lines": | ||
| mode = "line" | ||
| x1 = props["data"][1][0] | ||
| y1 = props["data"][1][1] | ||
| legend_shape = go.layout.Shape( | ||
| type=mode, | ||
| xref="paper", | ||
| yref="paper", | ||
| x0=x, | ||
| y0=y + 0.02, | ||
| x1=x1, | ||
| y1=y1 + 0.02, | ||
| **shape, | ||
| ) | ||
| else: | ||
| self.msg += "not sure how to handle this element\n" | ||
| return | ||
| self.plotly_fig.add_shape(legend_shape) | ||
| self.msg += " Heck yeah, I drew that shape\n" | ||
| def draw_marked_line(self, **props): | ||
@@ -505,7 +460,7 @@ """Create a data dict for a line obj. | ||
| ) | ||
| (self.plotly_fig.add_trace(marked_line),) | ||
| self.plotly_fig.add_trace(marked_line) | ||
| self.msg += " Heck yeah, I drew that line\n" | ||
| elif props["coordinates"] == "axes": | ||
| # dealing with legend graphical elements | ||
| self.draw_legend_shapes(mode=mode, shape=shape, **props) | ||
| self.msg += " Using native legend\n" | ||
| else: | ||
@@ -676,2 +631,12 @@ self.msg += " Line didn't have 'data' coordinates, not drawing\n" | ||
| self.msg += " Text object is a normal annotation\n" | ||
| # Skip creating annotations for legend text when using native legend | ||
| if ( | ||
| self._processing_legend | ||
| and self._legend_visible | ||
| and props["coordinates"] == "axes" | ||
| ): | ||
| self.msg += ( | ||
| " Skipping legend text annotation (using native legend)\n" | ||
| ) | ||
| return | ||
| if props["coordinates"] != "data": | ||
@@ -678,0 +643,0 @@ self.msg += " Text object isn't linked to 'data' coordinates\n" |
| # DO NOT EDIT | ||
| # This file is generated by the updatebundle commands.py command | ||
| __plotlyjs_version__ = "3.1.0" | ||
| __plotlyjs_version__ = "3.1.1" |
+1
-1
@@ -35,3 +35,3 @@ [build-system] | ||
| license = {file="LICENSE.txt"} | ||
| version = "6.3.0" | ||
| version = "6.3.1" | ||
| dependencies = [ | ||
@@ -38,0 +38,0 @@ "narwhals>=1.15.1", |
Sorry, the diff of this file is too big to display
| var _JUPYTERLAB;(()=>{"use strict";var e,r,t={987:(e,r,t)=>{var o={"./index":()=>t.e(340).then((()=>()=>t(340))),"./mimeExtension":()=>t.e(340).then((()=>()=>t(340)))},a=(e,r)=>(t.R=r,r=t.o(o,e)?o[e]():Promise.resolve().then((()=>{throw new Error('Module "'+e+'" does not exist in container.')})),t.R=void 0,r),n=(e,r)=>{if(t.S){var o="default",a=t.S[o];if(a&&a!==e)throw new Error("Container initialization failed as it has already been initialized with a different share scope");return t.S[o]=e,t.I(o,r)}};t.d(r,{get:()=>a,init:()=>n})}},o={};function a(e){var r=o[e];if(void 0!==r)return r.exports;var n=o[e]={exports:{}};return t[e](n,n.exports,a),n.exports}a.m=t,a.c=o,a.amdO={},a.d=(e,r)=>{for(var t in r)a.o(r,t)&&!a.o(e,t)&&Object.defineProperty(e,t,{enumerable:!0,get:r[t]})},a.f={},a.e=e=>Promise.all(Object.keys(a.f).reduce(((r,t)=>(a.f[t](e,r),r)),[])),a.u=e=>e+".e7c6cfbf008f29878868.js?v=e7c6cfbf008f29878868",a.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),a.o=(e,r)=>Object.prototype.hasOwnProperty.call(e,r),e={},r="jupyterlab-plotly:",a.l=(t,o,n,i)=>{if(e[t])e[t].push(o);else{var l,u;if(void 0!==n)for(var p=document.getElementsByTagName("script"),s=0;s<p.length;s++){var d=p[s];if(d.getAttribute("src")==t||d.getAttribute("data-webpack")==r+n){l=d;break}}l||(u=!0,(l=document.createElement("script")).charset="utf-8",l.timeout=120,a.nc&&l.setAttribute("nonce",a.nc),l.setAttribute("data-webpack",r+n),l.src=t),e[t]=[o];var c=(r,o)=>{l.onerror=l.onload=null,clearTimeout(f);var a=e[t];if(delete e[t],l.parentNode&&l.parentNode.removeChild(l),a&&a.forEach((e=>e(o))),r)return r(o)},f=setTimeout(c.bind(null,void 0,{type:"timeout",target:l}),12e4);l.onerror=c.bind(null,l.onerror),l.onload=c.bind(null,l.onload),u&&document.head.appendChild(l)}},a.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},(()=>{a.S={};var e={},r={};a.I=(t,o)=>{o||(o=[]);var n=r[t];if(n||(n=r[t]={}),!(o.indexOf(n)>=0)){if(o.push(n),e[t])return e[t];a.o(a.S,t)||(a.S[t]={});var i=a.S[t],l="jupyterlab-plotly",u=[];return"default"===t&&((e,r,t,o)=>{var n=i[e]=i[e]||{},u=n[r];(!u||!u.loaded&&(1!=!u.eager?o:l>u.from))&&(n[r]={get:()=>a.e(340).then((()=>()=>a(340))),from:l,eager:!1})})("jupyterlab-plotly","6.0.1"),e[t]=u.length?Promise.all(u).then((()=>e[t]=1)):1}}})(),(()=>{var e;a.g.importScripts&&(e=a.g.location+"");var r=a.g.document;if(!e&&r&&(r.currentScript&&"SCRIPT"===r.currentScript.tagName.toUpperCase()&&(e=r.currentScript.src),!e)){var t=r.getElementsByTagName("script");if(t.length)for(var o=t.length-1;o>-1&&(!e||!/^http(s?):/.test(e));)e=t[o--].src}if(!e)throw new Error("Automatic publicPath is not supported in this browser");e=e.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),a.p=e})(),(()=>{var e={80:0};a.f.j=(r,t)=>{var o=a.o(e,r)?e[r]:void 0;if(0!==o)if(o)t.push(o[2]);else{var n=new Promise(((t,a)=>o=e[r]=[t,a]));t.push(o[2]=n);var i=a.p+a.u(r),l=new Error;a.l(i,(t=>{if(a.o(e,r)&&(0!==(o=e[r])&&(e[r]=void 0),o)){var n=t&&("load"===t.type?"missing":t.type),i=t&&t.target&&t.target.src;l.message="Loading chunk "+r+" failed.\n("+n+": "+i+")",l.name="ChunkLoadError",l.type=n,l.request=i,o[1](l)}}),"chunk-"+r,r)}};var r=(r,t)=>{var o,n,[i,l,u]=t,p=0;if(i.some((r=>0!==e[r]))){for(o in l)a.o(l,o)&&(a.m[o]=l[o]);u&&u(a)}for(r&&r(t);p<i.length;p++)n=i[p],a.o(e,n)&&e[n]&&e[n][0](),e[n]=0},t=self.webpackChunkjupyterlab_plotly=self.webpackChunkjupyterlab_plotly||[];t.forEach(r.bind(null,0)),t.push=r.bind(null,t.push.bind(t))})();var n=a(987);(_JUPYTERLAB=void 0===_JUPYTERLAB?{}:_JUPYTERLAB)["jupyterlab-plotly"]=n})(); |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Alert delta unavailable
Currently unable to show alert delta for PyPI packages.
37786991
0.54%1659
0.12%630133
0.01%