Browse Source

added gnuplot csv example

Martin Thoma 12 năm trước cách đây
mục cha
commit
e3a4193f41

+ 32 - 0
math/gnuplot/draw-csv/Makefile

@@ -0,0 +1,32 @@
+SOURCE = draw-csv
+DELAY = 80
+DENSITY = 300
+WIDTH = 500
+
+make:
+	gnuplot plot.gnuplot
+	pdflatex $(SOURCE).tex -output-format=pdf
+	make clean
+
+clean:
+	rm -rf  $(TARGET) *.class *.html *.log *.aux plot-tmp.tex
+
+gif:
+	pdfcrop $(SOURCE).pdf
+	convert -verbose -delay $(DELAY) -loop 0 -density $(DENSITY) $(SOURCE)-crop.pdf $(SOURCE).gif
+	make clean
+
+png:
+	make
+	make svg
+	inkscape $(SOURCE).svg -w $(WIDTH) --export-png=$(SOURCE).png
+
+transparentGif:
+	convert $(SOURCE).pdf -transparent white result.gif
+	make clean
+
+svg:
+	#inkscape $(SOURCE).pdf --export-plain-svg=$(SOURCE).svg
+	pdf2svg $(SOURCE).pdf $(SOURCE).svg
+	# Necessary, as pdf2svg does not always create valid svgs:
+	inkscape $(SOURCE).svg --export-plain-svg=$(SOURCE).svg

+ 8 - 0
math/gnuplot/draw-csv/data.csv

@@ -0,0 +1,8 @@
+time,frequency
+1,100
+2,80
+3,10
+12,120
+4,50
+5,50
+6,50

+ 7 - 0
math/gnuplot/draw-csv/draw-csv.tex

@@ -0,0 +1,7 @@
+\documentclass{standalone}
+
+\usepackage{graphicx}
+
+\begin{document}
+\input plot-tmp
+\end{document}

+ 4 - 0
math/gnuplot/draw-csv/plot.gnuplot

@@ -0,0 +1,4 @@
+set terminal latex
+set output "plot-tmp.tex"
+set datafile separator "," 
+plot 'data.csv' every::1::7  using 1:2 with lines