Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for 3d surface/mesh plots? #116

Open
asinghvi17 opened this issue May 7, 2019 · 3 comments
Open

Support for 3d surface/mesh plots? #116

asinghvi17 opened this issue May 7, 2019 · 3 comments

Comments

@asinghvi17
Copy link

Will there be any support for surface or mesh plots? How might this best be accomplished?

@mykelk
Copy link
Member

mykelk commented May 8, 2019

Can you point us to an example in the PGF Manual of an example of what you would like? Typically, we use image plots or contour plots to represent scalar functions of two variables.

@asinghvi17
Copy link
Author

An example:

\documentclass[tikz]{standalone}
\usepackage{pgfplots}
\usepgfplotslibrary{colormaps}
\pgfplotsset{compat = 1.16}

\begin{document}

\begin{tikzpicture}

\begin{axis}[
  xmin=-4,
  xmax=4,
  ymin=-4,
  ymax=4,
  colormap/viridis,
  colorbar,
  xlabel = {$x$},
  ylabel = {$y$},
  zlabel = {$z$},
  grid = major,
  view = {120}{30},
  ]
  \addplot3 [
  surf,
  shader=interp,
  domain=-4:4,
  domain y=-4:4,
  ] {(4 - x - 2*y)/3};

\end{axis}

\end{tikzpicture}
\end{document}

which generates this as output:
Screen Shot 2019-05-08 at 1 28 25 PM
Basically, I would like 3d mesh/surf plots to be supported (I wasn't able to find any examples in the manual).

@mykelk
Copy link
Member

mykelk commented May 8, 2019

Ah, okay. I think it would be fairly easy to add. Just create a mutable struct Surface in plots.jl with the relevant fields. Then add function plot(p::Surface) to PGFPlots.jl with implementation similar to that of Contour. Pull requests are welcome.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants