mirror of
https://github.com/MartinThoma/LaTeX-examples.git
synced 2025-04-19 11:38:05 +02:00
added another CSV plot
This commit is contained in:
parent
cc73e5f571
commit
3189821751
5 changed files with 72 additions and 0 deletions
35
tikz/csv-2d-point-plot/Makefile
Normal file
35
tikz/csv-2d-point-plot/Makefile
Normal file
|
@ -0,0 +1,35 @@
|
||||||
|
SOURCE = csv-2d-point-plot
|
||||||
|
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:
|
||||||
|
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
|
||||||
|
rsvg-convert -a -w $(WIDTH) -f svg $(SOURCE).svg -o $(SOURCE)2.svg
|
||||||
|
inkscape $(SOURCE)2.svg --export-plain-svg=$(SOURCE).svg
|
||||||
|
rm $(SOURCE)2.svg
|
3
tikz/csv-2d-point-plot/README.md
Normal file
3
tikz/csv-2d-point-plot/README.md
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
Compiled example
|
||||||
|
----------------
|
||||||
|

|
BIN
tikz/csv-2d-point-plot/csv-2d-point-plot.png
Normal file
BIN
tikz/csv-2d-point-plot/csv-2d-point-plot.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 6.7 KiB |
29
tikz/csv-2d-point-plot/csv-2d-point-plot.tex
Normal file
29
tikz/csv-2d-point-plot/csv-2d-point-plot.tex
Normal file
|
@ -0,0 +1,29 @@
|
||||||
|
\documentclass[varwidth=true, border=2pt]{standalone}
|
||||||
|
\usepackage[utf8]{inputenc} % this is needed for umlauts
|
||||||
|
\usepackage[ngerman]{babel} % this is needed for umlauts
|
||||||
|
\usepackage[T1]{fontenc} % this is needed for correct output of umlauts in pdf
|
||||||
|
\usepackage[margin=2.5cm]{geometry} %layout
|
||||||
|
|
||||||
|
\usepackage{pgfplots}
|
||||||
|
|
||||||
|
\begin{document}
|
||||||
|
\begin{tikzpicture}
|
||||||
|
\begin{axis}[
|
||||||
|
width=15cm, height=8cm, % size of the image
|
||||||
|
xlabel=mean,
|
||||||
|
ylabel=variance,
|
||||||
|
visualization depends on={value \thisrow{label} \as \label},
|
||||||
|
% every node near coord/.append style={font={\tiny}},
|
||||||
|
nodes near coords={\label},
|
||||||
|
% nodes near coords align={horizontal}
|
||||||
|
]
|
||||||
|
\addplot[scatter,
|
||||||
|
mark=*,only marks,
|
||||||
|
% nodes near coords*=\label,
|
||||||
|
% ... which requires to define a visualization dependency:
|
||||||
|
% visualization depends on={\thisrow{label} \as \label}
|
||||||
|
]
|
||||||
|
table [x=mean, y=variance, col sep=comma] {data.csv};
|
||||||
|
\end{axis}
|
||||||
|
\end{tikzpicture}
|
||||||
|
\end{document}
|
5
tikz/csv-2d-point-plot/data.csv
Normal file
5
tikz/csv-2d-point-plot/data.csv
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
label,mean,variance
|
||||||
|
a,0.5,7
|
||||||
|
b,1.2,0.7
|
||||||
|
c,0.9,9
|
||||||
|
d,0.3,0.5
|
|
Loading…
Add table
Add a link
Reference in a new issue