As of May 31, 2023, we have updated our Code of Conduct.

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.

Filter by
Sorted by
Tagged with
10 votes
1 answer
253 views

Why arc with angles given by "trig format=rad" gives wrong result?

Consider the following MWE: \documentclass[border=10pt]{standalone} \usepackage{tikz} \begin{document} \begin{tikzpicture} \draw[trig format=rad,red] (0:1) arc(0:pi:1); \draw[blue] (0:1) arc(0:180:1)...
0 votes
0 answers
30 views

Making arrow heads smaller globally

In TikZ, single arrows between nodes can be scaled down using the scale command, for instance: \draw[-{>[scale=0.5]}](A)--(B); I would like all arrows in my entire document to have smaller heads. ...
2 votes
3 answers
142 views

Error with angle "shape" with TikZ

I'm having trouble drawing angles with TikZ. It's strange because I've done this before, I even copied the code that I used, but the shape of the angle line is all wacky. \documentclass{article} \...
0 votes
1 answer
59 views

Length of an arc diagram in radians

I am trying to create a homework assignment and I want to draw some circles with the radius and angle labeled. The following code can draw a circle with radius 5 and 120 degree angle. \begin{...
0 votes
1 answer
469 views

ieeeaccess: "Package xcolor Warning: Incompatible color definition" when TikZ package is used

I am trying to prepare a paper for IEEE Open Access that uses \documentclass{ieeeccess} ; its template (https://ieeeaccess.ieee.org/wp-content/uploads/2022/01/LaTeX.zip). When I add use tikz package, ...
42 votes
17 answers
8k views

Draw a unicorn in TikZ 🦄

I'm currently reading Sparks of Artificial General Intelligence: Early experiments with GPT-4. This paper by Microsoft employees experiments with the capabilities of GPT-4, a successor of ChatGPT. One ...
0 votes
0 answers
47 views

half-opaque colors of TikZ differ in PS and PDF

Consider the file mwe.tex containing \documentclass{article} \usepackage[paperwidth=1cm,paperheight=1.5cm,margin=0cm]{geometry} \pagestyle{empty} \usepackage{tikz} \begin{document} \begin{tikzpicture} ...
1 vote
2 answers
35 views

tikz - text not aligned vertically and how to center text?

You can see in the figure that the text "Reconstruction" and "Forecasting" are not vertically aligned. How do I fix that? Also, is it possible to have the text be centered between ...
3 votes
2 answers
92 views

Help replicating a simple graph in a textbook

\begin{figure}[H] \centering \begin{tikzpicture} \begin{axis}[ axis lines = left, ] \addplot[ domain=0:10, color=...
1 vote
2 answers
74 views

Tikz and Secant Line diagram with axis

I'm trying to modify the following diagram to also show the distances on the x and y axes. Here is a code from another post \documentclass[10pt]{article} \usepackage{tikz} \begin{document} \begin{...
6 votes
3 answers
2k views

TikZ node text margins

I have nodes with text inside, however the nodes are too large for the text, with large paddings. I want to keep the text size the same, but make the box tighter. I've tried varying text height and ...
3 votes
2 answers
84 views

Can 'append after command' draw on top of a node, instead of underneath it?

I'm trying to make a node style in which some extra decorations will be drawn on top of the node. However, I'm having trouble getting them to be drawn on top of the node rather than behind it, as the ...
0 votes
1 answer
43 views

Mixed Layering of Parametric Plot in 3d pgfplot

I am attempting to overlay 2d lines on a 3d surf plot in pgfplots, where the 2d lines are the minima of the function z=(1/2)* (x^2)*(y^2) as seen on the plot below. Is it possible to get the lines to ...
0 votes
1 answer
71 views

Reset tikzmath variable in for loop

I want to draw multiple curves (each with a different slope) using tikzmath coordinates: \begin{tikzpicture} \begin{axis}[ xmin=0, xmax=1, ymin=0, ymax=1, width=\textwidth, ...
1 vote
1 answer
235 views

How to draw equations (not functions) in LaTeX

I want to draw this equation in LaTeX using tikz (maybe with pgfplots): (x^2+y^2) + \frac{0.7}{\sqrt((x-0.3)^2+y^2)} + \frac{0.3}{\sqrt((x+0.7)^2+y^2)} = 2.5 This is from geogebra: I tried gnuplot: \...
1 vote
1 answer
88 views

Draw closed curve path using tikz

How to draw some arbitrary closed curve path using tikz? I find it hard to control the curves in tikz. Can anyone give an example code that draws the figure below?
0 votes
0 answers
91 views

How to customize in Exam class the grid from solid lines to dotted lines

Problem: Gray grids disappear or look uneven when copied or printed with our laser printers. Black grids are (re)produced well but look too bold even when the lines are thin. Question: Is there a ...
0 votes
0 answers
41 views

gv: the outputs of pdflatex, latex+dvipdf, and latex+ps2pdf are slightly shifted upwards compared to the output of latex+dvips

Let's create mwe.tex containing \documentclass{article} \usepackage[paperwidth=1cm,paperheight=1.25cm,margin=0cm]{geometry} \pagestyle{empty} \usepackage{tikz} \begin{document}\noindent \begin{...
1 vote
1 answer
41 views

tikz - position text remember picture

How do I position the text "xyz" at the top left of image1 ? Here is a MWE \documentclass{article} \usepackage{float} \usepackage{subfig} \usepackage{tikz}% loads graphicx \usetikzlibrary{...
1 vote
1 answer
52 views

Change line style in specified sections of the plot - pgfplots

I would like to be able to change the line style within a certain section of the graph given a single addplot command. Is there any way possible to change the properties of the line style for ...
2 votes
1 answer
87 views

TikZ: rounded corners only on a part of the path

What is the correct syntax if I only want rounded corners=<length> on part of the (closed) path? \documentclass[margin=5mm]{standalone} \usepackage{tikz} \begin{document} \begin{tikzpicture}[] \...
0 votes
1 answer
52 views

How to rotate triangle in Tikz?

I want the figure to rotate. \begin{figure} \begin{tikzpicture} \coordinate (A) at (0,0); \coordinate (B) at (1,-2); \coordinate (C) ...
0 votes
1 answer
31 views

nodes with rel axis cs are not shown in pgfplots

With pgfplots, I'm trying to add text to a relative position according to the axis. If the position is inside the figure, this works well, but when I want to add the text outside the figure, the text ...
3 votes
1 answer
85 views

TikZ matrix of pics

I have a picture showing a matrix of small pictures drawn as a \pic: \documentclass{scrartcl} \usepackage[svgnames]{xcolor} \usepackage{tikz,xstring} \tikzset{FilteredSphere/.pic={ \begin{...
0 votes
0 answers
20 views

why can't I specify a shade of color or color parameters in the fillcolor parameter of graphviz?

I am trying the following: \documentclass{standalone} \usepackage[pdf]{graphviz} %%% Helper code for Overleaf's build system to %%% automatically update output drawings when %%% code in a \digraph{......
6 votes
2 answers
592 views

Pipe dreams in TiKz

I was looking for a macros simplifying pipe dreams drawing (these are specific tilings used in combinatorics). However I haven’t found one. So I wrote it myself and I am providing the possible ...
0 votes
1 answer
65 views

Label the Tikz Arc

I want your help to label the tikz in the below code just the way this answer is labelled. \documentclass[tikz,border=3.14mm]{standalone} \begin{document} \begin{tikzpicture} \tikzset{...
2 votes
2 answers
48 views

How can I put an overlay tikz picture below and ordinary text?

The following code \documentclass{article} \usepackage{tikz} \usetikzlibrary{tikzmark} \begin{document} This is some text: \tikzmarknode{Foo}{foo}. And this is some text in between that the filling ...
0 votes
1 answer
71 views

Plotting coordinates from tikzmath in pgfplot axis coordinate system

Short Version I want to do some fairly complicated coordinate math to make a notional diagram but would like to use pgfplots since I have used it elsewhere in my document and want the axis styles (...
2 votes
1 answer
35 views

tkz-graph: Edge's beginning doesn't connect to vertex

In this example, the edges don't connect to the vertex it comes from. I'm using tkz-graph, and use \tikzstyle{EdgeStyle}=[pos] to give an arrow head to the edges. I modified the value of \...
1 vote
0 answers
32 views

What is the relation between path's options in, out, relative, and looseness?

The following example, \documentclass{article} \usepackage{booktabs} \usepackage{tikz} \usetikzlibrary{tikzmark} \begin{document} \begin{tabular}{ll} \tikzmarknode{FooUp}{foo} & foo\\ foo & ...
0 votes
1 answer
62 views

Tikz: Modify Some Spiral-Like Layers of Arcs to Form Layers of A Circle

I edit the following code from the answer to this question \documentclass{standalone} \usepackage{tikz} \begin{document} \begin{tikzpicture} \tikzset{declare function={hourstoangle(\h) = ...
0 votes
1 answer
57 views

Scaling TikZ picture based on text size around the environment

I'd like to scale a TikZ picture based on font size surrounding the environment. For example... \documentclass{standalone} ...
2 votes
1 answer
412 views

Using tikz with \pause command in rmarkdown or quarto presentation

I'm trying quarto for my slides and wondering how to use \pause in tkiz code. Minimum working example (Test.qmd) is below for reference. --- title: "Test Slides" format: revealjs: ...
12 votes
4 answers
975 views

How to draw tikz paths composed only of horizontal, vertical and diagonal segments?

Inspired by a recent question on stackoverflow about how to draw maps of transportation networks, I'm wondering how to draw paths that consists of vertical, horizontal and diagonal segments. Just ...
3 votes
2 answers
164 views

Continuous line between nodes of a tikz' matrix of nodes

In the following tikz matrix of nodes, the red line isn't drawn on the (magic-2-2) node. How could I make it continuous from (magic-1-1) to (magic-3-3) nodes, drawn through the (“step” on) node (magic-...
6 votes
1 answer
237 views

Construct A Spiral-Like Layers of Arcs Using Tikz

I want to use tikz to construct layers of arc folding all around a 12 integer-graded circle with each arc having a constant length of a quarter-of-a-circle and the first starting at 90 degrees, the ...
2 votes
2 answers
107 views

how to draw double-circle diagram in tiKz?

How can I draw the following diagram in LaTeX? But instead of the black dots in vertices, I want to put the numbers.
0 votes
2 answers
69 views

Fix and Improve cropped diagram

I tried to draw this diagram and did it differently; however, when added to my book template, it went outside, so I tried to show a standalone, and it looked cropped. How can I: fix the cropping of ...
0 votes
1 answer
48 views

Add search path for \usetikzlibrary

How could I add a folder to the search path of tikz? More precisely, I have a structure like this (see below for exact content): mycachedfiles/a.tex myinput.tex tikzlibrarymy.test.code.tex I’d like ...
5 votes
2 answers
181 views

TikZ: align nodes like path

I would like to have the numbers aligned like the path (and midway). But this only works at the number '1' here... Is there a trick or do I have to calculate angles? \documentclass[margin=5mm]{...
4 votes
2 answers
147 views

TikZ: add the rotation arms of a Roulette Wheel

How could I add a thing in the middle like this here \documentclass[margin=5mm]{standalone} \usepackage{tikz} \usetikzlibrary{shapes.geometric} \begin{document} \begin{tikzpicture}[font=\tiny\...
1 vote
1 answer
23 views

forest - Precise vertical adjustment of the text of extra additional nodes

I would like to adjust the vertical positions of the times symbol in the picture above. Here is the code used. \documentclass[12pt]{article} \usepackage{forest} \begin{document} \begin{forest} ...
93 votes
8 answers
48k views

What You See is What You Get (WYSIWYG) for PGF/TikZ?

Are there any WYSIWYG editors for PGF/TikZ? Perhaps something similar to LyX but for PGF/TikZ? If there is no WYSIWYG editor for this tandem, is there one perhaps that allows the user to easily ...
0 votes
1 answer
63 views

Fill a 3d surface with a gradient rather than solid colour

I wish to plot a 3d surface based on its outline coordinates provided in a file data.txt. The following code works as expected. \usepackage{pgfplots} \pgfplotsset{compat = newest} \begin{document} ...
2 votes
1 answer
66 views

Hatching a smooth cycle

I'd like to hatch a smooth circle, but everything I try ends up getting some weird part. My code is \documentclass[tikz,border={5pt}]{standalone} \usepackage{color} \usetikzlibrary{calc} \...
2 votes
1 answer
337 views

Shading in a rotation without a canvas transformation

I'm currently working on a magnifying glass as an object without making use of the spy library. It is written as a \newcommand since I have to use it to some extense. My problem is the shading for the ...
1 vote
1 answer
61 views

TikZ: Pgf Plot not taking desired width

I want to have two 3D plots next to each other, one showing the 3D view of the plot, the other showing the top view. I pulled out the pictures to put them in a MWE that gives me the same wrong result (...
0 votes
0 answers
24 views

PGFPlot presets in preamble to not show scientific numbers

I have a document that consists of a main file and multiple section.tex files that are included in the main file. The sections have figures and tables as separate tex. The tables and figures come ...
4 votes
1 answer
636 views

tikz shape "tape" with rounded corners

I am trying to use the shape "tape" with rounded corners using the following code: \documentclass[12pt]{scrartcl} \usepackage{tikz} \usetikzlibrary{% shapes, shadows, } \tikzset{ ...