Making a (filled) surface in a 3d plane to look like a (filled) ellipse in 3d plane
I have the following MWE
:
%&lualatex
% !TeX program = lualatex
documentclass{standalone}
usepackage{pgfplots}
pgfplotsset{compat=newest}
begin{document}
begin{tikzpicture}
begin{axis}[
width=8.5cm,
height=2in,
]
addplot3[surf,mesh/rows=2,fill=gray,opacity=0.2] coordinates {
(0.3,0,-1) (.3,7,-1)
(0.3,0,1) (.3,7,1)
};
end{axis}
end{tikzpicture}
end{document}
which gives:
Are there possibilities to render this (filled) region elliptical instead of the (filled) rectangular region (using the same coordinates).
Update 1 To avoid confusion, let us assume that the coordinate set
X belongs to {(x_i,y_i,z_i)|i={1,2,3,4}}
here the i's indicate the corners and the X
can randomly vary depending upon the desired dataset.
tikz-pgf pgfplots
add a comment |
I have the following MWE
:
%&lualatex
% !TeX program = lualatex
documentclass{standalone}
usepackage{pgfplots}
pgfplotsset{compat=newest}
begin{document}
begin{tikzpicture}
begin{axis}[
width=8.5cm,
height=2in,
]
addplot3[surf,mesh/rows=2,fill=gray,opacity=0.2] coordinates {
(0.3,0,-1) (.3,7,-1)
(0.3,0,1) (.3,7,1)
};
end{axis}
end{tikzpicture}
end{document}
which gives:
Are there possibilities to render this (filled) region elliptical instead of the (filled) rectangular region (using the same coordinates).
Update 1 To avoid confusion, let us assume that the coordinate set
X belongs to {(x_i,y_i,z_i)|i={1,2,3,4}}
here the i's indicate the corners and the X
can randomly vary depending upon the desired dataset.
tikz-pgf pgfplots
add a comment |
I have the following MWE
:
%&lualatex
% !TeX program = lualatex
documentclass{standalone}
usepackage{pgfplots}
pgfplotsset{compat=newest}
begin{document}
begin{tikzpicture}
begin{axis}[
width=8.5cm,
height=2in,
]
addplot3[surf,mesh/rows=2,fill=gray,opacity=0.2] coordinates {
(0.3,0,-1) (.3,7,-1)
(0.3,0,1) (.3,7,1)
};
end{axis}
end{tikzpicture}
end{document}
which gives:
Are there possibilities to render this (filled) region elliptical instead of the (filled) rectangular region (using the same coordinates).
Update 1 To avoid confusion, let us assume that the coordinate set
X belongs to {(x_i,y_i,z_i)|i={1,2,3,4}}
here the i's indicate the corners and the X
can randomly vary depending upon the desired dataset.
tikz-pgf pgfplots
I have the following MWE
:
%&lualatex
% !TeX program = lualatex
documentclass{standalone}
usepackage{pgfplots}
pgfplotsset{compat=newest}
begin{document}
begin{tikzpicture}
begin{axis}[
width=8.5cm,
height=2in,
]
addplot3[surf,mesh/rows=2,fill=gray,opacity=0.2] coordinates {
(0.3,0,-1) (.3,7,-1)
(0.3,0,1) (.3,7,1)
};
end{axis}
end{tikzpicture}
end{document}
which gives:
Are there possibilities to render this (filled) region elliptical instead of the (filled) rectangular region (using the same coordinates).
Update 1 To avoid confusion, let us assume that the coordinate set
X belongs to {(x_i,y_i,z_i)|i={1,2,3,4}}
here the i's indicate the corners and the X
can randomly vary depending upon the desired dataset.
tikz-pgf pgfplots
tikz-pgf pgfplots
edited Dec 27 at 21:12
asked Dec 27 at 20:26
Raaja
2,1722630
2,1722630
add a comment |
add a comment |
2 Answers
2
active
oldest
votes
Something like this?
documentclass{standalone}
usepackage{pgfplots}
usetikzlibrary{3d}
pgfplotsset{compat=newest}
begin{document}
begin{tikzpicture}
begin{axis}[
width=8.5cm,
height=2in,
]
begin{scope}[canvas is yz plane at x=0.3]
filldraw[fill = gray!10,rounded corners = 1mm, draw = black] (0,-1) rectangle (7,1);
fill[red, opacity = 0.4] (3.5, 0) ellipse (3cm and 1cm);
end{scope}
addplot3[surf,mesh/rows=2,fill=gray,opacity=0.2] coordinates {
(0.3,0,-1) (.3,7,-1)
(0.3,0,1) (.3,7,1)
};
end{axis}
end{tikzpicture}
end{document}
You can comment out the line filldraw[fill = gray!10,rounded corners = 1mm, draw = black] (0,-1) rectangle (7,1);
if you want to remove the plane
Not quite because, if we start using the plane definition then I must manually set the view everytime when it changes (becomes quite close to impossible when I deal with a large data-set). I am looking for a solution where we use the cooridnates to draw a elliptical plane in 3d without influencing the viewing angles (manually). Nevertheless it is a good solution (+1).
– Raaja
Dec 27 at 21:06
1
@Raaja Sorry but I don't get your comment. Where do I manually set the viewing angle?
– caverac
Dec 27 at 21:09
I meant the specification where it is mentioned asyz
plane. More specifically I want to avoid using the scope.
– Raaja
Dec 27 at 21:10
1
@Raaja Well, you need to draw the plane somewhere, I don't see how you can draw a figure if you don't know where you are going to draw it. but, I'm also pretty sure someone else can give you a better answer anyways :)
– caverac
Dec 27 at 21:13
I understand what you mean by that ;) however, this can be assumed a problem where I try to - let's say - modify the mesh into a elliptical one :D
– Raaja
Dec 27 at 21:15
|
show 1 more comment
First of all, let me start by saying that I don't think there is anything wrong with caverac's answer; rather I like and upvoted it. (One could add a local transformation to rotate the plane the ellipse is in.) Nevertheless, the arguably simplest way to generate an ellipse in pgfplots is to plot it. This code and animation show how one can do that.
documentclass[tikz,border=3.14mm]{standalone}
usepackage{pgfplots}
pgfplotsset{compat=newest}
begin{document}
foreach X in {5,15,...,355}
{begin{tikzpicture}[declare function={rot=X;a=3;b=1;}]
path[use as bounding box] (-1,-1) rectangle (9,5);
begin{axis}[xmin=-3,xmax=3,ymin=-3,ymax=3,zmin=-1,zmax=1,
width=8.5cm,
height=2in,
]
addplot3[fill=gray,opacity=0.2,domain=0:360,smooth]
({a*cos(x)*cos(rot)},{a*cos(x)*sin(rot)},{b*sin(x)});
end{axis}
end{tikzpicture}}
end{document}
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%2f467601%2fmaking-a-filled-surface-in-a-3d-plane-to-look-like-a-filled-ellipse-in-3d-pl%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
Something like this?
documentclass{standalone}
usepackage{pgfplots}
usetikzlibrary{3d}
pgfplotsset{compat=newest}
begin{document}
begin{tikzpicture}
begin{axis}[
width=8.5cm,
height=2in,
]
begin{scope}[canvas is yz plane at x=0.3]
filldraw[fill = gray!10,rounded corners = 1mm, draw = black] (0,-1) rectangle (7,1);
fill[red, opacity = 0.4] (3.5, 0) ellipse (3cm and 1cm);
end{scope}
addplot3[surf,mesh/rows=2,fill=gray,opacity=0.2] coordinates {
(0.3,0,-1) (.3,7,-1)
(0.3,0,1) (.3,7,1)
};
end{axis}
end{tikzpicture}
end{document}
You can comment out the line filldraw[fill = gray!10,rounded corners = 1mm, draw = black] (0,-1) rectangle (7,1);
if you want to remove the plane
Not quite because, if we start using the plane definition then I must manually set the view everytime when it changes (becomes quite close to impossible when I deal with a large data-set). I am looking for a solution where we use the cooridnates to draw a elliptical plane in 3d without influencing the viewing angles (manually). Nevertheless it is a good solution (+1).
– Raaja
Dec 27 at 21:06
1
@Raaja Sorry but I don't get your comment. Where do I manually set the viewing angle?
– caverac
Dec 27 at 21:09
I meant the specification where it is mentioned asyz
plane. More specifically I want to avoid using the scope.
– Raaja
Dec 27 at 21:10
1
@Raaja Well, you need to draw the plane somewhere, I don't see how you can draw a figure if you don't know where you are going to draw it. but, I'm also pretty sure someone else can give you a better answer anyways :)
– caverac
Dec 27 at 21:13
I understand what you mean by that ;) however, this can be assumed a problem where I try to - let's say - modify the mesh into a elliptical one :D
– Raaja
Dec 27 at 21:15
|
show 1 more comment
Something like this?
documentclass{standalone}
usepackage{pgfplots}
usetikzlibrary{3d}
pgfplotsset{compat=newest}
begin{document}
begin{tikzpicture}
begin{axis}[
width=8.5cm,
height=2in,
]
begin{scope}[canvas is yz plane at x=0.3]
filldraw[fill = gray!10,rounded corners = 1mm, draw = black] (0,-1) rectangle (7,1);
fill[red, opacity = 0.4] (3.5, 0) ellipse (3cm and 1cm);
end{scope}
addplot3[surf,mesh/rows=2,fill=gray,opacity=0.2] coordinates {
(0.3,0,-1) (.3,7,-1)
(0.3,0,1) (.3,7,1)
};
end{axis}
end{tikzpicture}
end{document}
You can comment out the line filldraw[fill = gray!10,rounded corners = 1mm, draw = black] (0,-1) rectangle (7,1);
if you want to remove the plane
Not quite because, if we start using the plane definition then I must manually set the view everytime when it changes (becomes quite close to impossible when I deal with a large data-set). I am looking for a solution where we use the cooridnates to draw a elliptical plane in 3d without influencing the viewing angles (manually). Nevertheless it is a good solution (+1).
– Raaja
Dec 27 at 21:06
1
@Raaja Sorry but I don't get your comment. Where do I manually set the viewing angle?
– caverac
Dec 27 at 21:09
I meant the specification where it is mentioned asyz
plane. More specifically I want to avoid using the scope.
– Raaja
Dec 27 at 21:10
1
@Raaja Well, you need to draw the plane somewhere, I don't see how you can draw a figure if you don't know where you are going to draw it. but, I'm also pretty sure someone else can give you a better answer anyways :)
– caverac
Dec 27 at 21:13
I understand what you mean by that ;) however, this can be assumed a problem where I try to - let's say - modify the mesh into a elliptical one :D
– Raaja
Dec 27 at 21:15
|
show 1 more comment
Something like this?
documentclass{standalone}
usepackage{pgfplots}
usetikzlibrary{3d}
pgfplotsset{compat=newest}
begin{document}
begin{tikzpicture}
begin{axis}[
width=8.5cm,
height=2in,
]
begin{scope}[canvas is yz plane at x=0.3]
filldraw[fill = gray!10,rounded corners = 1mm, draw = black] (0,-1) rectangle (7,1);
fill[red, opacity = 0.4] (3.5, 0) ellipse (3cm and 1cm);
end{scope}
addplot3[surf,mesh/rows=2,fill=gray,opacity=0.2] coordinates {
(0.3,0,-1) (.3,7,-1)
(0.3,0,1) (.3,7,1)
};
end{axis}
end{tikzpicture}
end{document}
You can comment out the line filldraw[fill = gray!10,rounded corners = 1mm, draw = black] (0,-1) rectangle (7,1);
if you want to remove the plane
Something like this?
documentclass{standalone}
usepackage{pgfplots}
usetikzlibrary{3d}
pgfplotsset{compat=newest}
begin{document}
begin{tikzpicture}
begin{axis}[
width=8.5cm,
height=2in,
]
begin{scope}[canvas is yz plane at x=0.3]
filldraw[fill = gray!10,rounded corners = 1mm, draw = black] (0,-1) rectangle (7,1);
fill[red, opacity = 0.4] (3.5, 0) ellipse (3cm and 1cm);
end{scope}
addplot3[surf,mesh/rows=2,fill=gray,opacity=0.2] coordinates {
(0.3,0,-1) (.3,7,-1)
(0.3,0,1) (.3,7,1)
};
end{axis}
end{tikzpicture}
end{document}
You can comment out the line filldraw[fill = gray!10,rounded corners = 1mm, draw = black] (0,-1) rectangle (7,1);
if you want to remove the plane
answered Dec 27 at 21:00
caverac
5,3731522
5,3731522
Not quite because, if we start using the plane definition then I must manually set the view everytime when it changes (becomes quite close to impossible when I deal with a large data-set). I am looking for a solution where we use the cooridnates to draw a elliptical plane in 3d without influencing the viewing angles (manually). Nevertheless it is a good solution (+1).
– Raaja
Dec 27 at 21:06
1
@Raaja Sorry but I don't get your comment. Where do I manually set the viewing angle?
– caverac
Dec 27 at 21:09
I meant the specification where it is mentioned asyz
plane. More specifically I want to avoid using the scope.
– Raaja
Dec 27 at 21:10
1
@Raaja Well, you need to draw the plane somewhere, I don't see how you can draw a figure if you don't know where you are going to draw it. but, I'm also pretty sure someone else can give you a better answer anyways :)
– caverac
Dec 27 at 21:13
I understand what you mean by that ;) however, this can be assumed a problem where I try to - let's say - modify the mesh into a elliptical one :D
– Raaja
Dec 27 at 21:15
|
show 1 more comment
Not quite because, if we start using the plane definition then I must manually set the view everytime when it changes (becomes quite close to impossible when I deal with a large data-set). I am looking for a solution where we use the cooridnates to draw a elliptical plane in 3d without influencing the viewing angles (manually). Nevertheless it is a good solution (+1).
– Raaja
Dec 27 at 21:06
1
@Raaja Sorry but I don't get your comment. Where do I manually set the viewing angle?
– caverac
Dec 27 at 21:09
I meant the specification where it is mentioned asyz
plane. More specifically I want to avoid using the scope.
– Raaja
Dec 27 at 21:10
1
@Raaja Well, you need to draw the plane somewhere, I don't see how you can draw a figure if you don't know where you are going to draw it. but, I'm also pretty sure someone else can give you a better answer anyways :)
– caverac
Dec 27 at 21:13
I understand what you mean by that ;) however, this can be assumed a problem where I try to - let's say - modify the mesh into a elliptical one :D
– Raaja
Dec 27 at 21:15
Not quite because, if we start using the plane definition then I must manually set the view everytime when it changes (becomes quite close to impossible when I deal with a large data-set). I am looking for a solution where we use the cooridnates to draw a elliptical plane in 3d without influencing the viewing angles (manually). Nevertheless it is a good solution (+1).
– Raaja
Dec 27 at 21:06
Not quite because, if we start using the plane definition then I must manually set the view everytime when it changes (becomes quite close to impossible when I deal with a large data-set). I am looking for a solution where we use the cooridnates to draw a elliptical plane in 3d without influencing the viewing angles (manually). Nevertheless it is a good solution (+1).
– Raaja
Dec 27 at 21:06
1
1
@Raaja Sorry but I don't get your comment. Where do I manually set the viewing angle?
– caverac
Dec 27 at 21:09
@Raaja Sorry but I don't get your comment. Where do I manually set the viewing angle?
– caverac
Dec 27 at 21:09
I meant the specification where it is mentioned as
yz
plane. More specifically I want to avoid using the scope.– Raaja
Dec 27 at 21:10
I meant the specification where it is mentioned as
yz
plane. More specifically I want to avoid using the scope.– Raaja
Dec 27 at 21:10
1
1
@Raaja Well, you need to draw the plane somewhere, I don't see how you can draw a figure if you don't know where you are going to draw it. but, I'm also pretty sure someone else can give you a better answer anyways :)
– caverac
Dec 27 at 21:13
@Raaja Well, you need to draw the plane somewhere, I don't see how you can draw a figure if you don't know where you are going to draw it. but, I'm also pretty sure someone else can give you a better answer anyways :)
– caverac
Dec 27 at 21:13
I understand what you mean by that ;) however, this can be assumed a problem where I try to - let's say - modify the mesh into a elliptical one :D
– Raaja
Dec 27 at 21:15
I understand what you mean by that ;) however, this can be assumed a problem where I try to - let's say - modify the mesh into a elliptical one :D
– Raaja
Dec 27 at 21:15
|
show 1 more comment
First of all, let me start by saying that I don't think there is anything wrong with caverac's answer; rather I like and upvoted it. (One could add a local transformation to rotate the plane the ellipse is in.) Nevertheless, the arguably simplest way to generate an ellipse in pgfplots is to plot it. This code and animation show how one can do that.
documentclass[tikz,border=3.14mm]{standalone}
usepackage{pgfplots}
pgfplotsset{compat=newest}
begin{document}
foreach X in {5,15,...,355}
{begin{tikzpicture}[declare function={rot=X;a=3;b=1;}]
path[use as bounding box] (-1,-1) rectangle (9,5);
begin{axis}[xmin=-3,xmax=3,ymin=-3,ymax=3,zmin=-1,zmax=1,
width=8.5cm,
height=2in,
]
addplot3[fill=gray,opacity=0.2,domain=0:360,smooth]
({a*cos(x)*cos(rot)},{a*cos(x)*sin(rot)},{b*sin(x)});
end{axis}
end{tikzpicture}}
end{document}
add a comment |
First of all, let me start by saying that I don't think there is anything wrong with caverac's answer; rather I like and upvoted it. (One could add a local transformation to rotate the plane the ellipse is in.) Nevertheless, the arguably simplest way to generate an ellipse in pgfplots is to plot it. This code and animation show how one can do that.
documentclass[tikz,border=3.14mm]{standalone}
usepackage{pgfplots}
pgfplotsset{compat=newest}
begin{document}
foreach X in {5,15,...,355}
{begin{tikzpicture}[declare function={rot=X;a=3;b=1;}]
path[use as bounding box] (-1,-1) rectangle (9,5);
begin{axis}[xmin=-3,xmax=3,ymin=-3,ymax=3,zmin=-1,zmax=1,
width=8.5cm,
height=2in,
]
addplot3[fill=gray,opacity=0.2,domain=0:360,smooth]
({a*cos(x)*cos(rot)},{a*cos(x)*sin(rot)},{b*sin(x)});
end{axis}
end{tikzpicture}}
end{document}
add a comment |
First of all, let me start by saying that I don't think there is anything wrong with caverac's answer; rather I like and upvoted it. (One could add a local transformation to rotate the plane the ellipse is in.) Nevertheless, the arguably simplest way to generate an ellipse in pgfplots is to plot it. This code and animation show how one can do that.
documentclass[tikz,border=3.14mm]{standalone}
usepackage{pgfplots}
pgfplotsset{compat=newest}
begin{document}
foreach X in {5,15,...,355}
{begin{tikzpicture}[declare function={rot=X;a=3;b=1;}]
path[use as bounding box] (-1,-1) rectangle (9,5);
begin{axis}[xmin=-3,xmax=3,ymin=-3,ymax=3,zmin=-1,zmax=1,
width=8.5cm,
height=2in,
]
addplot3[fill=gray,opacity=0.2,domain=0:360,smooth]
({a*cos(x)*cos(rot)},{a*cos(x)*sin(rot)},{b*sin(x)});
end{axis}
end{tikzpicture}}
end{document}
First of all, let me start by saying that I don't think there is anything wrong with caverac's answer; rather I like and upvoted it. (One could add a local transformation to rotate the plane the ellipse is in.) Nevertheless, the arguably simplest way to generate an ellipse in pgfplots is to plot it. This code and animation show how one can do that.
documentclass[tikz,border=3.14mm]{standalone}
usepackage{pgfplots}
pgfplotsset{compat=newest}
begin{document}
foreach X in {5,15,...,355}
{begin{tikzpicture}[declare function={rot=X;a=3;b=1;}]
path[use as bounding box] (-1,-1) rectangle (9,5);
begin{axis}[xmin=-3,xmax=3,ymin=-3,ymax=3,zmin=-1,zmax=1,
width=8.5cm,
height=2in,
]
addplot3[fill=gray,opacity=0.2,domain=0:360,smooth]
({a*cos(x)*cos(rot)},{a*cos(x)*sin(rot)},{b*sin(x)});
end{axis}
end{tikzpicture}}
end{document}
answered 2 days ago
marmot
87.1k4100187
87.1k4100187
add a comment |
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.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- 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%2f467601%2fmaking-a-filled-surface-in-a-3d-plane-to-look-like-a-filled-ellipse-in-3d-pl%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