Has anyone implemented slopecharts/slopegraphs/bump charts in Julia yet?

Hi all
not started with Julia YET but will do so next week. I would like to know if there is a mechanism for implementing SLOPEGRAPHS ( sometimes called bump charts) in Julia?
This is an article on the form of the charts


thank you

Could you maybe provide a link to some examples of this?

1 Like

sorry I updated the question to include an article on the form and utility of the charts.

That should be pretty easy to do using eg Plots.jl.

1 Like

That’s great to hear, normally the simple case of two columns is easy BUT to get the multicolumn ( which is the interesting case I think) is a little trickier. Take a look at the chart for Cancer Survival Rates. Part of the issue is how to proportion the plot. What happens to the fonts? I’m hoping that someone has taken a look at it.

1 Like

You can tweak the appearance further, but this is a reasonable starting point:

using PGFPlotsX

function slope_chart(opts, x, ydata; offset = 0.1)
    axis = Axis(merge(@pgf({ # labels left
                             ytick = first.(last.(ydata)),
                             yticklabels = first.(ydata),
                             # labels right
                             extra_y_ticks = last.(last.(ydata)),
                             extra_y_tick_labels = first.(ydata),
                             extra_y_tick_style = { ticklabel_pos = "right" },
                             # general
                             axis_line_style = { draw = "none" },
                             tick_style = { draw = "none" },
                             xtick = x,
                             xmin = minimum(x) - offset,
                             xmax = maximum(x) + offset}),
    for d in ydata
        label, seq = d
        push!(axis, @pgf Plot({ thin, black, no_marks }, Table(x, seq)))
        for (x, s) in zip(x, seq)
            push!(axis, "\\node [fill = white] at (axis cs:$x,$s) { $s };")

ydata = ["open plan" => [0.3, 0.9, 0.99],
         "cubicle" => [0.2, 0.5, 0.6],
         "private office" => [0.1, 0.1, 0.05]]

@pgf slope_chart({ xlabel = "time [h]",
                   ylabel = "probability of brain death" },
                 0:2, ydata)


WOW!! now that was impressive. I haven’t written a line of Julia and ALREADY I have a wonderful reference code to work on. Thank you so much Tamas.

1 Like

I am happy to help. Thanks for the opportunity, I remember seeing these graphs before and it was fun to do (I like Tufte’s work very much).