3

I am trying to generate a surface plot according to following criterion

Maximum value of x = .0022396698004215356

Minimum value of x = -.0022396698004215356

Maximum value of y = .0002880473016238141

Minimum value of Y = -.0002880473016238141

Whereas, the plot will be plotted using this formula:

Z = 1.64214226911672 * (1 - x^2/1.77762709862528 - y^2/0.228623294807122)^0.5

Here is the MWE which rather be called Minimum non working example. I have tried a lot of options but none seems to work.

\documentclass{article} 
\usepackage{pgfplots} 
\pgfplotsset{compat=newest} 
\pgfplotsset{plot coordinates/math parser=false} 

\newlength\figureheight 
\newlength\figurewidth 
\begin{document} 
\begin{tikzpicture}
\begin{axis}[
title={A test plot},
xlabel={a},
ylabel={b}, 
domain=-5:5,
samples=100,
colormap/jet
]
\addplot3[
mesh,
samples=40,
%domain=-8:8,
]
{sqrt(1000 - x^2 - y^2)};
\end{axis}
\end{tikzpicture}
\end{document}

I want to know a way to plot something like the figure given below:

Target image

4

Your data is too small even for pgfplots because of the squaring but your problem is homogenous hence scaling fortunately save you here and then you can change the labels etc. An example with scaled axis:

\documentclass{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=1.14}
\begin{document}
\begin{tikzpicture}
\begin{axis}[
title={A test plot},
xlabel={a},
ylabel={b}, 
domain = -0.0022396698004215356:0.0022396698004215356,
y domain=-0.0002880473016238141:0.0002880473016238141,
colormap/viridis
]
\addplot3[surf,samples=40]
{1.64214226911672 * (1 - (100*x)^2/1.77762709862528 -(100* y)^2/0.228623294807122)^0.5};
\end{axis}
\end{tikzpicture}
\end{document}

And please don't use jet it is a wrong colormap.

enter image description here

  • Perfectly what I was looking for! Excellent solution. Thanks – Mist Oct 7 '16 at 14:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.