Draw curved lines simply











up vote
5
down vote

favorite
1












How to draw nearly-arbitrary curved lines simply? For example, how to draw this graph:





Source Introduction to Algorithms (3rd edition) by Thomas H. Cormen, Charles E. Leiserson, Ronald L. Rivest, Clifford Stein | Page 45 | Figure 3.1



Now I have two ideas of how to draw such figures:





  1. Divide each curved line to many smaller curved lines which can be drawn by a TikZ command, for example



    draw (0,0) to [in=80, out=-30] (3,2);


    This way is quite natural. However, it is difficult to divide, for instance, the lines in the above figure, in this way. Also, when I have already divided, it is very possible that I will get confused with the coordinates.




  2. Find a formula for each of the curved line, and then draw the graph of the curved line.



    This way is good for normal graphs, but for the complicated curved lines as in the above figure, it seems to be impossible.




So none of the ways stated is good enough. Do you have any idea to draw such figures? Your help is much appreciated!





Notes




  1. I'm sorry if the question is a duplicate. I have searched for a while without success.


  2. Your help will be great if you can help me draw the above figure. However, I strongly prefer a general solution for this, because the aim of the question is not just to ask how to draw the figure only.


  3. You can see that there is no MWE in my question. As I explained above, all of my idea so far are just bad, so I haven't applied any of them.


  4. I strongly prefer using TikZ. However, answers using PGF, PStricks, etc. are all very useful to me.











share|improve this question




















  • 2




    You could try with draw plot[smooth] coordinates {<a suitable list of coordinates>}; for the curves.
    – Torbjørn T.
    Dec 1 at 17:36








  • 1




    I tend to define some points on the curve first, then connect then using bezier curves making sure each connection is smooth (same tangent in and out). Each segment is made like this: (a1).. controls ++(45:1) and ++(30:0.5).. (a2) where the control points are relative polar coordinates. Somewhere on the site there is a style that will enable you to see the control vectors (i think it is called show curve controls), I use this method for most of my drawings when I'm trying to replicate or trace something.
    – daleif
    Dec 1 at 17:36















up vote
5
down vote

favorite
1












How to draw nearly-arbitrary curved lines simply? For example, how to draw this graph:





Source Introduction to Algorithms (3rd edition) by Thomas H. Cormen, Charles E. Leiserson, Ronald L. Rivest, Clifford Stein | Page 45 | Figure 3.1



Now I have two ideas of how to draw such figures:





  1. Divide each curved line to many smaller curved lines which can be drawn by a TikZ command, for example



    draw (0,0) to [in=80, out=-30] (3,2);


    This way is quite natural. However, it is difficult to divide, for instance, the lines in the above figure, in this way. Also, when I have already divided, it is very possible that I will get confused with the coordinates.




  2. Find a formula for each of the curved line, and then draw the graph of the curved line.



    This way is good for normal graphs, but for the complicated curved lines as in the above figure, it seems to be impossible.




So none of the ways stated is good enough. Do you have any idea to draw such figures? Your help is much appreciated!





Notes




  1. I'm sorry if the question is a duplicate. I have searched for a while without success.


  2. Your help will be great if you can help me draw the above figure. However, I strongly prefer a general solution for this, because the aim of the question is not just to ask how to draw the figure only.


  3. You can see that there is no MWE in my question. As I explained above, all of my idea so far are just bad, so I haven't applied any of them.


  4. I strongly prefer using TikZ. However, answers using PGF, PStricks, etc. are all very useful to me.











share|improve this question




















  • 2




    You could try with draw plot[smooth] coordinates {<a suitable list of coordinates>}; for the curves.
    – Torbjørn T.
    Dec 1 at 17:36








  • 1




    I tend to define some points on the curve first, then connect then using bezier curves making sure each connection is smooth (same tangent in and out). Each segment is made like this: (a1).. controls ++(45:1) and ++(30:0.5).. (a2) where the control points are relative polar coordinates. Somewhere on the site there is a style that will enable you to see the control vectors (i think it is called show curve controls), I use this method for most of my drawings when I'm trying to replicate or trace something.
    – daleif
    Dec 1 at 17:36













up vote
5
down vote

favorite
1









up vote
5
down vote

favorite
1






1





How to draw nearly-arbitrary curved lines simply? For example, how to draw this graph:





Source Introduction to Algorithms (3rd edition) by Thomas H. Cormen, Charles E. Leiserson, Ronald L. Rivest, Clifford Stein | Page 45 | Figure 3.1



Now I have two ideas of how to draw such figures:





  1. Divide each curved line to many smaller curved lines which can be drawn by a TikZ command, for example



    draw (0,0) to [in=80, out=-30] (3,2);


    This way is quite natural. However, it is difficult to divide, for instance, the lines in the above figure, in this way. Also, when I have already divided, it is very possible that I will get confused with the coordinates.




  2. Find a formula for each of the curved line, and then draw the graph of the curved line.



    This way is good for normal graphs, but for the complicated curved lines as in the above figure, it seems to be impossible.




So none of the ways stated is good enough. Do you have any idea to draw such figures? Your help is much appreciated!





Notes




  1. I'm sorry if the question is a duplicate. I have searched for a while without success.


  2. Your help will be great if you can help me draw the above figure. However, I strongly prefer a general solution for this, because the aim of the question is not just to ask how to draw the figure only.


  3. You can see that there is no MWE in my question. As I explained above, all of my idea so far are just bad, so I haven't applied any of them.


  4. I strongly prefer using TikZ. However, answers using PGF, PStricks, etc. are all very useful to me.











share|improve this question















How to draw nearly-arbitrary curved lines simply? For example, how to draw this graph:





Source Introduction to Algorithms (3rd edition) by Thomas H. Cormen, Charles E. Leiserson, Ronald L. Rivest, Clifford Stein | Page 45 | Figure 3.1



Now I have two ideas of how to draw such figures:





  1. Divide each curved line to many smaller curved lines which can be drawn by a TikZ command, for example



    draw (0,0) to [in=80, out=-30] (3,2);


    This way is quite natural. However, it is difficult to divide, for instance, the lines in the above figure, in this way. Also, when I have already divided, it is very possible that I will get confused with the coordinates.




  2. Find a formula for each of the curved line, and then draw the graph of the curved line.



    This way is good for normal graphs, but for the complicated curved lines as in the above figure, it seems to be impossible.




So none of the ways stated is good enough. Do you have any idea to draw such figures? Your help is much appreciated!





Notes




  1. I'm sorry if the question is a duplicate. I have searched for a while without success.


  2. Your help will be great if you can help me draw the above figure. However, I strongly prefer a general solution for this, because the aim of the question is not just to ask how to draw the figure only.


  3. You can see that there is no MWE in my question. As I explained above, all of my idea so far are just bad, so I haven't applied any of them.


  4. I strongly prefer using TikZ. However, answers using PGF, PStricks, etc. are all very useful to me.








tikz-pgf diagrams pstricks






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Dec 1 at 17:57









Torbjørn T.

154k13245434




154k13245434










asked Dec 1 at 17:03









JouleV

1,809425




1,809425








  • 2




    You could try with draw plot[smooth] coordinates {<a suitable list of coordinates>}; for the curves.
    – Torbjørn T.
    Dec 1 at 17:36








  • 1




    I tend to define some points on the curve first, then connect then using bezier curves making sure each connection is smooth (same tangent in and out). Each segment is made like this: (a1).. controls ++(45:1) and ++(30:0.5).. (a2) where the control points are relative polar coordinates. Somewhere on the site there is a style that will enable you to see the control vectors (i think it is called show curve controls), I use this method for most of my drawings when I'm trying to replicate or trace something.
    – daleif
    Dec 1 at 17:36














  • 2




    You could try with draw plot[smooth] coordinates {<a suitable list of coordinates>}; for the curves.
    – Torbjørn T.
    Dec 1 at 17:36








  • 1




    I tend to define some points on the curve first, then connect then using bezier curves making sure each connection is smooth (same tangent in and out). Each segment is made like this: (a1).. controls ++(45:1) and ++(30:0.5).. (a2) where the control points are relative polar coordinates. Somewhere on the site there is a style that will enable you to see the control vectors (i think it is called show curve controls), I use this method for most of my drawings when I'm trying to replicate or trace something.
    – daleif
    Dec 1 at 17:36








2




2




You could try with draw plot[smooth] coordinates {<a suitable list of coordinates>}; for the curves.
– Torbjørn T.
Dec 1 at 17:36






You could try with draw plot[smooth] coordinates {<a suitable list of coordinates>}; for the curves.
– Torbjørn T.
Dec 1 at 17:36






1




1




I tend to define some points on the curve first, then connect then using bezier curves making sure each connection is smooth (same tangent in and out). Each segment is made like this: (a1).. controls ++(45:1) and ++(30:0.5).. (a2) where the control points are relative polar coordinates. Somewhere on the site there is a style that will enable you to see the control vectors (i think it is called show curve controls), I use this method for most of my drawings when I'm trying to replicate or trace something.
– daleif
Dec 1 at 17:36




I tend to define some points on the curve first, then connect then using bezier curves making sure each connection is smooth (same tangent in and out). Each segment is made like this: (a1).. controls ++(45:1) and ++(30:0.5).. (a2) where the control points are relative polar coordinates. Somewhere on the site there is a style that will enable you to see the control vectors (i think it is called show curve controls), I use this method for most of my drawings when I'm trying to replicate or trace something.
– daleif
Dec 1 at 17:36










3 Answers
3






active

oldest

votes

















up vote
7
down vote



accepted










This is an attempt to collect some key methods on one page. Clearly, this discussion is not exhaustive, so I am hoping that this post gets complemented by others, who have other methods and/or opinions. (I made zero effort to precisely reproduce your curves, sorry.)



documentclass{article}
usepackage[margin=1in]{geometry}
usepackage{multicol}
usepackage{tikz}
usetikzlibrary{hobby}
begin{document}
section*{A few ideas to draw smooth curves}

begin{multicols}{2}
subsection*{Your idea: use texttt{out} and texttt{in}}
This works, and the result looks smooth if you make sure that the texttt{in}
of one point and the texttt{out} of the next point differ by 180. In the
following pic, we have texttt{dots to[out=50,in=textbf{210}] (1,2) circle(1pt)
to[textbf{out=30},in=240] dots} to illustrate this. Notice that the
texttt{looseness} key can be of great help here.

begin{tikzpicture}
draw[latex-latex] (0,4) |- (6,0);
draw[blue] (0,0) circle(1pt) to[out=50,in=210] (1,2) circle(1pt)
to[out=30,in=240,looseness=0.5] (3,3) circle(1pt);
end{tikzpicture}

subsection*{Your idea: find an analytic formula}
This is IMHO often the simplest way. One only needs to keep in mind a few basic
functions like $sin$ and $tanh$.

begin{tikzpicture}
draw[latex-latex] (0,4) |- (6,0);
draw[blue] plot[variable=x,domain=0:6,smooth]
({x},{1+0.3*(tanh(3-x)+1)*sin(180*x)+0.2*x});
end{tikzpicture}

subsection*{Use texttt{plot[smooth] coordinates}}

A very convenient option, mentioned by Torj{o}rn T. in the comments, is to use
texttt{plot[smooth] coordinates}. You may want to play with the
texttt{tension} key.

begin{tikzpicture}
draw[latex-latex] (0,4) |- (6,0);
draw[blue] plot[smooth] coordinates
{(0,0) (1,2) (2,2) (3,3) (4,3)};
draw[red] plot[smooth,tension=2] coordinates
{(0,0) (1,2) (2,2) (3,3) (4,3)};
end{tikzpicture}

subsection*{Use the texttt{hobby} library}

The texttt{hobby} library is sort of an el Dorado for smooth curve
constructors. It has way too many options to be listed here. One thing I find
very useful is the texttt{tangent} style from the manual.

begin{tikzpicture}[tangent/.style={%
in angle={(180+#1)},Hobby finish ,
designated Hobby path=next , out angle=#1,
}]
draw[latex-latex] (0,4) |- (6,0);
draw[blue] plot[smooth,hobby,tension=0.3] coordinates
{(0,0) (1,1.2) (2,2) (3,3) (4,3)};
draw [red,use Hobby shortcut]
(0,0) .. ([tangent=30]1.5,1) .. ([tangent=-10]3,2) .. (5,1);
end{tikzpicture}

I'd also like to mention that, when it comes to decorations, in my experience
the Hobby paths are advantageous. They often do not lead to texttt{dimension too
large} errors when their almost identically looking texttt{plot[smooth]}
counterparts do.

subsection*{Not sure about texttt{controls}}

There is also the possibility of using Bezier curves (without texttt{hobby}).
Many users are able to use that to obtain great results. Unfortunately, I am not
one of those since IMHO the relation between position of the control points and
the outcome is not too obvious. But this is of course a very subjective
statement.
end{multicols}
end{document}


enter image description here






share|improve this answer





















  • (+1+AC) I didn't expect to get such a good answer when asking my question! Not only that you provide a clear explaination and good examples, but you also answered in a very creative way - I like it. Now it is much easier for me to draw the attached figure. Thank you very much!
    – JouleV
    Dec 1 at 19:21










  • +1: Perfect as usual!
    – Dr. Manuel Kuehner
    Dec 1 at 20:03


















up vote
3
down vote













put a coordinatesystem over the given images and choose some points:



documentclass[pstricks,border=12pt]{standalone}
usepackage{pst-plot}
begin{document}
begin{pspicture}(-0.5,-0.5)(6.4,6.4)
psaxes[labels=none,ticks=none]{->}(6,6)[$n$,0][,0]
psxTick(1.8){n_0}
pscurve[linecolor=red,linewidth=1.5pt]%
(0,1.6)(0.4,1.1)(0.6,0.9)(0.9,1.2)(1,1.8)(1.4,3)(1.8,2.5)(2,2)(2.3,1.9)(3,2.2)(4.5,3)(6,3.4)
pscurve[linecolor=blue,linewidth=1.5pt](0,1)(1,1.8)(1.8,2.5)(2.5,3)(3.5,3.4)(4.5,4)(6,5)
psline[linestyle=dashed](1.8,0)(1.8,2.5)
rput[r](6,5.2){textcolor{blue}{$cg(n)$}}
rput[r](6,3.5){textcolor{red}{$f(n)$}}
end{pspicture}
end{document}


enter image description here






share|improve this answer





















  • (+1) Thank you very much! The graph looks very nice, and from your code I think I can draw the rest.
    – JouleV
    Dec 1 at 19:22


















up vote
1
down vote













As suggest by marmot it is possible to use Bezier curves. For things like this I use TikzEdt, a very useful software for translate a diagram in TikZ. I import the diagram with node{includegraphics{YourDiagram}};and use the Bezier tool of TikzEdt to replicate exactly the diagram.
For example for your first plot I get the following result:



documentclass[10pt,a4paper]{article}
usepackage[latin1]{inputenc}
usepackage{tikz}
begin{document}
begin{tikzpicture}
%node{includegraphics[width=2textwidth]{YourDiagram}};%import the diagram that you want to copy in TikzEdt

%draw [help lines, step=.1cm] (-22.8,-7.4) grid (-7.7,8.2);

draw (-21,-1.8) .. controls (-19.9,-1.8)
and (-19.7,-1.6) .. (-19.3,-2) .. controls (-18.5,-2.8)
and (-18.5,-1.7) .. (-18,-0.9) .. controls (-16.9,0.4)
and (-15.6,0.6) .. (-14.2,1.2) .. controls (-13,1.6)
and (-11.9,1.9) .. (-10.2,3.3) node[above]{{LARGE$f(n)$}};

draw(-21,-3.8) .. controls (-20.3,-3.1)
and (-20,-2.8) .. (-19.7,-2.4) .. controls (-18.9,-1.4)
and (-17.9,-1.4) .. (-17.6,-1.4) .. controls (-16.2,-1.4)
and (-16.1,-1.1) .. (-15.8,-0.9) .. controls (-15.1,-0.2)
and (-14.8,0.1) .. (-13.4,0.5) .. controls (-12.5,0.7)
and (-12,0.8) .. (-10.2,1.1) node[above]{{LARGE$c_1g(n)$}};

draw(-21,-3.8) .. controls (-20.7,-3.2)
and (-20.4,-2.7) .. (-19.8,-1.2) .. controls (-19.1,0.4)
and (-18.5,1.2) .. (-17,1.1) .. controls (-16.4,1.1)
and (-16.1,1.5) .. (-15.5,2.5) .. controls (-15.1,3.3)
and (-14.6,4.1) .. (-13.5,4.7) .. controls (-12.7,5.1)
and (-12.3,5.3) .. (-10.2,6.1) node[above]{{LARGE$c_2g(n)$}};

draw (-21,7.1) -- (-21,-3.8) -- (-10.1,-3.8) node[right]{{LARGE$n$}};

draw[dashed] (-18.3,0.8) -- (-18.3,-3.8) node[below] {LARGE{$n_0$}};
end{tikzpicture}
end{document}


Diagram in TikZ with TikzEdt






share|improve this answer





















  • (+1) Your picture looks very nice and is nearly the same with my picture. Thank you very much for providing me a nice TikZ tool - which will be useful for me to draw complicated TikZ figures. Yep, but... the aim of the question is not to find a supporting software. Anyway, your help is highly appreciated!
    – JouleV
    Dec 4 at 13:14






  • 1




    As daleif and marmot said, when you use Bezier curves it is difficult to place correctly the control points. With TikzEdt you can place exactly the control points and with the autocompilation you get immediatly the result for further adjustments. Therefore it is very easy to replicate anything and translate it in TikZ. TikzEdt is not an exportation tool. In some sense with TikzEdt you can easly realize your first idea for draw your graphs (divide the line and draw it piece by piece). I made the above picture in 10 minutes.
    – vi pa
    Dec 4 at 14:06













Your Answer








StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "85"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f462721%2fdraw-curved-lines-simply%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























3 Answers
3






active

oldest

votes








3 Answers
3






active

oldest

votes









active

oldest

votes






active

oldest

votes








up vote
7
down vote



accepted










This is an attempt to collect some key methods on one page. Clearly, this discussion is not exhaustive, so I am hoping that this post gets complemented by others, who have other methods and/or opinions. (I made zero effort to precisely reproduce your curves, sorry.)



documentclass{article}
usepackage[margin=1in]{geometry}
usepackage{multicol}
usepackage{tikz}
usetikzlibrary{hobby}
begin{document}
section*{A few ideas to draw smooth curves}

begin{multicols}{2}
subsection*{Your idea: use texttt{out} and texttt{in}}
This works, and the result looks smooth if you make sure that the texttt{in}
of one point and the texttt{out} of the next point differ by 180. In the
following pic, we have texttt{dots to[out=50,in=textbf{210}] (1,2) circle(1pt)
to[textbf{out=30},in=240] dots} to illustrate this. Notice that the
texttt{looseness} key can be of great help here.

begin{tikzpicture}
draw[latex-latex] (0,4) |- (6,0);
draw[blue] (0,0) circle(1pt) to[out=50,in=210] (1,2) circle(1pt)
to[out=30,in=240,looseness=0.5] (3,3) circle(1pt);
end{tikzpicture}

subsection*{Your idea: find an analytic formula}
This is IMHO often the simplest way. One only needs to keep in mind a few basic
functions like $sin$ and $tanh$.

begin{tikzpicture}
draw[latex-latex] (0,4) |- (6,0);
draw[blue] plot[variable=x,domain=0:6,smooth]
({x},{1+0.3*(tanh(3-x)+1)*sin(180*x)+0.2*x});
end{tikzpicture}

subsection*{Use texttt{plot[smooth] coordinates}}

A very convenient option, mentioned by Torj{o}rn T. in the comments, is to use
texttt{plot[smooth] coordinates}. You may want to play with the
texttt{tension} key.

begin{tikzpicture}
draw[latex-latex] (0,4) |- (6,0);
draw[blue] plot[smooth] coordinates
{(0,0) (1,2) (2,2) (3,3) (4,3)};
draw[red] plot[smooth,tension=2] coordinates
{(0,0) (1,2) (2,2) (3,3) (4,3)};
end{tikzpicture}

subsection*{Use the texttt{hobby} library}

The texttt{hobby} library is sort of an el Dorado for smooth curve
constructors. It has way too many options to be listed here. One thing I find
very useful is the texttt{tangent} style from the manual.

begin{tikzpicture}[tangent/.style={%
in angle={(180+#1)},Hobby finish ,
designated Hobby path=next , out angle=#1,
}]
draw[latex-latex] (0,4) |- (6,0);
draw[blue] plot[smooth,hobby,tension=0.3] coordinates
{(0,0) (1,1.2) (2,2) (3,3) (4,3)};
draw [red,use Hobby shortcut]
(0,0) .. ([tangent=30]1.5,1) .. ([tangent=-10]3,2) .. (5,1);
end{tikzpicture}

I'd also like to mention that, when it comes to decorations, in my experience
the Hobby paths are advantageous. They often do not lead to texttt{dimension too
large} errors when their almost identically looking texttt{plot[smooth]}
counterparts do.

subsection*{Not sure about texttt{controls}}

There is also the possibility of using Bezier curves (without texttt{hobby}).
Many users are able to use that to obtain great results. Unfortunately, I am not
one of those since IMHO the relation between position of the control points and
the outcome is not too obvious. But this is of course a very subjective
statement.
end{multicols}
end{document}


enter image description here






share|improve this answer





















  • (+1+AC) I didn't expect to get such a good answer when asking my question! Not only that you provide a clear explaination and good examples, but you also answered in a very creative way - I like it. Now it is much easier for me to draw the attached figure. Thank you very much!
    – JouleV
    Dec 1 at 19:21










  • +1: Perfect as usual!
    – Dr. Manuel Kuehner
    Dec 1 at 20:03















up vote
7
down vote



accepted










This is an attempt to collect some key methods on one page. Clearly, this discussion is not exhaustive, so I am hoping that this post gets complemented by others, who have other methods and/or opinions. (I made zero effort to precisely reproduce your curves, sorry.)



documentclass{article}
usepackage[margin=1in]{geometry}
usepackage{multicol}
usepackage{tikz}
usetikzlibrary{hobby}
begin{document}
section*{A few ideas to draw smooth curves}

begin{multicols}{2}
subsection*{Your idea: use texttt{out} and texttt{in}}
This works, and the result looks smooth if you make sure that the texttt{in}
of one point and the texttt{out} of the next point differ by 180. In the
following pic, we have texttt{dots to[out=50,in=textbf{210}] (1,2) circle(1pt)
to[textbf{out=30},in=240] dots} to illustrate this. Notice that the
texttt{looseness} key can be of great help here.

begin{tikzpicture}
draw[latex-latex] (0,4) |- (6,0);
draw[blue] (0,0) circle(1pt) to[out=50,in=210] (1,2) circle(1pt)
to[out=30,in=240,looseness=0.5] (3,3) circle(1pt);
end{tikzpicture}

subsection*{Your idea: find an analytic formula}
This is IMHO often the simplest way. One only needs to keep in mind a few basic
functions like $sin$ and $tanh$.

begin{tikzpicture}
draw[latex-latex] (0,4) |- (6,0);
draw[blue] plot[variable=x,domain=0:6,smooth]
({x},{1+0.3*(tanh(3-x)+1)*sin(180*x)+0.2*x});
end{tikzpicture}

subsection*{Use texttt{plot[smooth] coordinates}}

A very convenient option, mentioned by Torj{o}rn T. in the comments, is to use
texttt{plot[smooth] coordinates}. You may want to play with the
texttt{tension} key.

begin{tikzpicture}
draw[latex-latex] (0,4) |- (6,0);
draw[blue] plot[smooth] coordinates
{(0,0) (1,2) (2,2) (3,3) (4,3)};
draw[red] plot[smooth,tension=2] coordinates
{(0,0) (1,2) (2,2) (3,3) (4,3)};
end{tikzpicture}

subsection*{Use the texttt{hobby} library}

The texttt{hobby} library is sort of an el Dorado for smooth curve
constructors. It has way too many options to be listed here. One thing I find
very useful is the texttt{tangent} style from the manual.

begin{tikzpicture}[tangent/.style={%
in angle={(180+#1)},Hobby finish ,
designated Hobby path=next , out angle=#1,
}]
draw[latex-latex] (0,4) |- (6,0);
draw[blue] plot[smooth,hobby,tension=0.3] coordinates
{(0,0) (1,1.2) (2,2) (3,3) (4,3)};
draw [red,use Hobby shortcut]
(0,0) .. ([tangent=30]1.5,1) .. ([tangent=-10]3,2) .. (5,1);
end{tikzpicture}

I'd also like to mention that, when it comes to decorations, in my experience
the Hobby paths are advantageous. They often do not lead to texttt{dimension too
large} errors when their almost identically looking texttt{plot[smooth]}
counterparts do.

subsection*{Not sure about texttt{controls}}

There is also the possibility of using Bezier curves (without texttt{hobby}).
Many users are able to use that to obtain great results. Unfortunately, I am not
one of those since IMHO the relation between position of the control points and
the outcome is not too obvious. But this is of course a very subjective
statement.
end{multicols}
end{document}


enter image description here






share|improve this answer





















  • (+1+AC) I didn't expect to get such a good answer when asking my question! Not only that you provide a clear explaination and good examples, but you also answered in a very creative way - I like it. Now it is much easier for me to draw the attached figure. Thank you very much!
    – JouleV
    Dec 1 at 19:21










  • +1: Perfect as usual!
    – Dr. Manuel Kuehner
    Dec 1 at 20:03













up vote
7
down vote



accepted







up vote
7
down vote



accepted






This is an attempt to collect some key methods on one page. Clearly, this discussion is not exhaustive, so I am hoping that this post gets complemented by others, who have other methods and/or opinions. (I made zero effort to precisely reproduce your curves, sorry.)



documentclass{article}
usepackage[margin=1in]{geometry}
usepackage{multicol}
usepackage{tikz}
usetikzlibrary{hobby}
begin{document}
section*{A few ideas to draw smooth curves}

begin{multicols}{2}
subsection*{Your idea: use texttt{out} and texttt{in}}
This works, and the result looks smooth if you make sure that the texttt{in}
of one point and the texttt{out} of the next point differ by 180. In the
following pic, we have texttt{dots to[out=50,in=textbf{210}] (1,2) circle(1pt)
to[textbf{out=30},in=240] dots} to illustrate this. Notice that the
texttt{looseness} key can be of great help here.

begin{tikzpicture}
draw[latex-latex] (0,4) |- (6,0);
draw[blue] (0,0) circle(1pt) to[out=50,in=210] (1,2) circle(1pt)
to[out=30,in=240,looseness=0.5] (3,3) circle(1pt);
end{tikzpicture}

subsection*{Your idea: find an analytic formula}
This is IMHO often the simplest way. One only needs to keep in mind a few basic
functions like $sin$ and $tanh$.

begin{tikzpicture}
draw[latex-latex] (0,4) |- (6,0);
draw[blue] plot[variable=x,domain=0:6,smooth]
({x},{1+0.3*(tanh(3-x)+1)*sin(180*x)+0.2*x});
end{tikzpicture}

subsection*{Use texttt{plot[smooth] coordinates}}

A very convenient option, mentioned by Torj{o}rn T. in the comments, is to use
texttt{plot[smooth] coordinates}. You may want to play with the
texttt{tension} key.

begin{tikzpicture}
draw[latex-latex] (0,4) |- (6,0);
draw[blue] plot[smooth] coordinates
{(0,0) (1,2) (2,2) (3,3) (4,3)};
draw[red] plot[smooth,tension=2] coordinates
{(0,0) (1,2) (2,2) (3,3) (4,3)};
end{tikzpicture}

subsection*{Use the texttt{hobby} library}

The texttt{hobby} library is sort of an el Dorado for smooth curve
constructors. It has way too many options to be listed here. One thing I find
very useful is the texttt{tangent} style from the manual.

begin{tikzpicture}[tangent/.style={%
in angle={(180+#1)},Hobby finish ,
designated Hobby path=next , out angle=#1,
}]
draw[latex-latex] (0,4) |- (6,0);
draw[blue] plot[smooth,hobby,tension=0.3] coordinates
{(0,0) (1,1.2) (2,2) (3,3) (4,3)};
draw [red,use Hobby shortcut]
(0,0) .. ([tangent=30]1.5,1) .. ([tangent=-10]3,2) .. (5,1);
end{tikzpicture}

I'd also like to mention that, when it comes to decorations, in my experience
the Hobby paths are advantageous. They often do not lead to texttt{dimension too
large} errors when their almost identically looking texttt{plot[smooth]}
counterparts do.

subsection*{Not sure about texttt{controls}}

There is also the possibility of using Bezier curves (without texttt{hobby}).
Many users are able to use that to obtain great results. Unfortunately, I am not
one of those since IMHO the relation between position of the control points and
the outcome is not too obvious. But this is of course a very subjective
statement.
end{multicols}
end{document}


enter image description here






share|improve this answer












This is an attempt to collect some key methods on one page. Clearly, this discussion is not exhaustive, so I am hoping that this post gets complemented by others, who have other methods and/or opinions. (I made zero effort to precisely reproduce your curves, sorry.)



documentclass{article}
usepackage[margin=1in]{geometry}
usepackage{multicol}
usepackage{tikz}
usetikzlibrary{hobby}
begin{document}
section*{A few ideas to draw smooth curves}

begin{multicols}{2}
subsection*{Your idea: use texttt{out} and texttt{in}}
This works, and the result looks smooth if you make sure that the texttt{in}
of one point and the texttt{out} of the next point differ by 180. In the
following pic, we have texttt{dots to[out=50,in=textbf{210}] (1,2) circle(1pt)
to[textbf{out=30},in=240] dots} to illustrate this. Notice that the
texttt{looseness} key can be of great help here.

begin{tikzpicture}
draw[latex-latex] (0,4) |- (6,0);
draw[blue] (0,0) circle(1pt) to[out=50,in=210] (1,2) circle(1pt)
to[out=30,in=240,looseness=0.5] (3,3) circle(1pt);
end{tikzpicture}

subsection*{Your idea: find an analytic formula}
This is IMHO often the simplest way. One only needs to keep in mind a few basic
functions like $sin$ and $tanh$.

begin{tikzpicture}
draw[latex-latex] (0,4) |- (6,0);
draw[blue] plot[variable=x,domain=0:6,smooth]
({x},{1+0.3*(tanh(3-x)+1)*sin(180*x)+0.2*x});
end{tikzpicture}

subsection*{Use texttt{plot[smooth] coordinates}}

A very convenient option, mentioned by Torj{o}rn T. in the comments, is to use
texttt{plot[smooth] coordinates}. You may want to play with the
texttt{tension} key.

begin{tikzpicture}
draw[latex-latex] (0,4) |- (6,0);
draw[blue] plot[smooth] coordinates
{(0,0) (1,2) (2,2) (3,3) (4,3)};
draw[red] plot[smooth,tension=2] coordinates
{(0,0) (1,2) (2,2) (3,3) (4,3)};
end{tikzpicture}

subsection*{Use the texttt{hobby} library}

The texttt{hobby} library is sort of an el Dorado for smooth curve
constructors. It has way too many options to be listed here. One thing I find
very useful is the texttt{tangent} style from the manual.

begin{tikzpicture}[tangent/.style={%
in angle={(180+#1)},Hobby finish ,
designated Hobby path=next , out angle=#1,
}]
draw[latex-latex] (0,4) |- (6,0);
draw[blue] plot[smooth,hobby,tension=0.3] coordinates
{(0,0) (1,1.2) (2,2) (3,3) (4,3)};
draw [red,use Hobby shortcut]
(0,0) .. ([tangent=30]1.5,1) .. ([tangent=-10]3,2) .. (5,1);
end{tikzpicture}

I'd also like to mention that, when it comes to decorations, in my experience
the Hobby paths are advantageous. They often do not lead to texttt{dimension too
large} errors when their almost identically looking texttt{plot[smooth]}
counterparts do.

subsection*{Not sure about texttt{controls}}

There is also the possibility of using Bezier curves (without texttt{hobby}).
Many users are able to use that to obtain great results. Unfortunately, I am not
one of those since IMHO the relation between position of the control points and
the outcome is not too obvious. But this is of course a very subjective
statement.
end{multicols}
end{document}


enter image description here







share|improve this answer












share|improve this answer



share|improve this answer










answered Dec 1 at 18:16









marmot

83.6k493178




83.6k493178












  • (+1+AC) I didn't expect to get such a good answer when asking my question! Not only that you provide a clear explaination and good examples, but you also answered in a very creative way - I like it. Now it is much easier for me to draw the attached figure. Thank you very much!
    – JouleV
    Dec 1 at 19:21










  • +1: Perfect as usual!
    – Dr. Manuel Kuehner
    Dec 1 at 20:03


















  • (+1+AC) I didn't expect to get such a good answer when asking my question! Not only that you provide a clear explaination and good examples, but you also answered in a very creative way - I like it. Now it is much easier for me to draw the attached figure. Thank you very much!
    – JouleV
    Dec 1 at 19:21










  • +1: Perfect as usual!
    – Dr. Manuel Kuehner
    Dec 1 at 20:03
















(+1+AC) I didn't expect to get such a good answer when asking my question! Not only that you provide a clear explaination and good examples, but you also answered in a very creative way - I like it. Now it is much easier for me to draw the attached figure. Thank you very much!
– JouleV
Dec 1 at 19:21




(+1+AC) I didn't expect to get such a good answer when asking my question! Not only that you provide a clear explaination and good examples, but you also answered in a very creative way - I like it. Now it is much easier for me to draw the attached figure. Thank you very much!
– JouleV
Dec 1 at 19:21












+1: Perfect as usual!
– Dr. Manuel Kuehner
Dec 1 at 20:03




+1: Perfect as usual!
– Dr. Manuel Kuehner
Dec 1 at 20:03










up vote
3
down vote













put a coordinatesystem over the given images and choose some points:



documentclass[pstricks,border=12pt]{standalone}
usepackage{pst-plot}
begin{document}
begin{pspicture}(-0.5,-0.5)(6.4,6.4)
psaxes[labels=none,ticks=none]{->}(6,6)[$n$,0][,0]
psxTick(1.8){n_0}
pscurve[linecolor=red,linewidth=1.5pt]%
(0,1.6)(0.4,1.1)(0.6,0.9)(0.9,1.2)(1,1.8)(1.4,3)(1.8,2.5)(2,2)(2.3,1.9)(3,2.2)(4.5,3)(6,3.4)
pscurve[linecolor=blue,linewidth=1.5pt](0,1)(1,1.8)(1.8,2.5)(2.5,3)(3.5,3.4)(4.5,4)(6,5)
psline[linestyle=dashed](1.8,0)(1.8,2.5)
rput[r](6,5.2){textcolor{blue}{$cg(n)$}}
rput[r](6,3.5){textcolor{red}{$f(n)$}}
end{pspicture}
end{document}


enter image description here






share|improve this answer





















  • (+1) Thank you very much! The graph looks very nice, and from your code I think I can draw the rest.
    – JouleV
    Dec 1 at 19:22















up vote
3
down vote













put a coordinatesystem over the given images and choose some points:



documentclass[pstricks,border=12pt]{standalone}
usepackage{pst-plot}
begin{document}
begin{pspicture}(-0.5,-0.5)(6.4,6.4)
psaxes[labels=none,ticks=none]{->}(6,6)[$n$,0][,0]
psxTick(1.8){n_0}
pscurve[linecolor=red,linewidth=1.5pt]%
(0,1.6)(0.4,1.1)(0.6,0.9)(0.9,1.2)(1,1.8)(1.4,3)(1.8,2.5)(2,2)(2.3,1.9)(3,2.2)(4.5,3)(6,3.4)
pscurve[linecolor=blue,linewidth=1.5pt](0,1)(1,1.8)(1.8,2.5)(2.5,3)(3.5,3.4)(4.5,4)(6,5)
psline[linestyle=dashed](1.8,0)(1.8,2.5)
rput[r](6,5.2){textcolor{blue}{$cg(n)$}}
rput[r](6,3.5){textcolor{red}{$f(n)$}}
end{pspicture}
end{document}


enter image description here






share|improve this answer





















  • (+1) Thank you very much! The graph looks very nice, and from your code I think I can draw the rest.
    – JouleV
    Dec 1 at 19:22













up vote
3
down vote










up vote
3
down vote









put a coordinatesystem over the given images and choose some points:



documentclass[pstricks,border=12pt]{standalone}
usepackage{pst-plot}
begin{document}
begin{pspicture}(-0.5,-0.5)(6.4,6.4)
psaxes[labels=none,ticks=none]{->}(6,6)[$n$,0][,0]
psxTick(1.8){n_0}
pscurve[linecolor=red,linewidth=1.5pt]%
(0,1.6)(0.4,1.1)(0.6,0.9)(0.9,1.2)(1,1.8)(1.4,3)(1.8,2.5)(2,2)(2.3,1.9)(3,2.2)(4.5,3)(6,3.4)
pscurve[linecolor=blue,linewidth=1.5pt](0,1)(1,1.8)(1.8,2.5)(2.5,3)(3.5,3.4)(4.5,4)(6,5)
psline[linestyle=dashed](1.8,0)(1.8,2.5)
rput[r](6,5.2){textcolor{blue}{$cg(n)$}}
rput[r](6,3.5){textcolor{red}{$f(n)$}}
end{pspicture}
end{document}


enter image description here






share|improve this answer












put a coordinatesystem over the given images and choose some points:



documentclass[pstricks,border=12pt]{standalone}
usepackage{pst-plot}
begin{document}
begin{pspicture}(-0.5,-0.5)(6.4,6.4)
psaxes[labels=none,ticks=none]{->}(6,6)[$n$,0][,0]
psxTick(1.8){n_0}
pscurve[linecolor=red,linewidth=1.5pt]%
(0,1.6)(0.4,1.1)(0.6,0.9)(0.9,1.2)(1,1.8)(1.4,3)(1.8,2.5)(2,2)(2.3,1.9)(3,2.2)(4.5,3)(6,3.4)
pscurve[linecolor=blue,linewidth=1.5pt](0,1)(1,1.8)(1.8,2.5)(2.5,3)(3.5,3.4)(4.5,4)(6,5)
psline[linestyle=dashed](1.8,0)(1.8,2.5)
rput[r](6,5.2){textcolor{blue}{$cg(n)$}}
rput[r](6,3.5){textcolor{red}{$f(n)$}}
end{pspicture}
end{document}


enter image description here







share|improve this answer












share|improve this answer



share|improve this answer










answered Dec 1 at 19:04









Herbert

268k23407716




268k23407716












  • (+1) Thank you very much! The graph looks very nice, and from your code I think I can draw the rest.
    – JouleV
    Dec 1 at 19:22


















  • (+1) Thank you very much! The graph looks very nice, and from your code I think I can draw the rest.
    – JouleV
    Dec 1 at 19:22
















(+1) Thank you very much! The graph looks very nice, and from your code I think I can draw the rest.
– JouleV
Dec 1 at 19:22




(+1) Thank you very much! The graph looks very nice, and from your code I think I can draw the rest.
– JouleV
Dec 1 at 19:22










up vote
1
down vote













As suggest by marmot it is possible to use Bezier curves. For things like this I use TikzEdt, a very useful software for translate a diagram in TikZ. I import the diagram with node{includegraphics{YourDiagram}};and use the Bezier tool of TikzEdt to replicate exactly the diagram.
For example for your first plot I get the following result:



documentclass[10pt,a4paper]{article}
usepackage[latin1]{inputenc}
usepackage{tikz}
begin{document}
begin{tikzpicture}
%node{includegraphics[width=2textwidth]{YourDiagram}};%import the diagram that you want to copy in TikzEdt

%draw [help lines, step=.1cm] (-22.8,-7.4) grid (-7.7,8.2);

draw (-21,-1.8) .. controls (-19.9,-1.8)
and (-19.7,-1.6) .. (-19.3,-2) .. controls (-18.5,-2.8)
and (-18.5,-1.7) .. (-18,-0.9) .. controls (-16.9,0.4)
and (-15.6,0.6) .. (-14.2,1.2) .. controls (-13,1.6)
and (-11.9,1.9) .. (-10.2,3.3) node[above]{{LARGE$f(n)$}};

draw(-21,-3.8) .. controls (-20.3,-3.1)
and (-20,-2.8) .. (-19.7,-2.4) .. controls (-18.9,-1.4)
and (-17.9,-1.4) .. (-17.6,-1.4) .. controls (-16.2,-1.4)
and (-16.1,-1.1) .. (-15.8,-0.9) .. controls (-15.1,-0.2)
and (-14.8,0.1) .. (-13.4,0.5) .. controls (-12.5,0.7)
and (-12,0.8) .. (-10.2,1.1) node[above]{{LARGE$c_1g(n)$}};

draw(-21,-3.8) .. controls (-20.7,-3.2)
and (-20.4,-2.7) .. (-19.8,-1.2) .. controls (-19.1,0.4)
and (-18.5,1.2) .. (-17,1.1) .. controls (-16.4,1.1)
and (-16.1,1.5) .. (-15.5,2.5) .. controls (-15.1,3.3)
and (-14.6,4.1) .. (-13.5,4.7) .. controls (-12.7,5.1)
and (-12.3,5.3) .. (-10.2,6.1) node[above]{{LARGE$c_2g(n)$}};

draw (-21,7.1) -- (-21,-3.8) -- (-10.1,-3.8) node[right]{{LARGE$n$}};

draw[dashed] (-18.3,0.8) -- (-18.3,-3.8) node[below] {LARGE{$n_0$}};
end{tikzpicture}
end{document}


Diagram in TikZ with TikzEdt






share|improve this answer





















  • (+1) Your picture looks very nice and is nearly the same with my picture. Thank you very much for providing me a nice TikZ tool - which will be useful for me to draw complicated TikZ figures. Yep, but... the aim of the question is not to find a supporting software. Anyway, your help is highly appreciated!
    – JouleV
    Dec 4 at 13:14






  • 1




    As daleif and marmot said, when you use Bezier curves it is difficult to place correctly the control points. With TikzEdt you can place exactly the control points and with the autocompilation you get immediatly the result for further adjustments. Therefore it is very easy to replicate anything and translate it in TikZ. TikzEdt is not an exportation tool. In some sense with TikzEdt you can easly realize your first idea for draw your graphs (divide the line and draw it piece by piece). I made the above picture in 10 minutes.
    – vi pa
    Dec 4 at 14:06

















up vote
1
down vote













As suggest by marmot it is possible to use Bezier curves. For things like this I use TikzEdt, a very useful software for translate a diagram in TikZ. I import the diagram with node{includegraphics{YourDiagram}};and use the Bezier tool of TikzEdt to replicate exactly the diagram.
For example for your first plot I get the following result:



documentclass[10pt,a4paper]{article}
usepackage[latin1]{inputenc}
usepackage{tikz}
begin{document}
begin{tikzpicture}
%node{includegraphics[width=2textwidth]{YourDiagram}};%import the diagram that you want to copy in TikzEdt

%draw [help lines, step=.1cm] (-22.8,-7.4) grid (-7.7,8.2);

draw (-21,-1.8) .. controls (-19.9,-1.8)
and (-19.7,-1.6) .. (-19.3,-2) .. controls (-18.5,-2.8)
and (-18.5,-1.7) .. (-18,-0.9) .. controls (-16.9,0.4)
and (-15.6,0.6) .. (-14.2,1.2) .. controls (-13,1.6)
and (-11.9,1.9) .. (-10.2,3.3) node[above]{{LARGE$f(n)$}};

draw(-21,-3.8) .. controls (-20.3,-3.1)
and (-20,-2.8) .. (-19.7,-2.4) .. controls (-18.9,-1.4)
and (-17.9,-1.4) .. (-17.6,-1.4) .. controls (-16.2,-1.4)
and (-16.1,-1.1) .. (-15.8,-0.9) .. controls (-15.1,-0.2)
and (-14.8,0.1) .. (-13.4,0.5) .. controls (-12.5,0.7)
and (-12,0.8) .. (-10.2,1.1) node[above]{{LARGE$c_1g(n)$}};

draw(-21,-3.8) .. controls (-20.7,-3.2)
and (-20.4,-2.7) .. (-19.8,-1.2) .. controls (-19.1,0.4)
and (-18.5,1.2) .. (-17,1.1) .. controls (-16.4,1.1)
and (-16.1,1.5) .. (-15.5,2.5) .. controls (-15.1,3.3)
and (-14.6,4.1) .. (-13.5,4.7) .. controls (-12.7,5.1)
and (-12.3,5.3) .. (-10.2,6.1) node[above]{{LARGE$c_2g(n)$}};

draw (-21,7.1) -- (-21,-3.8) -- (-10.1,-3.8) node[right]{{LARGE$n$}};

draw[dashed] (-18.3,0.8) -- (-18.3,-3.8) node[below] {LARGE{$n_0$}};
end{tikzpicture}
end{document}


Diagram in TikZ with TikzEdt






share|improve this answer





















  • (+1) Your picture looks very nice and is nearly the same with my picture. Thank you very much for providing me a nice TikZ tool - which will be useful for me to draw complicated TikZ figures. Yep, but... the aim of the question is not to find a supporting software. Anyway, your help is highly appreciated!
    – JouleV
    Dec 4 at 13:14






  • 1




    As daleif and marmot said, when you use Bezier curves it is difficult to place correctly the control points. With TikzEdt you can place exactly the control points and with the autocompilation you get immediatly the result for further adjustments. Therefore it is very easy to replicate anything and translate it in TikZ. TikzEdt is not an exportation tool. In some sense with TikzEdt you can easly realize your first idea for draw your graphs (divide the line and draw it piece by piece). I made the above picture in 10 minutes.
    – vi pa
    Dec 4 at 14:06















up vote
1
down vote










up vote
1
down vote









As suggest by marmot it is possible to use Bezier curves. For things like this I use TikzEdt, a very useful software for translate a diagram in TikZ. I import the diagram with node{includegraphics{YourDiagram}};and use the Bezier tool of TikzEdt to replicate exactly the diagram.
For example for your first plot I get the following result:



documentclass[10pt,a4paper]{article}
usepackage[latin1]{inputenc}
usepackage{tikz}
begin{document}
begin{tikzpicture}
%node{includegraphics[width=2textwidth]{YourDiagram}};%import the diagram that you want to copy in TikzEdt

%draw [help lines, step=.1cm] (-22.8,-7.4) grid (-7.7,8.2);

draw (-21,-1.8) .. controls (-19.9,-1.8)
and (-19.7,-1.6) .. (-19.3,-2) .. controls (-18.5,-2.8)
and (-18.5,-1.7) .. (-18,-0.9) .. controls (-16.9,0.4)
and (-15.6,0.6) .. (-14.2,1.2) .. controls (-13,1.6)
and (-11.9,1.9) .. (-10.2,3.3) node[above]{{LARGE$f(n)$}};

draw(-21,-3.8) .. controls (-20.3,-3.1)
and (-20,-2.8) .. (-19.7,-2.4) .. controls (-18.9,-1.4)
and (-17.9,-1.4) .. (-17.6,-1.4) .. controls (-16.2,-1.4)
and (-16.1,-1.1) .. (-15.8,-0.9) .. controls (-15.1,-0.2)
and (-14.8,0.1) .. (-13.4,0.5) .. controls (-12.5,0.7)
and (-12,0.8) .. (-10.2,1.1) node[above]{{LARGE$c_1g(n)$}};

draw(-21,-3.8) .. controls (-20.7,-3.2)
and (-20.4,-2.7) .. (-19.8,-1.2) .. controls (-19.1,0.4)
and (-18.5,1.2) .. (-17,1.1) .. controls (-16.4,1.1)
and (-16.1,1.5) .. (-15.5,2.5) .. controls (-15.1,3.3)
and (-14.6,4.1) .. (-13.5,4.7) .. controls (-12.7,5.1)
and (-12.3,5.3) .. (-10.2,6.1) node[above]{{LARGE$c_2g(n)$}};

draw (-21,7.1) -- (-21,-3.8) -- (-10.1,-3.8) node[right]{{LARGE$n$}};

draw[dashed] (-18.3,0.8) -- (-18.3,-3.8) node[below] {LARGE{$n_0$}};
end{tikzpicture}
end{document}


Diagram in TikZ with TikzEdt






share|improve this answer












As suggest by marmot it is possible to use Bezier curves. For things like this I use TikzEdt, a very useful software for translate a diagram in TikZ. I import the diagram with node{includegraphics{YourDiagram}};and use the Bezier tool of TikzEdt to replicate exactly the diagram.
For example for your first plot I get the following result:



documentclass[10pt,a4paper]{article}
usepackage[latin1]{inputenc}
usepackage{tikz}
begin{document}
begin{tikzpicture}
%node{includegraphics[width=2textwidth]{YourDiagram}};%import the diagram that you want to copy in TikzEdt

%draw [help lines, step=.1cm] (-22.8,-7.4) grid (-7.7,8.2);

draw (-21,-1.8) .. controls (-19.9,-1.8)
and (-19.7,-1.6) .. (-19.3,-2) .. controls (-18.5,-2.8)
and (-18.5,-1.7) .. (-18,-0.9) .. controls (-16.9,0.4)
and (-15.6,0.6) .. (-14.2,1.2) .. controls (-13,1.6)
and (-11.9,1.9) .. (-10.2,3.3) node[above]{{LARGE$f(n)$}};

draw(-21,-3.8) .. controls (-20.3,-3.1)
and (-20,-2.8) .. (-19.7,-2.4) .. controls (-18.9,-1.4)
and (-17.9,-1.4) .. (-17.6,-1.4) .. controls (-16.2,-1.4)
and (-16.1,-1.1) .. (-15.8,-0.9) .. controls (-15.1,-0.2)
and (-14.8,0.1) .. (-13.4,0.5) .. controls (-12.5,0.7)
and (-12,0.8) .. (-10.2,1.1) node[above]{{LARGE$c_1g(n)$}};

draw(-21,-3.8) .. controls (-20.7,-3.2)
and (-20.4,-2.7) .. (-19.8,-1.2) .. controls (-19.1,0.4)
and (-18.5,1.2) .. (-17,1.1) .. controls (-16.4,1.1)
and (-16.1,1.5) .. (-15.5,2.5) .. controls (-15.1,3.3)
and (-14.6,4.1) .. (-13.5,4.7) .. controls (-12.7,5.1)
and (-12.3,5.3) .. (-10.2,6.1) node[above]{{LARGE$c_2g(n)$}};

draw (-21,7.1) -- (-21,-3.8) -- (-10.1,-3.8) node[right]{{LARGE$n$}};

draw[dashed] (-18.3,0.8) -- (-18.3,-3.8) node[below] {LARGE{$n_0$}};
end{tikzpicture}
end{document}


Diagram in TikZ with TikzEdt







share|improve this answer












share|improve this answer



share|improve this answer










answered Dec 4 at 13:10









vi pa

39210




39210












  • (+1) Your picture looks very nice and is nearly the same with my picture. Thank you very much for providing me a nice TikZ tool - which will be useful for me to draw complicated TikZ figures. Yep, but... the aim of the question is not to find a supporting software. Anyway, your help is highly appreciated!
    – JouleV
    Dec 4 at 13:14






  • 1




    As daleif and marmot said, when you use Bezier curves it is difficult to place correctly the control points. With TikzEdt you can place exactly the control points and with the autocompilation you get immediatly the result for further adjustments. Therefore it is very easy to replicate anything and translate it in TikZ. TikzEdt is not an exportation tool. In some sense with TikzEdt you can easly realize your first idea for draw your graphs (divide the line and draw it piece by piece). I made the above picture in 10 minutes.
    – vi pa
    Dec 4 at 14:06




















  • (+1) Your picture looks very nice and is nearly the same with my picture. Thank you very much for providing me a nice TikZ tool - which will be useful for me to draw complicated TikZ figures. Yep, but... the aim of the question is not to find a supporting software. Anyway, your help is highly appreciated!
    – JouleV
    Dec 4 at 13:14






  • 1




    As daleif and marmot said, when you use Bezier curves it is difficult to place correctly the control points. With TikzEdt you can place exactly the control points and with the autocompilation you get immediatly the result for further adjustments. Therefore it is very easy to replicate anything and translate it in TikZ. TikzEdt is not an exportation tool. In some sense with TikzEdt you can easly realize your first idea for draw your graphs (divide the line and draw it piece by piece). I made the above picture in 10 minutes.
    – vi pa
    Dec 4 at 14:06


















(+1) Your picture looks very nice and is nearly the same with my picture. Thank you very much for providing me a nice TikZ tool - which will be useful for me to draw complicated TikZ figures. Yep, but... the aim of the question is not to find a supporting software. Anyway, your help is highly appreciated!
– JouleV
Dec 4 at 13:14




(+1) Your picture looks very nice and is nearly the same with my picture. Thank you very much for providing me a nice TikZ tool - which will be useful for me to draw complicated TikZ figures. Yep, but... the aim of the question is not to find a supporting software. Anyway, your help is highly appreciated!
– JouleV
Dec 4 at 13:14




1




1




As daleif and marmot said, when you use Bezier curves it is difficult to place correctly the control points. With TikzEdt you can place exactly the control points and with the autocompilation you get immediatly the result for further adjustments. Therefore it is very easy to replicate anything and translate it in TikZ. TikzEdt is not an exportation tool. In some sense with TikzEdt you can easly realize your first idea for draw your graphs (divide the line and draw it piece by piece). I made the above picture in 10 minutes.
– vi pa
Dec 4 at 14:06






As daleif and marmot said, when you use Bezier curves it is difficult to place correctly the control points. With TikzEdt you can place exactly the control points and with the autocompilation you get immediatly the result for further adjustments. Therefore it is very easy to replicate anything and translate it in TikZ. TikzEdt is not an exportation tool. In some sense with TikzEdt you can easly realize your first idea for draw your graphs (divide the line and draw it piece by piece). I made the above picture in 10 minutes.
– vi pa
Dec 4 at 14:06




















draft saved

draft discarded




















































Thanks for contributing an answer to TeX - LaTeX Stack Exchange!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.





Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


Please pay close attention to the following guidance:


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f462721%2fdraw-curved-lines-simply%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Quarter-circle Tiles

build a pushdown automaton that recognizes the reverse language of a given pushdown automaton?

Mont Emei