1

I'd like to produce diagrams such as this:

enter image description here

It is purely illustrative. There are no numbers attached to any of the points.

What is the simplest way for me to generate diagrams like this for a LaTeX document? TikZ, or pgfplot, or metapost or something else?

Ana
  • 111
  • 1
    Use pgfplots with a fake function and fake slopes. – alfC Jan 29 '16 at 20:24
  • 2
    ...there is no "best" way. – Werner Jan 29 '16 at 20:29
  • You also can try pstricks-add which defines commands for plotting tangent lines and normal to curves. – Bernard Jan 29 '16 at 20:49
  • 1
    A lot of people take exception to questions of the form "Please draw this for me". You will get more help if you post some code showing what you have tried and give a minimal working example. –  Jan 29 '16 at 21:50
  • 1
    Easiest? Easiest is \includegraphics{}... assuming you have access to a copy of the desired image. Why do you want to draw it in LaTeX itself? Draw-in-LaTeX does not really go with Easiest. – cfr Jan 30 '16 at 00:10

1 Answers1

2

I can tell you what's the simplest way for me.

I use Inkscape to do the drawings and export as pstricks (Save As: "Latex + pstricks macros"). It took me ~5 mins to do the drawing. Everything in the mydiagram definition is generated by Inkscape.

\documentclass{article}
\usepackage{pstricks}

\newcommand*{\mydiagram}{%
    \psset{xunit=.5pt,yunit=.5pt,runit=.5pt}
    \begin{pspicture}(330.50705617,288.43274454)
    {
        \newrgbcolor{curcolor}{0 0 0}
        \pscustom[linewidth=1,linecolor=curcolor]
        {
            \newpath
            \moveto(0.5,288.43274454)
            \lineto(0.5,0.5)
            \lineto(330.50704768,0.5)
        }
    }
    {
        \newrgbcolor{curcolor}{0 0 0}
        \pscustom[linewidth=1,linecolor=curcolor]
        {
            \newpath
            \moveto(0.5,45.12426565)
            \lineto(130.01750712,186.28944553)
        }
    }
    {
        \newrgbcolor{curcolor}{0 0 0}
        \pscustom[linewidth=1,linecolor=curcolor]
        {
            \newpath
            \moveto(183.90275326,222.02202485)
            \lineto(325.51339417,272.5714033)
        }
    }
    {
        \newrgbcolor{curcolor}{0 0 0}
        \pscustom[linewidth=1,linecolor=curcolor]
        {
            \newpath
            \moveto(93.08775773,119.42213388)
            \curveto(97.50632542,132.2702716)(105.27221632,159.17255412)(127.77442721,183.87039437)
            \curveto(140.87266571,198.24672499)(158.1196668,212.82204774)(183.90275326,222.02202485)
            \curveto(193.19893824,225.33911657)(203.60481614,227.95741498)(215.32600504,229.61564371)
        }
    }
    {
        \newrgbcolor{curcolor}{0 0 0}
        \pscustom[linestyle=none,fillstyle=solid,fillcolor=curcolor]
        {
            \newpath
            \moveto(216.93720724,229.72948325)
            \curveto(216.93720724,228.79708086)(216.18134576,228.04121938)(215.24894338,228.04121938)
            \curveto(214.31654099,228.04121938)(213.56067951,228.79708086)(213.56067951,229.72948325)
            \curveto(213.56067951,230.66188564)(214.31654099,231.41774712)(215.24894338,231.41774712)
            \curveto(216.18134576,231.41774712)(216.93720724,230.66188564)(216.93720724,229.72948325)
            \closepath
        }
    }
    {
        \newrgbcolor{curcolor}{0 0 0}
        \pscustom[linewidth=1,linecolor=curcolor,linestyle=dashed,dash=5 5]
        {
            \newpath
            \moveto(130.01750712,186.28944553)
            \lineto(200.77793033,263.46440965)
        }
    }
    {
        \newrgbcolor{curcolor}{0 0 0}
        \pscustom[linewidth=1,linecolor=curcolor,linestyle=dashed,dash=5 5]
        {
            \newpath
            \moveto(0.5,156.54830295)
            \lineto(183.90275326,222.02202485)
        }
    }
    \end{pspicture} %
}

\begin{document}
    \mydiagram
\end{document}

mydiagram

alwaysask
  • 2,248
  • 13
  • 16
  • Unrelated comment: Generally, it's best to use article instead of minimal, see Why should the minimal class be avoided? – Torbjørn T. Jun 26 '16 at 12:12
  • @TorbjørnT. ... unless you make a standalone graphic or just for testing - http://tex.stackexchange.com/questions/20974/what-is-the-advantage-of-using-minimal-over-article-when-creating-a-standalone-g – alwaysask Jun 26 '16 at 12:24
  • 1
    For a standalone graphic, why not use the standalone class? Even though Stefan says might be sufficient, I don't read his answer as a clear recommendation to use minimal, in particular because \small, \large etc. are undefined. – Torbjørn T. Jun 26 '16 at 12:32
  • @TorbjørnT. There was no typesetting here, at that time I considered minimal class to be sufficient. – alwaysask Jun 26 '16 at 12:40
  • Sure. I did say generally, and it was also intended as information for anyone else who might see the post, and who wasn't aware of the potential issues with minimal. (Sorry, should probably have been more explicit about that.) – Torbjørn T. Jun 26 '16 at 12:47
  • The point is that even if you know it is OK to use minimal in this particular case, lots of less experienced users will assume that minimal is suitable for minimal examples generally when it is not. So if you want to use it when testing yourself, that's no problem. But please don't use it when posting examples here as it causes entirely avoidable confusion for no benefit at all. – cfr Jun 27 '16 at 03:06
  • I edited the MWE and changed the documentclass from minimal to article. – alwaysask Jun 27 '16 at 04:22