I need to draw these two graphs using LaTeX, but so far I have no sucess.
This is the closest I got to the first one (for the second one I have no MWE unfortunately)
\documentclass[14pt]{extarticle}
\usepackage[margin=1in]{geometry}
\usepackage{etoolbox}
\usepackage{tikz}
\usetikzlibrary{calc,patterns,angles,quotes}
\usetikzlibrary{through,arrows,shapes,trees,positioning}
\usepackage{pgfplots}
\usepackage{accents}
\pgfplotsset{width=7cm,compat=newest}
\usepackage{accents}
\usepackage{calc}
\usepackage{pst-node}
\makeatletter
\pgfplotsset{
/tikz/max node/.style={
anchor=south
},
/tikz/min node/.style={
anchor=north
},
mark min/.style={
point meta rel=per plot,
visualization depends on={x \as \xvalue},
scatter/@pre marker code/.code={%
\ifx\pgfplotspointmeta\pgfplots@metamin
\def\markopts{}%
\node [min node] {
\pgfmathprintnumber[fixed]{\xvalue},%
\pgfmathprintnumber[fixed]{\pgfplotspointmeta}
};
\else
\def\markopts{mark=none}
\fi
\expandafter\scope\expandafter[\markopts,every node near coord/.style=green]
},%
scatter/@post marker code/.code={%
\endscope
},
scatter,
},
mark max/.style={
point meta rel=per plot,
visualization depends on={x \as \xvalue},
scatter/@pre marker code/.code={%
\ifx\pgfplotspointmeta\pgfplots@metamax
\def\markopts{}%
\node [max node] {
\pgfmathprintnumber[fixed]{\xvalue},%
\pgfmathprintnumber[fixed]{\pgfplotspointmeta}
};
\else
\def\markopts{mark=none}
\fi
\expandafter\scope\expandafter[\markopts]
},%
scatter/@post marker code/.code={%
\endscope
},
scatter
}
}
\makeatother
\begin{document}
\begin{tikzpicture}
\begin{axis}[
xlabel=$$,
ylabel=$$
]
\addplot[mark min, every node near coord/.style=] {sin(deg(x))};
\end{axis}
\end{tikzpicture}
\end{document}
Thank you in advance
pst-node
and most of tikz libraries in this case ? Also,mark min
does not seem to be a defaulttikz
orpgfplots
style, which makes your snippet not compilable. Could you please update it ?