• Viewing angles in pgfplot's axis
    by noparadise on August 29, 2025 at 2:34 pm

    I am starting to work with pgfplots and I'm struggling to get my axes right. I know that choosing the two angles in the view={}{} option of the axis environment can change the setup of your axes. Momentarily I have the following code. \documentclass[crop=false]{standalone} \usepackage{pgfplots} \pgfplotsset{width=10cm,compat=1.9} \begin{document} \begin{figure}[!ht] \centering \begin{tikzpicture} \begin{axis}[ view={-45}{45}, xlabel={$x$}, ylabel={$y$}, zlabel={$z$}, axis lines=center, axis on top, samples=5, domain=-4:4, xtick=data, ytick=data, ztick=\empty, % no z ticks here ] \addplot3 [surf] {x*y}; \end{axis} \end{tikzpicture} \end{figure} \end{document} However, I would like my axes to look like in the figure below. Is there anyone who can help me in finding the right angles to get to this axis configuration? Thanks in advance!

  • Memorizing inconsistent key names in pgfplots
    by Paul Paulsen on August 25, 2025 at 6:13 pm

    I absolutely love tikz and pgfplots, and I am really thankful for what their authors have built. I regularly am surprised and in awe by what people can accomplish in them. Also, both of them have among the best documentation I have ever come across, and the online versions (tikz and pgfplots) are so smooth to use that I even find myself wanting to learn new functionalities for fun. However, I have one big frustration with pgfplots: I am seemingly unable to ever memorize any of the keys I can use. I always need to look up how to fine tune my plots, no matter how recently I did the same thing - either in the documentation or a file I made earlier. That most code editors can't come up with suggestions for tikz and pgfplots commands doesn't make things easier (I currently mostly use overleaf). And I think the inconsistent naming for keys plays a big role in my difficulties. For example: xtick distance but extra x ticks - why not extra xticks? extra x ticks but extra x tick labels - why not extra x ticks labels? Does anyone have any tips and tricks how to work around this and how to remember the most important of the many, many, many possible options? And out of curiosity, are there any technical reasons for these inconsistencies?

  • Pgfplot Heatmap building fails due to ```\pgfmath@dimen@ ...men@@ #1=0.0pt\relax \pgfmath@```
    by Matthias on August 24, 2025 at 11:30 am

    I want to plot a heat map of our earth (it's actually SNR of HF-Propagation). This works fine, however, if enable the colorbar in my axis definition I run into this issue: ! Undefined control sequence. \pgfmath@dimen@ ...men@@ #1=0.0pt\relax \pgfmath@ This is the Result without colorbar: Here the latex code, as a full example: \begin{tikzpicture} \begin{axis}[ view={0}{90}, colormap/jet, %colorbar, %point meta min=-61.54, %point meta max=29.21, width=10cm, height=6cm, ] \addplot3[ surf, shader=interp, point meta=z ] table [ x index=1, %Long y index=0, %Lat z index=2, col sep=space ] {tote-zone.csv}; % \addplot [] table [] {world.dat}; \end{axis} \end{tikzpicture} tote-zone.csv: https://nopaste.net/logp5oV4Rr world.dat: https://nopaste.net/FK4vcztqXY EDIT: After some chat with ChatGPT-5 I come up with a minimal example: \documentclass{article} \usepackage{circuitikz} \makeatletter \let\empty\relax \makeatother \usepackage{pgfplots} \usepackage{pgfmath} \usepackage{pgfplotstable} \begin{document} \begin{tikzpicture} \begin{axis}[view={0}{90}, colormap/viridis, colorbar, width=10cm, height=6cm] \addplot3[surf, domain=0:1, y domain=0:1, point meta=z]{x*y}; \end{axis} \end{tikzpicture} \end{document} that fails with the same error: ! Undefined control sequence. \pgfmath@dimen@ ...men@@ #1=0.0pt\relax \pgfmath@ So the problem is \makeatletter \let\empty\relax \makeatother It seems that this is somewhere required in my project (I don't remember why). Has anyone a solution?

  • PGFPlots and the gradient of a function
    by Sebastiano on August 21, 2025 at 8:37 pm

    Tonight, I discovered that pgfplots can generate automatic vortices (gradient), i.e., level curves, using the contour lua= option when compiling with LuaLaTeX. I made some modifications to the code found on page 90 of the latest updated PGFPlots documentation. \documentclass[a4paper]{article} \usepackage{amsmath,amssymb} \usepackage{pgfplots} \pgfplotsset{width=7cm,compat=1.18} \usetikzlibrary{arrows.meta} \usepackage{tikz-3dplot} \usetikzlibrary{shapes.geometric} \begin{document} \begin{tikzpicture} \begin{axis}[ title={$x \exp(-x^2-y^2)$ and its gradient}, domain=-2:2, %view={0}{90}, 2D view={35}{35}, %3D axis background/.style={fill=white}, domain = -2:2 ,y domain = -2:2 ,xmin = -2 ,xmax = 2 ,ymin = -2 ,ymax = 2 ,zmin = -2 ,zmax = 2, xlabel=$x$, ylabel=$y$, zlabel=$z$, ] \addplot3 [ contour lua={number=10,labels=false},thick,samples=100 ] {exp(0-x^2-y^2)*x}; \addplot3 [ blue,-stealth,samples=15, quiver={ u={exp(0-x^2-y^2)*(1-2*x^2)},%<----------- ∂ f / ∂x v={exp(0-x^2-y^2)*(-2*x*y)},%<----------- ∂ f / ∂y scale arrows=0.3, }, y domain=-2:2 ] {exp(0-x^2-y^2)*x}; \end{axis} \begin{scope}[canvas is xy plane at z=0,transform shape] \node at (0,0) [rotate=90,scale=2] {$x$}; \node at (1,1) [rotate=90,scale=2] {$y$}; \node at (-2,2) [rotate=90,scale=2] {$z$}; \end{scope} \end{tikzpicture} \end{document} The questions are as follows: How can I modify the code to compute the gradient of the function using the contour lua option, but compiling with pdfLaTeX instead of LuaLaTeX? In the 3D plot, it seems that the vortices or spirals extend (gradient of the function) into the three-dimensional space. How can I fix the display to make it appear more accurate? Additionally, how can I modify the labels to achieve this desired effect of the image below? Related my previous questions: Managing vortex and spiral behavior in PGFPlots Drawing a 3D vector field with vortices and perspective axis labels

  • Wrong axis label position in PGFPlots with extra ticks
    by B Legrand on August 19, 2025 at 2:24 pm

    I noticed an issue with the placement of axis labels in PGFPlots when all of the following conditions are met: tick align=center or tick align=outside is used (not with tick align=inside), there is at least one extra tick, and the compat setting is 1.3 or higher. In this situation, the axis label gets shifted further away from the axis than expected, as if the label position were incorrectly computed based on the tick length. The following image illustrates the problem: First row: tick align=inside (x label placed correctly). Second row: tick align=center, with an extra tick in the second plot You can see that an unwanted extra space between axis and label is added. Third and fourth rows: tick align=outside. The issue becomes worse, and in the last row where I doubled the tick length, the axis label appears to have been shifted by twice that extra tick length (instead of one). This makes me think there is a bug in how PGFPlots calculates the label position when extra ticks are present in these alignments. How can I fix this in PGFPlots without having to apply a manual “hack” for each individual plot? The MWE: \documentclass{article} \usepackage{pgfplots} \pgfplotsset{compat=1.18} \begin{document} \begin{tikzpicture} \begin{axis}[tick align=inside, width = 0.5\textwidth, height=3cm, xlabel={Bla bla bla}] \addplot coordinates {(0,0) (10,10)}; \end{axis} \end{tikzpicture} \begin{tikzpicture} \begin{axis}[tick align=inside, width = 0.5\textwidth, height=3cm, xlabel={Bla bla bla}, extra x ticks={7}, extra x tick labels={\(\alpha\)}] \addplot coordinates {(0,0) (10,10)}; \end{axis} \end{tikzpicture} \hrule\bigbreak \begin{tikzpicture} \begin{axis}[tick align=center, width = 0.5\textwidth, height=3cm, xlabel={Bla bla bla}] \addplot coordinates {(0,0) (10,10)}; \end{axis} \end{tikzpicture} \begin{tikzpicture} \begin{axis}[tick align=center, width = 0.5\textwidth, height=3cm, xlabel={Bla bla bla}, extra x ticks={7}, extra x tick labels={\(\alpha\)}] \addplot coordinates {(0,0) (10,10)}; \end{axis} \end{tikzpicture} \hrule\bigbreak \begin{tikzpicture} \begin{axis}[tick align=outside, width = 0.5\textwidth, height=3cm, xlabel={Bla bla bla}, xticklabel shift=10pt] \addplot coordinates {(0,0) (10,10)}; \end{axis} \end{tikzpicture} \begin{tikzpicture} \begin{axis}[tick align=outside, width = 0.5\textwidth, height=3cm, xlabel={Bla bla bla}, extra x ticks={7}, extra x tick labels={\(\alpha\)}, xticklabel shift=10pt] \addplot coordinates {(0,0) (10,10)}; \end{axis} \end{tikzpicture} \hrule\bigbreak \begin{tikzpicture} \begin{axis}[tick align=outside, width = 0.5\textwidth, height=3cm, major tick length=0.3cm, xlabel={Bla bla bla}] \addplot coordinates {(0,0) (10,10)}; \end{axis} \end{tikzpicture} \begin{tikzpicture} \begin{axis}[tick align=outside, width = 0.5\textwidth, height=3cm, major tick length=0.3cm, xlabel={Bla bla bla}, extra x ticks={7}, extra x tick labels={\(\alpha\)},] \addplot coordinates {(0,0) (10,10)}; \end{axis} \end{tikzpicture} \hrule\bigbreak \begin{tikzpicture} \begin{axis}[tick align=outside, width = 0.5\textwidth, height=3cm, major tick length=0.3cm, xlabel={Bla bla bla}] \addplot coordinates {(0,0) (10,10)}; \end{axis} \end{tikzpicture} \begin{tikzpicture} \begin{axis}[tick align=outside, width = 0.5\textwidth, height=3cm, major tick length=0.3cm, xlabel={Bla bla bla}, extra x ticks={7}, extra x tick labels={\(\beta_{\beta_{\beta_{\beta}}}\)}] \addplot coordinates {(0,0) (10,10)}; \end{axis} \end{tikzpicture} \hrule\bigbreak \begin{tikzpicture} \begin{axis}[tick align=inside, width = 0.5\textwidth, height=3cm, xlabel={Bla bla bla}] \addplot coordinates {(0,0) (10,10)}; \end{axis} \end{tikzpicture} \begin{tikzpicture} \begin{axis}[tick align=inside, width = 0.5\textwidth, height=3cm, xlabel={Bla bla bla}, extra x ticks={7}, extra x tick labels={\(\beta_{\beta_{\beta_{\beta}}}\)}] \addplot coordinates {(0,0) (10,10)}; \end{axis} \end{tikzpicture} \hrule\bigbreak \begin{tikzpicture} \begin{axis}[tick align=outside, width = 0.5\textwidth, height=3cm, major tick length=0.3cm, xlabel={Bla bla bla},] \addplot coordinates {(0,0) (10,10)}; \end{axis} \end{tikzpicture} \begin{tikzpicture} \begin{axis}[tick align=outside, width = 0.5\textwidth, height=3cm, major tick length=0.3cm, xlabel={Bla bla bla}, extra x ticks={7}, extra x tick labels={\(\beta_{\beta_{\beta_{\beta}}}\)}, extra x tick style={xticklabel pos=top}] \addplot coordinates {(0,0) (10,10)}; \end{axis} \end{tikzpicture} \end{document} Maybe related: Pgfplots y label and extra ticks positioning problem. Edit 1: As suggested in kabenyuk’s answer, I tried using the xlabel absolute and ylabel absolute keys, but this creates other issues since the position of the axis labels is no longer computed dynamically based on the size of the tick labels. Below is an example of the problem encountered: Edit 2: I tried to dive into the PGFPlots code, in particular the files pgfplotsticks.code.tex and pgfplots.code.tex, but the code is too complex and far beyond my skills. By trial and error, I did try some modifications, but they don’t solve the problem in the particular case where ticks labels, extra ticks labels, and the axis label are not all on the same side (bottom/top for the x-axis, left/right for the y-axis), as in the last example of the MWE. On the contrary, they make it worse! Moreover, it also doesn’t work when ticklabel shift is nonzero. In any case, I suspect that a length (probably the ticks length) is being counted twice when using an extra tick. But I couldn’t find at which level this double counting happens. Perhaps a conditional structure would need to be implemented to handle the different possible combinations of ticks labels, extra ticks labels, and axis label positions, but I don’t know how to implement such a thing. The modifications in question: \usepackage{etoolbox} \makeatletter \patchcmd{\pgfplots@ticklabel@maxtickdimen@finish} {% \pgf@xa=\csname pgfplots@maxtickdimen@extrashift@#1\endcsname\relax \advance\pgf@xa by \csname pgfplots@maxtickdimen@#1\endcsname\relax }{% \pgf@xa=\csname pgfplots@maxtickdimen@extrashift@#1\endcsname\relax \pgf@xb=\csname pgfplots@maxtickdimen@#1\endcsname\relax \ifdim\pgf@xb>\pgf@xa\relax % max(pgfplots@maxtickdimen@ ; pgfplots@maxtickdimen@extrashift@) instead of pgfplots@maxtickdimen@ + pgfplots@maxtickdimen@extrashift@ \pgf@xa=\pgf@xb\relax \fi }{}{} \patchcmd{\pgfplots@show@ticklabel@@} {% \node at (\pgfplots@ticklabel@at@x,\pgfplots@ticklabel@at@y) {\csname pgfplots@#1ticklabel\endcsname};% \pgfplots@ticklabel@maxtickdimen@updateforcurrentpath {#1} {\pgf@x=\pgfplots@ticklabel@at@x\space\pgf@y=\pgfplots@ticklabel@at@y\space}% }{% \node at (\pgfplots@ticklabel@at@x,\pgfplots@ticklabel@at@y) {\csname pgfplots@#1ticklabel\endcsname};% \begingroup \pgf@x=\pgfplots@ticklabel@at@x\relax \pgf@y=\pgfplots@ticklabel@at@y\relax \pgf@xa=\pgfplots@tick@offset pt\relax \pgfplotsqpointoutsideofticklabelaxistransformed{#1}{\pgf@x,\pgf@y}{\the\pgf@xa}% \pgfplots@ticklabel@maxtickdimen@updateforcurrentpath {#1} {\pgf@x=\pgf@x\space\pgf@y=\pgf@y\space}% \endgroup }{}{} \makeatother

  • Change point according to shapes and colours independently from csv table
    by Miloop on August 18, 2025 at 9:32 pm

    I am trying to make a scatter (in a group plot) with data taken from a reference csv file. The x values are in the column PC1, y values are in the column PC2. I wanted the mark / shape to change according to "species" and the colour to change according to "Group". Here is my current working minimal code where I can change the colour according to "Group", but I am unable to find a way to change the marker shape according to species. Here is my current code: \documentclass{standalone} \usepackage{pgfplots} \pgfplotsset{compat=newest} \usepgfplotslibrary{groupplots} \begin{document} \begin{tikzpicture} \begin{groupplot}[% group style={group size=2 by 3, horizontal sep=50pt, vertical sep=70pt}, grid=major, grid style={dotted}, ] \nextgroupplot[% legend columns=-1, legend style={% draw=none,% font=\scriptsize, at={(0.5,-0.25)}, anchor=center, /tikz/every even column/.append style={column sep=0.5cm}}, xlabel= Dimension 1 (Variance: A), ylabel= Dimension 2 (Variance: B), scatter/classes={% Cluster1={black},% Cluster2={red},% Cluster3={orange},% Cluster4={brown}% }, scatter, only marks,% scatter src=explicit symbolic,% nodes near coords*={\color{black}{\tiny{\Label}}}, visualization depends on={value \thisrow{Phase} \as \Label}, title={Attempting plots}, ] \addplot [coordinate style/.from= \thisrow{style1} ] table[header=true, x=PC1, y=PC2,% col sep=comma, meta=Group ]% {Dataplots.csv}; % \legend{Cluster1, Cluster2, Cluster3, Cluster4} \end{groupplot} \end{tikzpicture} \end{document} here is the current output: and here is a snippet of my .csv file: Phase,species,Group,PC1,PC2,style1 1,Nannochloropsis sp.,Cluster1,-0.734450557719584,-0.0847134464097437,above 2,Nannochloropsis sp.,Cluster2,0.773295775967202,-1.66661307804925, 3,Nannochloropsis sp.,Cluster2,1.42698922050584,-0.388625246873419,right 4,Nannochloropsis sp.,Cluster2,0.762295941365682,-0.774238159403132,left 5,Nannochloropsis sp.,Cluster1,-1.6843212010837,-0.653047537913571, 6,Nannochloropsis sp.,Cluster2,1.57671153631581,0.176441969080513, 7,Nannochloropsis sp.,Cluster2,1.50418892016015,0.00830684847118905, 8,Nannochloropsis sp.,Cluster2,1.55668508185563,0.210127153121995, 9,Nannochloropsis sp.,Cluster2,1.12792941666917,-0.446037673614503, 10,Nannochloropsis sp.,Cluster1,-0.926556289159005,0.0669778004986934, 11,Nannochloropsis sp.,Cluster1,-1.51145943166273,-0.148218826593831, 12,Nannochloropsis sp.,Cluster1,-0.783668659075298,-0.333785592897085, 13,Nannochloropsis sp.,Cluster3,-2.04013934967114,-3.38635094179644, 14,Nannochloropsis sp.,Cluster3,-1.78347563822441,-2.86473893532614, 15,Nannochloropsis oculata,Cluster3,-2.20963153164226,-1.48222984126996, 16,Nannochloropsis oculata,Cluster1,-0.804260251840743,0.343532567678808, 17,Nannochloropsis oculata,Cluster1,-2.21242673684293,0.968433445806657, 18,Nannochloropsis oculata,Cluster3,-2.15590880212213,-0.00137825576226731, 19,Nannochloropsis oculata,Cluster2,1.01072360007777,1.5768720013781,

  • How to make the font of standalone graphics with pgfplots the same as the beamertheme in use such as moloch or metropolis
    by Natal Pires on August 15, 2025 at 11:25 pm

    I would like to achieve font consistency between graphics created using the standalone class and those rendered directly in Beamer using the metropolis or moloch themes. I'm creating plots with pgfplots for my lectures, and to simplify compilation, I'm generating the plots as separate PDF files using the standalone class and including them in the presentation. However, I'm having trouble matching the fonts used in the standalone figures to the ones used by Beamer when using themes like metropolis or moloch. In other words, I want the standalone-generated figures to use exactly the same font as if the plot were generated directly within a Beamer frame using those themes. \documentclass[border=1pt,tikz]{standalone} \usepackage{siunitx} \usepackage{fontspec} \setsansfont[ ItalicFont={Fira Sans Light Italic}, BoldFont={Fira Sans}, BoldItalicFont={Fira Sans Italic} ]{Fira Sans Extra Light} \setmonofont{Fira Mono} \usepackage{unicode-math} \setmathfont{FiraMath-Regular} \usepackage{tikz} \usepackage{pgfplots} \begin{document} \pgfmathsetmacro{\R}{0.0821} \begin{tikzpicture} \footnotesize \begin{axis}[ xlabel={$T (\si{\degreeCelsius})$}, ylabel={$V (L)$}, xmin=-273.15, xmax=310, ymin=0, ymax=50, grid=both, width=12cm, axis background/.style={fill=teal!5}, height=7cm, enlargelimits=0.05, samples=200, xlabel style={right}, ylabel style={above}, xtick={-273.15, -200, -100, 0, 100, 200, 300}, ytick distance=5, legend pos=south east ] % Linha tracejada: de -273.15 a -100 \addplot[ domain=-273.15:-100, densely dashed, thick, black, line width= 0.5pt ] {0.0821*(x + 273.15)}; % Linha sólida: de -100 a 300 \addplot[ domain=-100:300, solid, thick, teal, ] {0.0821*(x + 273.15)}; % Ponto de interseção com o eixo y (x=0) \addplot[ only marks, mark=*, mark size=2pt, red, fill=yellow ] coordinates {(0,22.438215)}; % Ponto de interseção com o eixo y (x=0) \addplot[ only marks, mark=*, mark size=2pt, teal, fill=yellow ] coordinates {(-273.15,0)}; \node[rectangle,fill=cyan!20,align=center,rounded corners,font=\scriptsize] (A) at (axis cs:0,35) {22.4 L\\ Molar volume}; \draw[red,-stealth] (axis cs:0,23) -- (A); \draw[line width=0.8pt, rounded corners, -stealth] (axis cs:-273.15,0) |- (axis cs:-230,25) node[fill=cyan!20,rounded corners,right,align=center,font=\scriptsize] at (axis cs:-230,25){Thermodynamic\\ zero = -273.15 \si{\degreeCelsius}}; \end{axis} \end{tikzpicture} \end{document} Here is the code for the chart generated in the metropolis theme frame environment. \documentclass[tikz]{beamer} \usepackage{siunitx} \usetheme{metropolis} \usepackage[no-math]{fontspec} \usepackage{tabularray} \usepackage{tikz} \usepackage{pgfplots} \usetikzlibrary{arrows.meta} \begin{document} \begin{frame}{Graph made with code in the frame.} \pgfmathsetmacro{\R}{0.0821} \begin{tikzpicture} \footnotesize \begin{axis}[ xlabel={$T (\si{\degreeCelsius})$}, ylabel={$V (L)$}, xmin=-273.15, xmax=310, ymin=0, ymax=50, grid=both, width=12cm, axis background/.style={fill=teal!5}, height=7cm, enlargelimits=0.05, samples=200, xlabel style={right}, ylabel style={above}, xtick={-273.15, -200, -100, 0, 100, 200, 300}, ytick distance=5, legend pos=south east ] % Linha tracejada: de -273.15 a -100 \addplot[ domain=-273.15:-100, densely dashed, thick, black, line width= 0.5pt ] {0.0821*(x + 273.15)}; % Linha sólida: de -100 a 300 \addplot[ domain=-100:300, solid, thick, teal, ] {0.0821*(x + 273.15)}; % Ponto de interseção com o eixo y (x=0) \addplot[ only marks, mark=*, mark size=2pt, red, fill=yellow ] coordinates {(0,22.438215)}; % Ponto de interseção com o eixo y (x=0) \addplot[ only marks, mark=*, mark size=2pt, teal, fill=yellow ] coordinates {(-273.15,0)}; \node[rectangle,fill=cyan!20,align=center,rounded corners,font=\scriptsize] (A) at (axis cs:0,35) {22.4 L\\ Molar volume}; \draw[red,-stealth] (axis cs:0,23) -- (A); \draw[line width=0.8pt, rounded corners, -stealth] (axis cs:-273.15,0) |- (axis cs:-230,25) node[fill=cyan!20,rounded corners,right,align=center,font=\scriptsize] at (axis cs:-230,25){Thermodynamic\\ zero = -273.15 \si{\degreeCelsius}}; \end{axis} \end{tikzpicture} \end{frame} \end{document}```

  • Managing vortex and spiral behavior in PGFPlots
    by Sebastiano on August 15, 2025 at 10:59 am

    I am trying to draw a vector field in pgfplots, but I am encountering issues that I can't solve despite various attempts. Specifically, I want the vortices or spirals to be dependent by the vector field, but when I change the value of parameters of the vector field F(u,v,w) or the vortex function H, the figure is completely wrong. Every time I need to draw the field, I have to make manual adjustments, such as with the shift={(-2.5, -2)}. How can I solve this problem and make the spirals and vortices dependent by vector field? For example, if I consider the function in two variables: F(u,v,w) = (x²y - xy², x²y - yx, 0) the Geogebra output is: I should to see, in my code, a correct description or visualization of the vector field, as expected. But if I use this \addplot3[ quiver={ u={x^2*y-x*y^2}, % x-component = 0 v={x^2*y-y*x}, % y-component w={0}, % z-component = 0 scale arrows=0.2 }, -stealth, blue, samples=16, domain=-5.01:5.01, y domain=-2.45:5 ] (x,y,0); I will obtain, as output, this bad graph: The comments in the code are due to the many tests and improvements. The .tex code is related to the vector field F(x,y,0) = 0 x̂ +(-2y² + y) ŷ + 0 ẑ and two independent vortices: \documentclass[a4paper]{article} \usepackage{pgfplots} \usepackage[dvipsnames]{xcolor} \pgfplotsset{compat=newest} \begin{document} \begin{figure}[h] \centering \begin{tikzpicture} \begin{axis}[% % grid=major, colormap/cool, view={35}{35}, shader=flat, xlabel=$x$, ylabel=$y$, zlabel=$z$, axis equal, ] \addplot3[surf,gray!60, opacity=0.5]{0}; % Orange plane at z=0 without grid lines %\addplot3[ % draw=none, % fill=orange!40, % opacity=0.5 %] coordinates { % (-2,-2,0) % ( 2,-2,0) % ( 2, 2,0) % (-2, 2,0) %}; % Vector field F(x,y) = (-2y^2 + y) \hat{y} \addplot3[ quiver={ u={0}, % x-component = 0 v={-2*y^2 + y}, % y-component w={0}, % z-component = 0 scale arrows=0.2 }, -stealth, blue, samples=16, domain=-5.01:5.01, y domain=-2.45:5 ] (x,y,0); % Disegno della spirale di Archimede in coordinate polari, applicando uno shift nel piano cartesiano %\pgfmathdeclarefunction{G}{2}{\pgfmathparse{#1*#2}} %\addplot [samples=1000, solid, thick, data cs=polarrad, domain=0:5*pi, shift={(-2.5, -2)}] % {G(0.05, x)}; % G(a=0.1, θ=x) è la spirale di Archimede %Definizione della funzione F(a, b, θ, c, θ0) = a e^(b * (θ - θ0)) + c \pgfmathdeclarefunction{H}{5}{\pgfmathparse{#1*exp(#2*(#3-#5))+#4}} % Disegno della curva in coordinate polari, applicando uno shift \addplot [red,samples=1000, solid, thick, data cs=polarrad, domain=0:10*pi, shift={(-2.5, -2)}] {H(1,-0.1,x,0.1,4)}; % r(θ) = 2 e^(-0.1*(θ + 2.5)) - 0.1 \addplot [ForestGreen,samples=1000, solid, thick, data cs=polarrad, domain=0:10*pi, shift={(-8, -8)}] {H(1,-0.1,x,0.1,4)}; % r(θ) = 2 e^(-0.1*(θ + 2.5)) - 0.1 \end{axis} \end{tikzpicture} \caption{Vector field $\mathbf{F}(x,y) = (-2y^2 + y)\,\mathbf{\hat{y}}$ on the plane $z=0$} \end{figure} \end{document} Related my previous question: Drawing a 3D vector field with vortices and perspective axis labels

  • I want to put the image in place of the logo written above In this poster
    by bakhta marouf on August 13, 2025 at 12:21 am

    I want to put the image in place of the logo and the name of the university that is in poster \documentclass[20pt,margin=1in,innermargin=-4.5in,blockverticalspace=-0.25in]{tikzposter} \geometry{paperwidth=33.11in,paperheight=46.81in} %A0 % \geometry{paperheight=33.11in,paperwidth=23.4in} %A1 \usepackage[utf8]{inputenc} \usepackage{csquotes} %\usepackage[estonian]{babel} \usepackage{amsmath} \usepackage{amsfonts} \usepackage{amsthm} \usepackage{amssymb} \usepackage{mathrsfs} \usepackage{graphicx} \usepackage{lipsum} \usepackage[export]{adjustbox} \usepackage{enumitem} \usepackage[backend=biber,style=numeric]{biblatex} \usepackage{unitartu-theme} \makeatletter \setlength{\TP@visibletextwidth}{31.0in} \setlength{ \TP@visibletextheight}{45in} \makeatother \usepackage{mwe} % for placeholder images \usepackage{bm} \usepackage{bbm} \addbibresource{refs.bib} % set theme parameters \tikzposterlatexaffectionproofoff \usetheme{UniTartuTheme} \usecolorstyle{UniTartuStyle} \usepackage[scaled]{helvet} \renewcommand\familydefault{\sfdefault} \renewcommand{\vec}[1]{\bm{#1}} \newcommand{\Tr}{\text{Tr}} \usepackage[T1]{fontenc} \title{\parbox{0.8\linewidth}{UniTartuCS Poster Template - Example of a long title for a poster}} \author{\textbf{John Smith}\textsuperscript{1}} \institute{\textsuperscript{1}Institute of Computer Science, University of Tartu} \titlegraphic{\includegraphics[width=0.35\linewidth]{unitartu_compact.png}} % begin document \begin{document} \maketitle \centering \begin{columns} \column{0.5} \block{Section 1}{ \lipsum[30] \begin{align*} \includegraphics[width=0.1\textwidth,valign=c]{kitten.jpg} \end{align*} \lipsum[10] \begin{align*} x = \frac{-b \pm\sqrtsign{b^2 - 4ac}}{2a}. \end{align*} \lipsum[20] } \block{Section 2}{ \lipsum[100] \lipsum[100] \lipsum[100] \lipsum[100] \lipsum[100] \lipsum[100] \lipsum[100] \lipsum[100] \lipsum[100] \lipsum[100] } \column{0.5} \block{Section 3}{ \lipsum[100] \lipsum[100] \lipsum[100] \lipsum[100] \lipsum[100] \textcolor{MainBlue}{\lipsum[100]} \lipsum[100] \lipsum[100] \lipsum[100] \lipsum[100] } \block{Conclusions}{ \lipsum[100] \cite{dirac} \cite{knuthwebsite} \lipsum[100] \lipsum[100] } \block{References}{ \begin{center} \mbox{}\vspace{-1\baselineskip} \printbibliography[heading=none] \end{center} } \end{columns} \end{document}

  • pgfplots: yticklabel positioning in partial polar plot
    by pawq on August 12, 2025 at 11:46 am

    I'm drawing polar plots covering only half of the full 360° (the right half of the circle) using pgfplots, and I can't figure out how to shift yticklabels to the top part of the plot (+90° in the plot below). I looked in both the pgfplots documentation and the forum and none of the options I found helped. MWE: \documentclass{article} %\usepackage{graphicx} \usepackage{textcomp, gensymb} % \degree command in gensymb, textcomp to avoid warnings \usepackage{tikz} \usepackage{pgfplots} \pgfplotsset{compat=1.17} \usepgfplotslibrary{polar} \begin{document} \begin{figure} \begin{center} \begin{tikzpicture} \small \begin{polaraxis}[ width = 10cm, height = 10cm, grid = major, xmin = -90, xmax = 90, xtick distance = 20, xticklabel = $\pgfmathprintnumber{\tick}\degree$, xlabel = {Polar angle}, xlabel style = {rotate = 45, xshift = -13mm, yshift = -5mm, anchor = north}, ymin = 52, ymax = 72, y coord trafo/.code=\pgfmathparse{#1-52}, y coord inv trafo/.code=\pgfmathparse{#1+52}, ytick distance = 4, ytick pos = right, yticklabel pos = top, yticklabel style = {anchor = east}, ylabel = {Value [unit]}, ylabel style = {rotate = 90, xshift = 9mm, yshift = 7mm, anchor = east} ] \addplot+ coordinates { (40, 66) (20, 63) (0, 59) (-20, 63) (-40, 67) }; \end{polaraxis} \end{tikzpicture} \end{center} \caption{Polar plot.} \end{figure} \end{document} What the code produces and what I'm trying to achieve: I know that the ytick pos option moves the ticks between the top and bottom halves of the plot, but the yticklabel pos option doesn't do anything for me. Thanks in advance!

  • Size of chemical formulas on a chart
    by Nicolas on August 12, 2025 at 6:45 am

    I need to add equations to some parts of the curves: I'm using the chemmacros package. I'm having trouble because the size of the chemical formulas seems too large compared to the curves: I therefore need to reduce their size. My problem is that when using the \tiny command, I find the formulas look unattractive and crowded (and for the positive charge, I find the + sign is way too large compared to the rest). \documentclass[10pt,border=1mm,tikz]{standalone} \usepackage[french]{babel} \usepackage{lmodern} \usepackage{pgfplots}\pgfplotsset{compat=newest} \usepackage{siunitx}% unités et écriture de valeurs \usepackage{chemmacros} \begin{document} \footnotesize \begin{tikzpicture} \begin{axis}[% mise en forme du graphique : xmin=-0.51,xmax=2.1, ymin=-30,ymax=41, axis lines = middle, xlabel=$\Delta E (\unit{\V})$, ylabel=$i (\unit{\micro \A}$), ytick=\empty, xtick distance=1, ] \addplot [blue,samples=100,domain=-0.25:0.1] {-11.55+0.062*(1-exp(-(x-0.0194)/0.0499))}; \addplot [blue,samples=100,domain=0.1:1.6] {-11.5+19.1/(0.658+exp(-62.6*(x-0.507)))}; \draw[densely dotted] (0,1)node[above left]{\tiny $i_a$} -- (0.515,1)--(0.515,-15); \draw[densely dotted] (0,-1)node[below left]{\tiny $i_c$} -- (0.50,-1) -- (0.50,-15); \draw[very thin,{Stealth[length=0.75mm,reversed]}-{Stealth[length=0.75mm,reversed]}](0.47,-15)--(0.545,-15); \node(a) at (0.53,-16.5){$\Delta E_a$}; \node(b) at (-0.25,-20){\ch{H2 <-{} H+}}; \end{axis} \end{tikzpicture} \end{document} I tried changing the overall font size in the preamble, but it doesn't change anything. What is the best method to adapt the size of the chemical equations to the size of the curves?

  • Mathematical path or approximation for a curly brace usable in 3D projective diagrams
    by Jasper on August 9, 2025 at 12:52 am

    I’m not sure if this is the best approach, but I’ve been trying to create a curly brace using an explicit mathematical function. So far, I’ve combined a couple of curves to approximate the shape, but I’m concerned this might not be the right method. My goal is to include a properly occluded curly brace in a 3D diagram (possibly in projective space), which is why I need a precise mathematical definition rather than a decorative path. Ideally, I’d like either: an exact path definition for a curly brace, or a good mathematical approximation (even one obtained by tracing an existing brace and turning it into a path). Here is my attempt: \documentclass[ tikz ,border = 1cm ]{standalone} \usetikzlibrary{decorations.pathreplacing} \pgfmathdeclarefunction{f}{1}{% \pgfmathparse{ (1/32) / ( (#1+2.05)*(#1-2.05) ) + (1/4) }% } \pgfmathdeclarefunction{g}{1}{% \pgfmathparse{ (1/8) / ( (32*#1)^2 + 1 ) }% } \begin{document} \begin{tikzpicture} \path[ preaction = { draw ,thick ,blue } ,postaction = { draw ,red ,decorate ,decoration = { brace ,raise = 2ex } } ] (0,0) -- (4,0) ; \draw[ domain = -2:2 ,samples = 500 ,green ] plot ( {\x+2} ,{-(f(\x)+g(\x)+1/4)} ); \end{tikzpicture} \end{document}

  • Proper display of markers in legend of ternary plot when using area style in pgfplots?
    by Buck Thorn on August 3, 2025 at 5:13 pm

    I'm trying to combine patches and individual marker symbols in a ternary diagram, but not able to display the markers in the legend. The following is my attempt with two different ways of adding points, neither resulting in symbols appearing properly in the legend. Evidently there is a conflict due to use of area style, which enforces the display of patches but overrides later definitions (without area style the markers show up properly in the legend). Any ideas how to implement this so that the marker symbols show up in the legend? \documentclass{article} \usepackage{pgfplots} \pgfplotsset{compat=1.18, tick label style={font=\sffamily\small}, label style={font=\sffamily\small}, xticklabel={$\mathsf{\pgfmathprintnumber{\tick}}$}, yticklabel={$\mathsf{\pgfmathprintnumber{\tick}}$}, zticklabel={$\mathsf{\pgfmathprintnumber{\tick}}$}, } \renewcommand{\familydefault}{\sfdefault} \begin{document} \usepgfplotslibrary{ternary} \begin{tikzpicture} \begin{ternaryaxis}[ xscale=-1, clip=false, disabledatascaling, y label style={rotate=-60,anchor=south,yshift=3ex}, y tick label style={anchor=west}, x label style = {rotate=60,anchor=south,yshift=3ex}, x tick label style={anchor=east}, xlabel=\% 1, ylabel=\% 2, zlabel=\% 3, label style={font={\sffamily\small}}, tick label style={font=\sffamily\footnotesize}, area style, minor tick num=1, grid=both, ] % try adding points to the ternary plot. Use addlegendentry to add legend entries. % method 1: addplot \addplot [mark=o,solid,mark size=3,only marks] coordinates { (0.2,0.3) }; \addlegendentry{sample} % method 2: addplot3 \addplot3 [mark=*,solid,mark size=3,only marks] coordinates { (0.1,0.4,0.5) }; \addlegendentry{sample2} \end{ternaryaxis} \end{tikzpicture} \end{document} Output:

  • How do I position the y-labels?
    by Manya Chauhan on August 1, 2025 at 3:50 am

    I want to position my y-labels such that the plot doesn't cover up the label. This is the code that I used: \begin{tikzpicture}[>=latex] \begin{axis}[ axis x line=center, axis y line=center, xlabel = {\(x\)}, ylabel = {\(\rho\)}, ylabel style={anchor=west, xshift=6pt}, ytick={0,1}, % Show only 0 and +1 here yticklabels={\(0\), \(eN_D\)}, yticklabel style={anchor=east}, extra y ticks={-1}, extra y tick labels={\(-eN_D\)}, extra y tick style={ ticklabel pos=right, anchor=west, xshift=2pt, % bring closer to y-axis yticklabel style={black}, major tick style={black, thick} }, xtick distance=2, ymin=-1.5, ymax=1.5, xmin=-10, xmax=10, width=9cm, height=6cm, ] % Plotting the charge density \addplot[domain=-10:-4, color=blue] {0}; \addplot[thick, dotted, color=magenta] coordinates {(-4,0)(-4,-1)}; \addplot[domain=-4:0, color=red] {-1}; \addplot[domain=0:4, color=red] {1}; \addplot[thick, dotted, color=magenta] coordinates {(4,1)(4,0)}; \addplot[domain=4:10, color=blue] {0}; \end{axis}\end{tikzpicture} Right now, this is what it's producing:

  • pgfplots: Using set layers in an overlay picture
    by schtandard on July 5, 2025 at 1:58 pm

    Using pgfplots, I want to draw a plot as an overlay picture, making use of layers inside that plot. However, when I say \begin{tikzpicture} [overlay] \pgfplotsset{set layers} \begin{axis} \end{axis} \end{tikzpicture} I get two ! Dimension too large. errors. pgfplots seems to attempt to set both unit lengths (\pgf@x and \pgf@y) to -32000.0pt. Why is that and how can I avoid it? For tinkering, here is a slightly more useful MWE. Interestingly, the result looks fine in this example. (In larger pictures, the errors do cause havoc, though.) \documentclass{article} \usepackage{pgfplots} \pgfplotsset{compat=1.18} \begin{document} \begin{tikzpicture} [remember picture] \draw [green] coordinate (test) circle [radius=5cm]; \end{tikzpicture} \begin{tikzpicture} [remember picture, overlay] \pgfplotsset{set layers} \begin{axis} [at=(test), anchor=center, ymajorgrids] \addplot+ {x^2}; \begin{pgfonlayer}{axis grid} \fill [red] (axis cs:3,20) circle [radius=2cm]; \end{pgfonlayer} \end{axis} \end{tikzpicture} \end{document}

  • pgfplots 3d schoolbook style (grid/tick marks)
    by Sammy on May 16, 2025 at 3:48 pm

    I'm trying to recreate the look of a 3D coordinate system as used in German schoolbooks. Below, I've included a minimal working example (MWE). The code that handles the grid and tick marks is quite lengthy, and my implementation isn’t very robust when it comes to making changes. Is there a simpler and more reliable way to achieve the desired result using pgfplots, particularly regarding the style and placement of tick marks and the background grid? I considered modifying the tick mark style, but as far as I can tell, there's no built-in option for this. (Avoid multiple tick marks in 3D tikz plot). I looked through the source code of pgfplots for a code piece I could patch, but I wasn't able to understand what's going on. It seems in an earlier version of pgfplots there was a bug that kind of "implemented" the tick mark style I'm looking for: Uniform appearance of tick marks in 3d pgfplot? Fix: https://github.com/pgf-tikz/pgfplots/commit/47a07927c46ecbdcd8a982c90c922bc4925e828b Is there a way to access the tick positions directly directly? Is there an easier option to have the tick marks always have length 0.1 inch regardless what value the ytick distance is? In the target style, the orientation of the axes will always be the same as shown in the example, and the distance between two grid lines should always be 5 mm. I’d like to retain this consistent layout while being able to freely adjust other parameters in the plot. Any other suggestions or improvements are very welcome. \documentclass{standalone} \usepackage{pgfplots} \pgfplotsset{compat=1.18} \newcommand{\unitvectorx}{(\pgfkeysvalueof{/pgfplots/minor x tick num} + 1)*0.5/\pgfkeysvalueof{/pgfplots/xtick distance}} \newcommand{\unitvectory}{(\pgfkeysvalueof{/pgfplots/minor y tick num} + 1)*0.5/\pgfkeysvalueof{/pgfplots/ytick distance}} \newcommand{\unitvectorz}{(\pgfkeysvalueof{/pgfplots/minor z tick num} + 1)*0.5/\pgfkeysvalueof{/pgfplots/ztick distance}} \pgfplotsset{ 3d_style/.style={ axis lines = middle, tick style = transparent, major tick length = 0.1in, minor tick num = 1, xtick distance = 1, ytick distance = 1, ztick distance = 1, xlabel = $x_1$, ylabel = $x_2$, zlabel = $x_3$, x = {(-.5cm*\unitvectorx,-.5cm*\unitvectorx)}, y = {(1cm*\unitvectory,0)}, z = {(0,1cm*\unitvectorz)}, set layers = standard, execute at end axis = {\pgfmathsetmacro{\xenlarge}{(\pgfkeysvalueof{/pgfplots/xmax} - \pgfkeysvalueof{/pgfplots/xmin}) * \pgfkeysvalueof{/pgfplots/enlarge x limits})} \pgfmathsetmacro{\yenlarge}{(\pgfkeysvalueof{/pgfplots/ymax} - \pgfkeysvalueof{/pgfplots/ymin}) * \pgfkeysvalueof{/pgfplots/enlarge y limits})} \pgfmathsetmacro{\zenlarge}{(\pgfkeysvalueof{/pgfplots/zmax} - \pgfkeysvalueof{/pgfplots/zmin}) * \pgfkeysvalueof{/pgfplots/enlarge z limits})} \pgfmathsetmacro{\xmin}{\pgfkeysvalueof{/pgfplots/xmin} - \xenlarge} \pgfmathsetmacro{\ymin}{\pgfkeysvalueof{/pgfplots/ymin} - \yenlarge} \pgfmathsetmacro{\zmin}{\pgfkeysvalueof{/pgfplots/zmin} - \zenlarge} \pgfmathsetmacro{\xmax}{\pgfkeysvalueof{/pgfplots/xmax} + \xenlarge} \pgfmathsetmacro{\ymax}{\pgfkeysvalueof{/pgfplots/ymax} + \yenlarge} \pgfmathsetmacro{\zmax}{\pgfkeysvalueof{/pgfplots/zmax} + \zenlarge} \pgfmathsetmacro{\ygriddist}{\pgfkeysvalueof{/pgfplots/ytick distance} / (\pgfkeysvalueof{/pgfplots/minor y tick num} + 1)} \pgfmathsetmacro{\zgriddist}{\pgfkeysvalueof{/pgfplots/ztick distance} / (\pgfkeysvalueof{/pgfplots/minor z tick num} + 1)} \pgfmathsetmacro{\ygridmin}{ceil(\ymin / \ygriddist) * \ygriddist} \pgfmathsetmacro{\zgridmin}{ceil(\zmin / \zgriddist) * \zgriddist} \pgfmathsetmacro{\ygridnext}{\ygridmin + \ygriddist} \pgfmathsetmacro{\zgridnext}{\zgridmin + \zgriddist} \pgfmathsetmacro{\ygridmax}{floor(\ymax / \ygriddist) * \ygriddist} \pgfmathsetmacro{\zgridmax}{floor(\zmax / \zgriddist) * \zgriddist} \pgfmathsetmacro{\xtickmin}{ceil(\xmin / \pgfkeysvalueof{/pgfplots/xtick distance}) * \pgfkeysvalueof{/pgfplots/xtick distance}} \pgfmathsetmacro{\ytickmin}{ceil(\ymin / \pgfkeysvalueof{/pgfplots/ytick distance}) * \pgfkeysvalueof{/pgfplots/ytick distance}} \pgfmathsetmacro{\ztickmin}{ceil(\zmin / \pgfkeysvalueof{/pgfplots/ztick distance}) * \pgfkeysvalueof{/pgfplots/ztick distance}} \pgfmathsetmacro{\xticknext}{\xtickmin + \pgfkeysvalueof{/pgfplots/xtick distance}} \pgfmathsetmacro{\yticknext}{\ytickmin + \pgfkeysvalueof{/pgfplots/ytick distance}} \pgfmathsetmacro{\zticknext}{\ztickmin + \pgfkeysvalueof{/pgfplots/ztick distance}} \pgfmathsetmacro{\xtickmax}{floor(\xmax / \pgfkeysvalueof{/pgfplots/xtick distance}) * \pgfkeysvalueof{/pgfplots/xtick distance}} \pgfmathsetmacro{\ytickmax}{floor(\ymax / \pgfkeysvalueof{/pgfplots/ytick distance}) * \pgfkeysvalueof{/pgfplots/ytick distance}} \pgfmathsetmacro{\ztickmax}{floor(\zmax / \pgfkeysvalueof{/pgfplots/ztick distance}) * \pgfkeysvalueof{/pgfplots/ztick distance}} \pgfmathsetmacro{\tickylength}{\pgfkeysvalueof{/pgfplots/major tick length}/1cm*0.5/\pgfkeysvalueof{/pgfplots/ytick distance}} \pgfmathsetmacro{\tickzlength}{\pgfkeysvalueof{/pgfplots/major tick length}/1cm*0.5/\pgfkeysvalueof{/pgfplots/ztick distance}} \pgfplotsonlayer{axis background} \draw[gray!50] \foreach \y in {\ygridmin,\ygridnext,...,\ygridmax}{(0,\y,\zmin) -- (0,\y,\zmax)}; \draw[gray!50] \foreach \z in {\zgridmin,\zgridnext,...,\zgridmax}{(0,\ymin,\z) -- (0,\ymax,\z)}; \endpgfplotsonlayer \pgfplotsonlayer{axis ticks} \draw \foreach \x in {\xtickmin,\xticknext,...,\xtickmax}{(\x,0,-\tickzlength) -- (\x,0,\tickzlength)}; \draw \foreach \y in {\ytickmin,\yticknext,...,\ytickmax}{(0,\y,-\tickzlength) -- (0,\y,\tickzlength)}; \draw \foreach \z in {\ztickmin,\zticknext,...,\ztickmax}{(0,-\tickylength,\z) -- (0,\tickylength,\z)}; \endpgfplotsonlayer } } } \begin{document} \begin{tikzpicture} \begin{axis}[ 3d_style, xmin=-9.2, xmax=9.2, ymin=-5.2, ymax=5.2, zmin=-5.2, zmax=5.2, ] \end{axis} \end{tikzpicture} \end{document}

  • pgfplots: CTAN vs. Github
    by Dr. Manuel Kuehner on May 3, 2025 at 11:51 am

    This might be a stupid question :). pgfplots is available on CTAN as version 1.18.1 2021-05-17. pgfplots is also on Github, see https://github.com/pgf-tikz/pgfplots. Since pgfplots in not actively officially maintained for quite some time, the CTAN version is "old". Q: My understanding is (maybe wrong), that the Github version still gets bug fixes -- is that the case? If yes, how would one install the Github version on one's local TeXLive system? Related: Future of the pgfplots package

  • Plotting a Discontinuous Function with pgfplots in LaTeX
    by Fractal on March 18, 2025 at 11:06 pm

    I am trying to plot the function $F(x) = \int_{\ln(x)}^{\ln(2x)} \dfrac{e^t}{t} dt \quad \text{if } x \neq 0 \quad ; \quad F(0) = 0$ using TikZ/pgfplots in LaTeX. The function is well-defined for $x \in ]0, 1/2[ and x \in ]1, +\infty[ but is undefined for x \in ]1/2, 1[ You can see his variations table : What I have tried I attempted to use \addplot in pgfplots with gnuplot to compute the integral numerically. However, nothing is displayed. I also tried breaking the plot into two separate parts: one for x \in ]0, 1/2[ and another for x \in ]1, +\infty[ but the graph does not appear. I suspect the issue might come from pgfplots struggling with numerical integration involving logarithmic limits. What I need How can I properly plot this function while handling the discontinuity using pgfplots ? Is there a better way to evaluate the integral numerically in LaTeX (without requiring external scripts)? Would it be more appropriate to precompute the function values in Python/Matlab and import them into LaTeX? Here is my latest attempt \documentclass{article} \usepackage{pgfplots} \usepackage{amsmath} \begin{document} \begin{tikzpicture} \begin{axis}[ axis x line=center, axis y line=center, xlabel={$x$}, ylabel={$F(x)$}, samples=100, domain=0.01:0.49, % First part restrict y to domain=-5:5, grid=major, thick ] \addplot[ blue, thick ] gnuplot [ raw gnuplot ] { f(x) = real(quad(exp(t)/t, log(x), log(2*x))); plot [x=0.01:0.49] f(x); }; \end{axis} \end{tikzpicture} \end{document} Update : This is what I have using gnuplot : The code : set terminal pngcairo size 800,600 set output "F_plot.png" set title "Graph of F(x)" set xlabel "x" set ylabel "F(x)" set grid plot "F_data.dat" using 1:2 with lines title "F(x)" For having F_data.dat I used this python code : import numpy as np import scipy.integrate as spi def F(x): if x == 0 or x < 0: return np.nan # Eviter les valeurs négatives if x < 0.5 or x > 1: integral, _ = spi.quad(lambda t: 1 / np.log(t), x, 2*x) return integral else: return np.nan # Evite l'intervalle ]1/2,1[ x_vals = np.linspace(0.01, 3, 100) # Valeurs de x y_vals = [F(x) for x in x_vals] np.savetxt("F_data.dat", np.column_stack((x_vals, y_vals)), fmt="%.6f") print("Données enregistrées dans F_data.dat")

  • Is there any way that pgfplots and tkz-euclide use the same coordinate system without misplacements?
    by miltos on March 5, 2025 at 7:16 am

    I use pgfplots and tkz-euclide to make a graph as this shown below. When the scaling of the tikzpicture is 1 everything is on place as in image 1. When I change this (e.g scale=1.5) I have misplacements (the point C and the mark of right angle) as you can see in the second image. I tried to move the last two commands of tkz-euclide inside the pgfplots code but I get error (thinking anyway the packages are tikz-based). Is there any way to make these excellent packages to work together? My MWE is: \documentclass[12pt]{exam} \usepackage[a4paper, total={180mm,257mm},left=15mm,top=17mm]{geometry} \usepackage[LGR,T1]{fontenc} \usepackage[greek,english]{babel} \usepackage{tkz-euclide}\tkzSetUpPoint[size=3,color=black,fill=white] \usetikzlibrary{arrows,calc,shapes,patterns,decorations.pathmorphing,shadows.blur,shadings,angles,quotes} \usepackage[most]{tcolorbox} \usepackage{pgfplots} \pgfplotsset{compat=newest} \begin{document} \begin{center} \textbf{BLA bLA} \textbf{Systems} \end{center} \begin{questions} \question This is first question $\varepsilon_1\;\varepsilon_2\ \text{and}\ \varepsilon_3$. \begin{minipage}[b][][t]{\textwidth} \begin{minipage}[b][11cm][t]{0.4\linewidth} \question Second question $\varepsilon_1,\;\varepsilon_2$ $\varepsilon_3$. \begin{parts} \part part1 $\varepsilon_1,\; \text{and}\ \varepsilon_2$ \fillwithdottedlines{4cm} \end{parts} \end{minipage} \hfill \begin{minipage}[b][11cm][t]{0.58\linewidth} \raisebox{2mm}{% \begin{tikzpicture}[scale=1.5,transform shape] \pgfplotsset{every axis/.append style={tick label style={font=\tiny},label style={font=\tiny}}} \begin{axis}[ axis lines=middle, xlabel = {\tiny $x$}, ylabel = {\tiny $y$}, xmin = -3.5, xmax = 5.5, ymin = -2.5, ymax = 5.5, xtick style={line width=0.5pt,black}, major tick length=1mm, ytick style={line width=0.5pt,black}, ytick = {-2,-1,0,1,...,5}, xtick = {-3,-2,...,5}, xticklabel shift=-3pt, yticklabel shift=-3pt, grid style={line width=0.15pt,gray!30}, grid = both, axis equal image, % <-- added inner axis line style={<->,>=Stealth}, after end axis/.code={% \path (axis cs:0,0) node [anchor=north west,yshift=1.6pt,xshift=-1.8pt] {\tiny $0$} node [anchor=south east,xshift=1.8pt,yshift=-1.6pt] {\tiny $0$ };} ] \addplot [domain=-6.5:6,samples=100] {2*x+3}; \addplot [domain=-6.5:8,samples=100] {-0.5*x+2}; \addplot [domain=-6.5:8,samples=100] {x-1}; \node[above] at (-2,3.4) {\tiny $\varepsilon_1:x+2y=4$}; \node[below] at (1.1,5) {\tiny $\varepsilon_3$};%\node[below right=-3pt and -3pt] at (0,4) {\tiny $A$}; \node[above] at (3,2) {\tiny $\varepsilon_2$}; \coordinate (A) at (axis cs: 2,1);\coordinate (B) at (axis cs: 0,3); \coordinate (C) at (axis cs: -0.4,2.2);\coordinate (D) at (-2,3); \tkzDrawPoint[](A) \tkzLabelPoint[](A){\tiny$A$} \end{axis} \tkzMarkRightAngle[size=0.15](D,C,B)\tkzDrawPoint[](C) \end{tikzpicture}} \end{minipage} \end{minipage} \end{questions} \end{document} Image 1: Image2:

  • Future of the pgfplots package
    by Dr. Manuel Kuehner on January 1, 2025 at 2:22 pm

    I assume that the question might get closed because it does not fit the scope of this site. But I want to give it a try anyway, because I believe that many naïve users may look for such a question on this site :). Motivation: I really like the pgfplots package and used it a lot in the past and still use it today. I always use the package via a distribution like TeX Live or MiKTeX. Issue: Sadly, the pgfplots package on CTAN wasn't updated in some years, on CTAN the current version is 1.18.1 from 2021-05-17. On Github it is somehow different: Latest version is 1.17 from 2020-02-01. Question: Are there any plans for the future for pgfplots from the community, e. g. someting like for the pgf package, i. e. something like the "The PGF/TikZ Team"? Happy new year, by the way :).

  • How can I remove the Labels of the blue dots on the left plot and change the position of label nr16 in the right plot?
    by dan1365 on March 30, 2023 at 9:46 am

    \documentclass[11pt]{report} \usepackage{pgfplots, pgfplotstable} \pgfplotsset{width=10cm,compat=1.18} \usepackage{graphicx} \usepackage{caption} \usepackage{subcaption} \begin{document} \begin{figure} \centering \begin{subfigure}[tb]{0.48\linewidth} \begin{tikzpicture} \begin{axis}[height=7cm, width=\linewidth, xlabel={}, ylabel={}, ytick={0,500,...,1700}, xtick={0,500,...,1700}, ymin=-170, ymax=1700, xmin=-170, xmax=1700, ymajorgrids, xmajorgrids] \addplot[ scatter/classes={0={blue}, 1={red}}, scatter, mark=*, only marks, scatter src=explicit symbolic, nodes near coords*={\Label}, visualization depends on={value \thisrow{label} \as \Label} %<- added value ] table [meta=class] { x y class label 0.3788 8.1653 0 - 6.3716 4.0196 0 - 0.4225 0.1447 0 - 14.8118 6.6124 0 - 2.7433 2.544 0 - 152.0046 30.6336 1 5 1375 428.5714 1 6 20.51 5.1280 0 - 38.8548 1492.8425 1 8 0.1409 0.000196 0 - }; \end{axis} \end{tikzpicture} \caption{} \label{} \end{subfigure}\hfill \begin{subfigure}[tb]{0.48\linewidth} \begin{tikzpicture} \begin{axis}[height=7cm, width=\linewidth, xlabel={}, ylabel={}, ytick={0,2,...,10}, xtick={0,5,...,20}, ymin=-1.133, ymax=11.333, xmin=-2.266, xmax=22.666, ymajorgrids, xmajorgrids] \addplot[ scatter/classes={0={blue}, 1={red}}, scatter, mark=*, only marks, scatter src=explicit symbolic, nodes near coords*={\Label}, visualization depends on={value \thisrow{label} \as \Label} %<- added value ] table [meta=class] { x y class label 0.3788 8.1653 0 9 6.3716 4.0196 0 10 0.4225 0.1447 0 12 14.8118 6.6124 0 13 2.7433 2.544 0 14 20.51 5.1280 0 15 0.1409 0.000196 0 16 }; \end{axis} \end{tikzpicture} \caption{} \label{} \end{subfigure}\hfill \caption{} \end{figure} \end{document} > Blockquote

  • Numerical precision issues within pgfplotstable
    by aeroben on March 23, 2023 at 12:41 pm

    I am creating a table which automatically generates outputs of various quantities of interest for compressible flow. The first column contains Mach numbers, which are used to calculate the quantities in the other columns: \documentclass{book} \usepackage[utf8]{inputenc} \usepackage{amsmath} % Used by equations \usepackage{amssymb} \usepackage{pgfplotstable} \usepackage{pgfplots} \usepackage{longtable} \pgfplotsset{compat=1.17} \begin{document} \pgfkeys{/pgf/number format/.cd,fixed,precision=15} \def\gma{1.40} \pgfplotstableset{ create on use/Mach/.style={ create col/expr={0.01*\pgfplotstablerow+0.91} }, create on use/P_over_P0/.style={ create col/expr={((1+((\gma-1)/2)*\thisrow{Mach}^2)^(-\gma/(\gma-1)))} }, create on use/m_dot_sqrt_cpT0_over_Ap0/.style={ create col/expr={\gma/sqrt(\gma-1)*\thisrow{Mach}*(1 + (\gma-1)/2*\thisrow{Mach}^2)^(-(\gma+1)/(2*(\gma-1)))} }, create on use/m_dot_sqrt_cpT0_over_Ap/.style={ create col/expr={\thisrow{m_dot_sqrt_cpT0_over_Ap0}/\thisrow{P_over_P0}} }, create on use/impulse_function/.style={ create col/expr={1/\thisrow{m_dot_sqrt_cpT0_over_Ap}*(1+\gma*\thisrow{Mach}^2)} }, } \pgfplotstablenew[ columns={Mach, P_over_P0, m_dot_sqrt_cpT0_over_Ap0, m_dot_sqrt_cpT0_over_Ap, impulse_function}, ]{10}{\loadedtable} % Custom command for empty row \newcommand{\emptyrow}{& & & &\\} \pgfplotstabletypeset[ begin table=\begin{longtable}, end table=\end{longtable}, columns/Mach/.style={column name=M, column type={|l}, fixed zerofill, precision=3}, columns/P_over_P0/.style={column name=$\frac{P}{P_0}$, column type=l, fixed zerofill, precision=4}, columns/m_dot_sqrt_cpT0_over_Ap0/.style={column name=$\frac{\dot{m}\sqrt{c_p T_0}}{A p_0}$, column type=l, fixed zerofill, precision=4}, columns/m_dot_sqrt_cpT0_over_Ap/.style={column name=$\frac{\dot{m}\sqrt{c_p T_0}}{A p}$, column type=l, fixed zerofill, precision=4}, columns/impulse_function/.style={column name=$\frac{F}{\dot{m}\sqrt{c_p T_0}}$, column type=l|, fixed zerofill, precision=4}, every head row/.style={output empty row, before row={ \multicolumn{5}{c}{Gas Flow Tables ($\gamma=1.400$): Subsonic Flow} \\ \hline \fontsize{11}{13}\selectfont M & $\frac{P}{P_0}$ & $\frac{\dot{m}\sqrt{c_p T_0}}{A p_0}$ & $\frac{\dot{m}\sqrt{c_p T_0}}{A p}$ &$\frac{F}{\dot{m}\sqrt{c_p T_0}}$ \\[\arraystretch \tabcolsep] \hline\endhead\hline\endfoot\hline\endlastfoot}}, every nth row={5}{before row={\emptyrow}}, ]{\loadedtable} \end{document} This produces the following table: However, the numbers are very slightly incorrect. For example, the very bottom row, the middle value should return "1.2810", not 1.2813. I have tried increasing the precision of the top line above 4 but it does not make any difference. It is in longtable format because there will actually be 100 rows, not the 10 shown here.

  • Problem with PGFPots wrt labeling both axes
    by Puck on December 30, 2022 at 12:18 am

    I have a problem with this code: \documentclass{article} \usepackage[margin=0.25in]{geometry} \usepackage{pgfplots} \pgfplotsset{width=10cm,compat=1.9} \begin{document} \begin{center} \begin{tikzpicture} \begin{axis}[ %xtick={0,1,...,10}, ytick={0,1*pi,...,3*pi}, domain=0:3*pi, %scaled y ticks={real:3.1415}, ytick scale label code/.code={$\cdot Q$},] \addplot[domain=0:1, samples=100, color=blue]({x},{2*pi}); \addplot[domain=1:10, samples=100, color=red]({x},{2*pi/x}); \end{axis} \end{tikzpicture} \end{center} \end{document} I'd like to have something like this: I'd like to cancel 3.14 and 6.28 values on y axis and substitute the 6.28-value with "$Q$", Moreover I'd like to cancel all values on x-axis and insert a "$R$" in correspondence with the end of blue line at the start of red function. I'd also like improve the space in the graph, I mean, the space between 3.14 and 6.28 is too wide. Is it possible? First Edit: I tried to edit my code so \documentclass{article} \usepackage[margin=0.25in]{geometry} \usepackage{pgfplots} \pgfplotsset{width=10cm,compat=1.9} \usepackage{mathtools} \begin{document} \begin{center} \begin{tikzpicture} \begin{axis}[ axis lines = center, xlabel = $r$, ylabel = $u$, xtick={5}, xticklabel={$R$}, ytick={0,2*pi}, domain=0:3, y domain=0:10, %scaled y ticks={real:3.1415}, %ytick scale label code/.code={$\cdot \pi$}, yticklabel={$\dfrac{Q}{R}$}] \addplot[domain=0:5, samples=100, color=blue]({x},{2*pi}); \addlegendentry{$\dfrac{Q}{R}$} \addplot[domain=0:10, samples=100, color=white]({x},{x}); \addlegendentry{} \addplot[domain=5:15, samples=100, color=red]({x},{10*pi/x}); \addlegendentry{$\dfrac{Q}{r}$} \addplot[domain=0:10, samples=100, color=white]({x},{x}); \addlegendentry{} \end{axis} \end{tikzpicture} \end{center} \end{document} Now, my final problem is how to shorten the vertical axis and extend the horizontal where possible. How could I do? Thx again

  • Book recommendation for plotting graphs in LaTeX
    by Asif Hossain on April 27, 2021 at 9:38 am

    Could anyone suggest a book or website, where I can learn all the features of mathematical and graph plotting in LaTeX?

  • Drawing a XY axis with categories
    by BuenoGrande on August 5, 2020 at 10:19 pm

    Can anybody help me reproduce such a figure: I succesfully reproduced most of it. But I would need to help with one small detail: How can I put: "High, Medium and Low" in the middle of each square of the grid? (As you can see on my original drawing) Here is what I have done so far: \documentclass[border=2mm]{standalone} \usepackage{pgfplots} \pgfplotsset{compat=1.11} \begin{document} \begin{tikzpicture} \begin{axis}[grid=both,ymin=0,ymax=8,xmax=8,xmin=0,xtick={2,4,6},xticklabels={Low,Middle, High},ytick={2,4,6}, yticklabels={Low,Middle, High},xlabel= Classical counterpart,ylabel=Quantization] \end{axis} \end{tikzpicture} \end{document}

  • pgfplots: accuracy of the color gradient in matrix plot
    by enco909 on April 2, 2020 at 1:35 pm

    I want to plot a matrix with pgfplots to match the style of the rest of my LaTeX document. The desired output is something like this plot from Mathematica: But when I try to plot this data with pgfplots I get much less resolution regarding the color: \documentclass[tikz]{standalone} \usepackage{pgfplots, filecontents} \usepgfplotslibrary{colormaps} \pgfplotsset{width=12cm, compat=1.16} \usepgfplotslibrary{external} \pgfplotsset{compat=newest, colormap={blackwhite}{[1pt] rgb255(0pt)=(0, 100, 255) rgb255(500pt)=(255, 255, 255); rgb255(1000pt)=(255, 75, 0); },} \begin{filecontents*}{temp.dat} 0 0 -1.02348 0 1 3.74392e-06 0 2 0 0 3 0 0 4 0 0 5 0 0 6 0 0 7 0 0 8 0 0 9 0 0 10 0 0 11 0 0 12 0 0 13 0 0 14 0 0 15 0 0 16 0 0 17 0 0 18 0 0 19 0 0 20 0.0372893 0 21 0 0 22 0 0 23 0 0 24 0 0 25 0 0 26 0 0 27 0 0 28 0 0 29 0 0 30 0 0 31 0 0 32 0 0 33 0 0 34 0 0 35 0 0 36 0 0 37 0 0 38 0 0 39 0 1 0 0 1 1 -1.02349 1 2 5.99027e-05 1 3 0 1 4 0 1 5 0 1 6 0 1 7 0 1 8 0 1 9 0 1 10 0 1 11 0 1 12 0 1 13 0 1 14 0 1 15 0 1 16 0 1 17 0 1 18 0 1 19 0 1 20 0 1 21 0.0372893 1 22 0 1 23 0 1 24 0 1 25 0 1 26 0 1 27 0 1 28 0 1 29 0 1 30 0 1 31 0 1 32 0 1 33 0 1 34 0 1 35 0 1 36 0 1 37 0 1 38 0 1 39 0 2 0 0 2 1 5.18667e-06 2 2 -1.02362 2 3 0.000303258 2 4 0 2 5 0 2 6 0 2 7 0 2 8 0 2 9 0 2 10 0 2 11 0 2 12 0 2 13 0 2 14 0 2 15 0 2 16 0 2 17 0 2 18 0 2 19 0 2 20 0 2 21 0 2 22 0.0372893 2 23 0 2 24 0 2 25 0 2 26 0 2 27 0 2 28 0 2 29 0 2 30 0 2 31 0 2 32 0 2 33 0 2 34 0 2 35 0 2 36 0 2 37 0 2 38 0 2 39 0 3 0 0 3 1 0 3 2 8.29867e-05 3 3 -1.0242 3 4 0.000958444 3 5 0 3 6 0 3 7 0 3 8 0 3 9 0 3 10 0 3 11 0 3 12 0 3 13 0 3 14 0 3 15 0 3 16 0 3 17 0 3 18 0 3 19 0 3 20 0 3 21 -0 3 22 0 3 23 0.0372893 3 24 0 3 25 0 3 26 0 3 27 0 3 28 0 3 29 0 3 30 0 3 31 0 3 32 0 3 33 0 3 34 0 3 35 0 3 36 0 3 37 0 3 38 0 3 39 0 4 0 0 4 1 0 4 2 0 4 3 0.00042012 4 4 -1.02577 4 5 0.00233995 4 6 0 4 7 0 4 8 0 4 9 0 4 10 0 4 11 0 4 12 0 4 13 0 4 14 0 4 15 0 4 16 0 4 17 0 4 18 0 4 19 0 4 20 0 4 21 -0 4 22 -0 4 23 8.68125e-17 4 24 0.0372893 4 25 0 4 26 0 4 27 0 4 28 0 4 29 0 4 30 0 4 31 0 4 32 0 4 33 0 4 34 0 4 35 0 4 36 0 4 37 0 4 38 0 4 39 0 5 0 0 5 1 0 5 2 0 5 3 -6.5579e-18 5 4 0.00132779 5 5 -1.02906 5 6 0.00485212 5 7 0 5 8 0 5 9 0 5 10 0 5 11 0 5 12 0 5 13 0 5 14 0 5 15 0 5 16 0 5 17 0 5 18 0 5 19 0 5 20 0 5 21 -0 5 22 -0 5 23 3.55584e-17 5 24 3.01617e-14 5 25 0.0372893 5 26 0 5 27 0 5 28 0 5 29 0 5 30 0 5 31 0 5 32 0 5 33 0 5 34 0 5 35 0 5 36 0 5 37 0 5 38 0 5 39 0 6 0 0 6 1 0 6 2 0 6 3 -3.16257e-18 6 4 -3.39595e-15 6 5 0.00324167 6 6 -1.03505 6 7 0.00898915 6 8 0 6 9 0 6 10 0 6 11 0 6 12 0 6 13 0 6 14 0 6 15 0 6 16 0 6 17 0 6 18 0 6 19 0 6 20 0 6 21 -0 6 22 -0 6 23 1.71481e-17 6 24 1.45456e-14 6 25 3.68424e-12 6 26 0.0372893 6 27 0 6 28 0 6 29 0 6 30 0 6 31 0 6 32 0 6 33 0 6 34 0 6 35 0 6 36 0 6 37 0 6 38 0 6 39 0 7 0 0 7 1 0 7 2 0 7 3 -1.70708e-18 7 4 -1.83305e-15 7 5 -6.00238e-13 7 6 0.00672192 7 7 -1.04492 7 8 0.0153351 7 9 0 7 10 0 7 11 0 7 12 0 7 13 0 7 14 0 7 15 0 7 16 0 7 17 0 7 18 0 7 19 0 7 20 0 7 21 -0 7 22 -0 7 23 9.25614e-18 7 24 7.85134e-15 7 25 1.98866e-12 7 26 1.98825e-10 7 27 0.0372893 7 28 0 7 29 0 7 30 0 7 31 0 7 32 0 7 33 0 7 34 0 7 35 0 7 36 0 7 37 0 7 38 0 7 39 0 8 0 0 8 1 0 8 2 0 8 3 -1.00066e-18 8 4 -1.0745e-15 8 5 -3.51849e-13 8 6 -4.60609e-11 8 7 0.0124532 8 8 -1.06006 8 9 0.0245639 8 10 0 8 11 0 8 12 0 8 13 0 8 14 0 8 15 0 8 16 0 8 17 0 8 18 0 8 19 0 8 20 0 8 21 -0 8 22 -0 8 23 5.42578e-18 8 24 4.60231e-15 8 25 1.16572e-12 8 26 1.16548e-10 8 27 5.44139e-09 8 28 0.0372894 8 29 0 8 30 0 8 31 0 8 32 0 8 33 0 8 34 0 8 35 0 8 36 0 8 37 0 8 38 0 8 39 0 9 0 0 9 1 0 9 2 0 9 3 -6.24705e-19 9 4 -6.70805e-16 9 5 -2.19657e-13 9 6 -2.87556e-11 9 7 -1.77069e-09 9 8 0.0212445 9 9 -1.08207 9 10 0.0374392 9 11 0 9 12 0 9 13 0 9 14 0 9 15 0 9 16 0 9 17 0 9 18 0 9 19 0 9 20 0 9 21 -0 9 22 -0 9 23 3.38729e-18 9 24 2.8732e-15 9 25 7.27751e-13 9 26 7.276e-11 9 27 3.39704e-09 9 28 8.35962e-08 9 29 0.0372897 9 30 0 9 31 0 9 32 0 9 33 0 9 34 0 9 35 0 9 36 0 9 37 0 9 38 0 9 39 0 10 0 0 10 1 0 10 2 0 10 3 -4.09869e-19 10 4 -4.40115e-16 10 5 -1.44117e-13 10 6 -1.88665e-11 10 7 -1.16175e-09 10 8 -3.77287e-08 10 9 0.034029 10 10 -1.11279 10 11 0.0548147 10 12 0 10 13 0 10 14 0 10 15 0 10 16 0 10 17 0 10 18 0 10 19 0 10 20 0 10 21 -0 10 22 -0 10 23 2.2224e-18 10 24 1.88511e-15 10 25 4.77477e-13 10 26 4.77379e-11 10 27 2.22879e-09 10 28 5.48475e-08 10 29 7.81768e-07 10 30 0.0372906 10 31 0 10 32 0 10 33 0 10 34 0 10 35 0 10 36 0 10 37 0 10 38 0 10 39 0 11 0 0 11 1 0 11 2 0 11 3 -2.79946e-19 11 4 -3.00605e-16 11 5 -9.8434e-14 11 6 -1.28861e-11 11 7 -7.93491e-10 11 8 -2.57692e-08 11 9 -4.81525e-07 11 10 0.0518611 11 11 -1.15423 11 12 0.0776334 11 13 0 11 14 0 11 15 0 11 16 0 11 17 0 11 18 0 11 19 0 11 20 0 11 21 -0 11 22 -0 11 23 1.51793e-18 11 24 1.28755e-15 11 25 3.26123e-13 11 26 3.26056e-11 11 27 1.5223e-09 11 28 3.74616e-08 11 29 5.33958e-07 11 30 4.76284e-06 11 31 0.0372904 11 32 0 11 33 0 11 34 0 11 35 0 11 36 0 11 37 0 11 38 0 11 39 0 12 0 0 12 1 0 12 2 0 12 3 -1.9766e-19 12 4 -2.12247e-16 12 5 -6.9501e-14 12 6 -9.09844e-12 12 7 -5.60258e-10 12 8 -1.81948e-08 12 9 -3.39989e-07 12 10 -3.92299e-06 12 11 0.0759084 12 12 -1.2086 12 13 0.106927 12 14 0 12 15 0 12 16 0 12 17 0 12 18 0 12 19 0 12 20 0 12 21 -0 12 22 -0 12 23 1.07176e-18 12 24 9.09098e-16 12 25 2.30265e-13 12 26 2.30217e-11 12 27 1.07484e-09 12 28 2.64504e-08 12 29 3.7701e-07 12 30 3.36288e-06 12 31 2.00372e-05 12 32 0.037277 12 33 0 12 34 0 12 35 0 12 36 0 12 37 0 12 38 0 12 39 0 13 0 0 13 1 0 13 2 0 13 3 -1.43506e-19 13 4 -1.54097e-16 13 5 -5.04594e-14 13 6 -6.6057e-12 13 7 -4.06761e-10 13 8 -1.32099e-08 13 9 -2.46841e-07 13 10 -2.84819e-06 13 11 -2.15508e-05 13 12 0.107439 13 13 -1.27818 13 14 0.143816 13 15 0 13 16 0 13 17 0 13 18 0 13 19 0 13 20 0 13 21 -0 13 22 -0 13 23 7.78124e-19 13 24 6.60028e-16 13 25 1.67178e-13 13 26 1.67144e-11 13 27 7.80363e-10 13 28 1.92036e-08 13 29 2.73719e-07 13 30 2.44154e-06 13 31 1.45475e-05 13 32 6.12057e-05 13 33 0.0372164 13 34 0 13 35 0 13 36 0 13 37 0 13 38 0 13 39 0 14 0 0 14 1 0 14 2 0 14 3 -1.06692e-19 14 4 -1.14566e-16 14 5 -3.75149e-14 14 6 -4.91111e-12 14 7 -3.02413e-10 14 8 -9.8211e-09 14 9 -1.83518e-07 14 10 -2.11753e-06 14 11 -1.60223e-05 14 12 -8.38046e-05 14 13 0.147822 14 14 -1.36532 14 15 0.189504 14 16 0 14 17 0 14 18 0 14 19 0 14 20 0 14 21 -0 14 22 -0 14 23 5.78509e-19 14 24 4.90708e-16 14 25 1.24291e-13 14 26 1.24266e-11 14 27 5.80174e-10 14 28 1.42772e-08 14 29 2.03501e-07 14 30 1.8152e-06 14 31 1.08156e-05 14 32 4.55044e-05 14 33 0.000141738 14 34 0.037054 14 35 0 14 36 0 14 37 0 14 38 0 14 39 0 15 0 0 15 1 0 15 2 0 15 3 -8.09617e-20 15 4 -8.69363e-17 15 5 -2.84676e-14 15 6 -3.72672e-12 15 7 -2.29482e-10 15 8 -7.45259e-09 15 9 -1.3926e-07 15 10 -1.60686e-06 15 11 -1.21583e-05 15 12 -6.35938e-05 15 13 -0.000240978 15 14 0.198572 15 15 -1.47244 15 16 0.245284 15 17 0 15 18 0 15 19 0 15 20 0 15 21 -0 15 22 -0 15 23 4.38992e-19 15 24 3.72367e-16 15 25 9.43165e-14 15 26 9.4297e-12 15 27 4.40256e-10 15 28 1.08341e-08 15 29 1.54423e-07 15 30 1.37744e-06 15 31 8.20722e-06 15 32 3.45303e-05 15 33 0.000107556 15 34 0.00025815 15 35 0.0367414 15 36 0 15 37 0 15 38 0 15 39 0 16 0 0 16 1 0 16 2 0 16 3 -6.2541e-20 16 4 -6.71562e-17 16 5 -2.19905e-14 16 6 -2.8788e-12 16 7 -1.77269e-10 16 8 -5.75695e-09 16 9 -1.07575e-07 16 10 -1.24126e-06 16 11 -9.39196e-06 16 12 -4.91247e-05 16 13 -0.00018615 16 14 -0.000532785 16 15 0.261412 16 16 -1.60237 16 17 0.312534 16 18 0 16 19 0 16 20 0 16 21 -0 16 22 -0 16 23 3.39111e-19 16 24 2.87644e-16 16 25 7.28573e-14 16 26 7.28422e-12 16 27 3.40087e-10 16 28 8.36906e-09 16 29 1.19288e-07 16 30 1.06404e-06 16 31 6.33988e-06 16 32 2.66738e-05 16 33 8.30842e-05 16 34 0.000199415 16 35 0.000380998 16 36 0.0362722 16 37 0 16 38 0 16 39 0 17 0 0 17 1 0 17 2 0 17 3 -4.90737e-20 17 4 -5.26951e-17 17 5 -1.72552e-14 17 6 -2.2589e-12 17 7 -1.39097e-10 17 8 -4.51727e-09 17 9 -8.44101e-08 17 10 -9.73972e-07 17 11 -7.36955e-06 17 12 -3.85465e-05 17 13 -0.000146065 17 14 -0.000418058 17 15 -0.000937622 17 16 0.338289 17 17 -1.75855 17 18 0.392721 17 19 0 17 20 0 17 21 -0 17 22 -0 17 23 2.66089e-19 17 24 2.25704e-16 17 25 5.71685e-14 17 26 5.71567e-12 17 27 2.66854e-10 17 28 6.56691e-09 17 29 9.36014e-08 17 30 8.34912e-07 17 31 4.97468e-06 17 32 2.093e-05 17 33 6.51932e-05 17 34 0.000156474 17 35 0.000298956 17 36 0.000464812 17 37 0.0356987 17 38 0 17 39 0 18 0 0 18 1 0 18 2 0 18 3 -3.9044e-20 18 4 -4.19253e-17 18 5 -1.37286e-14 18 6 -1.79722e-12 18 7 -1.10668e-10 18 8 -3.59403e-09 18 9 -6.71583e-08 18 10 -7.74912e-07 18 11 -5.86336e-06 18 12 -3.06683e-05 18 13 -0.000116213 18 14 -0.000332615 18 15 -0.000745991 18 16 -0.00135408 18 17 0.431311 18 18 -1.94504 18 19 0.487406 18 20 0 18 21 -0 18 22 -0 18 23 2.11705e-19 18 24 1.79575e-16 18 25 4.54844e-14 18 26 4.5475e-12 18 27 2.12315e-10 18 28 5.22476e-09 18 29 7.44712e-08 18 30 6.64273e-07 18 31 3.95796e-06 18 32 1.66524e-05 18 33 5.1869e-05 18 34 0.000124494 18 35 0.000237855 18 36 0.000369814 18 37 0.000468415 18 38 0.0351196 18 39 0 19 0 0 19 1 0 19 2 0 19 3 -3.14507e-20 19 4 -3.37716e-17 19 5 -1.10586e-14 19 6 -1.4477e-12 19 7 -8.91453e-11 19 8 -2.89506e-09 19 9 -5.40973e-08 19 10 -6.24206e-07 19 11 -4.72304e-06 19 12 -2.47039e-05 19 13 -9.36114e-05 19 14 -0.000267928 19 15 -0.000600909 19 16 -0.00109074 19 17 -0.00164864 19 18 0.543712 19 19 -1.70673 19 20 0 19 21 -0 19 22 -0 19 23 1.70533e-19 19 24 1.44651e-16 19 25 3.66386e-14 19 26 3.6631e-12 19 27 1.71023e-10 19 28 4.20864e-09 19 29 5.99879e-08 19 30 5.35084e-07 19 31 3.18821e-06 19 32 1.34138e-05 19 33 4.17815e-05 19 34 0.000100282 19 35 0.000191597 19 36 0.000297892 19 37 0.000377317 19 38 0.000183213 19 39 0.0345669 20 0 0.0170327 20 1 0 20 2 0 20 3 0 20 4 0 20 5 0 20 6 0 20 7 0 20 8 0 20 9 0 20 10 0 20 11 0 20 12 0 20 13 0 20 14 0 20 15 0 20 16 0 20 17 0 20 18 0 20 19 0 20 20 -1.04374 20 21 1.03733e-05 20 22 0 20 23 0 20 24 0 20 25 0 20 26 0 20 27 0 20 28 0 20 29 0 20 30 0 20 31 0 20 32 0 20 33 0 20 34 0 20 35 0 20 36 0 20 37 0 20 38 0 20 39 0 21 0 0 21 1 0.0170327 21 2 0 21 3 0 21 4 0 21 5 0 21 6 0 21 7 0 21 8 0 21 9 0 21 10 0 21 11 0 21 12 0 21 13 0 21 14 0 21 15 0 21 16 0 21 17 0 21 18 0 21 19 0 21 20 0 21 21 -1.04376 21 22 0.000165973 21 23 0 21 24 0 21 25 0 21 26 0 21 27 0 21 28 0 21 29 0 21 30 0 21 31 0 21 32 0 21 33 0 21 34 0 21 35 0 21 36 0 21 37 0 21 38 0 21 39 0 22 0 0 22 1 0 22 2 0.0170327 22 3 0 22 4 0 22 5 0 22 6 0 22 7 0 22 8 0 22 9 0 22 10 0 22 11 0 22 12 0 22 13 0 22 14 0 22 15 0 22 16 0 22 17 0 22 18 0 22 19 0 22 20 0 22 21 7.48396e-06 22 22 -1.04402 22 23 0.00084024 22 24 0 22 25 0 22 26 0 22 27 0 22 28 0 22 29 0 22 30 0 22 31 0 22 32 0 22 33 0 22 34 0 22 35 0 22 36 0 22 37 0 22 38 0 22 39 0 23 0 0 23 1 0 23 2 0 23 3 0.0170327 23 4 0 23 5 0 23 6 0 23 7 0 23 8 0 23 9 0 23 10 0 23 11 0 23 12 0 23 13 0 23 14 0 23 15 0 23 16 0 23 17 0 23 18 0 23 19 0 23 20 0 23 21 0 23 22 0.000119743 23 23 -1.04518 23 24 0.00265557 23 25 0 23 26 0 23 27 0 23 28 0 23 29 0 23 30 0 23 31 0 23 32 0 23 33 0 23 34 0 23 35 0 23 36 0 23 37 0 23 38 0 23 39 0 24 0 0 24 1 0 24 2 0 24 3 1.60105e-17 24 4 0.0170327 24 5 0 24 6 0 24 7 0 24 8 0 24 9 0 24 10 0 24 11 0 24 12 0 24 13 0 24 14 0 24 15 0 24 16 0 24 17 0 24 18 0 24 19 0 24 20 0 24 21 0 24 22 0 24 23 0.000606201 24 24 -1.04831 24 25 0.00648333 24 26 0 24 27 0 24 28 0 24 29 0 24 30 0 24 31 0 24 32 0 24 33 0 24 34 0 24 35 0 24 36 0 24 37 0 24 38 0 24 39 0 25 0 0 25 1 0 25 2 0 25 3 6.5579e-18 25 4 7.04184e-15 25 5 0.0170327 25 6 0 25 7 0 25 8 0 25 9 0 25 10 0 25 11 0 25 12 0 25 13 0 25 14 0 25 15 0 25 16 0 25 17 0 25 18 0 25 19 0 25 20 0 25 21 0 25 22 0 25 23 -3.55584e-17 25 24 0.00191589 25 25 -1.0549 25 26 0.0134438 25 27 0 25 28 0 25 29 0 25 30 0 25 31 0 25 32 0 25 33 0 25 34 0 25 35 0 25 36 0 25 37 0 25 38 0 25 39 0 26 0 0 26 1 0 26 2 0 26 3 3.16257e-18 26 4 3.39595e-15 26 5 1.11202e-12 26 6 0.0170327 26 7 0 26 8 0 26 9 0 26 10 0 26 11 0 26 12 0 26 13 0 26 14 0 26 15 0 26 16 0 26 17 0 26 18 0 26 19 0 26 20 0 26 21 0 26 22 0 26 23 -1.71481e-17 26 24 -1.45456e-14 26 25 0.00467748 26 26 -1.06689 26 27 0.0249064 26 28 0 26 29 0 26 30 0 26 31 0 26 32 0 26 33 0 26 34 0 26 35 0 26 36 0 26 37 0 26 38 0 26 39 0 27 0 0 27 1 0 27 2 0 27 3 1.70708e-18 27 4 1.83305e-15 27 5 6.00238e-13 27 6 7.85778e-11 27 7 0.0170327 27 8 0 27 9 0 27 10 0 27 11 0 27 12 0 27 13 0 27 14 0 27 15 0 27 16 0 27 17 0 27 18 0 27 19 0 27 20 0 27 21 0 27 22 0 27 23 -9.25614e-18 27 24 -7.85134e-15 27 25 -1.98866e-12 27 26 0.00969921 27 27 -1.08662 27 28 0.0424892 27 29 0 27 30 0 27 31 0 27 32 0 27 33 0 27 34 0 27 35 0 27 36 0 27 37 0 27 38 0 27 39 0 28 0 0 28 1 0 28 2 0 28 3 1.00066e-18 28 4 1.0745e-15 28 5 3.51849e-13 28 6 4.60609e-11 28 7 2.83631e-09 28 8 0.0170327 28 9 0 28 10 0 28 11 0 28 12 0 28 13 0 28 14 0 28 15 0 28 16 0 28 17 0 28 18 0 28 19 0 28 20 0 28 21 0 28 22 0 28 23 -5.42578e-18 28 24 -4.60231e-15 28 25 -1.16572e-12 28 26 -1.16548e-10 28 27 0.017969 28 28 -1.1169 28 29 0.0680594 28 30 0 28 31 0 28 32 0 28 33 0 28 34 0 28 35 0 28 36 0 28 37 0 28 38 0 28 39 0 29 0 0 29 1 0 29 2 0 29 3 6.24705e-19 29 4 6.70805e-16 29 5 2.19657e-13 29 6 2.87556e-11 29 7 1.77069e-09 29 8 5.75045e-08 29 9 0.0170331 29 10 0 29 11 0 29 12 0 29 13 0 29 14 0 29 15 0 29 16 0 29 17 0 29 18 0 29 19 0 29 20 0 29 21 0 29 22 0 29 23 -3.38729e-18 29 24 -2.8732e-15 29 25 -7.27751e-13 29 26 -7.276e-11 29 27 -3.39704e-09 29 28 0.0306543 29 29 -1.16092 29 30 0.103733 29 31 0 29 32 0 29 33 0 29 34 0 29 35 0 29 36 0 29 37 0 29 38 0 29 39 0 30 0 0 30 1 0 30 2 0 30 3 4.09869e-19 30 4 4.40115e-16 30 5 1.44117e-13 30 6 1.88665e-11 30 7 1.16175e-09 30 8 3.77287e-08 30 9 7.05001e-07 30 10 0.0170349 30 11 0 30 12 0 30 13 0 30 14 0 30 15 0 30 16 0 30 17 0 30 18 0 30 19 0 30 20 0 30 21 0 30 22 0 30 23 -2.2224e-18 30 24 -1.88511e-15 30 25 -4.77477e-13 30 26 -4.77379e-11 30 27 -2.22879e-09 30 28 -5.48475e-08 30 29 0.0491019 30 30 -1.22235 30 31 0.151876 30 32 0 30 33 0 30 34 0 30 35 0 30 36 0 30 37 0 30 38 0 30 39 0 31 0 0 31 1 0 31 2 0 31 3 2.79946e-19 31 4 3.00605e-16 31 5 9.8434e-14 31 6 1.28861e-11 31 7 7.93491e-10 31 8 2.57692e-08 31 9 4.81525e-07 31 10 5.55612e-06 31 11 0.0170399 31 12 0 31 13 0 31 14 0 31 15 0 31 16 0 31 17 0 31 18 0 31 19 0 31 20 0 31 21 0 31 22 0 31 23 -1.51793e-18 31 24 -1.28755e-15 31 25 -3.26123e-13 31 26 -3.26056e-11 31 27 -1.5223e-09 31 28 -3.74616e-08 31 29 -5.33958e-07 31 30 0.0748372 31 31 -1.30526 31 32 0.215103 31 33 0 31 34 0 31 35 0 31 36 0 31 37 0 31 38 0 31 39 0 32 0 0 32 1 0 32 2 0 32 3 1.9766e-19 32 4 2.12247e-16 32 5 6.9501e-14 32 6 9.09844e-12 32 7 5.60258e-10 32 8 1.81948e-08 32 9 3.39989e-07 32 10 3.92299e-06 32 11 2.96832e-05 32 12 0.0170378 32 13 0 32 14 0 32 15 0 32 16 0 32 17 0 32 18 0 32 19 0 32 20 0 32 21 0 32 22 0 32 23 -1.07176e-18 32 24 -9.09098e-16 32 25 -2.30265e-13 32 26 -2.30217e-11 32 27 -1.07484e-09 32 28 -2.64504e-08 32 29 -3.7701e-07 32 30 -3.36288e-06 32 31 0.109563 32 32 -1.41419 32 33 0.296278 32 34 0 32 35 0 32 36 0 32 37 0 32 38 0 32 39 0 33 0 0 33 1 0 33 2 0 33 3 1.43506e-19 33 4 1.54097e-16 33 5 5.04594e-14 33 6 6.6057e-12 33 7 4.06761e-10 33 8 1.32099e-08 33 9 2.46841e-07 33 10 2.84819e-06 33 11 2.15508e-05 33 12 0.000112721 33 13 0.0169713 33 14 0 33 15 0 33 16 0 33 17 0 33 18 0 33 19 0 33 20 0 33 21 0 33 22 0 33 23 -7.78124e-19 33 24 -6.60028e-16 33 25 -1.67178e-13 33 26 -1.67144e-11 33 27 -7.80363e-10 33 28 -1.92036e-08 33 29 -2.73719e-07 33 30 -2.44154e-06 33 31 -1.45475e-05 33 32 0.155156 33 33 -1.5542 33 34 0.398523 33 35 0 33 36 0 33 37 0 33 38 0 33 39 0 34 0 0 34 1 0 34 2 0 34 3 1.06692e-19 34 4 1.14566e-16 34 5 3.75149e-14 34 6 4.91111e-12 34 7 3.02413e-10 34 8 9.8211e-09 34 9 1.83518e-07 34 10 2.11753e-06 34 11 1.60223e-05 34 12 8.38046e-05 34 13 0.000317564 34 14 0.0166963 34 15 0 34 16 0 34 17 0 34 18 0 34 19 0 34 20 0 34 21 0 34 22 0 34 23 -5.78509e-19 34 24 -4.90708e-16 34 25 -1.24291e-13 34 26 -1.24266e-11 34 27 -5.80174e-10 34 28 -1.42772e-08 34 29 -2.03501e-07 34 30 -1.8152e-06 34 31 -1.08156e-05 34 32 -4.55044e-05 34 33 0.213676 34 34 -1.73091 34 35 0.525213 34 36 0 34 37 0 34 38 0 34 39 0 35 0 0 35 1 0 35 2 0 35 3 8.09617e-20 35 4 8.69363e-17 35 5 2.84676e-14 35 6 3.72672e-12 35 7 2.29482e-10 35 8 7.45259e-09 35 9 1.3926e-07 35 10 1.60686e-06 35 11 1.21583e-05 35 12 6.35938e-05 35 13 0.000240978 35 14 0.000689711 35 15 0.0160027 35 16 0 35 17 0 35 18 0 35 19 0 35 20 0 35 21 0 35 22 0 35 23 -4.38992e-19 35 24 -3.72367e-16 35 25 -9.43165e-14 35 26 -9.4297e-12 35 27 -4.40256e-10 35 28 -1.08341e-08 35 29 -1.54423e-07 35 30 -1.37744e-06 35 31 -8.20722e-06 35 32 -3.45303e-05 35 33 -0.000107556 35 34 0.287364 35 35 -1.95043 35 36 0.679981 35 37 0 35 38 0 35 39 0 36 0 0 36 1 0 36 2 0 36 3 6.2541e-20 36 4 6.71562e-17 36 5 2.19905e-14 36 6 2.8788e-12 36 7 1.77269e-10 36 8 5.75695e-09 36 9 1.07575e-07 36 10 1.24126e-06 36 11 9.39196e-06 36 12 4.91247e-05 36 13 0.00018615 36 14 0.000532785 36 15 0.00119493 36 16 0.014725 36 17 0 36 18 0 36 19 0 36 20 0 36 21 0 36 22 0 36 23 -3.39111e-19 36 24 -2.87644e-16 36 25 -7.28573e-14 36 26 -7.28422e-12 36 27 -3.40087e-10 36 28 -8.36906e-09 36 29 -1.19288e-07 36 30 -1.06404e-06 36 31 -6.33988e-06 36 32 -2.66738e-05 36 33 -8.30842e-05 36 34 -0.000199415 36 35 0.378653 36 36 -2.21916 36 37 0.866716 36 38 0 36 39 0 37 0 0 37 1 0 37 2 0 37 3 4.90737e-20 37 4 5.26951e-17 37 5 1.72552e-14 37 6 2.2589e-12 37 7 1.39097e-10 37 8 4.51727e-09 37 9 8.44101e-08 37 10 9.73972e-07 37 11 7.36955e-06 37 12 3.85465e-05 37 13 0.000146065 37 14 0.000418058 37 15 0.000937622 37 16 0.00170192 37 17 0.0128679 37 18 0 37 19 0 37 20 0 37 21 0 37 22 0 37 23 -2.66089e-19 37 24 -2.25704e-16 37 25 -5.71685e-14 37 26 -5.71567e-12 37 27 -2.66854e-10 37 28 -6.56691e-09 37 29 -9.36014e-08 37 30 -8.34912e-07 37 31 -4.97468e-06 37 32 -2.093e-05 37 33 -6.51932e-05 37 34 -0.000156474 37 35 -0.000298956 37 36 0.490159 37 37 -2.54365 37 38 1.08955 37 39 0 38 0 0 38 1 0 38 2 0 38 3 3.9044e-20 38 4 4.19253e-17 38 5 1.37286e-14 38 6 1.79722e-12 38 7 1.10668e-10 38 8 3.59403e-09 38 9 6.71583e-08 38 10 7.74912e-07 38 11 5.86336e-06 38 12 3.06683e-05 38 13 0.000116213 38 14 0.000332615 38 15 0.000745991 38 16 0.00135408 38 17 0.00204668 38 18 0.0106359 38 19 0 38 20 0 38 21 0 38 22 0 38 23 -2.11705e-19 38 24 -1.79575e-16 38 25 -4.54844e-14 38 26 -4.5475e-12 38 27 -2.12315e-10 38 28 -5.22476e-09 38 29 -7.44712e-08 38 30 -6.64273e-07 38 31 -3.95796e-06 38 32 -1.66524e-05 38 33 -5.1869e-05 38 34 -0.000124494 38 35 -0.000237855 38 36 -0.000369814 38 37 0.624671 38 38 -2.93065 38 39 1.35287 39 0 0 39 1 0 39 2 0 39 3 3.14507e-20 39 4 3.37716e-17 39 5 1.10586e-14 39 6 1.4477e-12 39 7 8.91453e-11 39 8 2.89506e-09 39 9 5.40973e-08 39 10 6.24206e-07 39 11 4.72304e-06 39 12 2.47039e-05 39 13 9.36114e-05 39 14 0.000267928 39 15 0.000600909 39 16 0.00109074 39 17 0.00164864 39 18 0.00106446 39 19 0.00713715 39 20 0 39 21 0 39 22 0 39 23 -1.70533e-19 39 24 -1.44651e-16 39 25 -3.66386e-14 39 26 -3.6631e-12 39 27 -1.71023e-10 39 28 -4.20864e-09 39 29 -5.99879e-08 39 30 -5.35084e-07 39 31 -3.18821e-06 39 32 -1.34138e-05 39 33 -4.17815e-05 39 34 -0.000100282 39 35 -0.000191597 39 36 -0.000297892 39 37 -0.000377317 39 38 0.785244 39 39 -2.41236 \end{filecontents*} \begin{document} \begin{tikzpicture} \begin{axis}[view={0}{90}, xlabel=$i$, ylabel=$j$, colorbar, y dir = reverse] \addplot3[surf] file {temp.dat}; \end{axis} \end{tikzpicture} \end{document} I believe the problem comes from the fact that the data set covers many orders of magnitude (from 1 to 1e-20). Is there the possibility to achieve a coloring of the plot that comes close to Mathematicas MatrixPlot? Edit: Due to setting a much lower meta value from -10^-8 to 10^-8 I'm at least getting the desired form (Thanks to @Marijn). Is there the possiblity to change the sensitivity of the colormap to changes in the value of the matrix components to further increase the resolution? Edit2: I should have mentioned that I switched from addplot3 to addplot with the matrix plot functionality, because of inconsistencies in the surface plot that I didn't understand. \begin{tikzpicture} \begin{axis}[xlabel=$i$, ylabel=$j$, colorbar, y dir = reverse, enlargelimits=false, axis on top, ymin=-0.5, ymax=39.5, xmin=-0.5, xmax=39.5, ] \addplot[matrix plot*, point meta min=-1e-8, point meta max=1e-8, point meta=explicit] file {temp.dat}; \end{axis} \end{tikzpicture}

  • pgfplots legends: propagate styles
    by Ilonpilaaja on January 16, 2020 at 1:46 pm

    In the following MWE, one would expect that the legend is drawn in the same way specified in the style, but it is not -- it is blue instead of black: \documentclass{article} \usepackage{tikz} \usepackage{pgfplots} \pgfplotsset{compat=newest} \usetikzlibrary{plotmarks} \begin{document} \begin{tikzpicture} \begin{axis}[ legend cell align=left, legend pos=north east, ] \addplot+ [ scatter/classes={ a={mark=square,black}, b={mark=square*,black} }, scatter, only marks, scatter src=explicit symbolic, ] table [meta=label] { x y label 0.1 0.2 a 0.2 0.1 b }; \legend{a,should-be-filled-with-black}; \end{axis} \end{tikzpicture} \end{document} How to fix this? How to make sure the styles you specify are propagated to the legend? Otherwise I am absolutely loving pgfplots.

  • Mosaic/Marimekko charts; does this answer still work?
    by Jan Verveckken on October 10, 2014 at 8:46 am

    I found this answer How can I produce a mosaic chart / Marimekko chart? and have used it before to create beautiful charts. Under Texlive-2014, with pgfplots version 1.10, I receive a lot of white spaces in the examples on the previous mentioned url. Using the mwe from the mentioned answer \documentclass[border=5mm]{standalone} \usepackage{pgfplots, pgfplotstable} \pgfplotstableread{ 23 30 50 20 55 10 40 50 32 60 30 10 0 0 0 0 }\datatable \pgfplotstableset{ create on use/accumy/.style={ create col/expr={\prevrow{0}+\pgfmathaccuma} } } \begin{document} \begin{tikzpicture} \begin{axis}[ stack plots=x, enlargelimits=false, table/y=accumy] \addplot [fill=orange!60,xbar interval] table [x index=1] {\datatable}; \addplot [fill=cyan!50,xbar interval] table [x index=2] {\datatable}; \addplot [fill=yellow!50,xbar interval] table [x index=3] {\datatable}; \end{axis} \end{tikzpicture} \end{document} Any advice?

  • \foreach not behaving in axis environment
    by Peter Grill on April 10, 2014 at 3:42 am

    Am hesitant to ask yet one more embarrassing question, but I can't seem to see the problem with the \foreach in the MWE. It should produce several horizontal lines but only produces the one with the yValue as specified in the \newcommand{\yValue}{0.3}: Code: \documentclass{article} \usepackage{pgfplots} \newcommand{\yValue}{0.3} \begin{document} \begin{tikzpicture} \begin{axis} [ ymin=0, ymax=1, xmin=0, xmax=1, ] \foreach \yValue in {0.00,0.1,...,1.00} { \draw [red] (axis cs:0,\yValue) -- (axis cs:1,\yValue); } \end{axis} \end{tikzpicture} \end{document}

  • Solid sphere with a cylindrical hole through center (bead shaped solid)
    by Peter Grill on February 21, 2014 at 5:52 am

    I am trying to draw a solid sphere with a cylindrical drilled through its center. The best I have been able to do is: which does not show it is solid. How do I make it more solid in appearance? Notes: The code is adapted from Strange problems in 3D-Plots TikZ: Missing parts and axes Besides a nice color version, I also need to be able to copy this in black and white so if you have suggestions on that, that would be helpful as well. Eventually need to be able to label the two radii: the sphere's and the cylinder's. Code: \documentclass{article} \usepackage{pgfplots} \begin{document} \begin{tikzpicture} \begin{axis}[width=\textwidth, samples=25,domain=0:360,y domain=-60:60, xmin=-1.2,xmax=1.2,ymin=-1.2,ymax=1.2,zmin=-1.2,zmax=1.2, xlabel={$x$},ylabel={$y$},zlabel={$z$}, axis lines=none] \addplot3[surf,opacity=0.5] ({cos(x)*cos(y)}, {sin(x)*cos(y)}, {1.5*sin(y)}); \end{axis} \end{tikzpicture} \end{document}