Graphics, Figures & Tables ⇒ 3D tikz problem
3D tikz problem
Hello everyone,
I have some problem with outcome I get when running 3d on tikz.
I need to produce two 3D graphs but in one of then I'm not getting the desired outcome.
I have attached 3 files, the desired equation, my commands and how the graph should look like.
Thank you for the help.
I have some problem with outcome I get when running 3d on tikz.
I need to produce two 3D graphs but in one of then I'm not getting the desired outcome.
I have attached 3 files, the desired equation, my commands and how the graph should look like.
Thank you for the help.
- Attachments
-
- Actual graph
- Screen Shot 2016-08-18 at 10.17.21 PM.png (80.22 KiB) Viewed 6754 times
-
- Try 3.tex
- Commends
- (405 Bytes) Downloaded 357 times
-
- Desired equation
- Equation.png (18.58 KiB) Viewed 6754 times
NEW: TikZ book now 40% off at Amazon.com for a short time.

- Stefan Kottwitz
- Site Admin
- Posts: 10344
- Joined: Mon Mar 10, 2008 9:44 pm
3D tikz problem
This comes a bit closer. Still, your sample graph seems to treat large values in a certain way, such as cutting off, while pgfplots discards or jumps. I guess this can be solved, I just don't see a way right now.
Stefan
Code: Select all
\documentclass[border=10pt]{standalone}
\usepackage{pgfplots}
\pgfplotsset{width=7cm,compat=1.8}
\usepgfplotslibrary{colormaps}
\begin{document}
\begin{tikzpicture}
\begin{axis}[zmin=0,zmax=10000]
\addplot3[surf,colormap/autumn,samples=50,samples y=30,
domain=0.0001:0.9999,restrict z to domain={0:20000},
unbounded coords=jump]
{((256*y^2*(1-x)^2)/(x^2*(1-sqrt(x/(2-x)))^4))*(1-(((12-3*x)*(1-x))/(4*(2-x)^2))-((1-sqrt(x/(2-x)))^2/16))};
\end{axis}
\end{tikzpicture}
\end{document}
LaTeX.org admin
Re: 3D tikz problem
Hi Stafen,
Thanks for the help that is much better than what I got.
Any ideas how I can add counter lines?
Thanks for the help that is much better than what I got.
Any ideas how I can add counter lines?
- Stefan Kottwitz
- Site Admin
- Posts: 10344
- Joined: Mon Mar 10, 2008 9:44 pm
3D tikz problem
Hm, do you mean contour lines? pgfplots can do it, using gnuplot in the background. Take a look at thelayuval wrote:Any ideas how I can add counter lines?

Stefan
LaTeX.org admin
- Stefan Kottwitz
- Site Admin
- Posts: 10344
- Joined: Mon Mar 10, 2008 9:44 pm
3D tikz problem
Here is another version. I restricted z using domain* to get this top surface.
A second plot is just a try to visualize horizontal lines a bit stronger, you could omit it.
Stefan
A second plot is just a try to visualize horizontal lines a bit stronger, you could omit it.
Code: Select all
\documentclass[border=10pt]{standalone}
\usepackage{pgfplots}
\pgfplotsset{width=7cm,compat=1.8}
\usepgfplotslibrary{colormaps}
\begin{document}
\begin{tikzpicture}
\begin{axis}[
zmin=0,zmax=11000,
scaled z ticks=false,
tick label style={font=\scriptsize},
]
\addplot3[surf,shader=faceted interp,
colormap/autumn,
samples=40,samples y=40,
domain=0.0001:0.9999,
restrict z to domain*={0:10000},
unbounded coords=jump,
]
{((256*y^2*(1-x)^2)/(x^2*(1-sqrt(x/(2-x)))^4))
*(1-(((12-3*x)*(1-x))/(4*(2-x)^2))
-((1-sqrt(x/(2-x)))^2/16))};
\addplot3[z filter/.expression={z>=10000 ? nan : z},
colormap/autumn,
fill=none,
smooth,
samples=40,samples y=40,
domain=0.0001:0.9999,
unbounded coords=jump,
]
{((256*y^2*(1-x)^2)/(x^2*(1-sqrt(x/(2-x)))^4))
*(1-(((12-3*x)*(1-x))/(4*(2-x)^2))
-((1-sqrt(x/(2-x)))^2/16))};
\end{axis}
\end{tikzpicture}
\end{document}
LaTeX.org admin
Re: 3D tikz problem
Thanks again!
Is there any guideline I can follow when producing this kind of graph?
I'm asking since I have similar problem with another graph.
As can be seen in the attached file the graph looks perfect when bounded in 0.1 but very unclear with any higher value.
Is there any guideline I can follow when producing this kind of graph?
I'm asking since I have similar problem with another graph.
As can be seen in the attached file the graph looks perfect when bounded in 0.1 but very unclear with any higher value.
- Attachments
-
- f&z impact on alfa.tex
- (569 Bytes) Downloaded 358 times
- Stefan Kottwitz
- Site Admin
- Posts: 10344
- Joined: Mon Mar 10, 2008 9:44 pm
3D tikz problem
There's no guideline. Though there are some good ways to fix things, such as restricting a domain, treating unbound coordinates (jump or discard), filters for results, point meta settings. They are in the
pgfplots manual, may be hard to find as it's a comprehensive reference. I like this big documentation with many examples though.
I made a gallery for getting started or for getting ideas: pgfplots.net.
I must admit that it took me some time to fine-tune your plot. It's often experimenting with settings and choosing the best. Btw. one nice trick I remember is changing parametrization for a better plot, as here: Cutting plots. There I also added a contour plot for the cut. I like plotting as the plots on tikz.de show.
Stefan

I made a gallery for getting started or for getting ideas: pgfplots.net.
I must admit that it took me some time to fine-tune your plot. It's often experimenting with settings and choosing the best. Btw. one nice trick I remember is changing parametrization for a better plot, as here: Cutting plots. There I also added a contour plot for the cut. I like plotting as the plots on tikz.de show.

Stefan
LaTeX.org admin