1

I'm trying to plot functions using domain colouring that I'd like to combine with tikz visual items (like arrows and curves). I've browsed through both tikz and pgfplots documentations but I could not find any other answer than abusing \addplot3 command which seems both overkill and super slow (actually the doc itself suggests to refrain from using it for sophisticated plots). The functions I'm dealing with are scalar field over the plane and I want a flat 2D representation. Am I missing a more appropriate command? Or by any chance is there some well-known package for this specific purpose?

1 Answer 1

1

Not sure if this is what you are looking for but you can use existing diagrams and import them in pgfplpots. Then you can use the normal tikz commands and pgfplots commands to prettify your plot.

This plot type allows to extend the plotting capabilities of pgfplots beyond its own limitations. The idea is to generate the graphics as such (for example, a contour plot, a complicated shaded surface9 or a large point cluster) with an external program like Matlab or gnuplot. The graphics, however, should not contain an axis or descriptions. Then, we use \includegraphics and a pgfplots axis which fits exactly on top of the imported graphics

-- Taken from the pgfplots manual: 4.3.7 Using External Graphics as Plot Sources.

enter image description here

\documentclass{article}
\usepackage{graphicx}

\usepackage{pgfplots}
\pgfplotsset{width=7cm,compat=1.15}

\begin{document}
% See also https://tex.stackexchange.com/questions/231738 for "example-grid-100x100pt"
% See pgfplots manuel "4.3.7 Using External Graphics as Plot Sources" including "Support for External Three-Dimensional Graphics" 

\begin{tikzpicture}
\begin{axis}[
enlargelimits=false,
axis on top,
]
\addplot graphics [
xmin=-3,xmax=3,
ymin=-3,ymax=3,
] {example-grid-100x100pt};
\end{axis}
\end{tikzpicture}

\end{document}

enter image description here

enter image description here -- Taken from the pgfplots manual.

1
  • I actually came to the same conclusion that generating my diagrams with an external tool was the best solution. Apr 25, 2021 at 7:41

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .