Skip to content

Instantly share code, notes, and snippets.

@abikoushi
Created March 10, 2023 06:22
Show Gist options
  • Save abikoushi/89a75230285de86fd71e403410f1a2b2 to your computer and use it in GitHub Desktop.
Save abikoushi/89a75230285de86fd71e403410f1a2b2 to your computer and use it in GitHub Desktop.
draw curve on tikz
\documentclass[dvipdfmx, margin=5pt]{standalone}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
\def \gamma{\x, \x * exp(-\x)}
\fill [fill=gray!30] (0.5,0) -- plot[domain=0:0.5] (\gamma) -- (0.5, 0) -- cycle;
\fill [fill=gray!30] (2,0) -- plot[domain=2:2.5] (\gamma) -- (2.5, 0) -- cycle;
\fill [fill=gray!30] (4,0) -- plot[domain=4:5] (\gamma) -- (5, 0) -- cycle;
\draw[color=black, domain=0:5, samples=100] plot (\gamma) node[right] {};
\draw[->, very thin] (0,0) -- (5.1,0) node[right] {};
\draw (0.25, 0) node[below] {$h_1$};
\draw (1.25, 0) node[below] {$\cdots$};
\draw (2.25, 0) node[below] {$h_j$};
\draw (3.25, 0) node[below] {$\cdots$};
\draw (4.5, 0) node[below] {$h_m$};
\end{tikzpicture}
\end{document}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment