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

**URL:** <https://discourse.julialang.org/t/has-anyone-implemented-slopecharts-slopegraphs-bump-charts-in-julia-yet/31107>\
**Category:** Visualization\
**Tags:** question\
**Created:** [November 14, 2019, 11:58pm UTC](https://discourse.julialang.org/t/has-anyone-implemented-slopecharts-slopegraphs-bump-charts-in-julia-yet/31107 "2019-11-14T23:58:42Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![anon97116444](https://avatars.discourse-cdn.com/v4/letter/a/5f9b8f/32.png) [@anon97116444](https://discourse.julialang.org/u/anon97116444)\
**Post date:** [November 14, 2019, 11:58pm UTC](https://discourse.julialang.org/t/has-anyone-implemented-slopecharts-slopegraphs-bump-charts-in-julia-yet/31107/1 "2019-11-14T23:58:42Z")

</div>

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

> **[Charlie Park](https://charliepark.org/slopegraphs/)**
>
> Charlie Park believes in you.

thank you

---

<div class="post-metadata">

**Author:** ![dpsanders](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dpsanders/32/3573_2.png) [@dpsanders](https://discourse.julialang.org/u/dpsanders)\
**Post date:** [November 15, 2019, 2:40am UTC](https://discourse.julialang.org/t/has-anyone-implemented-slopecharts-slopegraphs-bump-charts-in-julia-yet/31107/2 "2019-11-15T02:40:56Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![anon97116444](https://avatars.discourse-cdn.com/v4/letter/a/5f9b8f/32.png) [@anon97116444](https://discourse.julialang.org/u/anon97116444)\
**Post date:** [November 15, 2019, 2:51am UTC](https://discourse.julialang.org/t/has-anyone-implemented-slopecharts-slopegraphs-bump-charts-in-julia-yet/31107/3 "2019-11-15T02:51:28Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![dpsanders](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dpsanders/32/3573_2.png) [@dpsanders](https://discourse.julialang.org/u/dpsanders)\
**Post date:** [November 15, 2019, 2:55am UTC](https://discourse.julialang.org/t/has-anyone-implemented-slopecharts-slopegraphs-bump-charts-in-julia-yet/31107/4 "2019-11-15T02:55:48Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![anon97116444](https://avatars.discourse-cdn.com/v4/letter/a/5f9b8f/32.png) [@anon97116444](https://discourse.julialang.org/u/anon97116444)\
**Post date:** [November 15, 2019, 3:06am UTC](https://discourse.julialang.org/t/has-anyone-implemented-slopecharts-slopegraphs-bump-charts-in-julia-yet/31107/5 "2019-11-15T03:06:52Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Tamas\_Papp](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tamas_papp/32/25949_2.png) [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Post date:** [November 15, 2019, 11:58am UTC](https://discourse.julialang.org/t/has-anyone-implemented-slopecharts-slopegraphs-bump-charts-in-julia-yet/31107/6 "2019-11-15T11:58:30Z")

</div>

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

```julia
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}),
                      opts))
    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 };")
        end
    end
    axis
end

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)

```

 ![x](https://global.discourse-cdn.com/julialang/original/3X/d/6/d63f262bd482649403faaf258febb19ea4b70bdc.png)

---

<div class="post-metadata">

**Author:** ![anon97116444](https://avatars.discourse-cdn.com/v4/letter/a/5f9b8f/32.png) [@anon97116444](https://discourse.julialang.org/u/anon97116444)\
**Post date:** [November 15, 2019, 4:35pm UTC](https://discourse.julialang.org/t/has-anyone-implemented-slopecharts-slopegraphs-bump-charts-in-julia-yet/31107/7 "2019-11-15T16:35:22Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Tamas\_Papp](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tamas_papp/32/25949_2.png) [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Post date:** [November 15, 2019, 5:10pm UTC](https://discourse.julialang.org/t/has-anyone-implemented-slopecharts-slopegraphs-bump-charts-in-julia-yet/31107/8 "2019-11-15T17:10:15Z")

</div>

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