GithubHelp home page GithubHelp logo

rbkreisberg / carve Goto Github PK

View Code? Open in Web Editor NEW
6.0 2.0 0.0 772 KB

A flexible 2.5 dimension distribution plot. Let users carve the data!

License: BSD 3-Clause "New" or "Revised" License

JavaScript 99.15% CSS 0.85%

carve's Introduction

carve

A flexible 2.5 dimension distribution plot. Let users carve the data!

What is carve?

Carve is a web-based visualization for diving into high dimensional data. It is built on top of d3, underscore and sciencejs. Applications can leverage crossfilter to quickly filter, sort, and group datasets based on events from carve, along with other interfaces.

Carve accepts numerical and categorical data. Based on the types of data, it displays the distribution of data in one of three ways:

Numerical vs. Numerical Scatterplot

Alt Scatterplot

Numerical vs Categorical KDE plot

Alt Scatterplot

Categorical vs. Categorical Multiple Bar Chart

Alt Scatterplot

What Else?

Color There is also the ability to color the data by a third dimension of the dataset. The dimension must be a categorical feature (right now).

Highlight The visualization can be told to highlight one of the values of the colored dimension (useful for external interfaces).

Carving tools Those panels above and to the left of the data plot allow the user to make precise cuts in one or two dimensions. Cutting numerical data simply means locking a split in at a precision position by clicking on the panel. Cutting categorical data is done by toggling values to create the desired split.

Say What?

Check out a demonstration of carve: Splitiscope

Use It!

Carve can be used as a global variable called 'carve' or as an AMD module using requirejs. You can use multiple carves in the same page.

Carve depends on d3, underscore, and science.js. Import these scripts prior to initializing a carve plot.

var data = [

            { id: "Sparky", height : 10, weight : 14,  breed : "dachsund" },
            { id: "Lucy", height : 24, weight : 64,  breed : "retriever" },
            { id: "Chewbaca", height : 33, weight : 180, breed : "great dane" },
            { id: "Belle", height : 20, weight : 27,  breed : "whippet" },
            { id: "Crowe", height : 28, weight : 95,  breed : "ridgeback" },
            { id: "Chico", height : 7,  weight : 6,  breed : "chihuahua" },
            { id: "Katie", height : 32,  weight : 225,  breed : "mastiff" },
            { id: "Hamish", height : 27,  weight : 50,  breed : "saluki" }
]

var carve_obj = carve({
            width : 600,
            height: 450,
            radius : 20,
            margin : { top: 15, bottom: 20, left: 15, right: 50 }
        });
var carve_vis = carve_obj("#plot");

 carve_vis
        .colorBy({
            label : "breed",
            list : _.pluck(data, "breed")
        })
        .axisLabel({ x : "Weight (lbs)", y : "Height (in)" })
        .axisKey({ x : "weight", y : "height" })
        .data(data)
        .render();

There are additional settings that can be defined. The unique "id" key in each data point (defaults to "id"). The mapping between color_by class values and RGB Hex colors ( colorBy( { colors: colorList } ) ). Specific axis ranges (axisDomain), value dictionaries (axisValueDictionary), additional categorical values not in the data (axisInsistCategoricalValues), enforce axis data types (dataType). Enable the "carving" behavior (enableCarving).

Additional settings using chained functions:


carve_vis
     .id("id")
     .colorBy({
            label : "breed",
            list : _.pluck(data, "breed"),
             colors : [ 
                    "#71C560",
                    "#9768C4",
                    "#98B8B8",
                    "#4F473D",
                    "#C1B14C",
                    "#B55381",
                    "#393939",
                    "#787878"
                ]
        })
        .axisLabel({ x : "Weight (lbs)", y : "Height (in)" })
        .axisKey({ x : "weight", y : "height" })
        .axisDomain({ x : [0,200], y : [0, 35 ] })
        .enableCarving(true)
        .data(data)
        .render();

Highlight data that have the "color_by" attributes of a specified value. Remove the highlight.

carve_vis
    .highlight("saluki")
    .render();

carve_vis
    .highlight(null)
    .render();

Check this out on JSFiddle: demo

carve's People

Contributors

rbkreisberg avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.