# Absolute value of a function in tikz

Being a beginner, I'm having difficulty in plotting |sinx|. Can anyone help me with plotting y=|sinx| in [0,2pi] and y=0 elsewhere in tikz?

• Please show the code you have tried so far! Dec 2, 2021 at 14:30
• Sir I used package tikzpicture and I couldn't proceed after \begin{tikzpicture} \end{tikzpicture}. Dec 2, 2021 at 14:32
• I suggest looking the related package pgfplots and its documentation. Dec 2, 2021 at 14:34
• You can try looking here or here or here or here or Google: plot function tikz Dec 2, 2021 at 21:36
• Also, pgfplots would use abs(sin(x)) to calculate y. Look up Part VIII in the pgf manual and subsection 4.4.3 in the pgfplots manual. Dec 2, 2021 at 21:56