From 966706e25260fc830c2a35c8eba4a7994e091643 Mon Sep 17 00:00:00 2001 From: Martin Thoma Date: Sun, 30 Sep 2012 11:19:19 +0200 Subject: [PATCH] added bar chart examples --- tikz/bar-chart-grouping/Makefile | 32 +++++++++++++++++++ .../bar-chart-grouping/bar-chart-grouping.tex | 29 +++++++++++++++++ tikz/bar-chart-simple/Makefile | 32 +++++++++++++++++++ tikz/bar-chart-simple/bar-chart-simple.tex | 19 +++++++++++ tikz/bchart-simple/Makefile | 32 +++++++++++++++++++ tikz/bchart-simple/bchart-simple.tex | 16 ++++++++++ 6 files changed, 160 insertions(+) create mode 100644 tikz/bar-chart-grouping/Makefile create mode 100644 tikz/bar-chart-grouping/bar-chart-grouping.tex create mode 100644 tikz/bar-chart-simple/Makefile create mode 100644 tikz/bar-chart-simple/bar-chart-simple.tex create mode 100644 tikz/bchart-simple/Makefile create mode 100644 tikz/bchart-simple/bchart-simple.tex diff --git a/tikz/bar-chart-grouping/Makefile b/tikz/bar-chart-grouping/Makefile new file mode 100644 index 0000000..a62f23a --- /dev/null +++ b/tikz/bar-chart-grouping/Makefile @@ -0,0 +1,32 @@ +SOURCE = bar-chart-grouping +DELAY = 80 +DENSITY = 300 +WIDTH = 500 + +make: + pdflatex $(SOURCE).tex -output-format=pdf + make clean + +clean: + rm -rf $(TARGET) *.class *.html *.log *.aux + +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: + make + #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/tikz/bar-chart-grouping/bar-chart-grouping.tex b/tikz/bar-chart-grouping/bar-chart-grouping.tex new file mode 100644 index 0000000..cb5df7e --- /dev/null +++ b/tikz/bar-chart-grouping/bar-chart-grouping.tex @@ -0,0 +1,29 @@ +% Source: http://tex.stackexchange.com/a/69234/5645 +\documentclass[varwidth=true, border=2pt]{standalone} + +\usepackage{pgfplots} + +\begin{document} + \begin{tikzpicture} + \begin{axis}[ + ybar, + ylabel={vaule/weight}, + xlabel={items}, + legend style={at={(0.5,-0.15)}, + anchor=north,legend columns=-1}, + width=0.8*\textwidth, + height=9cm, + bar width=7pt, + symbolic x coords={$x_1$,$x_2$,$x_3$,$x_4$,$x_5$}, + xtick=data, + %nodes near coords, + %nodes near coords align={vertical}, + ] + \addplot + coordinates {($x_1$,96000) ($x_2$,126000) ($x_3$,115000) ($x_4$,125000) ($x_5$,123000)}; + \addplot + coordinates {($x_1$,27) ($x_2$,21) ($x_3$,27) ($x_4$,15) ($x_5$,19)}; + \legend{value, weight} + \end{axis} + \end{tikzpicture} +\end{document} diff --git a/tikz/bar-chart-simple/Makefile b/tikz/bar-chart-simple/Makefile new file mode 100644 index 0000000..65ea91a --- /dev/null +++ b/tikz/bar-chart-simple/Makefile @@ -0,0 +1,32 @@ +SOURCE = bar-chart-simple +DELAY = 80 +DENSITY = 300 +WIDTH = 500 + +make: + pdflatex $(SOURCE).tex -output-format=pdf + make clean + +clean: + rm -rf $(TARGET) *.class *.html *.log *.aux + +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: + make + #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/tikz/bar-chart-simple/bar-chart-simple.tex b/tikz/bar-chart-simple/bar-chart-simple.tex new file mode 100644 index 0000000..6ad5803 --- /dev/null +++ b/tikz/bar-chart-simple/bar-chart-simple.tex @@ -0,0 +1,19 @@ +% Source: http://tex.stackexchange.com/a/8584/5645 +\documentclass[varwidth=true, border=2pt]{standalone} + +\usepackage{pgfplots} + +\begin{document} + \begin{tikzpicture} + \begin{axis}[ + symbolic x coords={a small bar, a medium bar, a large bar}, + xtick=data + ] + \addplot[ybar,fill=blue] coordinates { + (a small bar, 42) + (a medium bar, 50) + (a large bar, 80) + }; + \end{axis} + \end{tikzpicture} +\end{document} diff --git a/tikz/bchart-simple/Makefile b/tikz/bchart-simple/Makefile new file mode 100644 index 0000000..a7b136d --- /dev/null +++ b/tikz/bchart-simple/Makefile @@ -0,0 +1,32 @@ +SOURCE = bchart-simple +DELAY = 80 +DENSITY = 300 +WIDTH = 500 + +make: + pdflatex $(SOURCE).tex -output-format=pdf + make clean + +clean: + rm -rf $(TARGET) *.class *.html *.log *.aux + +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: + make + #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/tikz/bchart-simple/bchart-simple.tex b/tikz/bchart-simple/bchart-simple.tex new file mode 100644 index 0000000..90f8074 --- /dev/null +++ b/tikz/bchart-simple/bchart-simple.tex @@ -0,0 +1,16 @@ +% Source: http://www.tug.org/texlive//Contents/live/texmf-dist/doc/latex/bchart/bchart.pdf +\documentclass[varwidth=true, border=2pt]{standalone} + +\usepackage{bchart} + +\begin{document} + \begin{bchart}[step=2,max=10] + \bcbar{3.4} + \smallskip + \bcbar{5.6} + \medskip + \bcbar{7.2} + \bigskip + \bcbar{9.9} + \end{bchart} +\end{document}