2

I have temperature data which is axis symmetric.(See Figure 1; apologies for my bad drawing)Figure 1 The number(1 to 10) denotes the point of measurement. Now, From this data, how do I get a filled contour like Figure 2 and 3 ? Is it possible in pgfplots? Figure 2 Figure 3

The last two figures are for representation purpose only.

crateane
  • 2,217
  • did you check the manual? a surf plots might be the closest what you can do with pgfplots – crateane May 18 '16 at 13:21
  • Just check this: – Francesco May 18 '16 at 13:34
  • http://www.ceus-now.com/tikz-radial-shading-of-a-ring/ – Francesco May 18 '16 at 13:34
  • @Francesco --> http://tex.stackexchange.com/questions/82425/tikz-radial-shading-of-a-ring – percusse May 18 '16 at 13:40
  • Yes @percusse, that's the same. Is what you wanted @SaravanaK? – Francesco May 18 '16 at 13:49
  • @Francesco I'm not sure. I'm looking for a graph rather than a picture. My contour colour should range from red(hottest) to blue (coolest) with a colourbar! Thanks anyway. I'll try if I can do something with it. – Rhinocerotidae May 18 '16 at 14:37
  • You may want to take a look at section "Filled Contour Plots" in the pgfplots reference manual. Limited support for filled contours is available since the current stable version 1.13 (see its documentation for limitations). Make sure you browse the manual in a decent pdf viewer -- shader=interp still poses challenges for pdf.js and other open source pdf viewers. – Christian Feuersänger Jul 09 '16 at 22:07

1 Answers1

3

You can use contour filled in order to visualize the data and data cs=polar if you need polar coordinates:

\documentclass{standalone}

\usepackage{pgfplots}

\usepgfplotslibrary{colorbrewer} \pgfplotsset{compat=1.14}

\begin{document}

\begin{tikzpicture} \begin{axis}[colorbar, colormap/Spectral,view={0}{90}] \addplot3[ domain=0:360, domain y=0:360, data cs=polar, contour filled={number=15}, ] (x,y,{sin(y)}); \end{axis} \end{tikzpicture}

\end{document}

enter image description here

The key data cs=polar ensures that x is the angle, y the radius, and the z value is chosen as oscillating function in the range -1:1. The provided colormap is a "diverging" scheme of colorbrewer which is quite suitable for the oscillating function here, but you can use any other colormap as well. You can use any kind of input data (including table data) as long as it forms a mesh (i.e. has inherent matrix structure).

\documentclass{standalone}

\usepackage{pgfplots}

\usepgfplotslibrary{colorbrewer} \pgfplotsset{compat=1.14}

\begin{document}

\begin{tikzpicture} \begin{axis}[colorbar, xmin=0, ymin=0,colormap/Spectral,view={0}{90}] \addplot3[ domain=0:360, domain y=0:360, data cs=polar, contour filled={number=15}, ] (x,y,{sin(y)}); \end{axis} \end{tikzpicture}

\end{document}

enter image description here

Note that contour filled requires pgfplots 1.14 or newer. At the time of this writing, you may need an update first (august 2016).