``qplot`` Directive =================== .. qplot:: series :kwargs: {"series": ["t", "cos"]} :width: 65% :caption: single series with explicit x #include #include int main() { printf("t cos sin\n"); float t; for (t=0; t<65; t+=0.1) printf("%12.8f %12.8f %12.8f\n", t, cosf(t), sinf(t)); return 0; } .. qplot:: series :kwargs: {"series": ["cos"]} :width: 65% :caption: single series with implied index as x #include #include int main() { printf("t cos sin\n"); float t; for (t=0; t<65; t+=0.1) printf("%12.8f %12.8f %12.8f\n", t, cosf(t), sinf(t)); return 0; } .. qplot:: series :kwargs: {"series": ["cos", {"color":"red"}]} :width: 65% :caption: single series with plot options #include #include int main() { printf("t cos sin\n"); float t; for (t=0; t<65; t+=0.1) printf("%12.8f %12.8f %12.8f\n", t, cosf(t), sinf(t)); return 0; } .. qplot:: series :kwargs: {"series": [["t", "cos"], ["t", "sin"]]} :width: 65% :caption: multiple series on one axis #include #include int main() { printf("t cos sin\n"); float t; for (t=0; t<65; t+=0.1) printf("%12.8f %12.8f %12.8f\n", t, cosf(t), sinf(t)); return 0; } .. qplot:: series :kwargs: {"series": [["t","cos"], ["t","sin"]]} :width: 65% :caption: multiple series on individual axes #include #include int main() { printf("t cos sin\n"); float t; for (t=0; t<65; t+=0.1) printf("%12.8f %12.8f %12.8f\n", t, cosf(t), sinf(t)); return 0; } .. qplot:: series :kwargs: {"series": [ ["t","cos"], ["t","sin"], ["t","exp"], ["t","tanh"] ] } :width: 65% :caption: multiple series on multiple axes #include #include int main() { printf("t cos sin exp tanh\n"); float t; for (t=0; t<65; t+=0.1) printf("%12.8f %12.8f %12.8f %12.8f %12.8f\n", t, cosf(t), sinf(t), expf(-t), tanhf(t-20)); return 0; } .. qplot:: series :kwargs: { "layout": [2,1], "plots": [ { "series": [["t","cos"], ["t","sin"]], "xrange" : [0,60], "yrange" : [-1.1, 1.1] }, { "series": [["t","exp"], ["t","tanh"]], "xrange" : [0,25], "yrange" : [-1.1, 1.1] } ]} :width: 65% :caption: Multiple series with customization for each subplot #include #include int main() { printf("t cos sin exp tanh\n"); float t; for (t=0; t<65; t+=0.1) printf("%12.8f %12.8f %12.8f %12.8f %12.8f\n", t, cosf(t), sinf(t), expf(-t), tanhf(t-20)); return 0; } Test Re-using ``qplot`` Directive with the Same Source ------------------------------------------------------ .. qplot:: series _test/arguments.c :args: -f 0.2 :kwargs: {"series": [["t", "cos"],["t", "sin"]]} :width: 65% :caption: Frequency 0.2 .. qplot:: series _test/arguments.c :args: -f 0.3 :kwargs: {"series": [["t", "cos"],["t", "sin"]]} :width: 65% :caption: Frequency 0.3 Test Plotting Existing Data File -------------------------------- This example plots a pre-configured data file. The directive recognizes from the file extension that this is not a source file and so it does not need to be compiled and executed. .. qplot:: series test/windowing.out :kwargs: {"series": ["w"]} :width: 65% :caption: Pre-configured data file .. comment Test Capturing Output --------------------- This example does not plot a result but just provides the output text as a listing. .. qplot:: series test/windowing.out :kwargs: {"plots": null} :width: 65% :caption: Pre-configured data file