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)

2
votes
1answer
831 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] ...
176
votes
13answers
26k 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} ...
20
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 ...
15
votes
2answers
7k 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
318 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 ...
45
votes
1answer
21k 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 ...
29
votes
1answer
7k 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? ...
10
votes
2answers
531 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 ...
9
votes
1answer
3k views

Multiple y axes in groupplot

I want to create a barplot with three groups. Compared are two criteria. To make it more comprehensive here the plot I already generated I approached this problem by using the example from Stacked ...
3
votes
1answer
1k 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 ...
21
votes
5answers
5k 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
479 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
1k 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?
28
votes
4answers
6k 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 ...
20
votes
2answers
8k 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
939 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 ...
18
votes
3answers
5k 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 ...
19
votes
3answers
7k 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
243 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 ...
8
votes
4answers
4k 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
761 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
1k 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
703 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} ...
20
votes
2answers
5k 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 ...
12
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
326 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] ...
14
votes
2answers
673 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 ...
12
votes
1answer
2k views

Stacked barplots/groupplots with 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: The ybar stacked option works quite nice here. But when I try to adapt it to a ...
14
votes
1answer
4k 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
1k 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
734 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 ...
8
votes
2answers
2k 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
367 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}{ -- ...
8
votes
3answers
2k 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
653 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
755 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} ...
12
votes
5answers
2k 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 | ------------------------------ ... ...
17
votes
3answers
6k 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
1k 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
228 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 ...
22
votes
3answers
2k 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
951 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. ...
33
votes
3answers
4k views

How to draw tangent vectors and component vectors on a curve

I am searching for a way to have a figure drawn using LaTeX. I am aware of some packages TikZ and PSTricks that could accomplish this, and have been tinkering around with them recently but do not have ...
4
votes
2answers
663 views

How to get consistent positioning for a node with \usebox containing a \tikzpicture

I'm using beamer and tikz to create an animation of a photon travelling between snowflakes. I have ten Koch snowflakes (hence the \newcommand in my MWE) typeset with decorate{ decorate{ decorate{ ...
8
votes
3answers
506 views

Clash between aligned environment and TikZ?

The following code mis-renders the multi-line label: \documentclass{article} \usepackage{tikz} \usepackage{amsmath} \begin{document} \begin{equation} \begin{aligned} \begin{tikzpicture} \node (A) at ...
3
votes
2answers
1k views

Drawing Arrows in Tables

What is the best way to draw a diagonal line through the following table? \begin{center} \begin{tabular}{*{9}{c}} $e_{1}$ & = & $0$ & $.$ & $d_{1}^{1}$ & $d_{1}^{2}$ & ...
7
votes
2answers
2k views

How to label complex edges with graph library?

I would like to use graph TikZ-library from CVS version (sourceforge or tlcontrib) to draw flowcharts. Something like the one shown in chapter 5 from TikZ manual. In this tutorial, some styles are ...