跳到主要内容

tikz

\documentclass{article}
\usepackage{tikz}
\usepackage{pgfplots}

\begin{document}

\begin{tikzpicture}[scale=0.7]
\draw [help lines] (0,-4) grid [step=1] (10,4);
\draw (0,0) -- (10,0);
\draw plot [domain=0.1:10,samples=100] (\x,{log2(\x)});
\draw plot [domain=0.1:10,samples=100] (\x,{log2(\x)});
\end{tikzpicture}

\vspace{1cm}

\begin{tikzpicture}[trim axis left]
\begin{axis}[domain=0:10,
samples=100,
enlarge x limits=false,
grid=both,
no markers,
axis equal]
\addplot +[thick] {ln(x)/ln(2)};
\end{axis}
\end{tikzpicture}
\end{document}
docker run --rm -it -v $PWD:/host -w /host wener/base
# AlpineLinux
apk add texlive texmf-dist-pictures icu-data-full texmf-dist-latexextra texmf-dist-langchinese
apk add -X http://mirrors.aliyun.com/alpine/edge/testing pdf2svg

# Linux GUI
# apk add -X http://mirrors.aliyun.com/alpine/edge/community tikzit
demo.tikz
\documentclass[crop,tikz,multi=false]{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=1.18}

\begin{document}

\begin{tikzpicture}
\fill[red!90!black] ( 90:.6) circle (1);
\fill[green!80!black](210:.6) circle (1);
\fill[blue!90!black] (330:.6) circle (1);
\end{tikzpicture}

\end{document}
# demo.aux demo.log demo.pdf
# -output-directory=/tmp
pdflatex -interaction=batchmode -halt-on-error demo.tikz
pdf2svg demo.pdf demo.svg 1

Examples

## Minimal Axis

$$
\begin{tikzpicture}
\draw[help lines, color=gray!30, dashed] (-4.9,-4.9) grid (4.9,4.9);
\draw[->,ultra thick] (-5,0)--(5,0) node[right]{$x$};
\draw[->,ultra thick] (0,-5)--(0,5) node[above]{$y$};
\end{tikzpicture}
$$