5

I have an old image with ppt style and I would like to customise it a bit. Main problem is I'm a beginner in Tikz/PGF and i really don't know where to start and which environments I should use.

If somebody can give me a hand to start in a good way.enter image description here

Thruston
  • 42,268
rhum187
  • 265
  • 2
    Or in other words: Post your first ideas in terms of an MWE, so we can see, where you get stuck. – Ronny Sep 09 '14 at 07:17
  • 1
    If you are a beginner with TikZ and don't know where to start, you should first check out the tutorial in the documentation. – Johannes_B Sep 09 '14 at 07:20
  • 2
    I am not really a beginner, I've done some stuff before but I've got no experience at all to start with a big figure like this. I did not expect a reaction like yours, but more something like "let's begin with an axis group and ...". Just some advices. I think to close conservation because it led nowhere. I would return when I have started coding because you can not talk without a MWE, apparently. – rhum187 Sep 09 '14 at 07:29
  • 1
    My advice would be to start step by step: The three boxes on the left are just certain styled nodes having a content and a label above. Then do the plots, maybe also inside nodes to get the braces right,... Edit: Somewhere in the rules it states: TeX.SE is not your image construction forum. We help you, but we won't do your work. – Ronny Sep 09 '14 at 07:33
  • 2
    Why not use Inkscape together with PDF + Tex output? – jnovacho Sep 09 '14 at 11:43
  • I do not want to use other software as Inkscape because I would rather use embedded tools like Tikz. It's definitely my opinion but I can imagine how many people who are using Inkscape can prove me the opposite – rhum187 Sep 09 '14 at 12:43
  • Even if it is another tool, inkscape is still a good idea because if you have exported your ppt picture as e.g. pdf you can use inkscape to export it to tikz code. Like this you have a basis to start with and modify details as you need. https://code.google.com/p/inkscape2tikz/ – samcarter_is_at_topanswers.xyz Sep 09 '14 at 14:08

3 Answers3

16

Well, today everybody woke up from the wrong side of the bed apparently, so somebody has to fart the bad mood out on this one.

But please notice that advice is not fit for our Q&A site without concrete examples because it would be too specific to your needs. You can also use the chat room if you wish to have a quick discussion. Our questions tend to be to the point about certain aspects with less commenting.

Anyway, here is some initial points for you so that you can start decorating them or changing the colors etc. And that is up to you to pick up the manual and start working on it :)

\documentclass[tikz]{standalone}
\pgfdeclaredecoration{single pulse}{initial}{
\state{initial}[width=\pgfdecoratedinputsegmentlength]
{%
    \pgfpathlineto{\pgfpoint{0.2*\pgfdecoratedinputsegmentlength}{0mm}}%    
    \pgfpathsine{\pgfpoint{0.15\pgfdecorationsegmentlength}{\pgfdecorationsegmentamplitude}}%
    \pgfpathcosine{\pgfpoint{0.15\pgfdecorationsegmentlength}{-\pgfdecorationsegmentamplitude}}%
    \pgfpathsine{\pgfpoint{0.15\pgfdecorationsegmentlength}{-\pgfdecorationsegmentamplitude}}
    \pgfpathcosine{\pgfpoint{0.15\pgfdecorationsegmentlength}{\pgfdecorationsegmentamplitude}}%
    \pgfpathlineto{\pgfpointdecoratedinputsegmentlast}%
}
\state{final}{}%
}
\begin{document}
\begin{tikzpicture}[mydeco/.style={decoration={single pulse,amplitude=4mm,segment length=2mm},decorate}]
\foreach\x in{0,1,2}{
\draw[mydeco] (0,-\x) -- (1,-\x);
\draw[mydeco] (2+0.25*\x,-\x) -- (3+0.25*\x,-\x);
\draw[mydeco] (4+0.5*\x,-\x) -- (5+0.5*\x,-\x);
}
\draw[dashed,blue] \foreach \x in {0,2,4}{(\x,0) -- (\x,-2.2)};
\draw[red,dashed] \foreach \x in {2.25,4.5}{(\x,-1) -- (\x,-2.2)};
\end{tikzpicture}
\end{document}

enter image description here

percusse
  • 157,807
  • I was not asking for that much but THIS is exactly what I wanted to do. Yep, understood, for my next post, I'm going to add a MWE for sure ;) (add the begin{document} and it would be perfect) – rhum187 Sep 09 '14 at 09:01
  • 2
    @rhum187 Oops. sorry about that – percusse Sep 09 '14 at 09:06
7

You might also like to learn Metapost, the graphics language devised by John Hobby and D. E. Knuth. Here are two little functions that draw a pulse shape and the down brace you would need for your picture. The rest of it is just lines and labels, as explained in the manual.

enter image description here

prologues := 3;
outputtemplate := "%j%c.eps";

vardef pulse(expr s) = 
    save x, y, pulse; path pulse; 
    z1 = left; z2 = z1/4; x3 = x2/2; y3 = 1;
    pulse = z1 .. subpath (0.2,0.6) of (z1--z2) .. controls z2 and z2
               .. subpath (0.2,0.6) of (z2--z3) .. controls z3 and z3 .. origin;
    (pulse .. reverse pulse rotated 180) scaled 1/2s
enddef;

vardef down_brace(expr s) = 
    save arm; path arm;
    arm = (-1,1/4) {down} .. {right} (-7/8,1/8) -- (-1/8,1/8) {right} .. {down} origin;
    (arm .. reverse arm reflectedabout(up,down)) scaled 1/2s
enddef;

beginfig(1);
  draw pulse(1cm)                       withcolor .78 blue; 
  draw down_brace(1cm) shifted (0,-7mm) withcolor .56 red;
endfig;
end.

Since the functions return a path, you can join them together like this:

draw pulse(1cm) -- pulse(1cm) shifted (2cm,0) -- pulse(1cm) shifted (4cm,0) withcolor .7 white;

to produce this.

enter image description here

You can also do this with one of MP's "inline" for loops if you prefer:

draw pulse(1cm) for i=1,2: -- pulse(1cm) shifted (i*2cm,0) endfor withcolor .7 white;
Thruston
  • 42,268
  • Thank you Thruston for your explanation, it could be useful for many Metapost users. I'll try to stay focus on Tikz and try to be better at it before learning another way to do some figures. – rhum187 Sep 10 '14 at 13:11
4

So, this is what I did so far :

\begin{tikzpicture}[mydeco/.style={decoration={single pulse,amplitude=7mm,segment     length=3mm},decorate}]
\foreach\x in{0,2,4}{
\draw[mydeco] (0,-\x) -- (0.6,-\x);
\draw[mydeco] (2+0.15*\x,-\x) -- (2.6+0.15*\x,-\x);
\draw[mydeco] (4+0.30*\x,-\x) -- (4.6+0.30*\x,-\x);
}
\draw[dotted,gray] \foreach \x in {0,2,4}{(0, -\x) -- (5+0.3*4, -\x)};  
\draw[dashed,blue] \foreach \x in {2,4}{(\x,0) -- (\x,-1.1)};
\draw[dashed,red] \foreach \x in {2.3,4.6}{(\x,-2) -- (\x,-3.1)};
\draw[dashed,green] \foreach \x in {2.6,5.2}{(\x,-4) -- (\x,-5.1)};
\draw[dashed,black,thick] (0,1) node[above] {$t_0$} -- (0,-5.2) ;

\draw[blue,<->,thick] (0.05,-0.8) -- (2-0.05,-0.8) node [below,align=center,midway]    {$T$};
\draw[blue,<->,thick] (2+0.05,-0.8) -- (4-0.05,-0.8) node [below,align=center,midway] {$T$};
\draw[red,<->,thick] (0.05,-2.8) -- (2.3-0.05,-2.8) node [below,align=center,midway] {$T+t_1$};
\draw[red,<->,thick] (2.3+0.05,-2.8) -- (4.6-0.05,-2.8) node [below,align=center,midway] {$T+t_1$};
\draw[green,<->,thick] (0.05,-4.8) -- (2.6-0.05,-4.8) node [below,align=center,midway] {$T+2*t_1$};
\draw[green,<->,thick] (2.6+0.05,-4.8) -- (5.2-0.05,-4.8) node [below,align=center,midway] {$T+2*t_1$};

\draw [fill=blue!20,draw=blue,thick] (-0.3,0) -- (-1.0,0.5) arc (90:270:.20) -- (-0.3,0) -- (-1,-0.04) arc (90:270:.20) -- cycle node[above,inner sep=22pt, midway] {\tiny{Antenna 1}};
\draw [fill=red!20,draw=red,thick] (-0.3,-2) -- (-1.0,-2+0.5) arc (90:270:.20) -- (-0.3,-2) -- (-1,-0.04-2) arc (90:270:.20) -- cycle node[above,inner sep=22pt, midway] {\tiny{Antenna 2}};
\draw [fill=green!20,draw=green,thick] (-0.3,-4) -- (-1.0,-4+0.5) arc (90:270:.20) -- (-0.3,-4) -- (-1,-0.04-4) arc (90:270:.20) -- cycle node[above,inner sep=22pt, midway] {\tiny{Antenna 3}};

\draw[decorate,decoration={brace,mirror},thick] (0,-5.3) -- (0.6,-5.3)    node[below,midway] {{\tiny Tir dans l'axe}};
\draw[decorate,decoration={brace,mirror},thick] (2.2,-5.3) -- (2.6+0.6,-5.3) node[below,midway] {{\tiny Dépointage $\Theta_A$}};
\draw[decorate,decoration={brace,mirror},thick] (4.4,-5.3) -- (5.2+0.6,-5.3) node[below,midway] {{\tiny Dépointage $\Theta_B$}};

\end{tikzpicture}

enter image description here

rhum187
  • 265