TeX - LaTeX Asked by Gomesz785 on July 30, 2021
documentclass[12pt,a4paper]{article}
usepackage[T1]{fontenc}
usepackage{amsmath}
usepackage{amsfonts}
usepackage{amssymb}
usepackage{pgfplots}pgfplotsset{compat=1.18}
begin{document}
begin{tikzpicture}
begin{axis}
[
% explicitly specify axis limits
xmin=0,xmax=1,ymin=0,ymax=1,zmin=18,zmax=26,
xlabel={x},
ylabel={y},
grid,
% do not clip the draw commands and clip each
% addplot to its domain
clip mode=individual,
]
% line on the xy plane (that way goes behind the surface)
% we mark a point at 30% of the line
draw[thick] (0.4,0,18) -- (0.4,1,18) coordinate[pos=0.3](a);
% line touching the parabola
draw[thick] (0.4,0,18) -- (0.4,0.3,25-5*0.4*0.4-0.3*0.3) coordinate[pos=0.3](b);% coordinate on the black parabola
% main surface, semi-transparent
addplot3[blue, no marks, surf, domain=0:1, samples=10, opacity=0.9] {25-5*x*x -y*y};
% graph restricted at at y=0.3 (parametric curve format)
addplot3[ultra thick, no marks, domain=0:1, samples=10, samples y=1] (x, 0.3, 25-5*x*x -0.3*0.3);
% draw spline and angle label
% in and out are the angle at which the curve leaves the final and initial point
draw[thick,->] (a) to[out=100, in=-10] node[midway, above right]{$alpha$} (b);
end{axis}
end{tikzpicture}
end{document}
What does coordinate[pos=0.3]
do in a draw
command? like does it have to do with somekind of panning in the graph?
Another question:
Tell me a wonderful way to put pgfplot
examples in the public domain. I am thinking a GitHub repository such as APEXCalculus. Do any of you have a good idea?
As a personal advice, you should really go through the tutorials in the Tikz manual, especially the first one; otherwise you will spend much more time with this kind of doubts. pgfplots
is based on TikZ, and as you need basic arithmetic to understand algebra, so you should learn TikZ to use pgfplots
or other libraries based on it.
Anyway
draw (0,0) -- (1,1);
draws a line from (0,0)
to (1,1)
in the current coordinate system.
draw (0,0) -- (1,1) coordinate(A);
gives a name to the coordinate (1,1)
that you can reuse (so that for example, you can change coordinates in a drawing in just one place).
draw (0,0) -- (1,1) coordinate[pos=0.3145](B);
gives a name to the coordinate in the segment from (0,0)
to (1,1)
at the position 0.3145
(where 0
corresponds to (0,0)
and 1
to (1,1)
).
Example:
documentclass[border=10pt]{standalone}
usepackage{tikz}
begin{document}
begin{tikzpicture}[]
draw (0,0) -- (1,1) coordinate(A);
draw (0,-2) -- (1,-1) coordinate[pos=0.3](B);
draw [red] (A) -- (B);
end{tikzpicture}
end{document}
Answered by Rmano on July 30, 2021
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP