# How to create a line graph and vary line thickness dynamically?April 21, 2011 9:49 AM   Subscribe

I need to figure out how to create a line graph that allows me to vary the thickness of the line dynamically (i.e., as a function of a variable). Sort of like the way this health care expenditure/life expectancy graph varies the line thickness based on average number of doctor visits per year.

Line graphs connect two points, so they convey start and endpoints and slope. I also want to bundle in a third variable. Sort of like a bubble plot allows you to show x and y coordinates AND another variable captured in the diameter of the bubble.

I know how to format the thickness of lines in Excel and SPSS, but that just sets it, statically. I'd like a solution that varies line thickness based on a variable value.
posted by jasper411 to Computers & Internet (4 answers total) 1 user marked this as a favorite

Ummm I don't know how comfortable you'd be with scripting but maybe could hack together a satisfactory solution using Processing?
posted by The Biggest Dreamer at 10:29 AM on April 21, 2011 [1 favorite]

I was going to suggest the odinsdream solution - add/subtract half of the third value to create lines that define the top and bottom of the "thick line", and display using a stacked line graph.
posted by misterbrandt at 10:38 AM on April 21, 2011

If you're familiar with R, it will handle it. I forget off the top of my head, but a quick google shows a few examples.
posted by Brian Puccio at 12:01 PM on April 21, 2011

R is awesome. The ggplot2 library extends R and has a ribbon plot that will do what you're describing, I think. Or you can use a regular line and specify its size parameter.
posted by Blazecock Pileon at 12:38 PM on April 21, 2011

« Older Help me debunk Auntie (& Bill Whittle)   |   Help Me Dump AT&T Newer »