cdf - Gnuplot CCDF plotting and log-log scale -


my data file set of sorted single-column:

1 1 2 2 2 3 ... 999 1000 1000 

i able plot cdf using command (assuming 10000 lines in file):

plot "file" using 1:(1/10000.) smooth cumulative title "cdf" 

i able plot logcale of x axis by:

set logscale x 

my problem how can have ccdf plotting gnuplot?

in additional, cdf log-log scale (set logscale xy) can not give me output. if have log-log ccdf plotting?

many thanks!

i found workaround problem, because not think can plot ccdf using gnuplot.

briefly, parsed data using bash create dataset cumulative data explicit; gnuplot may plot new dataset. example, assuming file contains (numerical) values want cumulate, in bash environment:

cat data | sort -n | uniq --count | awk 'begin{sum=0}{print $2,$1,sum; sum=sum+$1}' > parsed.dat' 

this command reads dataset (cat data), sorts numerical data using value (sort -n), counts occurrences of each sample (uniq --count) , creates new dataset, calculating cumulative sum of each data value (the awk command).

this new dataset contains 3 columns: first column ($1 in gnuplot) contains unique values of dataset, $2 contains number of occurrences of values, , third column represents cumulative sum.

finally, in gnuplot, can this:

stats "parsed.dat" using 3; plot "parsed.dat" using 1:($3/stats_max) lines title "cdf",\ "" using 1:(1-$3/stats_max)  lines title "ccdf",\ "" using 1:($2/stats_max) boxes title "pdf" 

the stats command of gnuplot analyzes third column (the 1 cumulative sum) , stores values variables. stats_max max value of column (so final cumulative sum). have data need plot not cdf, ccdf (which 1 - cdf) , pdf (or normalized histogram, discrete values).


Comments

Popular posts from this blog

python - pip install -U PySide error -

arrays - C++ error: a brace-enclosed initializer is not allowed here before ‘{’ token -

cytoscape.js - How to add nodes to Dagre layout with Cytoscape -