mirror of
https://github.com/MartinThoma/LaTeX-examples.git
synced 2025-04-26 06:48:04 +02:00
added bar chart examples
This commit is contained in:
parent
c96f849d1b
commit
966706e252
6 changed files with 160 additions and 0 deletions
32
tikz/bar-chart-grouping/Makefile
Normal file
32
tikz/bar-chart-grouping/Makefile
Normal file
|
@ -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
|
29
tikz/bar-chart-grouping/bar-chart-grouping.tex
Normal file
29
tikz/bar-chart-grouping/bar-chart-grouping.tex
Normal file
|
@ -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}
|
32
tikz/bar-chart-simple/Makefile
Normal file
32
tikz/bar-chart-simple/Makefile
Normal file
|
@ -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
|
19
tikz/bar-chart-simple/bar-chart-simple.tex
Normal file
19
tikz/bar-chart-simple/bar-chart-simple.tex
Normal file
|
@ -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}
|
32
tikz/bchart-simple/Makefile
Normal file
32
tikz/bchart-simple/Makefile
Normal file
|
@ -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
|
16
tikz/bchart-simple/bchart-simple.tex
Normal file
16
tikz/bchart-simple/bchart-simple.tex
Normal file
|
@ -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}
|
Loading…
Add table
Add a link
Reference in a new issue