From a0402e59e76ce3af3c8b577c534bc36c64892b70 Mon Sep 17 00:00:00 2001 From: Martin Thoma Date: Sun, 28 Oct 2012 12:04:25 +0100 Subject: [PATCH] added gnuplot example --- math/gnuplot/high-order-knot/Makefile | 32 +++++++ math/gnuplot/high-order-knot/README.md | 89 +++++++++++++++++++ .../high-order-knot/high-order-knot.tex | 7 ++ math/gnuplot/high-order-knot/plot.gnuplot | 9 ++ 4 files changed, 137 insertions(+) create mode 100644 math/gnuplot/high-order-knot/Makefile create mode 100644 math/gnuplot/high-order-knot/README.md create mode 100644 math/gnuplot/high-order-knot/high-order-knot.tex create mode 100644 math/gnuplot/high-order-knot/plot.gnuplot diff --git a/math/gnuplot/high-order-knot/Makefile b/math/gnuplot/high-order-knot/Makefile new file mode 100644 index 0000000..a80efd0 --- /dev/null +++ b/math/gnuplot/high-order-knot/Makefile @@ -0,0 +1,32 @@ +SOURCE = high-order-knot +DELAY = 80 +DENSITY = 300 +WIDTH = 500 + +make: + gnuplot plot.gnuplot + pdflatex -shell-escape $(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 diff --git a/math/gnuplot/high-order-knot/README.md b/math/gnuplot/high-order-knot/README.md new file mode 100644 index 0000000..29d3ad1 --- /dev/null +++ b/math/gnuplot/high-order-knot/README.md @@ -0,0 +1,89 @@ +Use gnuplot within latex +======================== +First make sure that you can use gnuplot: +* Execute "gnuplot" in your command line +** Doesn't work: Look up where the binary is located (e.g. `C:\Programs\gnuplot\bin\gnuplot.exe`) and add it to your path (Windows + Pause -> System variables -> Path). Then try executing "gnuplot" in terminal again +** remember: You have to use `-shell-escape` + +GnuPlot Terminal types +---------------------- +Available terminal types: + aed512 AED 512 Terminal + aed767 AED 767 Terminal + aifm Adobe Illustrator 3.0 Format + bitgraph BBN Bitgraph Terminal + cgm Computer Graphics Metafile + corel EPS format for CorelDRAW + dumb ascii art for anything that prints text + dxf dxf-file for AutoCad (default size 120x80) + eepic EEPIC -- extended LaTeX picture environment + emf Enhanced Metafile format + emtex LaTeX picture environment with emTeX specials + epslatex LaTeX picture environment using graphicx package + epson_180dpi Epson LQ-style 180-dot per inch (24 pin) printers + epson_60dpi Epson-style 60-dot per inch printers + epson_lx800 Epson LX-800, Star NL-10, NX-1000, PROPRINTER ... + fig FIG graphics language for XFIG graphics editor + gif GIF images using libgd and TrueType fonts + gpic GPIC -- Produce graphs in groff using the gpic preprocessor + hp2623A HP2623A and maybe others + hp2648 HP2648 and HP2647 + hp500c HP DeskJet 500c, [75 100 150 300] [rle tiff] + + hpdj HP DeskJet 500, [75 100 150 300] + hpgl HP7475 and relatives [number of pens] [eject] + hpljii HP Laserjet series II, [75 100 150 300] + hppj HP PaintJet and HP3630 [FNT5X9 FNT9X17 FNT13X25] + imagen Imagen laser printer + jpeg JPEG images using libgd and TrueType fonts + kc_tek40xx MS-DOS Kermit Tek4010 terminal emulator - color + km_tek40xx MS-DOS Kermit Tek4010 terminal emulator - monochrome + latex LaTeX picture environment + mf Metafont plotting standard + mif Frame maker MIF 3.00 format + mp MetaPost plotting standard + nec_cp6 NEC printer CP6, Epson LQ-800 [monocrome color draft] + okidata OKIDATA 320/321 Standard + pbm Portable bitmap [small medium large] [monochrome gray color] + pcl5 HP Designjet 750C, HP Laserjet III/IV, etc. (many options) + png PNG images using libgd and TrueType fonts + postscript PostScript graphics, including EPSF embedded files (*.eps) + pslatex LaTeX picture environment with PostScript \specials + pstex plain TeX with PostScript \specials + pstricks LaTeX picture environment with PSTricks macros + qms QMS/QUIC Laser printer (also Talaris 1200 and others) + regis REGIS graphics language + selanar Selanar + starc Star Color Printer + svg W3C Scalable Vector Graphics driver + tandy_60dpi Tandy DMP-130 series 60-dot per inch graphics + tek40xx Tektronix 4010 and others; most TEK emulators + tek410x Tektronix 4106, 4107, 4109 and 420X terminals + texdraw LaTeX texdraw environment + tgif TGIF X11 [mode] [x,y] [dashed] ["font" [fontsize]] + tkcanvas Tk/Tcl canvas widget [perltk] [interactive] + tpic TPIC -- LaTeX picture environment with tpic \specials + unknown Unknown terminal type - not a plotting device + vttek VT-like tek40xx terminal emulator + wxt wxWidgets cross-platform windowed terminal + x11 X11 Window System + xlib X11 Window System (gnulib_x11 dump) + xterm Xterm Tektronix 4014 Mode + +The following sound good: + eepic EEPIC -- extended LaTeX picture environment + emtex LaTeX picture environment with emTeX specials + epslatex LaTeX picture environment using graphicx package + latex LaTeX picture environment + pslatex LaTeX picture environment with PostScript \specials + pstricks LaTeX picture environment with PSTricks macros + texdraw LaTeX texdraw environment + tpic TPIC -- LaTeX picture environment with tpic \specials + svg W3C Scalable Vector Graphics driver + png PNG images using libgd and TrueType fonts + +Sources +------- +* [konze.org](http://konze.org/?p=422): Thanks for mentioning the image source +* [soukoreff.com/gnuplot](http://soukoreff.com/gnuplot/): Thanks for this amazing knot +* [eelvex.net](http://www.eelvex.net/latex/graphs-and-diagrams-in-latex/): Thanks for the solution that actually worked diff --git a/math/gnuplot/high-order-knot/high-order-knot.tex b/math/gnuplot/high-order-knot/high-order-knot.tex new file mode 100644 index 0000000..509670a --- /dev/null +++ b/math/gnuplot/high-order-knot/high-order-knot.tex @@ -0,0 +1,7 @@ +\documentclass{standalone} + +\usepackage{graphicx} + +\begin{document} +\input plot +\end{document} diff --git a/math/gnuplot/high-order-knot/plot.gnuplot b/math/gnuplot/high-order-knot/plot.gnuplot new file mode 100644 index 0000000..4aa6278 --- /dev/null +++ b/math/gnuplot/high-order-knot/plot.gnuplot @@ -0,0 +1,9 @@ +set terminal latex +set output "plot-tmp.tex" +set nokey +set parametric +set hidden3d +set view 45,60 +set isosamples 200,15 +splot [-3*pi:3*pi][-pi:pi] cos(u)*cos(v)+3*cos(u)*(1.5+sin(u*5/3)/2),\ +sin(u)*cos(v)+3*sin(u)*(1.5+sin(u*5/3)/2), sin(v)+2*cos(u*5/3)