# 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}
\begin{document}
\begin{tikzpicture}
\begin{axis}[
width=8.5cm,
height=2in,
]
(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.

Something like this?

\documentclass{standalone}
\usepackage{pgfplots}
\usetikzlibrary{3d}
\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}

(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 '18 at 21:06
• @Raaja Sorry but I don't get your comment. Where do I manually set the viewing angle? – caverac Dec 27 '18 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 '18 at 21:10
• @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 '18 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 '18 at 21:15

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}
\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,
]