TransWikia.com

Tikz: Filling up plane defined by equation with a particular colour

TeX - LaTeX Asked on December 16, 2020

I’m trying to draw planes using their equations using addplot3. Problems start to occur when I want to fill the planes with colour. I want to fill them with colour, just as I would be able to do had I defined my plane by a set of coordinates. Here is my code:

begin{figure}
centering
begin{tikzpicture}[scale=2.5]
begin{axis}[
title={Intersecting planes}, 
xlabel=$x$, ylabel=$y$, zlabel = $z$,zlabel style={rotate=-90},
small,
]


addplot3[
fill=blue,
domain=-5:5,
domain y=-5:5,
] {x + 2*y -1};

end{axis}

end{tikzpicture}
caption{Caption}
label{fig:my_label}
end{figure}

The output is then

How do I edit the code to make the plane a solid blue?

enter image description here

One Answer

fill=blue is just not the right key for this. Please notice that unless you use keys like axis equal different axes will undergo different scalings. Note also that for intersecting planes you may want to transition to patch plots. This is just to show that you get a blue plane when dialing the right keys. (The fact that it is blue is an accident because the color map happens to give it here, but of course it is possible to install any color one wants.)

documentclass{article}
usepackage{pgfplots}
pgfplotsset{compat=1.17}
begin{document}
begin{figure}
centering
begin{tikzpicture}[scale=2.5]
begin{axis}[
title={Intersecting planes}, 
xlabel=$x$, ylabel=$y$, zlabel = $z$,zlabel style={rotate=-90},
small,
]


addplot3[surf,point meta=0,shader=interp,
domain=-5:5,
domain y=-5:5,
] {x + 2*y -1};

end{axis}

end{tikzpicture}
caption{Caption}
label{fig:my_label}
end{figure}
end{document}

enter image description here

Answered by user227987 on December 16, 2020

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP