I am trying to plot the complementary cumulative distribution function (CCDF) using pgfplots. I found this answer Drawing cumulative distribution function for a discrete variable which plots only the CDF.

After reading the details in that answer I found this code create col/expr={\pgfmathaccuma + \thisrow{f(x)}} which as I understand calculates the cumulative sum of the row in f(x).

My problem is how to get the 1-CDF in this fourmla?

I tried using create col/expr={1 - \pgfmathaccuma - \thisrow{f(x)}} but it is wrong.

1 Answer 1


When using create col/expr, \pgfmathaccuma starts out being equal to 0. If you want to set a different starting value, use create col/expr accum={<expression>}{<starting value>}.

So in this case, you'd use create col/expr accum={\pgfmathaccuma - \thisrow{f(x)}}{1}.

  • Yes I found it finally thank you. Can you help me fix the marker because I obtain only horizontal lines without the dashed vertical lines nor the marker?
    – Jika
    Commented Oct 14, 2016 at 20:25

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .