2
0
Fork 0
mirror of https://github.com/MartinThoma/LaTeX-examples.git synced 2025-04-19 11:38:05 +02:00

added image with us military budget

This commit is contained in:
Martin Thoma 2014-09-25 09:58:37 +02:00
parent 69d11f2a4a
commit 610fe87fa4
4 changed files with 84 additions and 0 deletions

View file

@ -0,0 +1,33 @@
SOURCE = bar-chart-military-budget
DELAY = 80
DENSITY = 300
WIDTH = 512
make:
pdflatex $(SOURCE).tex -output-format=pdf
make clean
clean:
rm -rf $(TARGET) *.class *.html *.log *.aux *.data *.gnuplot
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-width=$(WIDTH) --export-plain-svg=$(SOURCE)1.svg
rsvg-convert -a -w 720 -f svg $(SOURCE)1.svg -o $(SOURCE).svg
rm $(SOURCE)1.svg

View file

@ -0,0 +1,3 @@
Compiled example
----------------
![Example](bar-chart-military-budget.png)

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

View file

@ -0,0 +1,48 @@
\documentclass{article}
\usepackage[pdftex,active,tightpage]{preview}
\setlength\PreviewBorder{2mm}
\usepackage{pgfplots}
\usepackage{tikz}
\begin{document}
\begin{preview}
\begin{tikzpicture}
\begin{axis}[
width=15cm,
height=10cm,
title=US military budget,
title style={font=\bfseries},
x tick label style={/pgf/number format/1000 sep=},
xlabel=Year,
ylabel=In constant (2010) billion US\$,
% enlargelimits=0.15,
ymin=340,
ymax=850,
xmin=1987,
xmax=2011.9,
legend style={at={(0.5,-0.15)},
anchor=north,legend columns=-1},
ybar=5pt,% configures bar shift
bar width=9pt,
nodes near coords,
every node near coord/.append style={rotate=90, anchor=west},
point meta=y, % the displayed number
% point meta style={rotate=90}
]
\addplot
coordinates {(1988, 540.415) (1989, 534.906) (1990, 510.998)
(1991, 448.806) (1992, 474.215) (1993, 449.281) (1994, 421.917)
(1995, 399.043) (1996, 377.342) (1997, 375.375) (1998, 366.918)
(1999, 367.822) (2000, 382.061) (2001, 385.142) (2002, 432.452)
(2003, 492.200) (2004, 536.459) (2005, 562.039) (2006, 570.769)
(2007, 585.749) (2008, 629.095) (2009, 679.574) (2010, 698.281)
(2011, 689.591) };
% \addplot
% coordinates {(1930,38e6) (1940,42e6)
% (1950,43e6) (1960,45e6) (1970,65e6)};
% \legend{Far,Near}
\end{axis}
\end{tikzpicture}
\end{preview}
\end{document}