How to use bqplot - 4 common examples

To help you get started, we’ve selected a few bqplot examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github glue-viz / bqplot-image-gl / js / lib / imagegl.js View on Github external
y_scale.del_domain([], this.model_id + "_y");
            }
        }
    }

}

ImageGLModel.serializers = Object.assign({}, bqplot.MarkModel.serializers,
                                         { x: serialize.array_or_json,
                                           y: serialize.array_or_json,
                                           image: { deserialize: (obj, manager) => {
                                               let state = {buffer: obj.value, dtype: obj.dtype, shape: obj.shape};
                                               return jupyter_dataserializers.JSONToArray(state);
                                           }}});

class ImageGLView extends bqplot.Mark {

    render() {
        var base_render_promise = super.render();
        window.last_image = this;

        this.image_plane = new THREE.PlaneBufferGeometry( 1.0, 1.0 );
        this.image_material = new THREE.ShaderMaterial( {
                    uniforms: {
                        image: { type: 't', value: null },
                        // the domain of the image pixel data (for intensity only, for rgb this is ignored)
                        // these 3 uniforms map one to one to the colorscale
                        colormap: { type: 't', value: null },
                        color_min: {type: 'f', value: 0.0},
                        color_max: {type: 'f', value: 1.0},
                        // the type of scale (linear/log) for x/y will be substituted in the shader
                        // map from domain
github glue-viz / bqplot-image-gl / js / lib / imagegl.js View on Github external
/*jshint esversion: 6 */

var widgets = require('@jupyter-widgets/base');
var _ = require('lodash');
var d3 = require("d3");
var bqplot = require('bqplot');
var THREE = require('three');

var interpolations = {'nearest': THREE.NearestFilter, 'bilinear': THREE.LinearFilter};

var jupyter_dataserializers = require("jupyter-dataserializers");
var serialize = require("./serialize");

class ImageGLModel extends bqplot.MarkModel {

    defaults() {
        return _.extend(bqplot.MarkModel.prototype.defaults(), {
            _model_name : 'ImageGLModel',
            _view_name : 'ImageGLView',
            _model_module : 'bqplot-image-gl',
            _view_module : 'bqplot-image-gl',
            _model_module_version : '0.2.0',
            _view_module_version : '0.2.0',
            interpolation: 'nearest',
            opacity: 1.0,
            x: (0.0, 1.0),
            y: (0.0, 1.0),
            scales_metadata: {
                'x': {'orientation': 'horizontal', 'dimension': 'x'},
                'y': {'orientation': 'vertical', 'dimension': 'y'},
github glue-viz / bqplot-image-gl / js / lib / imagegl.js View on Github external
defaults() {
        return _.extend(bqplot.MarkModel.prototype.defaults(), {
            _model_name : 'ImageGLModel',
            _view_name : 'ImageGLView',
            _model_module : 'bqplot-image-gl',
            _view_module : 'bqplot-image-gl',
            _model_module_version : '0.2.0',
            _view_module_version : '0.2.0',
            interpolation: 'nearest',
            opacity: 1.0,
            x: (0.0, 1.0),
            y: (0.0, 1.0),
            scales_metadata: {
                'x': {'orientation': 'horizontal', 'dimension': 'x'},
                'y': {'orientation': 'vertical', 'dimension': 'y'},
            },
        });
    }
github glue-viz / bqplot-image-gl / js / lib / imagegl.js View on Github external
} else {
                x_scale.del_domain([], this.model_id + "_x");
            }
        }
        if(y_scale) {
            if(!this.get("preserve_domain").y) {
                y_scale.compute_and_set_domain(this.mark_data.y, this.model_id + "_y");
            } else {
                y_scale.del_domain([], this.model_id + "_y");
            }
        }
    }

}

ImageGLModel.serializers = Object.assign({}, bqplot.MarkModel.serializers,
                                         { x: serialize.array_or_json,
                                           y: serialize.array_or_json,
                                           image: { deserialize: (obj, manager) => {
                                               let state = {buffer: obj.value, dtype: obj.dtype, shape: obj.shape};
                                               return jupyter_dataserializers.JSONToArray(state);
                                           }}});

class ImageGLView extends bqplot.Mark {

    render() {
        var base_render_promise = super.render();
        window.last_image = this;

        this.image_plane = new THREE.PlaneBufferGeometry( 1.0, 1.0 );
        this.image_material = new THREE.ShaderMaterial( {
                    uniforms: {

bqplot

bqplot

Apache-2.0
Latest version published 9 months ago

Package Health Score

69 / 100
Full package analysis

Popular bqplot functions