I want to create a graphic like the one in the attached image in latex, where each box represents an image (a graphic I want to insert). I also want to be able to write a word over the arrows that point from one image to another.
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{positioning}
\begin{document}
\begin{figure}[htb]
\centering
\begin{tikzpicture}[>=latex,node distance=2em]
\node(a){\includegraphics[width=4cm]{example-image-a}};
\node[right=of a](b){\includegraphics[width=4cm]{example-image-b}};
\draw[->] (a) -- (b);
\end{tikzpicture}
\caption{Two graphics.}
\end{figure}
\begin{figure}[htb]
\centering
\begin{tikzpicture}[>=latex,node distance=2em]
\node(a){\includegraphics[width=3cm]{example-image-a}};
\matrix[right=of a,row sep=2em] {
\node(b){\includegraphics[width=3cm]{example-image-b}};\\
\node(c){\includegraphics[width=3cm]{example-image-duck}};\\
};
\draw[->] (a) -- (b);
\draw[->] (a) -- (c);
\end{tikzpicture}
\caption{Three graphics.}
\end{figure}
\end{document}
visit: https://tex.stackexchange.com/questions/527216/diagrams-arrows
I'm trying to create the schema in tikz latex. I need to have arrows between nodes and arrows to the same node. The arrow to the same node has to be outside the node. It has to start on the top right of the box and end on the top left of the box.
How to add a bent arrow to the box as shown in the picture.
I would love to have the same arrow as shown in the screenshot.
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{positioning}
\begin{document}
\begin{tikzpicture}[
node distance=1.5cm and 1cm,
ar/.style={->,>=latex},
middle_node/.style={
draw,
text width=1.5cm,
minimum height=0.75cm,
align=center
},
end_node/.style={
draw,
text width=1cm,
minimum height=0.55cm,
align=center
}
]
% nodes
\node[end_node] (start) {\textbf{start}};
\node[middle_node,right=of start] (first_step) {a};
\node[middle_node,right=of first_step] (second_step) {b};
\node[middle_node,right=of second_step] (third_step) {c};
\node[end_node, right=of third_step] (stop) {\textbf{stop}};
% lines
\draw[ar] (start) -- (first_step);
% here i don know how to bend this arrow to the same box
\draw[ar] (first_step.80) -- (first_step.180);
\draw[ar] (first_step) -- (second_step);
\draw[ar] (second_step) -- (third_step);
\draw[ar] (third_step) -- (stop);
\end{tikzpicture}
\end{document}
You can add a loop like this:
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{positioning}
\begin{document}
\begin{tikzpicture}[
node distance=1.5cm and 1cm,
ar/.style={->,>=latex},
middle_node/.style={
draw,
text width=1.5cm,
minimum height=0.75cm,
align=center
},
end_node/.style={
draw,
text width=1cm,
minimum height=0.55cm,
align=center
}
]
% nodes
\node[end_node] (start) {\textbf{start}};
\node[middle_node,right=of start] (first_step) {a};
\node[middle_node,right=of first_step] (second_step) {b};
\node[middle_node,right=of second_step] (third_step) {c};
\node[end_node, right=of third_step] (stop) {\textbf{stop}};
% lines
\draw[ar] (start) -- (first_step);
% here i don know how to bend this arrow to the same box
\draw[ar,out=120,in=60,<-] (first_step.north west) to (first_step.north east);
\draw[ar] (first_step) -- (second_step);
\draw[ar] (second_step) -- (third_step);
\draw[ar] (third_step) -- (stop);
\end{tikzpicture}
\end{document}
I would like to convert the following picture, which is a cross section of an engine, into a TikZ code:
How to start with this picture?
How to draw the walls and pipes in an easy way?
How to draw the oil (the hatched area)?
How to draw the oil (the hatched area)?
One way may be to use pattern=north east lines from patterns library described at page 730 of the PGF Manual:
\documentclass[tikz,border=5mm]{standalone}
\usetikzlibrary{patterns}
\begin{document}
\begin{tikzpicture}
\fill [pattern=north east lines] (0,6) -- (0,0) -- (10,0) -- (10,6);
\draw (0,10) -- (0,0) -- (10,0) -- (10,10);
\end{tikzpicture}
\end{document}
Is there a simple way to increase the size of an arrow tip using something like:
\tikzset{myptr/.style=->, ????}
without designing a new arrow style from scratch?
One solution, very quick, to just scale the arrow head is number %2 in the following:
\documentclass[multi=false,tikz,border=2mm]{standalone}
\usetikzlibrary{arrows,decorations.markings}
\begin{document}
\begin{tikzpicture}
%1
\draw [->,>=stealth] (0,.5) -- (2,.5);
%2
\draw [decoration={markings,mark=at position 1 with
{\arrow[scale=3,>=stealth]{>}}},postaction={decorate}] (0,0) -- (2,0);
\end{tikzpicture}
\end{document}
This produces:
(sorry for excessive zoom).
Much more in the answers to this question and in this answer, that I used as a source.
Addendum
\tikzset approach. This code:
\documentclass[multi=false,tikz,border=2mm]{standalone}
\usetikzlibrary{arrows,decorations.markings}
\begin{document}
\begin{tikzpicture}
\tikzset{myptr/.style={decoration={markings,mark=at position 1 with %
{\arrow[scale=3,>=stealth]{>}}},postaction={decorate}}}
%1
\draw [->,>=stealth] (0,.5) -- (2,.5);
%2
\draw [myptr] (0,0) -- (2,0);
\end{tikzpicture}
\end{document}
produces the same output as the above one (source: PGF Manual, section 2.8).
Obviously you can use -Latex instead of stealth.
There is a new solution, see https://latexdraw.com/exploring-tikz-arrows/#t-1610685307397. It allows changing both the length and width of arrows:
\documentclass[border=1mm]{standalone}
\usepackage{tikz}
\usetikzlibrary{arrows.meta,arrows}
\begin{document}
\begin{tikzpicture}
\draw [-{Stealth[length=3mm, width=2mm]}] (0,0.5) -- (1,0.5);
\draw [-stealth] (0,0) -- (1,0);
\end{tikzpicture}
\end{document}
I am trying to make 3d figures (great dodecahedron, small stellated dodecahedron) for which till now I was using tikz package in latex. Using \coordinate and \draw functions I managed to generate exact stencil for these models.
Now instead of making polyhedrons, I am trying to add floral patterns to it using tikz only, as I am not good at sketching.
That is importing jpg images (with floral patterns) into triangles drawn using tikz so as to make stencil for polyhedrons, like:
I know how to import graphics in latex and how to make make geometric patterns using tikz, but do not know how to "crop" jpg file into triangle or any other polygon whose coordinates are specified in tikz.
For example following is the code I am using to make one surface containing 10 triangles.
\documentclass{article}
\usepackage[usenames,dvipsnames]{xcolor}
\usepackage{tikz,ifthen}
\usetikzlibrary{calc,intersections,patterns}
\usepackage[paper=a4paper,dvips,top=.7cm,left=1.5cm,right=1.5cm, foot=1.2cm,bottom=1cm]{geometry}
\begin{document}
\pagestyle{empty}
\begin{tikzpicture}[scale=0.95,thin,rotate=0]
\coordinate (O) at (0cm,0cm);
\coordinate (A) at ($(O) + (36:3cm)$);
\coordinate (B) at ($(A) + (-36:3cm)$);
\coordinate (C) at ($(O) + (-36:3cm)$);
\coordinate (X) at ($(O) + (4.78mm,1.56mm)$);
\coordinate (Y) at ($(A) + (0mm,-1.9mm)$);
\coordinate (Z) at ($(B) + (-4.78mm,1.56mm)$);
\coordinate (X1) at ($(O) + (4.78mm,-1.56mm)$);
\coordinate (Y1) at ($(O) + (-36:3cm) + (0mm,1.9mm)$);
\coordinate (Z1) at ($(B) + (-4.78mm,-1.56mm)$);
\foreach \i in {0,72,...,360}{
\draw[gray, thin] let \p0=(O), \p1=(A), \p2=(B), \p3=(C) in
[rotate around={\i:(O)}] (\p2)--(\p1)--(\p0)--(\p2)--(\p3);
\draw[gray,thin,dashed] let \p1=(X), \p2=(Y), \p3=(Z) in
[rotate around={\i:(O)}] (\p1)--(\p2)--(\p3)--cycle;
\draw[gray,thin,dashed] let \p1=(X1), \p2=(Y1), \p3=(Z1) in
[rotate around={\i:(O)}] (\p1)--(\p2)--(\p3)--cycle;
}
\foreach \density in {20,30,...,160}{
\foreach \i in {0,72,...,360}{
\draw[fill=Magenta!\density] let \p1=(X), \p2=(Y), \p3=(Z) in
[rotate around={\i:(O)}] (\p1)--(\p2)--(\p3)--cycle;
}
\path
(X) coordinate (X1)
-- (Y) coordinate[pos=.15](X)
-- (Z) coordinate[pos=.15](Y)
-- (X1) coordinate[pos=.15](Z);
}
\end{tikzpicture}
\end{document}
This is the image it generates:
The problem is that the pattern in the image is also generated by tex, what I want is given any floral/non-floral pattern (that I choose) can I crop inside a triangle (the triangle is at some specific location in tex figure).
Any help would be greatly appreciated.
Thanks.
Reading pages 1062-1072 of the PGF Manual, I wrote the following test code:
\documentclass[tikz,border=2mm]{standalone}
\begin{document}
\begin{tikzpicture}
\filldraw [red] (0,0) rectangle (4,2);
\pgftext {\pgfimage[interpolate=true,width=1cm,height=1cm]{sample}}
\pgftext[at=\pgfpoint{28mm}{0.8cm},left,base] {\pgfimage[interpolate=true,width=1cm,height=1cm]{sample}}
\end{tikzpicture}
\end{document}
In the same folder where I saved a .tex file with the code above, I also saved this picture as sample.png. Here is a screenshot of the output of the tex compiled:
It shows the effect of positioning the png graphic using the commands \pgftext and \pgfpoint with or without attributes 28mm and 0.8cm.
Please add your feedback in a comment so we can watch deeper into it. Also, to have your code added to the question would help being more precise!
Addendum
Here is how I applied the idea in my code above to the code you added to the question:
\documentclass{article}
\usepackage[usenames,dvipsnames]{xcolor}
\usepackage{tikz,ifthen}
\usetikzlibrary{calc,intersections,patterns}
\usepackage[paper=a4paper,dvips,top=.7cm,left=1.5cm,right=1.5cm, foot=1.2cm,bottom=1cm]{geometry}
\begin{document}
\pagestyle{empty}
\begin{tikzpicture}[scale=0.95,thin,rotate=0]
\coordinate (O) at (0cm,0cm);
\coordinate (A) at ($(O) + (36:3cm)$);
\coordinate (B) at ($(A) + (-36:3cm)$);
\coordinate (C) at ($(O) + (-36:3cm)$);
\coordinate (X) at ($(O) + (4.78mm,1.56mm)$);
\coordinate (Y) at ($(A) + (0mm,-1.9mm)$);
\coordinate (Z) at ($(B) + (-4.78mm,1.56mm)$);
\coordinate (X1) at ($(O) + (4.78mm,-1.56mm)$);
\coordinate (Y1) at ($(O) + (-36:3cm) + (0mm,1.9mm)$);
\coordinate (Z1) at ($(B) + (-4.78mm,-1.56mm)$);
\foreach \i in {0,72,...,360}{
\draw[gray, thin] let \p0=(O), \p1=(A), \p2=(B), \p3=(C) in
[rotate around={\i:(O)}] (\p2)--(\p1)--(\p0)--(\p2)--(\p3);
\draw[gray,thin,dashed] let \p1=(X), \p2=(Y), \p3=(Z) in
[rotate around={\i:(O)}] (\p1)--(\p2)--(\p3)--cycle;
\draw[gray,thin,dashed] let \p1=(X1), \p2=(Y1), \p3=(Z1) in
[rotate around={\i:(O)}] (\p1)--(\p2)--(\p3)--cycle;
}
\foreach \density in {20,30,...,160}{
\path
(X) coordinate (X1)
-- (Y) coordinate[pos=.15](X)
-- (Z) coordinate[pos=.15](Y)
-- (X1) coordinate[pos=.15](Z);
}
% including graphics from external file:
\foreach \i in {0,72,...,360}{
\pgftext[at=\pgfpoint{2cm*cos(\i)}{2cm*sin(\i)},left,base,rotate=\i]
{\pgfimage[interpolate=true,width=1cm,height=1cm]{sample}}
}
\end{tikzpicture}
\end{document}
To include the graphics from external file, I chose a \foreach loop, but only for the sake of using five times the same image. The key point is that the line:
\pgftext[at=\pgfpoint{2cm*cos(\i)}{2cm*sin(\i)},left,base,rotate=\i]
{\pgfimage[interpolate=true,width=1cm,height=1cm]{sample}}
should allow you to position the external graphics using the attributes 2cm*cos(\i), 2cm*sin(\i), left, base and rotate=\i only.
You may avoid the \foreach loop and use one single
\pgftext[at=\pgfpoint ... ] {\pgfimage[ ... ]{filename}}
for each of your external files. If you can generate transparent-background images for your triangle graphics, you may then enjoy this solution.
The output of mine: