How could I graph z=sqrt(x^2-y^2) using Pgftools? I believe I've all suggestions on the internet but to no...
I have tried graphing it with the parametric notation (i.e. ({x},{y},{sort(x^2-y^2)}) and as seen on my code below but nothing renders the image shown on graphing calculators.
begin{tikzpicture}[scale=1.5]
begin{axis}[
grid=major,
3d box=complete,
enlargelimits=false,
colormap/cool,
xlabel=$x$,
ylabel=$y$,
zlabel=$z$,
zlabel style = {sloped like x axis}
]
addplot3 [
surf,
shader=faceted,
samples=50,
z buffer=sort,
] {sqrt((x)^2-(y)^2)};
end{axis}
end{tikzpicture}
tikz-pgf pgfplots plot 3d tikz-3dplot
add a comment |
I have tried graphing it with the parametric notation (i.e. ({x},{y},{sort(x^2-y^2)}) and as seen on my code below but nothing renders the image shown on graphing calculators.
begin{tikzpicture}[scale=1.5]
begin{axis}[
grid=major,
3d box=complete,
enlargelimits=false,
colormap/cool,
xlabel=$x$,
ylabel=$y$,
zlabel=$z$,
zlabel style = {sloped like x axis}
]
addplot3 [
surf,
shader=faceted,
samples=50,
z buffer=sort,
] {sqrt((x)^2-(y)^2)};
end{axis}
end{tikzpicture}
tikz-pgf pgfplots plot 3d tikz-3dplot
add a comment |
I have tried graphing it with the parametric notation (i.e. ({x},{y},{sort(x^2-y^2)}) and as seen on my code below but nothing renders the image shown on graphing calculators.
begin{tikzpicture}[scale=1.5]
begin{axis}[
grid=major,
3d box=complete,
enlargelimits=false,
colormap/cool,
xlabel=$x$,
ylabel=$y$,
zlabel=$z$,
zlabel style = {sloped like x axis}
]
addplot3 [
surf,
shader=faceted,
samples=50,
z buffer=sort,
] {sqrt((x)^2-(y)^2)};
end{axis}
end{tikzpicture}
tikz-pgf pgfplots plot 3d tikz-3dplot
I have tried graphing it with the parametric notation (i.e. ({x},{y},{sort(x^2-y^2)}) and as seen on my code below but nothing renders the image shown on graphing calculators.
begin{tikzpicture}[scale=1.5]
begin{axis}[
grid=major,
3d box=complete,
enlargelimits=false,
colormap/cool,
xlabel=$x$,
ylabel=$y$,
zlabel=$z$,
zlabel style = {sloped like x axis}
]
addplot3 [
surf,
shader=faceted,
samples=50,
z buffer=sort,
] {sqrt((x)^2-(y)^2)};
end{axis}
end{tikzpicture}
tikz-pgf pgfplots plot 3d tikz-3dplot
tikz-pgf pgfplots plot 3d tikz-3dplot
asked Feb 28 at 2:28
Daniel HernándezDaniel Hernández
152
152
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
You did almost everything right, pgfplots
is just not very good at taking the square root of a negative number. So if you adjust the domains a bit you get
documentclass[tikz,border=3.14mm]{standalone}
usepackage{tikz,pgfplots}
pgfplotsset{compat=1.16}
begin{document}
begin{tikzpicture}[scale=1.5]
begin{axis}[
grid=major,
3d box=complete,
enlargelimits=false,
colormap/cool,
xlabel=$x$,
ylabel=$y$,
zlabel=$z$,
zlabel style = {sloped like x axis}
]
addplot3 [domain=2:4,domain y=-2:2,
surf,
shader=faceted,
samples=50,
z buffer=sort,
] {sqrt(x^2-y^2)};
end{axis}
end{tikzpicture}
end{document}
As for your request in the comments, one can write the function as sqrt(u*v)
, where u=x+y
and v=x-y
. Then x=(u+v)/2
and y=(u-v)/2
. Since the variables are just placeholders in a parametric plot, we can rename u
and v
to x
and y
, respectively, and arrive at
documentclass[tikz,border=3.14mm]{standalone}
usepackage{pgfplots}
pgfplotsset{compat=1.16}
begin{document}
begin{tikzpicture}[scale=1.5]
begin{axis}[xmax=2,xmin=-2,
grid=major,
3d box=complete,
enlargelimits=false,
colormap/cool,
xlabel=$x$,
ylabel=$y$,
zlabel=$z$,
zlabel style = {sloped like x axis}
]
addplot3 [domain=0:4,domain y=0:4,
surf,
shader=faceted,
samples=50,
z buffer=sort,
] ({(x+y)/2},{(x-y)/2},{sqrt(x*y)});
addplot3 [domain=0:4,domain y=0:4,
surf,
shader=faceted,
samples=50,
z buffer=sort,
] ({-(x+y)/2},{-(x-y)/2},{sqrt(x*y)});
end{axis}
end{tikzpicture}
end{document}
Thanks though that fixed most of it. Though yesterday I forgot to post the image of how I would like my graph to look like. How can I make the graph look more like this?
– Daniel Hernández
Feb 28 at 13:34
@DanielHernández I added a graph of this sort.
– marmot
Feb 28 at 15:22
©marmot Thanks! That's what I needed. Pgfplots still is kind of confusing for me.
– Daniel Hernández
Feb 28 at 17:52
@DanielHernández You are welcome! (The issue here is more a parametrization question than a pgfplots question, I think. But you're right, pgfplots is a nontrivial packages with lots of functionality that one keeps discovering.)
– marmot
Feb 28 at 18:03
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "85"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f477069%2fhow-could-i-graph-z-sqrtx2-y2-using-pgftools-i-believe-ive-all-suggestions%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
You did almost everything right, pgfplots
is just not very good at taking the square root of a negative number. So if you adjust the domains a bit you get
documentclass[tikz,border=3.14mm]{standalone}
usepackage{tikz,pgfplots}
pgfplotsset{compat=1.16}
begin{document}
begin{tikzpicture}[scale=1.5]
begin{axis}[
grid=major,
3d box=complete,
enlargelimits=false,
colormap/cool,
xlabel=$x$,
ylabel=$y$,
zlabel=$z$,
zlabel style = {sloped like x axis}
]
addplot3 [domain=2:4,domain y=-2:2,
surf,
shader=faceted,
samples=50,
z buffer=sort,
] {sqrt(x^2-y^2)};
end{axis}
end{tikzpicture}
end{document}
As for your request in the comments, one can write the function as sqrt(u*v)
, where u=x+y
and v=x-y
. Then x=(u+v)/2
and y=(u-v)/2
. Since the variables are just placeholders in a parametric plot, we can rename u
and v
to x
and y
, respectively, and arrive at
documentclass[tikz,border=3.14mm]{standalone}
usepackage{pgfplots}
pgfplotsset{compat=1.16}
begin{document}
begin{tikzpicture}[scale=1.5]
begin{axis}[xmax=2,xmin=-2,
grid=major,
3d box=complete,
enlargelimits=false,
colormap/cool,
xlabel=$x$,
ylabel=$y$,
zlabel=$z$,
zlabel style = {sloped like x axis}
]
addplot3 [domain=0:4,domain y=0:4,
surf,
shader=faceted,
samples=50,
z buffer=sort,
] ({(x+y)/2},{(x-y)/2},{sqrt(x*y)});
addplot3 [domain=0:4,domain y=0:4,
surf,
shader=faceted,
samples=50,
z buffer=sort,
] ({-(x+y)/2},{-(x-y)/2},{sqrt(x*y)});
end{axis}
end{tikzpicture}
end{document}
Thanks though that fixed most of it. Though yesterday I forgot to post the image of how I would like my graph to look like. How can I make the graph look more like this?
– Daniel Hernández
Feb 28 at 13:34
@DanielHernández I added a graph of this sort.
– marmot
Feb 28 at 15:22
©marmot Thanks! That's what I needed. Pgfplots still is kind of confusing for me.
– Daniel Hernández
Feb 28 at 17:52
@DanielHernández You are welcome! (The issue here is more a parametrization question than a pgfplots question, I think. But you're right, pgfplots is a nontrivial packages with lots of functionality that one keeps discovering.)
– marmot
Feb 28 at 18:03
add a comment |
You did almost everything right, pgfplots
is just not very good at taking the square root of a negative number. So if you adjust the domains a bit you get
documentclass[tikz,border=3.14mm]{standalone}
usepackage{tikz,pgfplots}
pgfplotsset{compat=1.16}
begin{document}
begin{tikzpicture}[scale=1.5]
begin{axis}[
grid=major,
3d box=complete,
enlargelimits=false,
colormap/cool,
xlabel=$x$,
ylabel=$y$,
zlabel=$z$,
zlabel style = {sloped like x axis}
]
addplot3 [domain=2:4,domain y=-2:2,
surf,
shader=faceted,
samples=50,
z buffer=sort,
] {sqrt(x^2-y^2)};
end{axis}
end{tikzpicture}
end{document}
As for your request in the comments, one can write the function as sqrt(u*v)
, where u=x+y
and v=x-y
. Then x=(u+v)/2
and y=(u-v)/2
. Since the variables are just placeholders in a parametric plot, we can rename u
and v
to x
and y
, respectively, and arrive at
documentclass[tikz,border=3.14mm]{standalone}
usepackage{pgfplots}
pgfplotsset{compat=1.16}
begin{document}
begin{tikzpicture}[scale=1.5]
begin{axis}[xmax=2,xmin=-2,
grid=major,
3d box=complete,
enlargelimits=false,
colormap/cool,
xlabel=$x$,
ylabel=$y$,
zlabel=$z$,
zlabel style = {sloped like x axis}
]
addplot3 [domain=0:4,domain y=0:4,
surf,
shader=faceted,
samples=50,
z buffer=sort,
] ({(x+y)/2},{(x-y)/2},{sqrt(x*y)});
addplot3 [domain=0:4,domain y=0:4,
surf,
shader=faceted,
samples=50,
z buffer=sort,
] ({-(x+y)/2},{-(x-y)/2},{sqrt(x*y)});
end{axis}
end{tikzpicture}
end{document}
Thanks though that fixed most of it. Though yesterday I forgot to post the image of how I would like my graph to look like. How can I make the graph look more like this?
– Daniel Hernández
Feb 28 at 13:34
@DanielHernández I added a graph of this sort.
– marmot
Feb 28 at 15:22
©marmot Thanks! That's what I needed. Pgfplots still is kind of confusing for me.
– Daniel Hernández
Feb 28 at 17:52
@DanielHernández You are welcome! (The issue here is more a parametrization question than a pgfplots question, I think. But you're right, pgfplots is a nontrivial packages with lots of functionality that one keeps discovering.)
– marmot
Feb 28 at 18:03
add a comment |
You did almost everything right, pgfplots
is just not very good at taking the square root of a negative number. So if you adjust the domains a bit you get
documentclass[tikz,border=3.14mm]{standalone}
usepackage{tikz,pgfplots}
pgfplotsset{compat=1.16}
begin{document}
begin{tikzpicture}[scale=1.5]
begin{axis}[
grid=major,
3d box=complete,
enlargelimits=false,
colormap/cool,
xlabel=$x$,
ylabel=$y$,
zlabel=$z$,
zlabel style = {sloped like x axis}
]
addplot3 [domain=2:4,domain y=-2:2,
surf,
shader=faceted,
samples=50,
z buffer=sort,
] {sqrt(x^2-y^2)};
end{axis}
end{tikzpicture}
end{document}
As for your request in the comments, one can write the function as sqrt(u*v)
, where u=x+y
and v=x-y
. Then x=(u+v)/2
and y=(u-v)/2
. Since the variables are just placeholders in a parametric plot, we can rename u
and v
to x
and y
, respectively, and arrive at
documentclass[tikz,border=3.14mm]{standalone}
usepackage{pgfplots}
pgfplotsset{compat=1.16}
begin{document}
begin{tikzpicture}[scale=1.5]
begin{axis}[xmax=2,xmin=-2,
grid=major,
3d box=complete,
enlargelimits=false,
colormap/cool,
xlabel=$x$,
ylabel=$y$,
zlabel=$z$,
zlabel style = {sloped like x axis}
]
addplot3 [domain=0:4,domain y=0:4,
surf,
shader=faceted,
samples=50,
z buffer=sort,
] ({(x+y)/2},{(x-y)/2},{sqrt(x*y)});
addplot3 [domain=0:4,domain y=0:4,
surf,
shader=faceted,
samples=50,
z buffer=sort,
] ({-(x+y)/2},{-(x-y)/2},{sqrt(x*y)});
end{axis}
end{tikzpicture}
end{document}
You did almost everything right, pgfplots
is just not very good at taking the square root of a negative number. So if you adjust the domains a bit you get
documentclass[tikz,border=3.14mm]{standalone}
usepackage{tikz,pgfplots}
pgfplotsset{compat=1.16}
begin{document}
begin{tikzpicture}[scale=1.5]
begin{axis}[
grid=major,
3d box=complete,
enlargelimits=false,
colormap/cool,
xlabel=$x$,
ylabel=$y$,
zlabel=$z$,
zlabel style = {sloped like x axis}
]
addplot3 [domain=2:4,domain y=-2:2,
surf,
shader=faceted,
samples=50,
z buffer=sort,
] {sqrt(x^2-y^2)};
end{axis}
end{tikzpicture}
end{document}
As for your request in the comments, one can write the function as sqrt(u*v)
, where u=x+y
and v=x-y
. Then x=(u+v)/2
and y=(u-v)/2
. Since the variables are just placeholders in a parametric plot, we can rename u
and v
to x
and y
, respectively, and arrive at
documentclass[tikz,border=3.14mm]{standalone}
usepackage{pgfplots}
pgfplotsset{compat=1.16}
begin{document}
begin{tikzpicture}[scale=1.5]
begin{axis}[xmax=2,xmin=-2,
grid=major,
3d box=complete,
enlargelimits=false,
colormap/cool,
xlabel=$x$,
ylabel=$y$,
zlabel=$z$,
zlabel style = {sloped like x axis}
]
addplot3 [domain=0:4,domain y=0:4,
surf,
shader=faceted,
samples=50,
z buffer=sort,
] ({(x+y)/2},{(x-y)/2},{sqrt(x*y)});
addplot3 [domain=0:4,domain y=0:4,
surf,
shader=faceted,
samples=50,
z buffer=sort,
] ({-(x+y)/2},{-(x-y)/2},{sqrt(x*y)});
end{axis}
end{tikzpicture}
end{document}
edited Feb 28 at 14:49
answered Feb 28 at 3:35
marmotmarmot
106k5129243
106k5129243
Thanks though that fixed most of it. Though yesterday I forgot to post the image of how I would like my graph to look like. How can I make the graph look more like this?
– Daniel Hernández
Feb 28 at 13:34
@DanielHernández I added a graph of this sort.
– marmot
Feb 28 at 15:22
©marmot Thanks! That's what I needed. Pgfplots still is kind of confusing for me.
– Daniel Hernández
Feb 28 at 17:52
@DanielHernández You are welcome! (The issue here is more a parametrization question than a pgfplots question, I think. But you're right, pgfplots is a nontrivial packages with lots of functionality that one keeps discovering.)
– marmot
Feb 28 at 18:03
add a comment |
Thanks though that fixed most of it. Though yesterday I forgot to post the image of how I would like my graph to look like. How can I make the graph look more like this?
– Daniel Hernández
Feb 28 at 13:34
@DanielHernández I added a graph of this sort.
– marmot
Feb 28 at 15:22
©marmot Thanks! That's what I needed. Pgfplots still is kind of confusing for me.
– Daniel Hernández
Feb 28 at 17:52
@DanielHernández You are welcome! (The issue here is more a parametrization question than a pgfplots question, I think. But you're right, pgfplots is a nontrivial packages with lots of functionality that one keeps discovering.)
– marmot
Feb 28 at 18:03
Thanks though that fixed most of it. Though yesterday I forgot to post the image of how I would like my graph to look like. How can I make the graph look more like this?
– Daniel Hernández
Feb 28 at 13:34
Thanks though that fixed most of it. Though yesterday I forgot to post the image of how I would like my graph to look like. How can I make the graph look more like this?
– Daniel Hernández
Feb 28 at 13:34
@DanielHernández I added a graph of this sort.
– marmot
Feb 28 at 15:22
@DanielHernández I added a graph of this sort.
– marmot
Feb 28 at 15:22
©marmot Thanks! That's what I needed. Pgfplots still is kind of confusing for me.
– Daniel Hernández
Feb 28 at 17:52
©marmot Thanks! That's what I needed. Pgfplots still is kind of confusing for me.
– Daniel Hernández
Feb 28 at 17:52
@DanielHernández You are welcome! (The issue here is more a parametrization question than a pgfplots question, I think. But you're right, pgfplots is a nontrivial packages with lots of functionality that one keeps discovering.)
– marmot
Feb 28 at 18:03
@DanielHernández You are welcome! (The issue here is more a parametrization question than a pgfplots question, I think. But you're right, pgfplots is a nontrivial packages with lots of functionality that one keeps discovering.)
– marmot
Feb 28 at 18:03
add a comment |
Thanks for contributing an answer to TeX - LaTeX Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f477069%2fhow-could-i-graph-z-sqrtx2-y2-using-pgftools-i-believe-ive-all-suggestions%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown