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.
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.
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
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
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
posted by Blazecock Pileon at 12:38 PM on April 21, 2011
This thread is closed to new comments.
posted by The Biggest Dreamer at 10:29 AM on April 21, 2011 [1 favorite]