Graphics, Figures & Tablestikz: scaling the axes

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
theo moore
Posts: 72
Joined: Thu Jan 15, 2009 3:16 pm

tikz: scaling the axes

Post by theo moore »

I want to plot a set of points using tikz. This does the trick

Code: Select all

\begin{tikzpicture}[only marks, scale=1.0]
    \draw plot[mark=*, mark size=3pt] file {divergence.dat};
    \draw[->] (0,-12) -- coordinate (x axis mid) (25,-12);
    \draw[->] (0,-12) -- coordinate (y axis mid)(0,-2);
    \foreach \x in {0, 5,10,15,20,25}
        \draw [xshift=0](\x,-12) -- (\x,-12.1)
            node[anchor=north] {$\x$};
    \foreach \y in {-12, -10, -8, -6, -4, -2}
        \draw (0,\y) -- (-0.1,\y) node[anchor=east] {$\y$};
    \node[below=1cm] at (x axis mid) {$N$};
    \node[left=2cm,rotate=90] at (y axis mid) {$\log\text{Error}$};
\end{tikzpicture}
where divergence.dat contains something like,

Code: Select all

1	-4.77517
2 	-6.46093
3 	-7.73634
4 	-8.71971
5 	-9.47605
6 	-10.0466
7 	-10.4598
...
Now the problem is that I want to scale the x-axis (or y-axis). That is, I want the x and y axes to be a certain ratio (say 1:1) in 'physical units' (at the moment, the x-axis is much longer than the y).

How would I do that?

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

tikz: scaling the axes

Post by localghost »

The pgfplots package simplifies plotting data sets. It is based on pgf/tikZ.


Best regards
Thorsten
Post Reply