Created
February 9, 2014 03:59
-
-
Save n-st/8894062 to your computer and use it in GitHub Desktop.
Example of a Lorenz curve for Wikipedia: https://commons.wikimedia.org/wiki/File:Lorenz-Kurve_Beispiel.svg
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
% Lorenz curve | |
% by n.st, originally created on 2014-02-08 | |
% based on | |
% - http://www.texample.net/tikz/examples/line-plot-example/ | |
% - http://tex.stackexchange.com/a/51766 | |
\documentclass[crop,tikz,convert={outext=.svg,command=\unexpanded{pdf2svg \infile\space\outfile}},multi=false]{standalone} | |
\usepackage[utf8]{inputenc} | |
\begin{document} | |
\begin{tikzpicture}[y=.1cm, x=.1cm] | |
\path[fill=white] (-25,-25) rectangle (115,115); | |
%axes | |
\draw (0,0) -- coordinate (x axis mid) (100,0); | |
\draw (0,0) -- coordinate (y axis mid) (0,100); | |
\draw[help lines] (100,0) -- (100,100); | |
\draw[help lines] (0,100) -- (100,100); | |
%ticks | |
\foreach \x in {0,20,...,100} | |
\draw (\x,1pt) -- (\x,-3pt) | |
node[anchor=north] {\x\%}; | |
\foreach \y in {0,20,...,100} | |
\draw (1pt,\y) -- (-3pt,\y) | |
node[anchor=east] {\y\%}; | |
%labels | |
\node[below=0.8cm] at (x axis mid) {\% der Bevölkerung}; | |
\node[rotate=90, above=0.8cm] at (y axis mid) {\% des Einkommens}; | |
%lines | |
\draw[ultra thick,domain=0:100,smooth,variable=\x] plot ({\x},{\x}); | |
\newcommand*{\CenterOffset}{40} | |
\draw[ultra thick] (100,100) arc | |
( | |
-asin(\CenterOffset/(100+\CenterOffset)) : | |
-acos(\CenterOffset/(100+\CenterOffset)) : | |
148 % = approx. sqrt((102+\CenterOffset)^2 + (2+\CenterOffset)^2) | |
); | |
\renewcommand*{\CenterOffset}{0} | |
\draw[ultra thick,dashed] (100,100) arc | |
( | |
-asin(\CenterOffset/(100+\CenterOffset)) : | |
-acos(\CenterOffset/(100+\CenterOffset)) : | |
100 % = approx. sqrt((100+\CenterOffset)^2 + \CenterOffset^2) | |
); | |
\draw[ultra thick,->] (64,36) -- (70,30); | |
\end{tikzpicture} | |
\end{document} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment