Pgfplots: embedding a line in a surface

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
3
down vote

favorite












I want to draw an identity across a surface plot. This identity should start at the bottom left, and end at the top right (from tip to tip). With the axis I've given (see below), the v_1=2(v_2-20). This becomes y=2(x-20) given the way the axes are defined. I've tried plotting this in various ways, but it does not seem to work on top of the 3d surface.



beginfigure[h]
begintikzpicture[scale=2]
beginaxis[
title=secret research,
xlabel=$v_2$, ylabel=$v_1$,
small,
x dir=reverse
]
addplot3[
surf,
domain=0:20,
domain y=0:10,
]
((y^2/(0.5*(x+y))/20);
endaxis
endtikzpicture


enter image description here










share|improve this question























  • I am sorry, I do not understand the question. Could you please make more explicit what you mean? What does "This becomes y=2(x-20) given the way the axes are defined. " mean? Do you just want to plot (x,2*(x-20))? But this is a 3d plot.
    – marmot
    3 hours ago











  • @marmot Sorry for it being unclear. I would like to plot the identity that maps across the surface diagonally from v_2=20 to v_1=10. This would be a single function, not a surface, as it is defined at one particular intersection of the v_2 and v_1 axes.
    – pafnuti
    3 hours ago











  • You want a one-dimensional plot, i.e a line, then? At which z-value should this line be? Should it really be v_1=2(v_2-20), i.e. at v_1=0 v_2 will be -40, ie. far off from the surface?
    – marmot
    3 hours ago











  • @marmot Yes one-dimensional, at the z-value of the surface.
    – pafnuti
    2 hours ago










  • Could you perhaps consider changing the title of your nice question such that it is easier to find for others? My request is triggered by this discussion. One possible title might be "pgfplots: embedding a line in a surface".
    – marmot
    11 mins ago















up vote
3
down vote

favorite












I want to draw an identity across a surface plot. This identity should start at the bottom left, and end at the top right (from tip to tip). With the axis I've given (see below), the v_1=2(v_2-20). This becomes y=2(x-20) given the way the axes are defined. I've tried plotting this in various ways, but it does not seem to work on top of the 3d surface.



beginfigure[h]
begintikzpicture[scale=2]
beginaxis[
title=secret research,
xlabel=$v_2$, ylabel=$v_1$,
small,
x dir=reverse
]
addplot3[
surf,
domain=0:20,
domain y=0:10,
]
((y^2/(0.5*(x+y))/20);
endaxis
endtikzpicture


enter image description here










share|improve this question























  • I am sorry, I do not understand the question. Could you please make more explicit what you mean? What does "This becomes y=2(x-20) given the way the axes are defined. " mean? Do you just want to plot (x,2*(x-20))? But this is a 3d plot.
    – marmot
    3 hours ago











  • @marmot Sorry for it being unclear. I would like to plot the identity that maps across the surface diagonally from v_2=20 to v_1=10. This would be a single function, not a surface, as it is defined at one particular intersection of the v_2 and v_1 axes.
    – pafnuti
    3 hours ago











  • You want a one-dimensional plot, i.e a line, then? At which z-value should this line be? Should it really be v_1=2(v_2-20), i.e. at v_1=0 v_2 will be -40, ie. far off from the surface?
    – marmot
    3 hours ago











  • @marmot Yes one-dimensional, at the z-value of the surface.
    – pafnuti
    2 hours ago










  • Could you perhaps consider changing the title of your nice question such that it is easier to find for others? My request is triggered by this discussion. One possible title might be "pgfplots: embedding a line in a surface".
    – marmot
    11 mins ago













up vote
3
down vote

favorite









up vote
3
down vote

favorite











I want to draw an identity across a surface plot. This identity should start at the bottom left, and end at the top right (from tip to tip). With the axis I've given (see below), the v_1=2(v_2-20). This becomes y=2(x-20) given the way the axes are defined. I've tried plotting this in various ways, but it does not seem to work on top of the 3d surface.



beginfigure[h]
begintikzpicture[scale=2]
beginaxis[
title=secret research,
xlabel=$v_2$, ylabel=$v_1$,
small,
x dir=reverse
]
addplot3[
surf,
domain=0:20,
domain y=0:10,
]
((y^2/(0.5*(x+y))/20);
endaxis
endtikzpicture


enter image description here










share|improve this question















I want to draw an identity across a surface plot. This identity should start at the bottom left, and end at the top right (from tip to tip). With the axis I've given (see below), the v_1=2(v_2-20). This becomes y=2(x-20) given the way the axes are defined. I've tried plotting this in various ways, but it does not seem to work on top of the 3d surface.



beginfigure[h]
begintikzpicture[scale=2]
beginaxis[
title=secret research,
xlabel=$v_2$, ylabel=$v_1$,
small,
x dir=reverse
]
addplot3[
surf,
domain=0:20,
domain y=0:10,
]
((y^2/(0.5*(x+y))/20);
endaxis
endtikzpicture


enter image description here







tikz-pgf pgfplots






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited 7 mins ago

























asked 3 hours ago









pafnuti

2517




2517











  • I am sorry, I do not understand the question. Could you please make more explicit what you mean? What does "This becomes y=2(x-20) given the way the axes are defined. " mean? Do you just want to plot (x,2*(x-20))? But this is a 3d plot.
    – marmot
    3 hours ago











  • @marmot Sorry for it being unclear. I would like to plot the identity that maps across the surface diagonally from v_2=20 to v_1=10. This would be a single function, not a surface, as it is defined at one particular intersection of the v_2 and v_1 axes.
    – pafnuti
    3 hours ago











  • You want a one-dimensional plot, i.e a line, then? At which z-value should this line be? Should it really be v_1=2(v_2-20), i.e. at v_1=0 v_2 will be -40, ie. far off from the surface?
    – marmot
    3 hours ago











  • @marmot Yes one-dimensional, at the z-value of the surface.
    – pafnuti
    2 hours ago










  • Could you perhaps consider changing the title of your nice question such that it is easier to find for others? My request is triggered by this discussion. One possible title might be "pgfplots: embedding a line in a surface".
    – marmot
    11 mins ago

















  • I am sorry, I do not understand the question. Could you please make more explicit what you mean? What does "This becomes y=2(x-20) given the way the axes are defined. " mean? Do you just want to plot (x,2*(x-20))? But this is a 3d plot.
    – marmot
    3 hours ago











  • @marmot Sorry for it being unclear. I would like to plot the identity that maps across the surface diagonally from v_2=20 to v_1=10. This would be a single function, not a surface, as it is defined at one particular intersection of the v_2 and v_1 axes.
    – pafnuti
    3 hours ago











  • You want a one-dimensional plot, i.e a line, then? At which z-value should this line be? Should it really be v_1=2(v_2-20), i.e. at v_1=0 v_2 will be -40, ie. far off from the surface?
    – marmot
    3 hours ago











  • @marmot Yes one-dimensional, at the z-value of the surface.
    – pafnuti
    2 hours ago










  • Could you perhaps consider changing the title of your nice question such that it is easier to find for others? My request is triggered by this discussion. One possible title might be "pgfplots: embedding a line in a surface".
    – marmot
    11 mins ago
















I am sorry, I do not understand the question. Could you please make more explicit what you mean? What does "This becomes y=2(x-20) given the way the axes are defined. " mean? Do you just want to plot (x,2*(x-20))? But this is a 3d plot.
– marmot
3 hours ago





I am sorry, I do not understand the question. Could you please make more explicit what you mean? What does "This becomes y=2(x-20) given the way the axes are defined. " mean? Do you just want to plot (x,2*(x-20))? But this is a 3d plot.
– marmot
3 hours ago













@marmot Sorry for it being unclear. I would like to plot the identity that maps across the surface diagonally from v_2=20 to v_1=10. This would be a single function, not a surface, as it is defined at one particular intersection of the v_2 and v_1 axes.
– pafnuti
3 hours ago





@marmot Sorry for it being unclear. I would like to plot the identity that maps across the surface diagonally from v_2=20 to v_1=10. This would be a single function, not a surface, as it is defined at one particular intersection of the v_2 and v_1 axes.
– pafnuti
3 hours ago













You want a one-dimensional plot, i.e a line, then? At which z-value should this line be? Should it really be v_1=2(v_2-20), i.e. at v_1=0 v_2 will be -40, ie. far off from the surface?
– marmot
3 hours ago





You want a one-dimensional plot, i.e a line, then? At which z-value should this line be? Should it really be v_1=2(v_2-20), i.e. at v_1=0 v_2 will be -40, ie. far off from the surface?
– marmot
3 hours ago













@marmot Yes one-dimensional, at the z-value of the surface.
– pafnuti
2 hours ago




@marmot Yes one-dimensional, at the z-value of the surface.
– pafnuti
2 hours ago












Could you perhaps consider changing the title of your nice question such that it is easier to find for others? My request is triggered by this discussion. One possible title might be "pgfplots: embedding a line in a surface".
– marmot
11 mins ago





Could you perhaps consider changing the title of your nice question such that it is easier to find for others? My request is triggered by this discussion. One possible title might be "pgfplots: embedding a line in a surface".
– marmot
11 mins ago











1 Answer
1






active

oldest

votes

















up vote
8
down vote



accepted










I hope I guess correctly.



documentclass[tikz,border=3.14mm]standalone
usepackagepgfplots
pgfplotssetcompat=1.16
begindocument
begintikzpicture[scale=2,declare function=f(x,y)=((y*y/(0.5*(x+y))/20);]
beginaxis[
title=secret research,
xlabel=$v_2$, ylabel=$v_1$,
small,
x dir=reverse
]
addplot3[
surf,
domain=0:20,
domain y=0:10,
]
(f(x,y);
addplot3[mesh,domain=0:10,point meta=0] (2*x,x, (f(2*x,x));
addplot3[mesh,domain=0:10,point meta=0.5] (2*(10-x),x, (f(2*(10-x),x));
endaxis
endtikzpicture
enddocument


enter image description here



Of course, you can choose whatever color you like for those lines.



documentclass[tikz,border=3.14mm]standalone
usepackagepgfplots
pgfplotssetcompat=1.16
begindocument
begintikzpicture[scale=2,declare function=f(x,y)=((y*y/(0.5*(x+y))/20);]
beginaxis[
title=secret research,
xlabel=$v_2$, ylabel=$v_1$,
small,
x dir=reverse
]
addplot3[
surf,
domain=0:20,
domain y=0:10,
]
(f(x,y);
addplot3[mesh,domain=0:10,color=red] (2*x,x, (f(2*x,x));
addplot3[mesh,domain=0:10,color=black] (2*(10-x),x, (f(2*(10-x),x));
endaxis
endtikzpicture
enddocument


enter image description here






share|improve this answer






















  • That's exactly what I want, but from the left-most point at (v_1=0,v_2=20,z=0) to the rightmost (v_1=10,v_2=0, z approx 1). Will change it myself :)
    – pafnuti
    2 hours ago











  • @pafnuti I add that one. There is one potential piftfall: you need to use mesh since otherwise there will be a closed cycle.
    – marmot
    2 hours ago










  • Does this mean I can't choose an arbitrary colour for the line? Because of the point meta colour map?
    – pafnuti
    2 hours ago











  • @pafnuti You can choose whatever color you like, I added an update.
    – marmot
    1 hour ago










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',
convertImagesToLinks: false,
noModals: false,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













 

draft saved


draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f450999%2fpgfplots-embedding-a-line-in-a-surface%23new-answer', 'question_page');

);

Post as a guest






























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes








up vote
8
down vote



accepted










I hope I guess correctly.



documentclass[tikz,border=3.14mm]standalone
usepackagepgfplots
pgfplotssetcompat=1.16
begindocument
begintikzpicture[scale=2,declare function=f(x,y)=((y*y/(0.5*(x+y))/20);]
beginaxis[
title=secret research,
xlabel=$v_2$, ylabel=$v_1$,
small,
x dir=reverse
]
addplot3[
surf,
domain=0:20,
domain y=0:10,
]
(f(x,y);
addplot3[mesh,domain=0:10,point meta=0] (2*x,x, (f(2*x,x));
addplot3[mesh,domain=0:10,point meta=0.5] (2*(10-x),x, (f(2*(10-x),x));
endaxis
endtikzpicture
enddocument


enter image description here



Of course, you can choose whatever color you like for those lines.



documentclass[tikz,border=3.14mm]standalone
usepackagepgfplots
pgfplotssetcompat=1.16
begindocument
begintikzpicture[scale=2,declare function=f(x,y)=((y*y/(0.5*(x+y))/20);]
beginaxis[
title=secret research,
xlabel=$v_2$, ylabel=$v_1$,
small,
x dir=reverse
]
addplot3[
surf,
domain=0:20,
domain y=0:10,
]
(f(x,y);
addplot3[mesh,domain=0:10,color=red] (2*x,x, (f(2*x,x));
addplot3[mesh,domain=0:10,color=black] (2*(10-x),x, (f(2*(10-x),x));
endaxis
endtikzpicture
enddocument


enter image description here






share|improve this answer






















  • That's exactly what I want, but from the left-most point at (v_1=0,v_2=20,z=0) to the rightmost (v_1=10,v_2=0, z approx 1). Will change it myself :)
    – pafnuti
    2 hours ago











  • @pafnuti I add that one. There is one potential piftfall: you need to use mesh since otherwise there will be a closed cycle.
    – marmot
    2 hours ago










  • Does this mean I can't choose an arbitrary colour for the line? Because of the point meta colour map?
    – pafnuti
    2 hours ago











  • @pafnuti You can choose whatever color you like, I added an update.
    – marmot
    1 hour ago














up vote
8
down vote



accepted










I hope I guess correctly.



documentclass[tikz,border=3.14mm]standalone
usepackagepgfplots
pgfplotssetcompat=1.16
begindocument
begintikzpicture[scale=2,declare function=f(x,y)=((y*y/(0.5*(x+y))/20);]
beginaxis[
title=secret research,
xlabel=$v_2$, ylabel=$v_1$,
small,
x dir=reverse
]
addplot3[
surf,
domain=0:20,
domain y=0:10,
]
(f(x,y);
addplot3[mesh,domain=0:10,point meta=0] (2*x,x, (f(2*x,x));
addplot3[mesh,domain=0:10,point meta=0.5] (2*(10-x),x, (f(2*(10-x),x));
endaxis
endtikzpicture
enddocument


enter image description here



Of course, you can choose whatever color you like for those lines.



documentclass[tikz,border=3.14mm]standalone
usepackagepgfplots
pgfplotssetcompat=1.16
begindocument
begintikzpicture[scale=2,declare function=f(x,y)=((y*y/(0.5*(x+y))/20);]
beginaxis[
title=secret research,
xlabel=$v_2$, ylabel=$v_1$,
small,
x dir=reverse
]
addplot3[
surf,
domain=0:20,
domain y=0:10,
]
(f(x,y);
addplot3[mesh,domain=0:10,color=red] (2*x,x, (f(2*x,x));
addplot3[mesh,domain=0:10,color=black] (2*(10-x),x, (f(2*(10-x),x));
endaxis
endtikzpicture
enddocument


enter image description here






share|improve this answer






















  • That's exactly what I want, but from the left-most point at (v_1=0,v_2=20,z=0) to the rightmost (v_1=10,v_2=0, z approx 1). Will change it myself :)
    – pafnuti
    2 hours ago











  • @pafnuti I add that one. There is one potential piftfall: you need to use mesh since otherwise there will be a closed cycle.
    – marmot
    2 hours ago










  • Does this mean I can't choose an arbitrary colour for the line? Because of the point meta colour map?
    – pafnuti
    2 hours ago











  • @pafnuti You can choose whatever color you like, I added an update.
    – marmot
    1 hour ago












up vote
8
down vote



accepted







up vote
8
down vote



accepted






I hope I guess correctly.



documentclass[tikz,border=3.14mm]standalone
usepackagepgfplots
pgfplotssetcompat=1.16
begindocument
begintikzpicture[scale=2,declare function=f(x,y)=((y*y/(0.5*(x+y))/20);]
beginaxis[
title=secret research,
xlabel=$v_2$, ylabel=$v_1$,
small,
x dir=reverse
]
addplot3[
surf,
domain=0:20,
domain y=0:10,
]
(f(x,y);
addplot3[mesh,domain=0:10,point meta=0] (2*x,x, (f(2*x,x));
addplot3[mesh,domain=0:10,point meta=0.5] (2*(10-x),x, (f(2*(10-x),x));
endaxis
endtikzpicture
enddocument


enter image description here



Of course, you can choose whatever color you like for those lines.



documentclass[tikz,border=3.14mm]standalone
usepackagepgfplots
pgfplotssetcompat=1.16
begindocument
begintikzpicture[scale=2,declare function=f(x,y)=((y*y/(0.5*(x+y))/20);]
beginaxis[
title=secret research,
xlabel=$v_2$, ylabel=$v_1$,
small,
x dir=reverse
]
addplot3[
surf,
domain=0:20,
domain y=0:10,
]
(f(x,y);
addplot3[mesh,domain=0:10,color=red] (2*x,x, (f(2*x,x));
addplot3[mesh,domain=0:10,color=black] (2*(10-x),x, (f(2*(10-x),x));
endaxis
endtikzpicture
enddocument


enter image description here






share|improve this answer














I hope I guess correctly.



documentclass[tikz,border=3.14mm]standalone
usepackagepgfplots
pgfplotssetcompat=1.16
begindocument
begintikzpicture[scale=2,declare function=f(x,y)=((y*y/(0.5*(x+y))/20);]
beginaxis[
title=secret research,
xlabel=$v_2$, ylabel=$v_1$,
small,
x dir=reverse
]
addplot3[
surf,
domain=0:20,
domain y=0:10,
]
(f(x,y);
addplot3[mesh,domain=0:10,point meta=0] (2*x,x, (f(2*x,x));
addplot3[mesh,domain=0:10,point meta=0.5] (2*(10-x),x, (f(2*(10-x),x));
endaxis
endtikzpicture
enddocument


enter image description here



Of course, you can choose whatever color you like for those lines.



documentclass[tikz,border=3.14mm]standalone
usepackagepgfplots
pgfplotssetcompat=1.16
begindocument
begintikzpicture[scale=2,declare function=f(x,y)=((y*y/(0.5*(x+y))/20);]
beginaxis[
title=secret research,
xlabel=$v_2$, ylabel=$v_1$,
small,
x dir=reverse
]
addplot3[
surf,
domain=0:20,
domain y=0:10,
]
(f(x,y);
addplot3[mesh,domain=0:10,color=red] (2*x,x, (f(2*x,x));
addplot3[mesh,domain=0:10,color=black] (2*(10-x),x, (f(2*(10-x),x));
endaxis
endtikzpicture
enddocument


enter image description here







share|improve this answer














share|improve this answer



share|improve this answer








edited 1 hour ago

























answered 2 hours ago









marmot

57.5k462124




57.5k462124











  • That's exactly what I want, but from the left-most point at (v_1=0,v_2=20,z=0) to the rightmost (v_1=10,v_2=0, z approx 1). Will change it myself :)
    – pafnuti
    2 hours ago











  • @pafnuti I add that one. There is one potential piftfall: you need to use mesh since otherwise there will be a closed cycle.
    – marmot
    2 hours ago










  • Does this mean I can't choose an arbitrary colour for the line? Because of the point meta colour map?
    – pafnuti
    2 hours ago











  • @pafnuti You can choose whatever color you like, I added an update.
    – marmot
    1 hour ago
















  • That's exactly what I want, but from the left-most point at (v_1=0,v_2=20,z=0) to the rightmost (v_1=10,v_2=0, z approx 1). Will change it myself :)
    – pafnuti
    2 hours ago











  • @pafnuti I add that one. There is one potential piftfall: you need to use mesh since otherwise there will be a closed cycle.
    – marmot
    2 hours ago










  • Does this mean I can't choose an arbitrary colour for the line? Because of the point meta colour map?
    – pafnuti
    2 hours ago











  • @pafnuti You can choose whatever color you like, I added an update.
    – marmot
    1 hour ago















That's exactly what I want, but from the left-most point at (v_1=0,v_2=20,z=0) to the rightmost (v_1=10,v_2=0, z approx 1). Will change it myself :)
– pafnuti
2 hours ago





That's exactly what I want, but from the left-most point at (v_1=0,v_2=20,z=0) to the rightmost (v_1=10,v_2=0, z approx 1). Will change it myself :)
– pafnuti
2 hours ago













@pafnuti I add that one. There is one potential piftfall: you need to use mesh since otherwise there will be a closed cycle.
– marmot
2 hours ago




@pafnuti I add that one. There is one potential piftfall: you need to use mesh since otherwise there will be a closed cycle.
– marmot
2 hours ago












Does this mean I can't choose an arbitrary colour for the line? Because of the point meta colour map?
– pafnuti
2 hours ago





Does this mean I can't choose an arbitrary colour for the line? Because of the point meta colour map?
– pafnuti
2 hours ago













@pafnuti You can choose whatever color you like, I added an update.
– marmot
1 hour ago




@pafnuti You can choose whatever color you like, I added an update.
– marmot
1 hour ago

















 

draft saved


draft discarded















































 


draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f450999%2fpgfplots-embedding-a-line-in-a-surface%23new-answer', 'question_page');

);

Post as a guest













































































Comments

Popular posts from this blog

What does second last employer means? [closed]

Installing NextGIS Connect into QGIS 3?

One-line joke