summaryrefslogtreecommitdiff
path: root/Master/texmf-dist
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2016-12-31 21:26:18 +0000
committerKarl Berry <karl@freefriends.org>2016-12-31 21:26:18 +0000
commit9b491767bcc27a0d41045c2ffad2530455d81763 (patch)
treedf2c26d3f70d6bbf05322d8728ef905a3fa9602a /Master/texmf-dist
parentef3722646aa7f034d07d94074504a5c474692d32 (diff)
sparklines (31dec16)
git-svn-id: svn://tug.org/texlive/trunk@42821 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist')
-rw-r--r--Master/texmf-dist/doc/latex/sparklines/sparklines.pdfbin35574 -> 136597 bytes
-rw-r--r--Master/texmf-dist/doc/latex/sparklines/sparklines.tex125
-rw-r--r--Master/texmf-dist/tex/latex/sparklines/sparklines.sty66
3 files changed, 176 insertions, 15 deletions
diff --git a/Master/texmf-dist/doc/latex/sparklines/sparklines.pdf b/Master/texmf-dist/doc/latex/sparklines/sparklines.pdf
index 487d09fdb00..45f9401af48 100644
--- a/Master/texmf-dist/doc/latex/sparklines/sparklines.pdf
+++ b/Master/texmf-dist/doc/latex/sparklines/sparklines.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/latex/sparklines/sparklines.tex b/Master/texmf-dist/doc/latex/sparklines/sparklines.tex
index a489d7d7e22..1e038cbd5f3 100644
--- a/Master/texmf-dist/doc/latex/sparklines/sparklines.tex
+++ b/Master/texmf-dist/doc/latex/sparklines/sparklines.tex
@@ -15,7 +15,7 @@
\title{Sparklines}
\author{Andreas Loeffler \and Dan Luecking}
-\date{updated 19.~October 2014 (version 1.6)}\maketitle
+\date{Updated 27~December 2016 (version 1.7)}\maketitle
\section{What are sparklines?}
@@ -131,7 +131,7 @@ Bar graphs can be drawn easily:
\end{sparkline}.
This was created by the code:
\begin{verbatim}
- \begin{sparkline}{4}
+ \begin{sparkline}{5}
\sparkspike .083 .18
\sparkspike .25 .55
\sparkspike .417 1
@@ -149,6 +149,34 @@ above example was drawn with it changed to \texttt{red}. The width of
each bar is the value of the length \verb$\sparkspikewidth$, which the
user may change (with \verb$\setlength$). The default is \texttt{2pt}.
+You can combine bars and lines:
+\begin{sparkline}{5}
+ \sparkspike .083 .18
+ \sparkspike .25 .55
+ \sparkspike .417 1
+ \sparkspike .583 .62
+ \sparkspike .75 .42
+ \sparkspike .917 .5
+ \spark 0.1 0.95 0.2 0.8 0.3 0.3 0.4 0.52 0.5 0.62
+ 0.6 0.7 0.7 0.5 0.8 0.4 0.9 0.25 1 0.2 /
+ \sparkdot 1 0.2 blue
+\end{sparkline}\space. This was created with
+\begin{verbatim}
+\begin{sparkline}{5}
+ \sparkspike .083 .18
+ \sparkspike .25 .55
+ \sparkspike .417 1
+ \sparkspike .583 .62
+ \sparkspike .75 .42
+ \sparkspike .917 .5
+ \spark 0.1 0.95 0.2 0.8 0.3 0.3 0.4 0.52 0.5 0.62
+ 0.6 0.7 0.7 0.5 0.8 0.4 0.9 0.25 1 0.2 /
+ \sparkdot 1 0.2 blue
+\end{sparkline}\space.
+\end{verbatim}
+
+
+
\paragraph{Colors} In case you want to change colors use
\begin{verbatim}
\definecolor{sparkrectanglecolor}{gray}{0.9}
@@ -165,24 +193,111 @@ before the sparkline environment (see a manual about defining colors in \LaTeX{}
\sparkspike .483 .62
\sparkspike .65 .42
\sparkspike .817 .5
-\sparkbottomline 0.9
+\sparkbottomline[0.9]
\end{sparkline}.
The code used was
\begin{verbatim}
\begin{sparkline}{5}
- \definecolor{sparkbottomlinecolor}{gray}{0.9}
+ \definecolor{sparkbottomlinecolor}{gray}{0.9}
\sparkspike .15 .55
\sparkspike .317 1
\sparkspike .483 .62
\sparkspike .65 .42
\sparkspike .817 .5
- \sparkbottomline 0.9
+ \sparkbottomline[0.9]
\end{sparkline}.
\end{verbatim}
Changing the color of the bottom line is quite easy using the command
+like
+\begin{verbatim}
+\definecolor{sparkbottomlinecolor}{named}{red}
+\end{verbatim}. You can change the thickness of the bottom line using
+command like
+\begin{verbatim}
+\setlength\sparkbottomlinethickness{1pt}
+\end{verbatim}
+
+The optional argument of \verb|\sparkbottomline| is the length of the
+bottom line (by default~1).
+
+If you need to set both start and end of the bottomline, use
+\verb|\sparkbottomlinex| command, which has two obligatory arguments:
+the start and the end, for example,
+\definecolor{sparkbottomlinecolor}{named}{blue}%
+ \begin{sparkline}{5}
+ \sparkspike .15 .55
+ \sparkspike .317 1
+ \sparkspike .483 .62
+ \sparkspike .65 .42
+ \sparkspike .817 .5
+ \sparkbottomlinex 0.3 0.8
+ \end{sparkline}. This was created with the code
+\begin{verbatim}
+ \begin{sparkline}{5}
+ \sparkspike .15 .55
+ \sparkspike .317 1
+ \sparkspike .483 .62
+ \sparkspike .65 .42
+ \sparkspike .817 .5
+ \sparkbottomlinex 0.3 0.8
+ \end{sparkline}
+\end{verbatim}
+
+\paragraph{Clipping}
+
+Sometimes you may have sparklines outside the drawing region, for
+example,
+ \begin{sparkline}{10}
+ \sparkrectangle 0.3 0.8
+ \sparkdot 0.5 0.62 blue
+ \sparkdot 1 0.2 red
+ \spark 0.1 0.95 0.2 0.8 0.3 0.3 0.4 2.52 0.5 0.62
+ 0.6 0.7 0.7 0.5 0.8 0.4 0.9 0.25 1 0.2 /
+ \end{sparkline}. You may want to clip them. The starred version
+ \verb|sparkline*| creates \emph{clipped} sparklines: the graphics
+ outside the rectangle (0,0) -- (1,1) plus a thin border of the width
+ \verb|\sparklineclipsep| is clipped:
+ \begin{sparkline*}{10}
+ \sparkrectangle 0.3 0.8
+ \sparkdot 0.5 0.62 blue
+ \sparkdot 1 0.2 red
+ \spark 0.1 0.95 0.2 0.8 0.3 0.3 0.4 2.52 0.5 0.62
+ 0.6 0.7 0.7 0.5 0.8 0.4 0.9 0.25 1 0.2 /
+ \end{sparkline*}. The first sparkline was created with
+\begin{verbatim}
+ \begin{sparkline}{10}
+ \sparkrectangle 0.3 0.8
+ \sparkdot 0.5 0.62 blue
+ \sparkdot 1 0.2 red
+ \spark 0.1 0.95 0.2 0.8 0.3 0.3 0.4 2.52 0.5 0.62
+ 0.6 0.7 0.7 0.5 0.8 0.4 0.9 0.25 1 0.2 /
+ \end{sparkline}.
+\end{verbatim}
+The second sparkline was created with
+\begin{verbatim}
+ \begin{sparkline*}{10}
+ \sparkrectangle 0.3 0.8
+ \sparkdot 0.5 0.62 blue
+ \sparkdot 1 0.2 red
+ \spark 0.1 0.95 0.2 0.8 0.3 0.3 0.4 2.52 0.5 0.62
+ 0.6 0.7 0.7 0.5 0.8 0.4 0.9 0.25 1 0.2 /
+ \end{sparkline*}.
+\end{verbatim}
+
+The clipping separation is set to 2~pt. You can change it with
+\begin{verbatim}
+\setlength\sparklineclipsep{...}.
+\end{verbatim}
+
\section*{Version history}
\begin{description}
+
+ \item[] Dev 26, 2016
+
+ version 1.7: Boris Veytsman (borisv@lk.net). Added clipping,
+ extensible bottom lines, some bug fixes.
+
\item[] Oct 19, 2014
version 1.6: Emiel van Miltenburg (emiel.van.miltenburg@vu.nl) - Adding a bottom line (the x-axis, this is useful to visually separate different bar charts that are next to each other) and changing the color of the bottom line.
diff --git a/Master/texmf-dist/tex/latex/sparklines/sparklines.sty b/Master/texmf-dist/tex/latex/sparklines/sparklines.sty
index 2eb864cfd16..78836d6c07b 100644
--- a/Master/texmf-dist/tex/latex/sparklines/sparklines.sty
+++ b/Master/texmf-dist/tex/latex/sparklines/sparklines.sty
@@ -1,4 +1,4 @@
-%%% sparklines.sty Version 1.6
+%%% sparklines.sty Version 1.7
%%%
%%% What Are Sparklines?
%%% Sparklines are intense, simple, wordlike graphics (so named by Edward Tufte).
@@ -16,25 +16,45 @@
%%% al@wacc.de
%%%
%%% MODIFICATION HISTORY:
+%%%
+%%% Dec 26 2016:
+%%% version 1.7: Boris Veytsman (borisv@lk.net): Adding optional clipping,
+%%% extensible bottom lines, some bug fixing.
+%%%
%%% Oct 19, 2014
-%%% version 1.6: Emiel van Miltenburg (emiel.van.miltenburg@vu.nl) - Adding a bottom line (the x-axis, this is useful to visually separate different bar charts that are next to each other) and changing the color of the bottom line.
+%%% version 1.6: Emiel van Miltenburg (emiel.van.miltenburg@vu.nl) -
+%%% Adding a bottom line (the x-axis, this is useful to visually
+%%% separate different bar charts that are next to each other) and
+%%% changing the color of the bottom line.
+%%%
%%% Nov 21, 2009
-%%% version 1.5: Benno Puetz (puetz@mpipsykl.mpg.de) made change of colors possible.
+%%% version 1.5: Benno Puetz (puetz@mpipsykl.mpg.de) made change of
+%%% colors possible.
+%%%
%%% Apr 20, 2009
-%%% version 1.4: Alexander Kowalski (Alexander.Kowarik@statistik.gv.at) found an error concerning spark-rectangles
+%%% version 1.4: Alexander Kowalski
+%%% (Alexander.Kowarik@statistik.gv.at) found an error concerning
+%%% spark-rectangles
+%%%
%%% Mar 21, 2007
%%% version 1.3: Dan Luecking (luecking@uark.edu) added user-changeable
%%% parameters, and expanded documentation
+%%%
%%% Mar 19, 2007
-%%% version 1.2: Harlan Harris (harlan@harris.name) added positive-value-only bars
+%%% version 1.2: Harlan Harris (harlan@harris.name) added
+%%% positive-value-only bars
+%%%
%%% Apr 21, 2005
-%%% version 1.1: bug removed thanks to Mathias Hofmann <mathias.hofmann@web.de>
+%%% version 1.1: bug removed thanks to Mathias Hofmann
+%%% <mathias.hofmann@web.de>
+%%%
%%% Dec 12, 2004
%%% version 1.0: first version of sparklines
+%%%
\ProvidesPackage{sparklines}
- [2014/10/19 v1.6 Sparklines (see more about sparklines at www.EdwardTufte.com)]
- \typeout {Package: `sparklines' 1.6bp \space 2014/10/19}
+ [2016/12/26 v1.7 Sparklines (see more about sparklines at www.EdwardTufte.com)]
+ \typeout {Package: `sparklines' 1.7bp \space 2016/12/26}
\RequirePackage{pgf}
% We define the colors of two features: the background rectangle and
@@ -48,24 +68,43 @@
% \sparkdotwidth -- diameter of the dot drawn by \sparkdot,
% \sparkspikewidth -- width of bar drawn in \sparkspike,
% \sparklineheight -- macro, number of ex for the height of picture.
+% \sparkbottomlinewidth -- width of the bottom line
% Defaults equal old hard-coded values.
\newlength\sparklinethickness
\newlength\sparkdotwidth
\newlength\sparkspikewidth
+\newlength\sparkbottomlinethickness
+\newlength\sparklineclipsep
\setlength\sparklinethickness{0.2pt}
\setlength\sparkdotwidth{1.2pt}
\setlength\sparkspikewidth{2pt}
+\setlength\sparkbottomlinethickness{2pt}
+\setlength\sparklineclipsep{2pt}
\providecommand{\sparklineheight}{1.75}
% defines sparkline environment
% Replace hard coded line thickness and picture height with above
% defined parameters.
-\newenvironment{sparkline}[1]{\pgfpicture{0ex}{0ex}{#1 ex}{\sparklineheight ex}
+\newenvironment{sparkline}[1]{\pgfpicture{0ex}{0ex}{#1
+ ex}{\sparklineheight ex}
\pgfsetlinewidth{\sparklinethickness}
\pgfsetxvec{\pgfpoint{#1 ex}{0pt}}
\pgfsetyvec{\pgfpoint{0pt}{\sparklineheight ex}}
} {\pgfstroke \endpgfpicture}
+\newenvironment{sparkline*}[1]{\pgfpicture{0ex}{0ex}{#1
+ ex}{\sparklineheight ex}
+ \pgfpathrectanglecorners%
+ {\pgfpoint{-\sparklineclipsep}{-\sparklineclipsep}}%
+ {\pgfpointadd{\pgfpoint{#1 ex}{\sparklineheight ex}}%
+ {\pgfpoint{\sparklineclipsep}{\sparklineclipsep}}}
+ \pgfusepath{clip}
+ \pgfsetlinewidth{\sparklinethickness}
+ \pgfsetxvec{\pgfpoint{#1 ex}{0pt}}
+ \pgfsetyvec{\pgfpoint{0pt}{\sparklineheight ex}}
+} {\pgfstroke \endpgfpicture}
+
+
% defines sparkdot with color
% Replace hard-coded diameter with previously defined parameter.
\def\sparkdot #1 #2 #3 {%
@@ -82,7 +121,13 @@
\pgfrect[fill]{\pgfxy(0, #1)}{\pgfxy(1, #2-#1)}}}%
% defines sparkbottomline
-\newcommand{\sparkbottomline}[1][1]{\color{sparkbottomlinecolor}\pgfline{\pgfxy(0,0)}{\pgfxy(#1,0)}\color{sparklinecolor}}
+\newcommand{\sparkbottomline}[1][1]{\pgfsetlinewidth{\sparkbottomlinethickness}%
+ \color{sparkbottomlinecolor}%
+ \pgfline{\pgfxy(0,0)}{\pgfxy(#1,0)}\color{sparklinecolor}}
+% defines sparkbottomlinex
+\def\sparkbottomlinex #1 #2 {\pgfsetlinewidth{\sparkbottomlinethickness}%
+ \color{sparkbottomlinecolor}
+ \pgfline{\pgfxy(#1,0)}{\pgfxy(#2,0)}\color{sparklinecolor}}
% defines sparkline-plot
% Replace \@shouldIstop hack with equivalent \@ifnextchar code.
@@ -90,6 +135,7 @@
\pgfmoveto{\pgfxy(#1,#2)} %
\@SPARK}
\def\@SPARK#1 #2 {%
+ \pgfsetlinewidth{\sparklinethickness}%
\pgfsetstrokecolor{sparklinecolor}%
\pgflineto{\pgfxy(#1,#2)} %
\@ifnextchar/{\pgfstroke\ignorespaces}{\@SPARK}}