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
738 views

Tikz and alignment with two nodes on the same line

Another minimal example: \documentclass{article} \usepackage{tikz} \begin{document} \begin{tikzpicture} \node[draw=black,% rounded corners=2pt,% rectangle,% bottom color=black!80!white] (A) {node ...
8
votes
1answer
4k views

Rectangle around data points in pgfplots

If I have some data points in a pgfplot, how can I draw a rectangle around them, with the rectangle using the same coordinate system as the points? I've included an example which does not work below. ...
18
votes
5answers
898 views

What tips and tricks are there for debugging TikZ/PGF code?

When answering questions here and when drawing my own complicated TikZ/PGF drawings, I've developed a fair number of "tips and tricks" for debugging the code. I'm sure that others have as well. I ...
8
votes
3answers
894 views

Can't get split rectangle to shrink small enough in this TikZ picture

I'm having problem with a TikZ picture - I've got rectangles that I've split, but for some reason the split rectangles are a bit larger than the other rectangles, causing the the alignment to get ...
10
votes
2answers
1k views

Problem filling intersection using TikZ

I was trying to use TikZ to draw a figure, I want to fill the common area of four circles of which centers are at four points of a square, and the radios for the arc is 0.9772 of the length of square. ...
16
votes
6answers
833 views

Combining |- and !.5! in TikZ

How do I combine the !.5! operator with the -| operator? I want a node that has x-coordinate equal to the average of x coordinates of nodes A and B, and a y-coordinate equal to the average the y ...
2
votes
1answer
726 views

Flow chart nodes misaligned

I would like to do a flow chart with the first row width the same as that of the second row but just below the first row. I can not do it and actually I don't know how to fix the problem. If anyone ...
85
votes
3answers
23k views

Putting a timeline for dates in moderncv

This question led to a new package: moderntimeline I just had the idea of using a timeline to specify dates in my CV. I've made a mockup in Inkscape: The idea, as you see it, is to display ...
26
votes
3answers
14k views

Moving a label along the path

Friends, consider the following code: \documentclass{article} \usepackage{tikz} \usetikzlibrary{automata,positioning} \begin{document} \pagestyle{empty} \begin{tikzpicture}[shorten >=1pt,node ...
2
votes
1answer
381 views

TikZ and different alignments on the same line

This is my minimal example: \documentclass{article} \usepackage{tikz} \begin{document} \begin{tikzpicture} \node[draw=black, rounded corners=2pt, rectangle, bottom color=black!80!white, text ...
7
votes
1answer
4k views

Forcing TikZ minimum size for nodes

I have a tree structure consisting of many unlabelled nodes. However, for some reason the nodes are far larger than I would like and appear to have a minimum size below which the minimum size key is ...
2
votes
2answers
1k views

TikZ and subfigures in math nodes

I have a tikzpicture with a matrix of math nodes. It by itself compiles fine. If I put it in a figure environment, it still compiles fine. However, if i put it in a subfigure environment, it returns ...
8
votes
1answer
1k views

What are the guidelines for making TikZ pictures properly scalable?

I've just started using TikZ for rendering figures for my Master thesis. I've made a few and they look good in the report. But when I tried using them in my presentation slides, some were too small ...
1
vote
1answer
3k views

Using scalable sizes for rectangles, circles and nodes in TikZ?

How do you define the size of a rectangle, circle or node in TikZ to be scalable, like when you position objects using (1, 2) and then apply scale=2? What I'm looking for is to be able to scale the ...
13
votes
1answer
1k views

TikZ finishes a morphed path with a straight segment

When, in TikZ, I apply a path morphing decoration (say, "snake") and specify the segment length option, I often finish up with a straight segment at the end of the path, such as which often is not ...
12
votes
1answer
3k views

Adding values to pgfplot legend

As a follow-up to my earlier question (here), here is a question that is perhaps a little more latex than gnuplot. having used gnuplot and pgfplots to generate a fitted curve, is there an easy way to ...
20
votes
1answer
4k views

How can I express half the distance between two nodes?

I want to draw a line from node A half-way to node B in TiKZ. How can I find express the end point?
5
votes
1answer
961 views

How to center text between two rectangles in TiKZ?

I have the following TiKZ code: \documentclass{article} \usepackage{tikz} \begin{document} \begin{tikzpicture} \newcommand{\delim}[1]{\draw(#1,-0.2) -- (#1,-0.5);} \draw (0,0) rectangle (1,1); ...
12
votes
1answer
4k views

Non-linear curve fitting with gnuplot

I am trying to use gnuplot with pgfplots in TexShop, following on from an example by Martin H in the comments here. I can get the data points in OK, and plot them but the fit (red line) does not seem ...
6
votes
3answers
4k views

Why doesn't relative coordinates in TikZ work with this example?

I was working on a figure, and for some reason relative coordinates have stopped working (it did before). I removed all code down to a bare minimum, and they still don't work. I don't know what I've ...
4
votes
1answer
669 views

How can you update the current relative coordinate in TikZ without adding an element?

Is it possible to update the current relative coordinate in TikZ without actually adding anything to the picture? For instance, \node at ++(1, 0) (node1) {...}; will update the current x coordinate ...
6
votes
1answer
797 views

How to generate named nodes from the counter used in `foreach` in TikZ?

I'm trying to generate multiple nodes in TikZ using the foreach operator, but whatever I try I get compilation errors. I need all nodes to be named in order to draw edges between them. Having read ...
9
votes
1answer
3k views

TikZ: Variable arithmetic result in node name

I'm having trouble incrementing a variable in TikZ and then using the result as part of a node name: \def\x{2} \begin{figure}[H] \begin{tikzpicture} \pgfmathsetmacro{\xplusone}{add(\x,1)} \node ...
4
votes
1answer
640 views

Best way to replicate the node diagram in LeeMcq08?

Q: What would be the best (I'm sure there's some subjectivity involved) way to replicate the univariate distribution relationship diagram of LeeMcq08? From what I can gather Inkscape and TikZ along ...
2
votes
1answer
223 views

Looping and linking with TikZ

How would you build a grid using a nested foreach, defining one node for each iteration? If I were coding in Python, I would write: nodes = {} for i in range(10): for j in range(5): ...
6
votes
1answer
2k views

meta arrow tips

Page 316 of the tikz-pfg manual describes meta arrow tips and says that usually we do not want to have the tip scaled the same way as the supporting line. Is there a way to keep this feature, ie, when ...
4
votes
3answers
359 views

PGFkeys problem. Meta arrow tips with parameters works only when I use different line width. Why?

The solution given here has a problem. Let re-write a minimum example \documentclass{standalone} \usepackage{tikz} \makeatletter \tikzset{arrow length/.initial = 6pt, arrow angle/.initial ...
3
votes
1answer
811 views

No Color Showing in TikZ Drawing

I am trying to draw some pictures using TikZ within LaTeX. I have started by using simple examples, but I am having trouble getting colors to show. For example, I use the following commands, but only ...
7
votes
2answers
3k views

Define a color in a tikz style

How do I do a definecolor in a /.style? \pgfkeys{/IMMstyle/.style={ inputnode/.style={shape=ellipse,draw,inner sep=2pt,minimum size=5.0mm}, \definecolor{dpred}{rgb}{0.50,0.35,0} ...
4
votes
1answer
1k views

In Tikz, how can I specify where an edge connects to a child node?

I have a Tikz graph that looks something like this: \usepackage{tikz} \usetikzlibrary{shapes,positioning,shadows,arrows} ... \begin{tikzpicture}[ singleNode/.style={rectangle, draw=none, ...
12
votes
3answers
2k views

TikZ: how to find the intersection of two extended lines?

From How to draw a line passing through a point and perpendicular to another? I learned to use shorten to extend lines. But the extended part doesn't seem to "really exist". For example, I would like ...
38
votes
3answers
15k views

Pgfplots: how to fill the area under a curve with oblique lines (hatching) as a pattern?

I want to hatch the area under a curve (graph of a function) with oblique lines on an interval (to illustrate the function's integral on that interval). This can be done elegantly in gnuplot... ...
19
votes
1answer
4k views

How to zoom a portion of TiKZ picture?

I want to draw a small rectangle within a tikz picture, then zoom it out somewhere. I skim through the PGF manual but I couldn't find a way to put the logic together. So far I've just drawn the ...
11
votes
2answers
3k views

Making arrows not touch in TikZ

I'm trying to make a fairly simple diagram using TikZ, along the lines of the following examples: \begin{tikzpicture} \draw [->] (0,0) node[anchor=south]{A} -- (1,-2) node[anchor= north]{D}; \draw ...
1
vote
1answer
160 views

flacards and forloop is working but not with tikz foreach

My flashcard with \forloop is working after your help. I try it with \foreach (tikz) but it's not working. The pdf files contain only one flash card in the bottom right corner, the 24th card and the ...
7
votes
2answers
6k views

pgfplot: Customize the axis wide scientific notation multiplier

Hy Guys, I'm experiencing two problems with ticklabel formats. First, if I explicitly set scaled y ticks = true, the base ten notation still appears at every tick. Here's the diagram: Here the ...
-3
votes
2answers
993 views

Factorial-design diagrams in TikZ

I'd highly appreciate if someone could give me hand to draw this diagram in TikZ.
26
votes
1answer
45k views

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 ...
8
votes
1answer
5k views

Specifying a domain and pgfplots

I'm making a graph with pgfplots with a specific domain, but the graph's domain (both x and y) are not changing. I'm reading through the pgfplots manual and I think I'm doing the right thing except ...
9
votes
1answer
7k views

TikZ automata: size of circle around nodes

I am trying to replace vaucanson-g with TikZ, but I cannot make the automata as small. There seems to be a minimum size of the circle around nodes, that I can't reduce even with inner sep=0. Example ...
12
votes
1answer
4k views

spiral spring in tikz

I'm aware of the possibility to easily draw linear springs with tikz but what about spiral springs (torsion)? It looks like there is nothing ready and a long journey in pgf is necessary. I could ...
5
votes
1answer
814 views

Automagically scale Tikz-Picture AND use Externalization

I need to scale Tikz pictures automatically, and I do this using the following custom environment: % Automagically scale a Tikz picture, so it has the desired (given) width. % Does NOT scale line ...
13
votes
1answer
2k views

How to combine a timeline with a calendar

I'm using the pgfgantt package to create a timeline. This is what I've got so far: \documentclass[landscape]{article} \usepackage[dvipsnames,usenames]{xcolor} \usepackage{tikz} \usepackage{pgfgantt} ...
17
votes
2answers
1k views

equivalent of pstricks rput in tikz

A very powerful feature of pstricks is its possibly nested rput command that can be used to rotate and move a portion of a drawing. Is there something similar in tikz?
9
votes
1answer
2k views

PGFplots skip the first row of a table on which there are NaN values. Why?

Suppose to have a file .dat like this: -4.8767000e+000 -2.9142000e-001 NaN NaN NaN NaN -3.9017000e+000 -4.1404000e-001 NaN ...
5
votes
1answer
458 views

Labels in TikZ are incorrectly interpreted

I'm running into a weird problem with TikZ. The following code \node (A) [label=45:$A$] at (p2) {}; is rendered correctly in one document, but incorrectly in another, larger document (which uses ...
6
votes
1answer
615 views

Macro inside TikZ node properties

I was looking for a way to use a conditional expression to define the node type in TikZ. Specifically, I wanted to do something based on the section number. ...
5
votes
2answers
931 views

Using colors defined with spotcolor.sty in TikZ

I would like to specify pantone colors. spotcolor.sty seems to to the trick when compiled with pdfLaTeX: \documentclass{article} \usepackage{color} % \usepackage{xcolor} % Does not work ...
4
votes
0answers
2k views

Problems by enlarging tex memory [closed]

I have a problem with the tex memory while using pgfplots and a very huge dataset in Ubuntu. Under Windows with MikTeX I have the following settings and the texfile compile without any problems: ...
3
votes
1answer
542 views

Arrow scaling problem. How can I zoom properly a very tiny part of a drawing?

Thanks to this solution, I can draw tangent line to a path. I'd like to zoom a very little part of my drawing. Here it is the code: \documentclass{standalone} \usepackage{tikz} ...