Questions tagged [tikz-pgf]

TikZ is a higher-level drawing language built on top of the PGF graphics framework. For questions specifically about the PGF layer use {pgf-core} instead. Both tags are possible on the same question. The tag {diagrams} is also compatible with this tag.

Questions tagged with are about the higher-level drawing language TikZ built over the PGF graphics framework or about the whole TikZ/PGF stack. For questions specifically about the PGF layer use instead. Both tags are possible on the same question.

In addition to all TikZ examples in questions on this site, TeXample.net shows examples of what can be done with TikZ.

For learning TikZ see:

34745 questions
328
votes
7 answers

Correctly scaling a tikzpicture

I was wondering which is the correct way to scale a tikzpicture. I tried with \begin{tikzpicture}[scale=0.50] but what I obtain is that distances between elements are scaled but not their sizes or text size too. It's like if the picture collapses…
Jack
  • 3,383
214
votes
5 answers

Easy curves in TikZ

I find myself needing to draw lots of elegantly curved paths in TikZ. Ideally, I'd just specify a series of points, and TikZ would calculate the extra data itself to draw a nice series of curves passing smoothly through these points, perhaps with an…
Jamie Vicary
  • 11,098
171
votes
6 answers

How productive are you with TikZ?

First, I must say I have very limited knowledge about PGF/TikZ. Most things I do are blind copy-pastes of examples I find on the Internet with lots of trial-and-error and googling around. After spending 4 hours on drawing the simple diagram below…
Caetano Sauer
  • 1,751
  • 3
  • 11
  • 6
162
votes
2 answers

How can I flip the direction of curly braces in TikZ?

I am using TikZ with the following code to draw a picture. How can I turn the curly bracket next to $P_2$ to the…
Helium
  • 2,493
158
votes
5 answers

How can I use \linebreak inside a node, in tikz?

This is my code, which doesn't work: \documentclass{article} \usepackage{tikz} \begin{document} \tikz \node {start\linebreak{}stop}; \end{document} The \linebreak command doesn't work. In order to make it working I have to say \node[text…
yegor256
  • 12,021
144
votes
7 answers

TikZ: Node at same x-coordinate as another node, but specified y-coordinate?

In TikZ, if I have a node (A), how do I create a node (B) with the same x-coordinate as (A), but a given y-coordinate?
Jamie Vicary
  • 11,098
142
votes
8 answers

Draw arc in tikz when center of circle is specified

It would be convenient sometimes to be able to draw an arc in tikz by specifying the center of the corresponding circle its radius the initial/final angle i.e., the "natural" way an arc is defined, instead of the "first point of the arc". Is there…
niels
  • 3,295
125
votes
5 answers

Define a variable in TikZ

I guess this is a very simple question, but I couldn't find the answer... How can I define a variable in TikZ? I want to have something like, for example: \draw[->] (x1,y1)--(x2,y2); Such that x1,x2,y1,y2 are defined somewhere else and can be…
Dror
  • 22,613
121
votes
10 answers

Specifying the width and height of a tikzpicture

Is it possible to specify the width and height of a tikzpicture? To scale a tikzpicture I use the option scale, i.e. for instance \begin{tikzpicture}[scale = 2] ... \end{tikzpicture} I tried to change the width and height…
user1876
121
votes
1 answer

TikZ Adding Text

I'm a recent convert to TikZ from xy-pic, and am still trying to get a hang for it. I see that one can add labels to the end of arrows and the like using \node. Is there a way to add an arbitrary piece of text at a given position in the drawing,…
Skeptic
  • 3,025
  • 5
  • 26
  • 23
119
votes
8 answers

Sieve of Eratosthenes in tikz

I am writing notes for my students under the topic of prime factorization and I needed to illustrate the Sieve of Eratosthenes and this is what I came up with in…
azetina
  • 28,884
116
votes
5 answers

How to plot functions like ‎‎‎‎‎x=f(y)‎‎ using TikZ?

To plot functions in the form of y=f(x), we simply write‎ ‎\draw ‎[‎smooth,‎samples=100‎,domain=0:‎‎2‎‎] ‎plot(\x,‎‎‎‎‎‎‎‎{(\x)...‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎});‎‎ But how about functions like x=f(y)? How to plot them? How to specify their domains ‎in terms of…
Sisabe
  • 3,351
108
votes
1 answer

TikZ: Get values for predefined dash patterns

Is there a way to get values for predefined dash patterns such as dotted? I would like to use those in another program to create the same visual experience. Or do I have to define my own patterns in order to have the same values?
Eike
  • 1,083
103
votes
2 answers

How to draw a filled rectangle without a border using TikZ?

Method 1: \draw [fill=orange] (0.1,0.1) rectangle (0.2,0.2); For the line above, by default, the filled orange rectangle will have a black border. Method 2: \draw [fill=orange,orange] (0.1,0.1) rectangle (0.2,0.2); With this line, the border…
Shashank Sawant
  • 6,557
  • 11
  • 37
  • 49
100
votes
3 answers

Summary of Tikz commands

Many times, when I'm coding a tikz-picture, I don't remember the command syntax or the name of one option, and I have to look in pgf-manual is not very short. Does anybody has a summary of Tikz commands fit to one or two pages?
1
2 3
99 100