vidartf / ipyscales Goto Github PK
View Code? Open in Web Editor NEWA widget library for scales
Home Page: http://ipyscales.readthedocs.io/en/latest/
License: BSD 3-Clause "New" or "Revised" License
A widget library for scales
Home Page: http://ipyscales.readthedocs.io/en/latest/
License: BSD 3-Clause "New" or "Revised" License
It would be useful to have a link to the docs, either in the readme or the project description:
Hello,
I have tried to run some examples extracted from the documentation and I didn't succeed in displaying any figure.
I am under JupyterHub.
Standard HBox or VBox generated from other scripts work well. Only the ones issued from ipyscales don't work.
Any idea ?
Thanks.
Patrick
from ipyscales import NamedSequentialColorMap, ColorBar, LinearColorScale
from ipyscales.datawidgets import ScaledArray
from ipydatawidgets import DataImage
from ipywidgets import HBox, VBox
from IPython.display import display
delta = 0.025
x = y = np.arange(-3.0, 3.0, delta)
X, Y = np.meshgrid(x, y)
Z1 = np.exp(-X**2 - Y**2)
Z2 = np.exp(-(X - 1)**2 - (Y - 1)**2)
Z = (Z1 - Z2) * 2
scale = NamedSequentialColorMap(domain=(np.min(Z), np.max(Z)))
data = ScaledArray(data=Z, scale=scale, output_dtype='uint8')
img = DataImage(data=data)
VBox([HBox([img, ColorBar(colormap=data.scale, length=len(x))]), scale.edit()]) # -> NOT WORKING
# OR
# VBox([img]) # -> NOT WORKING
# OR
# vbox = VBox([img])
# display(vbox) # -> NOT WORKING
There is an unexpected token in the package.json
file, maybe the first "
token?
I get a ModuleNotFoundError when installing the jlab extension
ModuleNotFoundError: Module not found: Error: Can't resolve '../styles/plugin.css' in '/home/martin/miniconda3/envs/geopython/share/jupyter/lab/staging/node_modules/jupyter-scales/lib'
at factory.create (/home/martin/miniconda3/envs/geopython/share/jupyter/lab/staging/node_modules/webpack/lib/Compilation.js:535:10)
at factory (/home/martin/miniconda3/envs/geopython/share/jupyter/lab/staging/node_modules/webpack/lib/NormalModuleFactory.js:397:22)
at resolver (/home/martin/miniconda3/envs/geopython/share/jupyter/lab/staging/node_modules/webpack/lib/NormalModuleFactory.js:130:21)
at asyncLib.parallel (/home/martin/miniconda3/envs/geopython/share/jupyter/lab/staging/node_modules/webpack/lib/NormalModuleFactory.js:224:22)
at /home/martin/miniconda3/envs/geopython/share/jupyter/lab/staging/node_modules/neo-async/async.js:2830:7
at /home/martin/miniconda3/envs/geopython/share/jupyter/lab/staging/node_modules/neo-async/async.js:6877:13
at normalResolver.resolve (/home/martin/miniconda3/envs/geopython/share/jupyter/lab/staging/node_modules/webpack/lib/NormalModuleFactory.js:214:25)
at doResolve (/home/martin/miniconda3/envs/geopython/share/jupyter/lab/staging/node_modules/enhanced-resolve/lib/Resolver.js:184:12)
at hook.callAsync (/home/martin/miniconda3/envs/geopython/share/jupyter/lab/staging/node_modules/enhanced-resolve/lib/Resolver.js:238:5)
at _fn0 (eval at create (/home/martin/miniconda3/envs/geopython/share/jupyter/lab/staging/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:15:1)
at resolver.doResolve (/home/martin/miniconda3/envs/geopython/share/jupyter/lab/staging/node_modules/enhanced-resolve/lib/UnsafeCachePlugin.js:37:5)
at hook.callAsync (/home/martin/miniconda3/envs/geopython/share/jupyter/lab/staging/node_modules/enhanced-resolve/lib/Resolver.js:238:5)
at _fn0 (eval at create (/home/martin/miniconda3/envs/geopython/share/jupyter/lab/staging/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:15:1)
at hook.callAsync (/home/martin/miniconda3/envs/geopython/share/jupyter/lab/staging/node_modules/enhanced-resolve/lib/Resolver.js:238:5)
at _fn0 (eval at create (/home/martin/miniconda3/envs/geopython/share/jupyter/lab/staging/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:27:1)
at resolver.doResolve (/home/martin/miniconda3/envs/geopython/share/jupyter/lab/staging/node_modules/enhanced-resolve/lib/DescriptionFilePlugin.js:42:38)
at hook.callAsync (/home/martin/miniconda3/envs/geopython/share/jupyter/lab/staging/node_modules/enhanced-resolve/lib/Resolver.js:238:5)
at _fn42 (eval at create (/home/martin/miniconda3/envs/geopython/share/jupyter/lab/staging/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:16:1)
at hook.callAsync (/home/martin/miniconda3/envs/geopython/share/jupyter/lab/staging/node_modules/enhanced-resolve/lib/Resolver.js:238:5)
at _fn0 (eval at create (/home/martin/miniconda3/envs/geopython/share/jupyter/lab/staging/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:27:1)
at resolver.doResolve (/home/martin/miniconda3/envs/geopython/share/jupyter/lab/staging/node_modules/enhanced-resolve/lib/DescriptionFilePlugin.js:42:38)
at hook.callAsync (/home/martin/miniconda3/envs/geopython/share/jupyter/lab/staging/node_modules/enhanced-resolve/lib/Resolver.js:238:5)
at _fn1 (eval at create (/home/martin/miniconda3/envs/geopython/share/jupyter/lab/staging/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:16:1)
at hook.callAsync (/home/martin/miniconda3/envs/geopython/share/jupyter/lab/staging/node_modules/enhanced-resolve/lib/Resolver.js:238:5)
at _fn0 (eval at create (/home/martin/miniconda3/envs/geopython/share/jupyter/lab/staging/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:15:1)
at fs.stat (/home/martin/miniconda3/envs/geopython/share/jupyter/lab/staging/node_modules/enhanced-resolve/lib/DirectoryExistsPlugin.js:22:13)
at process.nextTick (/home/martin/miniconda3/envs/geopython/share/jupyter/lab/staging/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js:73:15)
at processTicksAndRejections (internal/process/task_queues.js:79:9)
resolve '../styles/plugin.css' in '/home/martin/miniconda3/envs/geopython/share/jupyter/lab/staging/node_modules/jupyter-scales/lib'
using description file: /home/martin/miniconda3/envs/geopython/share/jupyter/lab/staging/node_modules/jupyter-scales/package.json (relative path: ./lib)
Field 'browser' doesn't contain a valid alias configuration
using description file: /home/martin/miniconda3/envs/geopython/share/jupyter/lab/staging/node_modules/jupyter-scales/package.json (relative path: ./styles/plugin.css)
no extension
Field 'browser' doesn't contain a valid alias configuration
/home/martin/miniconda3/envs/geopython/share/jupyter/lab/staging/node_modules/jupyter-scales/styles/plugin.css doesn't exist
.wasm
Field 'browser' doesn't contain a valid alias configuration
/home/martin/miniconda3/envs/geopython/share/jupyter/lab/staging/node_modules/jupyter-scales/styles/plugin.css.wasm doesn't exist
.mjs
Field 'browser' doesn't contain a valid alias configuration
/home/martin/miniconda3/envs/geopython/share/jupyter/lab/staging/node_modules/jupyter-scales/styles/plugin.css.mjs doesn't exist
.js
Field 'browser' doesn't contain a valid alias configuration
/home/martin/miniconda3/envs/geopython/share/jupyter/lab/staging/node_modules/jupyter-scales/styles/plugin.css.js doesn't exist
.json
Field 'browser' doesn't contain a valid alias configuration
/home/martin/miniconda3/envs/geopython/share/jupyter/lab/staging/node_modules/jupyter-scales/styles/plugin.css.json doesn't exist
as directory
/home/martin/miniconda3/envs/geopython/share/jupyter/lab/staging/node_modules/jupyter-scales/styles/plugin.css doesn't exist
error Command failed with exit code 1.
I'm using the current release via pip and use this to display
cm = NamedSequentialColorMap(color_map.name, domain=(self.vmin, self.vmax))
self.bar = ColorBar(colormap=cm, length=self.render_size[1], orientation='vertical')
This resulted in the top and bottom tick label missing.
Edit: Turns out I tested Firefox with the wrong codebase. After correcting that, Firefox shows the same problem as Chrome.
The dev console in Chrome shows no related error AFAICT:
kernel.js:106 Kernel: kernel_restarting (678766a5-0edf-45d5-b728-b0937adc1c9c)
kernel.js:106 Kernel: kernel_created (678766a5-0edf-45d5-b728-b0937adc1c9c)
kernel.js:462 Starting WebSockets: ws://localhost:9180/api/kernels/678766a5-0edf-45d5-b728-b0937adc1c9c
kernel.js:106 Kernel: kernel_connected (678766a5-0edf-45d5-b728-b0937adc1c9c)
kernel.js:106 Kernel: kernel_ready (678766a5-0edf-45d5-b728-b0937adc1c9c)
RendererPool.js:186 RendererPool.release(id=0)
Renderable.js:517 TV(371161): ThreeView WebGL context is being reclaimed: 0
Renderable.js:513 TV(371161): already frozen...
Renderable.js:517 TV(371161): Disable controls
jquery.min.js:5092 [Violation] Added synchronous DOM mutation listener to a 'DOMNodeInserted' event. Consider using MutationObserver to make the page more responsive.
add @ jquery.min.js:5092
(anonymous) @ jquery.min.js:4992
each @ jquery.min.js:367
each @ jquery.min.js:202
on @ jquery.min.js:4991
on @ jquery.min.js:5728
KeyboardManager.register_events @ keyboardmanager.js:255
n.OutputArea.register_mime_type.safe @ widget.js:1
OutputArea.append_mime_type @ outputarea.js:696
OutputArea.append_display_data @ outputarea.js:659
OutputArea.append_output @ outputarea.js:346
OutputArea.handle_output @ outputarea.js:257
output @ codecell.js:395
Kernel._handle_output_message @ kernel.js:1197
proxy @ jquery.min.js:10502
Kernel._handle_iopub_message @ kernel.js:1224
Kernel._finish_ws_message @ kernel.js:1016
(anonymous) @ kernel.js:1007
jquery.min.js:5092 [Violation] Added synchronous DOM mutation listener to a 'DOMNodeInserted' event. Consider using MutationObserver to make the page more responsive.
add @ jquery.min.js:5092
(anonymous) @ jquery.min.js:4992
each @ jquery.min.js:367
each @ jquery.min.js:202
on @ jquery.min.js:4991
on @ jquery.min.js:5728
KeyboardManager.register_events @ keyboardmanager.js:255
n.OutputArea.register_mime_type.safe @ widget.js:1
OutputArea.append_mime_type @ outputarea.js:696
OutputArea.append_display_data @ outputarea.js:659
OutputArea.append_output @ outputarea.js:346
OutputArea.handle_output @ outputarea.js:257
output @ codecell.js:395
Kernel._handle_output_message @ kernel.js:1197
proxy @ jquery.min.js:10502
Kernel._handle_iopub_message @ kernel.js:1224
Kernel._finish_ws_message @ kernel.js:1016
(anonymous) @ kernel.js:1007
Renderable.js:517 TV(491356): unfreeze
Renderable.js:517 TV(491356): ThreeView.acquiring...
RendererPool.js:134 RendererPool.acquiring...
RendererPool.js:179 RendererPool.acquire(id=0)
Renderable.js:517 TV(491356): ThreeView.acquireRenderer(0)
Renderable.js:517 TV(491356): Enable controls
Renderable.js:517 TV(491356): renderScene
Renderable.js:89 child changed: cada71af5f8d4a23903dca1ec537b296
Three.js:357 child changed: 29019744fc794e128333838933c8f62d
Renderable.js:89 child changed: cada71af5f8d4a23903dca1ec537b296
Renderable.js:517 TV(491356): renderScene
Renderable.js:89 child changed: cada71af5f8d4a23903dca1ec537b296
Renderable.js:517 TV(491356): renderScene
Renderable.js:89 child changed: cada71af5f8d4a23903dca1ec537b296
Renderable.js:517 TV(491356): renderScene
Renderable.js:89 child changed: cada71af5f8d4a23903dca1ec537b296
Renderable.js:517 TV(491356): renderScene
Renderable.js:89 child changed: cada71af5f8d4a23903dca1ec537b296
Renderable.js:517 TV(491356): renderScene
Renderable.js:89 child changed: cada71af5f8d4a23903dca1ec537b296
Renderable.js:517 TV(491356): renderScene
Renderable.js:89 child changed: cada71af5f8d4a23903dca1ec537b296
Renderable.js:517 TV(491356): renderScene
Renderable.js:89 child changed: cada71af5f8d4a23903dca1ec537b296
Renderable.js:517 TV(491356): renderScene
Renderable.js:89 child changed: cada71af5f8d4a23903dca1ec537b296
Renderable.js:517 TV(491356): renderScene
Renderable.js:89 child changed: cada71af5f8d4a23903dca1ec537b296
Renderable.js:517 TV(491356): renderScene
Any help would be appreciated. I'm really looking forward to replacing my crappy hand-drawn colorbars.
The setup is available via mybinder
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.