Plotting functions

functions-001.pngfunctions-002.pngfunctions-003.png

Edit and compile if you like:

% Author: Izaak Neutelings (June, 2017)
% based on code from a friend
\documentclass[border=3pt,tikz]{standalone}
\usepackage{amsmath} % for \dfrac
\usepackage{tikz}
\tikzset{>=latex} % for LaTeX arrow head
\usepackage{pgfplots} % for the axis environment
\begin{document}
% DRAW PLOT: sin, cos, tan
\begin{tikzpicture}[domain=-pi:pi,xscale=2/pi]
%https://tex.stackexchange.com/questions/45151/format-numbers-as-a-fraction-of-pi-with-tikz-pgfmathprintnumber
% limits
\def\xa{ -pi-0.3}
\def\xb{3*pi+0.4}
\def\ya{-3.4}
\def\yb{ 3.6}
\def\N{100} % number of points
% axes & grid
\draw[xstep=pi/2,very thin, color=gray]
(\xa,\ya) grid (\xb,\yb);
\draw[->]
(\xa,0) -- (\xb,0)
node[right] {$x$};
\draw[->]
(0,\ya) -- (0,\yb)
node[left] {$y$};
% ticks
\draw[] % x
node[below,scale=0.9] at ( -pi, 0) {$-\pi$}
node[below,scale=0.9] at ( -pi/2, 0) {$-\dfrac{\pi}{2}$}
node[below,scale=0.9] at ( 0, 0) {0}
node[below,scale=0.9] at ( pi/2, 0) {$\dfrac{\pi}{2}$}
node[below,scale=0.9] at ( pi, 0) {$\pi$}
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Click to download: functions.texfunctions.pdf
Open in Overleaf: functions.tex

One Reply to “Plotting functions”

  1. Nice work your graphs of trigonometric function! I have just noticed that line 42 is a duplicate of line 39.

Leave a Reply

Your email address will not be published.