Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Download

📚 The CoCalc Library - books, templates and other resources

132932 views
License: OTHER
1
\documentclass[varwidth=true, border=2pt]{standalone}
2
3
\usepackage{pgfplots}
4
\usepackage{tikz}
5
6
\begin{document}
7
\begin{tikzpicture}
8
\begin{axis}[
9
legend pos=south west,
10
axis x line=middle,
11
axis y line=middle,
12
grid = major,
13
%width=9cm,
14
%height=9cm,
15
grid style={dashed, gray!30},
16
xmin=-1.5, % start the diagram at this x-coordinate
17
xmax= 1.5, % end the diagram at this x-coordinate
18
%ymin=-0.25, % start the diagram at this y-coordinate
19
%ymax= 2.25, % end the diagram at this y-coordinate
20
axis background/.style={fill=white},
21
xlabel=$x$,
22
ylabel=$y$,
23
%xticklabels={-2,-1.6,...,7},
24
%yticklabels={-8,-7,...,8},
25
tick align=outside,
26
minor tick num=-3,
27
enlargelimits=true,
28
tension=0.08]
29
\addplot[domain=-1.5:1.5, red, thick,samples=50] {x*x};
30
\draw[blue, thick] \pgfextra{
31
\pgfpathellipse{\pgfplotspointaxisxy{0}{1}}
32
{\pgfplotspointaxisdirectionxy{0.87}{0}}
33
{\pgfplotspointaxisdirectionxy{0}{0.87}}
34
% see also the documentation of
35
% 'axis direction cs' which
36
% allows a simpler way to draw this ellipse
37
};
38
\end{axis}
39
\end{tikzpicture}
40
\end{document}
41
42