Download the R script and one input file in the same directory. Then, run the R script and you will get a .svg file under the same directory. You can use Inkscape to open the output file (.svg) and save as a PDF file.
There are one input file you need to prepare if you want to plot your own figure:
data.txt
Note, the value of ratio is between 0 and 1.