Graphics, Figures & TablesLinebreak in pgf graph node

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
ZeV
Posts: 7
Joined: Sat Feb 26, 2011 12:06 pm

Linebreak in pgf graph node

Post by ZeV »

I needed to re-draw a faulty graph for a presentation, and I encountered no problems with the graph itself, but I cannot get the text to break. \\ does not work, \linebreak does not give me a linebreak. I'm stymied as I cannot find a way to get the text to fold and stay visible. I could let the text center on the graph, but I do not like avoiding problems I encounter.

Code: Select all

\begin{tikzpicture}
	\begin{axis}[xlabel=time,ylabel=Etch parameter,yticklabels={,,},xticklabels={,,},scale only axis,xmin=0,xmax=30,ymin=0,ymax=15]
		\addplot[color=blue,thick,] coordinates {
		(0,8)
		(5,8.1)
		(6.5,10.1)
		(20,10.2)
		(20.2,10.6)
		(20.4,10.55)
		(22,0.1)
		(30,0.1)};
};

\node [coordinate,pin=right:{\small  change in etch rate-detection occurs here}] at (axis cs:20.3,10.5) {};
	\end{axis}
\end{tikzpicture}
Last edited by ZeV on Sun Mar 13, 2011 2:16 pm, edited 1 time in total.

Recommended reading 2024:

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

Learn LaTeX easily with newest books:

The LaTeX Beginner's Guide: 2nd edition and perfect for students writing a thesis

The LaTeX Cookbook: 2nd edition full of practical examples for mathematics, physics, chemistry, and more

LaTeX Graphics with TikZ: the first book about TikZ for perfect drawings in your LaTeX thesis

User avatar
shadgrind
Posts: 140
Joined: Thu Jul 16, 2009 12:39 am

Linebreak in pgf graph node

Post by shadgrind »

Assuming you have at least version 2.00 of TikZ, you could have multi-line text nodes by using the align option, like this:

Code: Select all

\node[align=left] at (0,0) {Here's line 1\\And here's line 2};
System: TeX Live 2012, Fedora 18 x86_64, GNU Emacs 24.2
ZeV
Posts: 7
Joined: Sat Feb 26, 2011 12:06 pm

Linebreak in pgf graph node

Post by ZeV »

Thanks. Yes, that's what the manual suggested too.
But it will not compile when I type that into my document.
I use MacTex 2010, and I've checked, the tikz package is 2.0, so it shouldn't be a problem. But it is regardless.

The error message(s) I get is (are):

Code: Select all

Latex Error: ../Exercise7/Exercise7.tex:83 Package pgfkeys Error: I do not know the key '/tikz/align' and I am going to ignore it. Perhaps you misspelled it.

Latex Error: ../Exercise7/Exercise7.tex:83 LaTeX Error: Something's wrong--perhaps a missing \item.
ZeV
Posts: 7
Joined: Sat Feb 26, 2011 12:06 pm

Re: Linebreak in pgf graph node

Post by ZeV »

Ah. Turns out there was a problem with my tex Live installation. It's fixed now. Thanks anyway :)
Post Reply