• Stars
    star
    86
  • Rank 369,488 (Top 8 %)
  • Language
    Julia
  • License
    Other
  • Created over 8 years ago
  • Updated about 3 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Dive deeper into your data with interactive graphics

splash

Immerse

Build Status

Immerse is a wrapper that adds graphical interactivity to Julia plots. Currently, Immerse supports Gadfly.

Usage

By and large, you plot just as you would in Gadfly:

using Immerse, Distributions
X = rand(MultivariateNormal([0.0, 0.0], [1.0 0.5; 0.5 1.0]), 10000)
plot(x=X[1,:], y=X[2,:], Geom.hexbin)

However, rather than being displayed in a browser window, you'll see your figure in a Gtk window:

window

The toolbar at the top supports saving your figure to a file, zooming and panning, and lasso selection.

Zooming and panning uses the defaults set by GtkUtilities. The left mouse button allows you to rubberband-select a zoom region. Use your mouse wheel or arrow-keys to pan or change the zoom level. Double-click, or press the 1:1 button, to restore the full view.

Lasso selection

The right-most button on the toolbar allows you to select a group of points for further analysis by drawing a "lasso" around them:

lasso

By default, this pops up a dialog asking you which variable in Main you want to save the selected indexes to:

lassodialog

You can alternatively define a custom callback function; see the help for lasso_initialize by typing ?lasso_initialize at the REPL.

Lasso selection is currently implemented only for Geom.point and Geom.line. If you want to try this feature, the demonstration in test/faces.jl can be fun.

Hit testing

You can add extra interactivity by setting up callbacks that run whenever the user clicks on an object. A demonstration of this capability is exhibited in the test/hittesting.jl test script:

hittest

Here the red circles are drawn around the dots that the user clicked on; see also the console output that showed the results of clicking on the line segments between the dots.

Note that hit testing is disabled while the "zoom" button is active. Like lasso selection, this is currently implemented only for Geom.point and Geom.line.

Setting and getting properties

Objects can be modified interactively after their creation:

julia> using Immerse, Colors

julia> hfig = figure()
1

julia> x = linspace(0,4pi,101);

julia> p = plot(x=x, y=sin(x), Geom.line(tag=:line))

julia> setproperty!((hfig,:line), rand(1:5), :linewidth)
3

julia> setproperty!((hfig,:line), RGB(rand(),rand(),rand()), :stroke)
RGB{Float64}(0.9563599683564541,0.20964995278692222,0.997388106654052)

julia> setproperty!((hfig,:line), false, :visible)
false

julia> setproperty!((hfig,:line), true, :visible)
true

julia> getproperty((hfig,:line), :visible)
1-element Array{Bool,1}:
 true

Compose Form and Property objects apply to a vector of objects, which is why getproperty returns a vector.

Figure windows

Each figure is addressed by an integer; for a window displaying a single Gadfly figure, by default this integer appears in the window title.

There are a few simple utilities for working with figure windows:

  • figure() opens a new figure window. This will become the default plotting window.
  • figure(3) raises the corresponding window and makes it the default.
  • gcf() returns the index of the current default figure.
  • scf() shows the current figure (raising the window to the top).
  • closefig(3) destroys Figure 3, closing the window.
  • closeall() closes all open figure windows.

Issues

When I type scf(), nothing happens

Your window manager may have "focus stealing prevention" enabled. For example, under KDE, go to the Kmenu->System Settings->Window behavior->Window behavior (pane)->Focus (tab) and set "Focus stealing prevent" to "None". Alternatively, if you want to limit this change to julia, use the "Window rules" pane and add a new setting where "Window class (application)" is set to "Regular Expression" with value "^julia.*".

More Repositories

1

Luxor.jl

Simple drawings using vector graphics; Cairo "for tourists!"
Julia
557
star
2

QML.jl

Build Qt6 QML interfaces for Julia programs.
Julia
359
star
3

Gtk.jl

Julia interface to Gtk windowing toolkit.
Julia
286
star
4

Colors.jl

Color manipulation utilities for Julia
Julia
191
star
5

ColorSchemes.jl

colorschemes, colormaps, gradients, and palettes
Julia
179
star
6

Winston.jl

2D plotting for Julia
Julia
170
star
7

Cairo.jl

Bindings to the Cairo graphics library.
Julia
86
star
8

ColorTypes.jl

Basic color definitions and traits
Julia
74
star
9

Tk.jl

Julia interface to Tk windowing toolkit.
Julia
52
star
10

ColorVectorSpace.jl

Treat colors as if they are n-vectors for the purposes of arithmetic
Julia
33
star
11

NamedColors.jl

More color names than you ever knew you wanted
Julia
30
star
12

NativeFileDialog.jl

mlabbe/nativefiledialog julia wrapper
Julia
28
star
13

FreeTypeAbstraction.jl

A Julian abstraction layer over FreeType.jl
Julia
24
star
14

SignedDistanceFields.jl

Simple and efficient SDF calculation.
Julia
23
star
15

UnicodeGraphics.jl

Visualize arrays in the REPL using braille or block unicode symbols!
Julia
21
star
16

ColorSchemeTools.jl

tools for working with color schemes, color maps, gradients
Julia
15
star
17

FreeType.jl

FreeType 2 bindings for Julia
Julia
13
star
18

Measures.jl

Unified measure and coordinates types
Julia
13
star
19

Graphics.jl

A holding place for Base graphics
Julia
12
star
20

RadeonProRender.jl

Wrapper for AMD's RadeonPro ray tracer
Julia
10
star
21

jlqml

C++ component of the QML.jl package
C++
8
star
22

Fontconfig.jl

Basic Julia bindings for fontconfig
Julia
8
star
23

Showoff.jl

Nicely format an array of n things for tables and plots
Julia
7
star