Graphics, Figures & Tables ⇒ 3D tikz problem
3D tikz problem
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 6722 times
-
- Try 3.tex
- Commends
- (405 Bytes) Downloaded 355 times
-
- Desired equation
- Equation.png (18.58 KiB) Viewed 6722 times
NEW: TikZ book now 40% off at Amazon.com for a short time.
And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p
- Stefan Kottwitz
- Site Admin
- Posts: 10324
- Joined: Mon Mar 10, 2008 9:44 pm
3D tikz problem
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}
Re: 3D tikz problem
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: 10324
- 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
- Stefan Kottwitz
- Site Admin
- Posts: 10324
- Joined: Mon Mar 10, 2008 9:44 pm
3D tikz problem
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}
Re: 3D tikz problem
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 356 times
- Stefan Kottwitz
- Site Admin
- Posts: 10324
- Joined: Mon Mar 10, 2008 9:44 pm
3D tikz problem

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