# Questions about recreating a plot without knowing the function

I'm still learning how to plot functions. I'm currently using the pgfplots package, but let me know if there's a different one you recommend. I'm trying to recreate the following image from a PDF I found. Since the function is not given, is there a good way to approach drawing the curve? Moreover, how would one add the ticks to 2 and 10 along with the dashed lines? I appreciate the help. I have experience writing math formulas and whatnot in Tex, just not plots like this. It seems relatively basic, so I'm hoping to add it to my Tex knowledge.

• Welcome to TeX.SE :) Sep 12, 2021 at 20:38
• Hello and welcome to TeX-SE. I wouldn't do it with pgfplots but only with TikZ, especially using either Béziers curves or simply the to[out=<angle1>,in=<angle2>] command for a path. You'll find many useful informations here and ther on the website. Sep 12, 2021 at 21:47

Here are some hints for you about documentations.

1. Tutorial "PGF/TikZ - Graphics for LATEX", https://www.math.uni-leipzig.de/~hellmund/LaTeX/pgf-tut.pdf .

Check out e.g. p.4 (starting code), p.8 (curved lines), p.10 (arrows, dash patterns), p.12 (nodes, which is a way to place text labels).

1. For more details have a look at CTAN tikz, https://ctan.org/pkg/pgf?lang=en . The minimal introduction will introduce you to some basics, while the PGF manual is huge. I suggest to skim through the latter one first, and look for details, second, e.g. about curved lines.

We'd be happy, if you share your attempts and struggles, soon :) because it's always easier, and better suited for this group, to talk about concrete code.

P.S.: You may also want to check out the "Related" links column to the right ;-) // Please search in this group too, e.g. for curved lines, or click on your tags.

MS-SPO gave some good links and advices. Here's a starting point, just to show you how quickly this type of drawing can be done. Note that it is not the best option, because it's not totally accurate, but it's just to be considered as a starting point: \documentclass[tikz,border=3.14mm]{standalone}
\usetikzlibrary{arrows.meta}

\begin{document}
\begin{tikzpicture}[scale=0.5,>={Latex[scale=1.5]},line width=1pt,font=\large]
\draw[->] (-5,0) -- (30,0);
\draw[->] (0,-5) -- (0,25);

\draw (-5,15.5) to[out=-45,in=180,looseness=.8] (20,0) to[out=0,in=-100,looseness=.6] (30,25);
\draw[dotted] (10,0) node[below] {10}  |- (0,3) node[left] {2};
\end{tikzpicture}
\end{document}


With pgfplots. Curve is smooth line through three points (start, minimum and end) which coordinates are estimated from given picture:

\documentclass[border=3.141592]{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=1.18}
\usetikzlibrary{arrows.meta,
intersections}

\begin{document}
\begin{tikzpicture}%[>={Straight Barb[scale=0.8]}]
\begin{axis}[
axis lines=center,
xlabel = $T$,   ylabel = $C$,
label style = {anchor=north east},
ticks=none,
xmax=30, ymin=-1,
no markers,
]
\addplot + [thick, smooth, name path=A]
coordinates {(-5,7) (20,0.06) (30,12)};
\path[name path=B]  (0,2) -- (20,2);
\draw   [name intersections={of=A and B, by={x}}, densely dashed] % <---
(0,2) node[left] {2} -| (0,0 -| x) node[below] {10};
\node[below left] at (0,0) {0};
\end{axis}
\end{tikzpicture}
\end{document} Edit: due to rounding errors in the smooth macro, the curve cross T axis for about line thickness. That it will only touch it, the second coordinate should be moved up for a little bit, for example for 0.06. Thank you very much @Sebastiano for point me to this.

• Excuse me Zarko, but the blue curve is not tangent to the T-axis. Can you improve your function? Sep 13, 2021 at 23:17
• @Sebastiano, ugh, you are to precise. Yes, the curve for wee bit cross T-axis (due to calculation erros of splin functions used in smoot macto. It can be corrected by moving second coordinate for a little bit up. See corrected answer. Sep 14, 2021 at 6:40
• Very kind Zarko ☺️Why most people give me as a precise 'man' 😞? Also my students 🙂🙂 and all my friends. I like the esthetic especially for the women😉 Sep 14, 2021 at 12:24