Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Download

๐Ÿ“š The CoCalc Library - books, templates and other resources

132935 views
License: OTHER
1
\documentclass{article}
2
\usepackage[pdftex,active,tightpage]{preview}
3
\setlength\PreviewBorder{2mm}
4
5
\usepackage{pgfplots}
6
\usepackage{tikz}
7
\usepackage{helvet}
8
\usepackage[eulergreek]{sansmath}
9
10
% Sans serif fonts do not look as nice as serif fonts,
11
% but they are much easier to read when the image is small
12
\pgfplotsset{
13
tick label style = {font=\sansmath\sffamily},
14
every axis label = {font=\sansmath\sffamily},
15
legend style = {font=\sansmath\sffamily},
16
label style = {font=\sansmath\sffamily}
17
}
18
19
\begin{document}
20
\begin{preview}
21
\begin{tikzpicture}
22
\begin{axis}[
23
title = US military budget,
24
% xlabel = Year,
25
ylabel = In constant (2010) billion US\$,
26
% Display option
27
width = 12cm,
28
height = 10cm,
29
ymin = 340,
30
ymax = 760,
31
xmin = 1987,
32
xmax = 2011.9,
33
% Configuration
34
title style = {font=\bfseries},
35
x tick label style = {/pgf/number format/1000 sep=,
36
inner sep=0pt,
37
anchor=north east,
38
rotate=45 },
39
legend style = {at={(0.5,-0.15)},
40
anchor = north,legend columns=-1},
41
ybar = 5pt, % configures โ€˜bar shiftโ€™
42
bar width = 9pt,
43
nodes near coords,
44
every node near coord/.append style = {rotate=90, anchor=west, font=\small\sansmath\sffamily},
45
point meta = y, % the displayed number
46
]
47
\addplot
48
coordinates {(1988, 540.415) (1989, 534.906) (1990, 510.998)
49
(1991, 448.806) (1992, 474.215) (1993, 449.281) (1994, 421.917)
50
(1995, 399.043) (1996, 377.342) (1997, 375.375) (1998, 366.918)
51
(1999, 367.822) (2000, 382.061) (2001, 385.142) (2002, 432.452)
52
(2003, 492.200) (2004, 536.459) (2005, 562.039) (2006, 570.769)
53
(2007, 585.749) (2008, 629.095) (2009, 679.574) (2010, 698.281)
54
(2011, 689.591) };
55
\end{axis}
56
\end{tikzpicture}
57
\end{preview}
58
\end{document}
59
60