From 5e41690dfbccea7ddb33038707ad43d469cd3a91 Mon Sep 17 00:00:00 2001 From: Leandro Lucarella Date: Wed, 26 Aug 2009 21:09:09 -0300 Subject: [PATCH] micro: Add a script to generate histogram tics There is no way to take histogram tics labels from a data file in GNUPlot. A new script is added to generate the histogram tics labels from the data, suitable to be included directly in a GNUPlot script. --- micro/Makefile | 4 ++++ micro/tics.awk | 11 +++++++++++ 2 files changed, 15 insertions(+) create mode 100644 micro/tics.awk diff --git a/micro/Makefile b/micro/Makefile index ddbbac7..8529d82 100644 --- a/micro/Makefile +++ b/micro/Makefile @@ -78,6 +78,10 @@ $(STAT_DIR)/%.h.csv: $(STAT_DIR)/%.a.csv hist.awk .PHONY: plot plot: $(graphs) +.PRECIOUS: $(PLOT_DIR)/%.tics +$(PLOT_DIR)/%.tics: $(STAT_DIR)/%.h.csv tics.awk + $(P_AWK) awk -F, -f $(lastword $^) $< > $@ + $(PLOT_DIR)/%.c.eps: $(STAT_DIR)/%.c.csv plot-c.gpi $(P_PLOT) sed "s|@@PRG@@|$(*F)|g; s|@@COL@@|$(VERS)|g; \ s|@@IN@@|$<|g; s|@@OUT@@|$@|g" $(lastword $^) \ diff --git a/micro/tics.awk b/micro/tics.awk new file mode 100644 index 0000000..4c88049 --- /dev/null +++ b/micro/tics.awk @@ -0,0 +1,11 @@ +#!/usr/bin/env awk -F, -f + +BEGIN { + ORS = "" # don't use a \n after each print + print "'' 0" +} + +NR > 1 { # skip the input CVS header + print ", '" $1 "' " (NR-2) +} + -- 2.43.0