How to make flames in R

By | October 24, 2013

Making flames in R may come in handy. Maybe you're bored or perhaps you want to make a beautiful histogram? Who knows? Nonetheless, it's a short piece of code and it makes beautiful images:

Flame shape made in R

Flame shape made in R

It's actually quite simple to make. You may start out with a normal distribution. But to add complex color spectrums, you'll want to create curves that are stacked on top of this. And in order to get the shape, we'll need to use beta distributions. Here's the full code:

#set up variables
x = seq(0.15,0.85,by=0.01)
shape1 = 10
shape2 = 10
mult = 5
height = 700
colors = c("red", "orange", "yellow",
           "green", "blue", "violet",
           "lightblue", "lightgreen",
           "darkgreen", "black")

for(i in 1:200)

Hope it works for everyone! Let me know how it goes.

Share    Send article as PDF   

Leave a Reply

Your email address will not be published. Required fields are marked *

eight × = 32