Code Monkey home page Code Monkey logo

figures.jl's Introduction

Figures.jl

Figures.jl is a simple package that creates draggable figures in a browser window to display plots from various plotting packages. It currently works with plotly.js.

Figures.jl is still in early stages of development, will likely see API changes and is not (yet) intended for use in a production environment.

To obtain the latest tagged release, try:

pkg> add Figures

To obtain the latest development branch, try:

pkg> add Figures#master

Example

The simplest way to see an example is to run

julia> using Figures; Figures.examples(launch=true);

This

  1. Starts a server on localhost at the default port 8000.
  2. Opens a new browser tab to http://localhost:8000/examples/plot.ly.

If you prefer a different port and do not want to launch a new browser tab (which is better for interactive work, i.e. it is what I do), try

julia> using Figures; Figures.example(port=3000)

or simply

julia> using Figures; Figures.example() # Uses the default port 8000.

This starts the local server, but then you need to manually open - or refresh - the url from the browser at http://localhost:8000/examples/plot.ly.

You should see a blank page with two buttons as shown below:

Start

Clicking "Generate Plots", you should see (after a brief warmup the first time) 4 interactive plotly.js charts overlaid on top of each other.

Overlaid

Each chart has a thin strip at the top (seen in white). This strip serves two purposes:

  1. Click and drag the strip to move the figure.
  2. Double click the strip to close the figure.

Layout

Clicking "Generate Plots" again, will update two of the four charts with random data.

Update

The usual plotly.js interactivity is also available:

Interact

Next, you can open a second browser tab to the same url http://localhost:8000/examples/plot.ly. It is best if the two pages are open side by side.

Clicking "Generate Plots" will only update the charts in the given window where the button was clicked. "Broadcast Plots" will update the charts on all connected pages.

To remove figures, there is the method

julia> Figures.closeall()

which closes all figures and

julia> Figures.close("Plot4")

which closes the specified figure.

Alternatively, figures can be closed directly in the browser by double clicking them.

To Do

  • Add support for VegaLite.jl
  • Add support for Plots.jl
  • Add support for resizing figures, etc.

figures.jl's People

Contributors

ericforgy 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.