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.

learn more… | top users | synonyms (3)

83
votes
8answers
7k views

Simulating hand-drawn lines

I am working on a project that will have some vector graphics, perhaps using TikZ (or a similar tool). All of the graphics consists of lines, in shades of gray. However, the lines from TikZ appear too ...
4
votes
2answers
1k views

Coordinates A, B: compute |B-A| and angle between +x and (B-A)

This question has two parts: why is the angle computed always 0 (should be 45) what is a straightforward way to compute distance between coordinates (there is How can I compute the distance between ...
15
votes
2answers
4k views

Tikz: Arrowheads in the center

For arrows I have gone through options like ->, ->>, <-, <<- but havent found one for making the arrowhead appear in the center of the line of the curve (something like ->-) How do I do it in ...
7
votes
1answer
2k views

LaTeX probability tree

Please could you tell me if the Probability tree posted on 2006-12-14 by Kjell Magne Fauske can be done with three branches instead of just two.
3
votes
1answer
861 views

Multiline table header

Is it possible typeset a table with \pgfplotstabletypeset and change the style of 1 column header to be multiline? This code doesn't work and can't compile: ... columns/errorRelC/.style={ column ...
12
votes
1answer
633 views

Define TikZ macro for hatched rectangles in local coordinate system

I would like to define macros for functions defined on beams in structural mechanics course: I am trying to cook up some macro which would draw each segment where the function is constant (perhaps ...
2
votes
1answer
645 views

Plotting area in the plane where two inequalities in two variables hold

I would like to plot the area in the plane where two inequalities hold, both involving two variables. I would like to do it the way Wolfram Alpha does it, but within a LaTeX document. I have looked ...
1
vote
1answer
1k views

Drawing Mass Spring Damp Systems in TikZ [closed]

I'd like to draw a Spring-Mass-Damping system by TikZ. I found the example in Drawing Mechanical Systems in LaTeX But I have problems compiling it. If I delete the damper code \draw [dampener] ...
152
votes
11answers
22k views

How can we draw a Christmas tree with decorations, using TikZ?

I would like to use TikZ for drawing a christmas tree. Here's a start, I used the lindenmayersystems library for drawing a tree: \documentclass{article} \usepackage{tikz} ...
18
votes
2answers
2k views

How to change the level distance in tikz-qtree for one level only?

I am trying to draw a tree for a game theory problem. The problem is that the label p1=0.5 crosses label I. I would like to adjust the level distance of the first level, but the \tikzset{level ...
13
votes
2answers
4k views

Need to do some changes to pgfplots axis

I am still in the habit of learning TikZ, barely started using pgfplots to create my images Although I am still not sure what the best way to do so is, I need to create the image below. My problems ...
2
votes
1answer
267 views

Wrong area plot

I'm trying to draw a plot from this table: ip Min Std 0 19.86764349 97.20356138 16 19.86764349 250.079659 22 19.86764349 168.2253117 23 19.86764349 169.2514577 33 ...
29
votes
1answer
10k views

Tikz: use opacity for fill, yet leave draw (lines) untouched

When I use the tikz key opacity for a polygon in a tikzpicture, it applies to the drawn fill as well as to the draw lines. I would like to have it this way that the lines remain untouched by the ...
23
votes
1answer
4k views

How to draw a decorated rectangle with rounded corners?

As the title says, I was trying to draw a rectangle with rounded corners, and then decided it needed decorating. Well, the result looks awesome, but isn't really what I had in mind. a) What happened? ...
9
votes
2answers
364 views

How can I globally set pgfmathsetlength?

How can I declare a length via pgfmathsetlength global? The example results in 20pt -- 5pt -- 20pt But I had expected: 20pt -- 5pt -- 5pt \documentclass[10pt]{article} \parindent0pt ...
3
votes
1answer
931 views

Error when using both minted and TikZ externalize with xelatex

See the following MWE. \documentclass{article} \usepackage{minted, tikz} \usepackage{fontspec} \setmainfont{Arial} \usetikzlibrary{external} \tikzset{external/system call={% xelatex ...
20
votes
5answers
3k views

Best way to denote an angle in TikZ?

What is the best and simplest way to denote an angle, with an arc and a label telling its name? I wish to be able to control (obviously) the vertices on which the angle lays, the name of the angle and ...
4
votes
1answer
419 views

Prevent tikz to calculate

I just played with an answer to a question I asked here some time ago: Divide a rectangle into n times k equal cells. I wanted to be able to generate the list of points in a separate macro, however ...
4
votes
1answer
2k views

Problem using matlab2tikz

I'm trying to get matlab2tikz to work. I want to use it for prettyfying output of Matlab's image() command. In Matlab I tried imagesc(rand(100)); xlabel('X'); ylabel('Y'); title('Random Colors'); ...
2
votes
2answers
764 views

Source code for examples in TikZ/PGF manual

I am starting to learn TikZ. I was wondering if the source code for all examples in the TikZ manual (2.10 version) is available somewhere for download?
23
votes
4answers
4k views

How to place a node in the middle of an arc?

I think it is a simple question, but I didn't find the answer yet. The code I'm using is the following: \draw[->](1,0) arc(0:-30:1) node[midway]{$30$}; But in this way the node is placed at the ...
18
votes
2answers
4k views

How do I add an image in the upper, left-hand corner using TikZ and graphicx

This is perhaps a simple question with a simple answer, but I'm stumped as a tikz novice. What would be the best method to add an image (logo) file to the upper left-hand corner of my document? ...
5
votes
2answers
819 views

Drawing a simple line with tikz and remove the additonal horizontal space

In the following example I want to draw a simple line with tikz. It seems that the line produced a additional horizontal space left and right about .5\pgflinewidth. I tried outer xsep=0pt but with no ...
13
votes
2answers
3k views

Image with axis

I need to plot some data in a file (10000 records of 2 points each one) but PGFPlots is very very slow rendering it. So I'm trying to use MatLab to plot the data, capture the image without axis and in ...
14
votes
3answers
5k views

Scaling a TikZ figure from an external file

I would like to insert figures which were created with TikZ to my LaTeX document. I suppose that if I create the TikZ figure inside the document, that wouldn't be a problem - I'd just play with the ...
6
votes
1answer
214 views

Adding a TikZ figure to a document

I really hate to post "what's wrong with my code" questions, but I'm a bit clueless and couldn't find a good guide about it. Anyway, I'm trying to add a figure which was created by TikZ to my ...
8
votes
1answer
1k views

Arrows and nodes in TikZ

I wish to draw arrows not necessarily at the end of the line, nor in the middle. I would also like to write a node directly above (or below, or to the right, ...) the arrow. I saw this question, but ...
7
votes
4answers
3k views

tikz foreach index in variable name

I want to have a set of variables holding numerical values (e.g., cnt1, cnt2, cnt3) and access them based on the foreach index. For example: \foreach \i in {1,...,5} { ...
6
votes
2answers
501 views

scope/yscale not transforming coordinates?

To my understanding of the documentation, the scope block should transform all coordinates. However, in the following example, only circles themselves are scaled, but not their centers: black circles ...
13
votes
2answers
779 views

coordinate along decorated path

I'm using the brace decoration from the TikZ decorations.pathreplacing library to draw a brace around some nodes. Now I would like to connect the tip of the brace to another path (use case: labelling ...
15
votes
2answers
548 views

How to center a typewriter (ttfamily) '+'

I would like to draw a circular TikZ node with + in its center, but font=\ttfamily moves it up. Why? How to solve it? \documentclass[border=3mm]{standalone} \usepackage{tikz} \begin{document} ...
15
votes
2answers
3k views

How can I compute the distance between two coordinates in TikZ?

Given two points (defined, for instance using nodes), I want to compute the distance between them. Is there some build in functionality in tikz to do this? If not, how can it be done using the ...
11
votes
2answers
2k views

Coordinates of intersections

In axis environment I have a curve and a line intersecting it. How can I get components of intersection-1, intersection-2 etc. in axis units? \documentclass{minimal} \usepackage{pgfplots} ...
4
votes
0answers
288 views

A plot using tikz is giving very odd results [closed]

I'm trying to include a plot of tan(x) in some student notes. Here is my input (using ConTeXt): \usemodule[newmat,tikz,pgfmath] \usetikzlibrary[arrows] \starttext \starttikzpicture[scale=0.65] ...
12
votes
2answers
488 views

Triple lines in TikZ

I need to be able to draw tripled paths in TikZ. I guess this could be done by some clever style which draws a big doubled path to get the outer curves correct, then uses some clever post-action ...
8
votes
1answer
2k views

Stacked barplots and text labels in x-coordinate

I was trying to stack a groupplot, or was it grouping a stacked plot? However I was trying to get something like: With Excel it didn't seem to be a problem but when I tried adapting it with pgfplots ...
12
votes
1answer
3k views

How to align TikZ figures in subfigs

I use subfig to show an array of tikz figures. Unfortunately these figures are sometimes of different height, so they don't show up properly aligned: I'd like to see all nodes on the same line. I'm ...
9
votes
1answer
916 views

How to use shading in TikZ when rotating the picture?

I have the following problem: I want to draw a rectangle and around it, there should be some smooth fading to the background (white). I found the shading technique of tikz quite interesting. The ...
3
votes
1answer
594 views

Add text to absolute position in every slide automatically IN ADDITION to theme footer

I know this sounds like a repeat question, but I'm pretty sure it's not. I am trying to add text to an absolute position in every slide of the presentation, in addition to to content already provided ...
7
votes
2answers
1k views

How to draw just the arrow tip in TikZ

How can one draw "just the arrow tip" from one of the arrows in the arrow tip library in TikZ? The problem is that if you try a brute-force solution, eg. \tikz \draw[-triangle 90] (0,0) -- +(.1,0); ...
3
votes
1answer
298 views

foreach within \draw, without giving the first point explicitly

I am plotting line given by y(x) expression evaluated at regularly spaced points, e.g. \def\ffIiC{+0.0436275-1.18778*\x^1+0.542693*\x^2} % ... \draw (0,0.0436275) \foreach\x in {0,.1,...,4}{ -- ...
7
votes
3answers
1k views

Drawing Multiple Diagonal Arrows in a Table

My question is basically the same as this one, but with many arrows instead. (I'd like to see the TikZ solution--I feel like once I get it here, I'll be able to extrapolate and do it in other cases ...
8
votes
2answers
406 views

Alignment base on two reference nodes

I am new to tikz. If I have two nodes [A] and [B] as: [A] [B] How do I align [C] so that it is vertically below [A] and horizontally left of [B] such that: [A] [C] [B] without ...
5
votes
4answers
609 views

Rectangular diagram with TikZ

I have a problem with getting rectangular diagrams in LaTeX. For example, the diagram below gives a diagram which looks like a trapezium. What do I need to change to get what I want ? \begin{center} ...
10
votes
4answers
1k views

Create an array in TikZ with \underbrace in different colors

I would like to create TikZ something like: ------------------------------- ... ---------------- | 0000 | 0001 | 0010 | 0100 | | 0111 | 1111 | ------------------------------ ... ...
14
votes
3answers
3k views

How to get correct arrow orientation on TikZ arc?

I'm trying to fix the following TikZ figure, where the circle device in the middle should be embraced by two bended arrows pointing counter-clockwise. I have drawn these arrows with an arc path, ...
5
votes
2answers
769 views

Problem with preview package (and standalone class) with tikz

I updated MacTeX recently with TeX Live Manager and I installed the last tikz/pgf CVS (02/12/2011) and I got a problem with the standalone class. The size of the picture seems fine but nothing is ...
12
votes
1answer
214 views

One path or several paths for a tikzpicture?

Perhaps the title of my question is not fine (let me know). I try to finish a document about the best practices when programming with TikZ. I remark in several answers that a lot of users like to use ...
20
votes
3answers
1k views

Draw dimension of a line as a decoration in TikZ

Is it possible to define in TikZ a new decoration or something like that, such that it is possible to write something like: \draw[dim={text,above}] (A) -- (B); \draw[dim={text,below}] (C) -- (D); ...
8
votes
1answer
680 views

Multiple marks on a path

I want to add a multitude of marks to a single path. However, sometimes these marks are heavily misplaced. For example, the blue arrows should be a little bit ahead of the red ones. ...