New answers tagged

3

I think there is no inconsistency, you get the arrows you are asking for. Yet you may be looking for this. \documentclass[tikz,border=3.14mm]{standalone} \usepackage{pgfplots} \pgfplotsset{compat=newest} \usepgfplotslibrary{fillbetween} \newcommand{\DrawWithXYProjections}[8] { \coordinate (O) at (#1,#2,#3); % First endpoint in space \coordinate (E)...


6

This is at least a start. You can define function that compute the components of the gradient numerically for a given function. Then you do a loop to produce the next coordinate from the previous one and the gradient at the previous coordinate. Many variations are possible, as usual (and I hope that this does not not lead to many comments requesting to spell ...


1

Here is my version: \documentclass[border=10pt]{standalone} \usepackage[pdftex]{graphicx} \usepackage{pgfplots} \usepgfplotslibrary{colormaps} \begin{document} \begin{tikzpicture}[yscale=2, xscale=1] \begin{axis}[axis line style={draw=none}, view={170}{-20}, grid=major, xmin=0,xmax=2, ymin=0,ymax=2, zmin=0,zmax=4, ...


1

Along the lines of my answer Plotting a 3d surface in tikz, with a limit to the infinity, I combine a computer algebra system, SAGE with LaTeX by way of the sagetex package. First, it helps to know what the plot will look like. Go to a Sage Cell Server and typing in the following lines: var('y') plot3d(x^3/y^2,(x,-2,2),(y,-2,2)) followed by enter and ...


1

With R instead of gnuplot: \documentclass{article} \begin{document} <<echo=F,dev="tikz",message=FALSE>>= s <- function (x, y) {return (x^3/y^2)} x <- seq(-1, 1, length= 30) y <- x z <- outer(x, y, s) library(lattice) library(gridExtra) trellis.par.set("axis.line", list(col=NA,lty=1,lwd=1)) wireframe(z, drape=T, shade=T, xlab="x", ...


3

If you have properly installed a coordinate system, you can use canvas is <planex planey> plane at <orth>=<coord> from the 3d library. Here <planex planey> is something like xy or zx, and <orth> denotes the orthogonal direction (i.e. for xy it is z, for zx it is y and so on), and coord is the coordinate to the plane along the ...


2

This is certainly an overkill answer. Yet it is an attempt to achieve 3d ordering independently of the package used to obtain orthographic projections. The fill colors are stored in keys like xy face/.style={fill=orange}. \documentclass[tikz,border=5pt]{standalone} \usetikzlibrary{perspective,3d,fpu} \makeatletter \pgfmathdeclarefunction{screendepth}{3}{% \...


2

\value is not what you want. It works on counters, which your expression does not contain. To perform the required integer math, use \numexpr...\relax. Please see comments below for additional warnings/disclaimers. \documentclass[border=3pt,tikz]{standalone} \let\oldvec\vec \usepackage{amsmath} % for \text \usepackage{tikz} \usepackage{comment} \tikzset{&...


4

I have two more truncations \documentclass{book} \usepackage{tikz} \usepackage{pgfplots} \pgfplotsset{compat=1.7} \begin{document} \pgfmathdeclarefunction{volcano_z}{2}{% \pgfmathsetmacro\radsq{#1^2 + #2^2}% \radsq is radius^2 in FPU notation \pgfmathfloattofixed{\radsq}\let\radsqsafe=\pgfmathresult % in safe notation \ifdim\radsqsafe pt > ...


2

This isn't tikz, it's the graphics from a computer algebra system, SAGE. If you're going to consider gnuplot or asymptote then it makes sense to consider SAGE. The coding is simple to do: \documentclass{article} \usepackage{graphicx} \usepackage{sagetex} \begin{document} \begin{sagesilent} var("y,z") F = z*y^2-x^3+3*x*z^2-3*z^3 p = implicit_plot3d(F, (x,-2,...


3

The issue is that TikZ/pgfplots assumes that the arguments of the trigonometric functions are in degrees unless told otherwise. In order to switch to radians, you can use trig format plots=rad or wrap the arguments of the trigonometric functions into deg, among other things. From your other question I take that you want to add some water waves to the plot. ...


3

What I meant is this: you can always use a parametric plot to swap the roles of x and z, say. For instance, if you replace \addplot3[surf,domain=0:5,domain y=0:5] {f(x,y)}; by \addplot3[surf,domain=0:5,domain y=0:5,point meta=x] ({f(x,y)},x,y); the x amplitude is determined by the function instead of the z amplitude. \documentclass[tikz,border=3mm]{...


13

Normally, in order to get a good finish of radially symmetric functions, one switches to polar coordinates. However, this does not look good at the bottom, at least not without considerable surgery. So one possibility is to superimpose two plots. \documentclass{book} \usepackage{pgfplots} \pgfplotsset{compat=1.17} \begin{document} \begin{tikzpicture} \...


Top 50 recent answers are included