• How to draw highly accurate, continuous pH titration curves with the tangent method in TikZ/pgfplots?
    by Natsu on August 15, 2026 at 5:28 pm

    When attempting to plot pH-metric titration curves for weak/polyprotic acids and bases using piecewise Henderson-Hasselbalch approximations, sharp breaks and discontinuous artifacts often appear near equivalence points. Is there a robust, automated way in TikZ and pgfplots to plot continuous curves using exact charge and mass balance equations, while also supporting geometric constructions such as the tangent method (méthode des tangentes)?

  • How to reproduce the correct intersection curve of two 3D surfaces using PGFPlots?
    by Samia Rani on August 10, 2026 at 10:50 am

    I am trying to reproduce a 3D figure from a mathematics book in LaTeX using TikZ/PGFPlots. The figure shows two surfaces and their intersection. The two surfaces are given by x^2 + xy - y - 3z = 0 and 2x^2 + 3xy - 2y - 3z = 0. I plotted both surfaces directly from their equations and also added their intersection curve. However, the shape and especially the intersection curve in my output look quite different from the figure in the book, even though I am using the same equations. I am not sure whether the difference is caused by the viewing angle, the plotting ranges, the parametrization of the intersection curve, or something else. Here is my current code: \documentclass[border=5pt]{standalone} \usepackage{pgfplots} \usepackage{tikz} \pgfplotsset{compat=1.18} \begin{document} \begin{tikzpicture} \begin{axis}[ view={120}{25}, axis lines=none, xmin=-2.5, xmax=2.5, ymin=-2.5, ymax=2.5, zmin=-5, zmax=5, width=11cm, height=8cm, ticks=none, ] %================================================ % GREEN SURFACE % 2x^2 + 3xy - 2y - 3z = 0 %================================================ \addplot3[ surf, shader=interp, colormap={greenmap}{ color(0cm)=(green!15); color(1cm)=(green!35) }, colormap name=greenmap, domain=-2:2, y domain=-2:2, samples=35, samples y=35, opacity=0.65, ] { (2*x^2 + 3*x*y - 2*y)/3 }; %================================================ % BLUE SURFACE % x^2 + xy - y - 3z = 0 %================================================ \addplot3[ surf, shader=interp, colormap={bluemap}{ color(0cm)=(blue!15); color(1cm)=(blue!35) }, colormap name=bluemap, domain=-2.2:2.2, y domain=-2.2:2.2, samples=30, samples y=30, opacity=0.55, ] { (x^2 + x*y - y)/3 }; %================================================ % INTERSECTION CURVE % gamma(t) = % ( t, -t^2/(2t-1), t^3/(3(2t-1)) ) %================================================ \addplot3[ very thick, red, samples=100, domain=-2.2:0.35, variable=\t, ] ( {\t}, {-\t^2/(2*\t-1)}, {\t^3/(3*(2*\t-1))} ); \addplot3[ very thick, red, samples=50, domain=0.65:2.2, variable=\t, ] ( {\t}, {-\t^2/(2*\t-1)}, {\t^3/(3*(2*\t-1))} ); \end{axis} \end{tikzpicture} \end{document} The book's figure has a noticeably different orientation and shape for the two surfaces and their intersection. The book's figure looks like this: My current output looks like this: Could someone please explain what is causing this difference and how I can modify my PGFPlots code to obtain a figure that looks like the one in the book? In particular, I would like to know whether I should change the view angles, the plotting domains, or the parametrization of the intersection curve.

  • How can I draw the plane and intersection curve on a one-sheet hyperboloid in TikZ?
    by Samia Rani on August 9, 2026 at 5:23 pm

    I am trying to recreate the following mathematical figure in LaTeX/TikZ. The figure shows the one-sheet hyperboloid x^2 + y^2 - z^2 = 1 together with the plane 2x + z = 1. Their intersection is the red curve shown on the hyperboloid. After quite a lot of effort, I have managed to draw the one-sheet hyperboloid reasonably well in TikZ. However, I am having difficulty with the two remaining parts: How can I draw the transparent red plane 2x + z = 1 behind/in front of the hyperboloid, as shown in the reference image? How can I draw the red intersection curve between the plane and the hyperboloid so that it lies correctly on the surface? I would like the final figure to look as close as possible to the reference image, including the perspective, transparency of the plane, and the red intersection curve. Here is the code I currently have for the hyperboloid: \documentclass[border=5pt]{standalone} \usepackage{pgfplots} \usepackage{tikz} \pgfplotsset{compat=1.18} \begin{document} \begin{tikzpicture}[>=stealth] \begin{axis}[ view={120}{22}, axis lines=none, xmin=-3.3, xmax=3.3, ymin=-3.3, ymax=3.3, zmin=-2.0, zmax=2.0, xtick=\empty, ytick=\empty, ztick=\empty, clip=false, ] %------------------------------------------------ % Red point at the origin %------------------------------------------------ \addplot3[ only marks, mark=*, mark size=2.5pt, draw=red, fill=red, ] coordinates {(0,0,0)}; %------------------------------------------------ % Smooth one-sheet hyperboloid %------------------------------------------------ \addplot3[ surf, shader=interp, draw=blue!55!black, opacity=0.65, samples=45, samples y=80, domain=-2.2:2.2, y domain=0:360, z buffer=sort, ] ( {sqrt(1+x^2)*cos(y)}, {sqrt(1+x^2)*sin(y)}, {x} ); %------------------------------------------------ % POSITIVE x-axis %------------------------------------------------ \draw[ ->, black, thick ] (axis cs:0,0,0) -- (axis cs:5.0,0,0) node[right] {$x$}; %------------------------------------------------ % NEGATIVE x-axis -- dashed %------------------------------------------------ \draw[ dashed, black, thick ] (axis cs:0,0,0) -- (axis cs:-2.0,0,0); %------------------------------------------------ % POSITIVE y-axis %------------------------------------------------ \draw[ ->, black, thick ] (axis cs:0,0,0) -- (axis cs:0,4.0,0) node[above left] {$y$}; %------------------------------------------------ % NEGATIVE y-axis -- dashed %------------------------------------------------ \draw[ dashed, black, thick ] (axis cs:0,0,0) -- (axis cs:0,-1.0,0); %------------------------------------------------ % POSITIVE z-axis %------------------------------------------------ \draw[ ->, black, thick ] (axis cs:0,0,0) -- (axis cs:0,0,3.0) node[above] {$z$}; %------------------------------------------------ % NEGATIVE z-axis -- dashed %------------------------------------------------ \draw[ dashed, black, thick ] (axis cs:0,0,0) -- (axis cs:0,0,-2.0); %------------------------------------------------ % Origin %------------------------------------------------ \node[ below right, inner sep=1pt ] at (axis cs:0,0,0) {$0$}; %------------------------------------------------ % Equation %------------------------------------------------ \node[ blue!75!black, font=\large ] at (axis cs:2.0,-0.5,1.1) {$x^2+y^2-z^2=1$}; \end{axis} \end{tikzpicture} \end{document} I would be very grateful for any suggestions on how to add the plane and, especially, the intersection curve correctly. Thank you!

  • How to easily draw and parameterize various pH titration curves (including diprotic/dibasic) for a beginner?
    by user446526 on August 6, 2026 at 8:23 am

    I am a complete beginner when it comes to drawing complex functional plots in LaTeX. I am trying to create several types of pH titration curves for a document, but I am struggling to write the code from scratch. I found a very helpful French website that seems to have the exact mathematical logic and LaTeX code for what I need: https://www.astrolabe-science.fr/courbes-titrages-acido-basiques-latex/ However, as a beginner, I find it quite difficult to extract just the essential parts to create a simple, easily editable template. I need to recreate the following types of curves (I have attached images of what I am aiming for): The 4 basic monoprotic titrations: Strong Acid, Strong Base, Weak Acid, and Weak Base. Diprotic acid titration: A curve with two equivalence points (increasing pH). Dibase titration: A curve with two equivalence points (decreasing pH). My request: Could someone help provide a simplified, beginner-friendly pgfplots (or TikZ) template based on the math from that website? Ideally, I am looking for a code structure where the main parameters (like initial concentrations, volumes, and pK_a values) are defined at the top so I can easily change them. It would be incredibly helpful if you could include brief comments/instructions inside the code explaining how to switch between the different types of curves (e.g., "change this sign for a base", "uncomment this for a diprotic acid"). Thank you so much for your time and help! I have attached images of what I am aiming for.

  • Stacking multiple number lines on top of each other
    by Muhannad Al Ayoubi on August 1, 2026 at 9:09 am

    I made the following diagram, which is supposed to depict how the intersection of two intervals can be determined. However, as you can see, I could include only one number line, which makes the diagram look rather empty, in my opinion. Is there a away to draw two more number lines above the original one, aligned with the "flying" blue intervals? I have thought about drawing three separate tikz pictures above each other, but then I can't draw the red dashed line, and it would also make it difficult to control the invisible space taken by the y-axis. \documentclass{book} \usepackage{pgfplots} \begin{document} \begin{tikzpicture}[every node/.style={font=\small},] \begin{axis}[ clip=false, axis x line=middle, axis y line=none, x axis line style={<->}, xmin=-3.4, xmax=7.4, ymin=-.5, ymax=3, xtick distance=1, x=.6cm, y=1cm, ] % Red dashed lines \draw [red,dashed] (axis cs:-1,0) -- (axis cs:-1,2.2) (axis cs:6,0) -- (axis cs:6,2.2); % Points \addplot[only marks,mark options={fill=white}] coordinates {(6,2) (-1,1) (6,0) (-1,0)}; % Uppermost number line for x < 6 \draw[<-,very thick] (axis cs:-3,2) -- (axis cs:6,2); % Middle number line for x > -1 \draw[->,very thick] (axis cs:-1,1) -- (axis cs:7,1); % Lower number line for intersection of inequalities \draw[very thick] (axis cs:-1,0) -- (axis cs:6,0); % Labels \draw (axis cs:8,2) node[right]{$x<6$} (axis cs:8,1) node[right]{$x>-1$} (axis cs:8,0) node[right]{$x<6$ and $x>-1$, or simply $-1<x<6$.}; \end{axis} \end{tikzpicture} \end{document} Here is what it looks like (note I have removed color and font information from the code to keep things simple).

  • tikz and pgf not framed
    by user446112 on July 29, 2026 at 3:55 pm

    I'm drawing the graph below using Beamer, but the plot is not framed with the points (1/Pi/2) and (-1,-Pi/2). What’s happening here? My code is: \documentclass{beamer} \usepackage{pgfplots} \usepackage{tikz} \usetikzlibrary{tikzmark,calc,positioning,fit,arrows,shapes,backgrounds,shapes.geometric,arrows.meta,patterns.meta,decorations.pathreplacing} \begin{document} \begin{frame} \begin{center} \begin{tikzpicture}[scale=0.7, samples=100] \draw[-latex,thick] (-3,0) -- (3,0); \draw[-latex,thick] (0,-2.5) -- (0,2.5); \draw [thick](-1,-0.125)--(-1,0.125); \draw [thick](1,-0.125)--(1,0.125); \draw [thick](-0.125,-1.570796327)--(0.125,-1.570796327); \draw [thick](-0.125,1.570796327)--(0.125,1.570796327); \node at (2.5,-0.5) {$x$}; %\draw[-latex,thick] (0,-2) -- (0,3); \node at (-0.5,2.3) {$y$}; \node at (-1,-0.5) {{\scriptsize$-1$}}; \node at (1,-0.5) {{\scriptsize$1$}}; \node at (0.6,-1.570796327) {{\scriptsize$-\frac{\pi}{2}$}}; \node at (-0.4,1.570796327) {{\scriptsize$\frac{\pi}{2}$}}; \draw [thick](-0.125,-1.570796327)--(0.125,-1.570796327); \draw [thick](-0.125,1.570796327)--(0.125,1.570796327); \draw [dotted](1,0)--(1,1.570796327); \draw [dotted](-1,-0.8)--(-1,-1.570796327); \draw [dotted](0,1.570796327)--(1,1.570796327); \draw [dotted](-1,-1.570796327)--(0,-1.570796327); \begin{axis}[smooth,anchor=origin,xmin=-3,xmax=3, domain=-3:3,ymin=-2.5,ymax=2.5,restrict y to domain=-2.5:2.5,axis equal,axis x line=none,axis y line=none,xticklabels=\empty,yticklabels=\empty,samples=100] \addplot[domain=-1:1,blue,line width=2pt] {rad(asin(x))}; \end{axis} \end{tikzpicture} \end{center} \end{frame} \end{document} (compiled through LuaLaTeX).

  • Fine-tuning the box surrounding a bar plot
    by Muhannad Al Ayoubi on July 18, 2026 at 5:22 pm

    This is my first time making a bar plot using pgfplots. I am happy so far with what I have, but I still need some points. How can I make the top-most tick (14) coincide with the top boundary of the box? I do not like the tiny space between the top-most gridline and the top boundary of the box. I've already tried removing 14 from the key ytick but I don't like the result. I think the 14 has to stay. Suppose instead I decided to completely remove the top and right boundaries of the box. I know I can do that using the options axis x line*=bottom and axis y line*=left, but then I'd like to include arrowheads, at least for the y-axis. How to do that? Finally, I've managed to adjust the distance between successive bars by playing with the option x=0.8 cm. Is there a better way? Here is my code. I've also attached the figure. \documentclass[10pt]{book} \usepackage{tikz,pgfplots} \begin{document} \begin{tikzpicture}[every node/.style={font=\footnotesize}] \begin{axis}[ clip=false, ybar, ymajorgrids, grid style={dashed}, ymin=0, %axis x line*=bottom, %axis y line*=left, xlabel=Number of siblings, ylabel=Frequency, ytick pos=left, xtick pos=left, xtick=data, ytick={0,2,4,...,12,14}, bar width=.4cm, x=0.8cm, y=0.3cm, label style={font={\footnotesize \itshape}}, tick label style={font={\footnotesize \itshape}}, nodes near coords, nodes near coords align={vertical}, ] \addplot [fill=orange,] coordinates { (0,3) (1,13) (2,8) (3,3) (4,1) }; \end{axis} \end{tikzpicture} \end{document}

  • PGFplot ybar stacked with meta data
    by Paul on July 16, 2026 at 4:11 pm

    I want to use ybar stacked to plot data for multiple series. I first tried to organise my data.dat file like that : { config; value1; value2; value3 config1; 3; 4.2; 1 config2; 3.25; 6; 0.758 } with for each row the series symbolic name and all the values. I then used a for loop to plot each column. This worked fine and all the data were stacked correctly. But I also need for each data point to have specific label and color meta data like in my MWE : \documentclass[class=article, crop=true,varwidth=false]{standalone} \usepackage{tikz,pgfplots} \pgfplotsset{compat=1.18,width=15cm,height = 5.5cm} \begin{document} \begin{tikzpicture} \begin{axis}[ axis y line* = left,axis x line* = bottom, ybar stacked, table/col sep=semicolon, symbolic x coords={config1,config2}, xtick = data, ] \addplot+[nodes near coords,point meta=explicit symbolic,] table [trim cells=true,y expr=\thisrow{value}, x=config,meta = label ] { config; value; type; label config1; 3; L; $W_{L1}$ config1; 4.2; C; $W_{C1}$ config1; 1; L; $W_{L2}$ config2; 3.25; L; $W_{L1}$ config2; 6; C; $W_{C1}$ config2; 0.758; L; $W_{C2}$ }; \end{axis} \end{tikzpicture} \end{document} This is compiling but data are not stacked. PGFplog interprets each row as a new serie and plot the bar from 0. What would be the easiest way to plot the stacked bar with meta data for each point ? Thank for your help !

  • Controlling what appears in front in a 3d pgfplot
    by James on July 12, 2026 at 6:00 pm

    I'm trying to make a nice diagram to illustrate partial derivatives for my multivariable class. I have the graph of a function, a plane, the intersection of these in the graph, a tangent line, and some guide lines to show what's occurring, but (presumably because of the order in which they appear in the code) the diagram doesn't respect what object is behind a different object, i.e., the graph is drawn on top of the plane, or the plane is drawn on top of the graph, even though they ``should'' pass through one another. Is there any nice way to make whatever ``should'' be on top be drawn on top without manually finding intersections and having different domains/clip regions for different features? My code so far is below, along with the image that is produced \begin{standalone} \usepackage{tikz} \usepackage{pgfplots} \begin{document} \begin{tikzpicture} \begin{axis}[axis lines = center, xmin = 0, xmax = 3, ymin = 0, ymax = 3, view = {100}{30}, xlabel = {$x$}, ylabel = {$y$}, zlabel = {$z$}, xtick=\empty, ytick=\empty, ztick=\empty, ] % Using f(x,y) = 2 - (x-2)^3 - (y-1.5)^2 %graph \addplot3[ domain =1:3, y domain = 0.5:2.5,surf,colormap/viridis, opacity=0.9] {-(x-2)^3 - (y-1.5)^2 + 2}; %plane \draw[fill = blue!90, color = blue, opacity = 0.3] (2,0,0)--(2,3,0)-- (2,3,3) node[black, above, opacity = 0.9] {$x=a$}--(2,0,3)--cycle ; %intersection of line and plane \addplot3[domain = 0.5:2.5, blue, samples y = 1, thick] ({2},{x},{2 - (2-2)^3 - (x-1.5)^2}); %tangent line \addplot3[black, thick, domain = -1:1.23] ({2},{x+1},{-2*(1-1.5)*x + 2 - (1-1.5)^2}); %point of tangancy \draw[fill = black] (2,1, {2 - (1-1.5)^2}) circle (2pt); %guide lines for point \draw[dashed, thick] (2,0,0)--(2,1,0) node[below] {$(a,b,0)$}--(0,1,0); \draw[dashed, thick,] (2,1,0) -- (2,1,{2 - (1-1.5)^2}); \end{axis} \end{tikzpicture} \end{document}

  • PGFPlots / TikZ: Filtering data from a file when the x-axis contains string values
    by joseldsm on June 10, 2026 at 9:57 am

    I am generating a plot in PGFPlots/TikZ where the x-axis contains string values and the y-axis contains numerical data. The data is imported from a CSV file, and everything works correctly so far. However, when I use skip coordinates between index, the filtering is applied to the y-values and not to the x-axis categories. In this case, I want to draw only the data with the string value B. Is there a way to correctly apply this filtering to both x-axis ? Thanks! Here is the MWE. Keep in mind that in my case the data are extract from csv file. \documentclass{article} \usepackage{pgfplots} \usepackage{pgfplotstable} \pgfplotsset{compat=1.18} \pgfplotstableread{ String Value A 0 A 6 A 4 B 9 B 5 B 1 B 3 B 7 C 4 C 7 C 9 C 3 }\data \begin{document} \begin{tikzpicture} \begin{axis}[ ybar, ymin=0, xtick=data, xticklabels from table={\data}{String}, nodes near coords ] \addplot table[ x expr=\coordindex, y={Value}, skip coords between index={0}{3}, skip coords between index={8}{100} ]{\data}; \end{axis} \end{tikzpicture} \end{document}

  • pgfplots speed up compilation (filtered rows)
    by Mathieu on December 4, 2024 at 2:36 pm

    I have a csv file with approx 2000 rows and filter 100 rows of the data. However, the compilation time is already approx five seconds. When we filter rows (see below) are there some pertinent settings to speed up the compilation? I already use standalone tikz to only have to compile once, still, I feel there is room for improvement. \documentclass[tikz]{standalone} \usepackage{pgfplots} \pgfplotsset{compat=1.18} \usepackage{pgfplotstable} \usepackage{xstring} \begin{document} \begin{tikzpicture} %Load csv file \pgfplotstableread[col sep=comma, header=true]{data.csv}\data % Plot the rows where the first column contains Exp18 \begin{axis}[] \addplot[table/x index={1}, table/y index={2}, x filter/.code={ \pgfplotstablegetelem{\coordindex}{Experiment}\of{\data} \IfStrEq{\pgfplotsretval}{Exp18} {} {\def\pgfmathresult{}} }] table {\data}; \end{axis} \end{tikzpicture} \end{document} Here is the file content of data.csv. (I had to delete some rows to input less than 30000 characters.) # Exp1, Some meta info..., # Exp2, ..., # Exp3, ..., # Exp4, ..., # Exp5, ..., # Exp6, ..., # Exp7, ..., # Exp8, ..., # Exp9, ..., # Exp10, ..., # Exp11, ..., # Exp12, ..., # Exp13, ..., # Exp14, ..., # Exp15, ..., # Exp16, ..., # Exp17, ..., # Exp18, ..., Experiment,X,Y Exp1,nan,nan Exp1,nan,nan Exp1,nan,nan Exp1,nan,nan Exp1,nan,nan Exp1,nan,nan Exp1,nan,nan Exp1,nan,nan Exp1,nan,nan Exp1,nan,nan Exp1,nan,nan Exp1,nan,nan Exp1,nan,nan Exp1,nan,nan Exp1,nan,nan Exp1,nan,nan Exp1,nan,nan Exp1,nan,nan Exp1,nan,nan Exp1,nan,nan Exp1,nan,nan Exp1,nan,nan Exp1,nan,nan Exp1,nan,nan Exp1,nan,nan Exp1,nan,nan Exp1,nan,nan Exp1,nan,nan Exp1,nan,nan Exp1,nan,nan Exp1,nan,nan Exp1,nan,nan Exp1,nan,nan Exp1,nan,nan Exp1,nan,nan Exp1,nan,nan Exp1,nan,nan Exp1,nan,nan Exp1,nan,nan Exp1,nan,nan Exp1,nan,nan Exp1,nan,nan Exp1,nan,nan Exp1,nan,nan Exp1,nan,nan Exp1,nan,nan Exp1,nan,nan Exp1,nan,nan Exp1,nan,nan Exp1,nan,nan Exp1,nan,nan Exp1,nan,nan Exp1,nan,nan Exp1,nan,nan Exp1,nan,nan Exp1,nan,nan Exp1,nan,nan Exp1,nan,nan Exp1,nan,nan Exp1,nan,nan Exp1,nan,nan Exp1,nan,nan Exp1,nan,nan Exp1,nan,nan Exp1,nan,nan Exp1,nan,nan Exp1,nan,nan Exp1,nan,nan Exp1,nan,nan Exp1,nan,nan Exp1,nan,nan Exp1,nan,nan Exp1,nan,nan Exp1,nan,nan Exp1,nan,nan Exp1,nan,nan Exp1,nan,nan Exp1,nan,nan Exp1,nan,nan Exp1,nan,nan Exp1,nan,nan Exp1,nan,nan Exp1,nan,nan Exp1,nan,nan Exp1,nan,nan Exp1,nan,nan Exp1,nan,nan Exp1,nan,nan Exp1,nan,nan Exp1,nan,nan Exp1,nan,nan Exp1,nan,nan Exp1,nan,nan Exp1,nan,nan Exp1,nan,nan Exp1,nan,nan Exp1,nan,nan Exp1,nan,nan Exp1,nan,nan Exp1,nan,nan Exp5,nan,nan Exp5,nan,nan Exp5,nan,nan Exp5,nan,nan Exp5,nan,nan Exp5,nan,nan Exp5,nan,nan Exp5,nan,nan Exp5,nan,nan Exp5,nan,nan Exp5,nan,nan Exp5,nan,nan Exp5,nan,nan Exp5,nan,nan Exp5,nan,nan Exp5,nan,nan Exp5,nan,nan Exp5,nan,nan Exp5,nan,nan Exp5,nan,nan Exp5,nan,nan Exp5,nan,nan Exp5,nan,nan Exp5,nan,nan Exp5,nan,nan Exp5,nan,nan Exp5,nan,nan Exp5,nan,nan Exp5,nan,nan Exp5,nan,nan Exp5,nan,nan Exp5,nan,nan Exp5,nan,nan Exp5,nan,nan Exp5,nan,nan Exp5,nan,nan Exp5,nan,nan Exp5,nan,nan Exp5,nan,nan Exp5,nan,nan Exp5,nan,nan Exp5,nan,nan Exp5,nan,nan Exp5,nan,nan Exp5,nan,nan Exp5,nan,nan Exp5,nan,nan Exp5,nan,nan Exp5,nan,nan Exp5,nan,nan Exp5,nan,nan Exp5,nan,nan Exp5,nan,nan Exp5,nan,nan Exp5,nan,nan Exp5,nan,nan Exp5,nan,nan Exp5,nan,nan Exp5,nan,nan Exp5,nan,nan Exp5,nan,nan Exp5,nan,nan Exp5,nan,nan Exp5,nan,nan Exp5,nan,nan Exp5,nan,nan Exp5,nan,nan Exp5,nan,nan Exp5,nan,nan Exp5,nan,nan Exp5,nan,nan Exp5,nan,nan Exp5,nan,nan Exp5,nan,nan Exp5,nan,nan Exp5,nan,nan Exp5,nan,nan Exp5,nan,nan Exp5,nan,nan Exp5,nan,nan Exp5,nan,nan Exp5,nan,nan Exp5,nan,nan Exp5,nan,nan Exp5,nan,nan Exp5,nan,nan Exp5,nan,nan Exp6,nan,nan Exp6,nan,nan Exp6,nan,nan Exp6,nan,nan Exp6,nan,nan Exp6,nan,nan Exp6,nan,nan Exp6,nan,nan Exp6,nan,nan Exp6,nan,nan Exp6,nan,nan Exp6,nan,nan Exp6,nan,nan Exp6,nan,nan Exp6,nan,nan Exp6,nan,nan Exp6,nan,nan Exp6,nan,nan Exp6,nan,nan Exp6,nan,nan Exp6,nan,nan Exp6,nan,nan Exp6,nan,nan Exp6,nan,nan Exp6,nan,nan Exp6,nan,nan Exp6,nan,nan Exp6,nan,nan Exp6,nan,nan Exp6,nan,nan Exp6,nan,nan Exp6,nan,nan Exp6,nan,nan Exp6,nan,nan Exp6,nan,nan Exp6,nan,nan Exp6,nan,nan Exp6,nan,nan Exp6,nan,nan Exp6,nan,nan Exp6,nan,nan Exp6,nan,nan Exp6,nan,nan Exp6,nan,nan Exp6,nan,nan Exp6,nan,nan Exp6,nan,nan Exp6,nan,nan Exp6,nan,nan Exp6,nan,nan Exp6,nan,nan Exp6,nan,nan Exp6,nan,nan Exp6,nan,nan Exp6,nan,nan Exp6,nan,nan Exp6,nan,nan Exp6,nan,nan Exp6,nan,nan Exp6,nan,nan Exp6,nan,nan Exp6,nan,nan Exp6,nan,nan Exp6,nan,nan Exp6,nan,nan Exp6,nan,nan Exp6,nan,nan Exp6,nan,nan Exp6,nan,nan Exp6,nan,nan Exp6,nan,nan Exp6,nan,nan Exp6,nan,nan Exp6,nan,nan Exp6,nan,nan Exp6,nan,nan Exp6,nan,nan Exp6,nan,nan Exp6,nan,nan Exp6,nan,nan Exp6,nan,nan Exp6,nan,nan Exp6,nan,nan Exp6,nan,nan Exp6,nan,nan Exp6,nan,nan Exp6,nan,nan Exp6,nan,nan Exp6,nan,nan Exp6,nan,nan Exp6,nan,nan Exp6,nan,nan Exp6,nan,nan Exp6,nan,nan Exp6,nan,nan Exp6,nan,nan Exp6,nan,nan Exp6,nan,nan Exp6,nan,nan Exp6,nan,nan Exp7,nan,nan Exp7,nan,nan Exp7,nan,nan Exp7,nan,nan Exp7,nan,nan Exp7,nan,nan Exp7,nan,nan Exp7,nan,nan Exp7,nan,nan Exp7,nan,nan Exp7,nan,nan Exp7,nan,nan Exp7,nan,nan Exp7,nan,nan Exp7,nan,nan Exp7,nan,nan Exp7,nan,nan Exp7,nan,nan Exp7,nan,nan Exp7,nan,nan Exp7,nan,nan Exp7,nan,nan Exp7,nan,nan Exp7,nan,nan Exp7,nan,nan Exp7,nan,nan Exp7,nan,nan Exp7,nan,nan Exp7,nan,nan Exp7,nan,nan Exp7,nan,nan Exp7,nan,nan Exp7,nan,nan Exp7,nan,nan Exp7,nan,nan Exp7,nan,nan Exp7,nan,nan Exp7,nan,nan Exp7,nan,nan Exp7,nan,nan Exp7,nan,nan Exp7,nan,nan Exp7,nan,nan Exp7,nan,nan Exp7,nan,nan Exp7,nan,nan Exp7,nan,nan Exp7,nan,nan Exp7,nan,nan Exp7,nan,nan Exp7,nan,nan Exp7,nan,nan Exp7,nan,nan Exp7,nan,nan Exp7,nan,nan Exp7,nan,nan Exp7,nan,nan Exp7,nan,nan Exp7,nan,nan Exp7,nan,nan Exp7,nan,nan Exp7,nan,nan Exp7,nan,nan Exp7,nan,nan Exp7,nan,nan Exp7,nan,nan Exp7,nan,nan Exp7,nan,nan Exp7,nan,nan Exp7,nan,nan Exp7,nan,nan Exp7,nan,nan Exp7,nan,nan Exp7,nan,nan Exp7,nan,nan Exp7,nan,nan Exp7,nan,nan Exp7,nan,nan Exp7,nan,nan Exp7,nan,nan Exp7,nan,nan Exp7,nan,nan Exp7,nan,nan Exp7,nan,nan Exp7,nan,nan Exp7,nan,nan Exp7,nan,nan Exp7,nan,nan Exp7,nan,nan Exp7,nan,nan Exp7,nan,nan Exp7,nan,nan Exp7,nan,nan Exp7,nan,nan Exp7,nan,nan Exp7,nan,nan Exp7,nan,nan Exp7,nan,nan Exp7,nan,nan Exp7,nan,nan Exp8,nan,nan Exp8,nan,nan Exp8,nan,nan Exp8,nan,nan Exp8,nan,nan Exp8,nan,nan Exp8,nan,nan Exp8,nan,nan Exp8,nan,nan Exp8,nan,nan Exp8,nan,nan Exp8,nan,nan Exp8,nan,nan Exp8,nan,nan Exp8,nan,nan Exp8,nan,nan Exp8,nan,nan Exp8,nan,nan Exp8,nan,nan Exp8,nan,nan Exp8,nan,nan Exp8,nan,nan Exp8,nan,nan Exp8,nan,nan Exp8,nan,nan Exp8,nan,nan Exp8,nan,nan Exp8,nan,nan Exp8,nan,nan Exp8,nan,nan Exp8,nan,nan Exp8,nan,nan Exp8,nan,nan Exp8,nan,nan Exp8,nan,nan Exp8,nan,nan Exp8,nan,nan Exp8,nan,nan Exp8,nan,nan Exp8,nan,nan Exp8,nan,nan Exp8,nan,nan Exp8,nan,nan Exp8,nan,nan Exp8,nan,nan Exp8,nan,nan Exp8,nan,nan Exp8,nan,nan Exp8,nan,nan Exp8,nan,nan Exp8,nan,nan Exp8,nan,nan Exp8,nan,nan Exp8,nan,nan Exp8,nan,nan Exp8,nan,nan Exp8,nan,nan Exp8,nan,nan Exp8,nan,nan Exp8,nan,nan Exp8,nan,nan Exp8,nan,nan Exp8,nan,nan Exp8,nan,nan Exp8,nan,nan Exp8,nan,nan Exp8,nan,nan Exp8,nan,nan Exp8,nan,nan Exp8,nan,nan Exp8,nan,nan Exp8,nan,nan Exp8,nan,nan Exp8,nan,nan Exp8,nan,nan Exp8,nan,nan Exp8,nan,nan Exp8,nan,nan Exp8,nan,nan Exp8,nan,nan Exp8,nan,nan Exp8,nan,nan Exp8,nan,nan Exp8,nan,nan Exp8,nan,nan Exp8,nan,nan Exp8,nan,nan Exp8,nan,nan Exp8,nan,nan Exp8,nan,nan Exp8,nan,nan Exp8,nan,nan Exp8,nan,nan Exp8,nan,nan Exp8,nan,nan Exp8,nan,nan Exp8,nan,nan Exp8,nan,nan Exp8,nan,nan Exp8,nan,nan Exp9,nan,nan Exp9,nan,nan Exp9,nan,nan Exp9,nan,nan Exp9,nan,nan Exp9,nan,nan Exp9,nan,nan Exp9,nan,nan Exp9,nan,nan Exp9,nan,nan Exp9,nan,nan Exp9,nan,nan Exp9,nan,nan Exp9,nan,nan Exp9,nan,nan Exp9,nan,nan Exp9,nan,nan Exp9,nan,nan Exp9,nan,nan Exp9,nan,nan Exp9,nan,nan Exp9,nan,nan Exp9,nan,nan Exp9,nan,nan Exp9,nan,nan Exp9,nan,nan Exp9,nan,nan Exp9,nan,nan Exp9,nan,nan Exp9,nan,nan Exp9,nan,nan Exp9,nan,nan Exp9,nan,nan Exp9,nan,nan Exp9,nan,nan Exp9,nan,nan Exp9,nan,nan Exp9,nan,nan Exp9,nan,nan Exp9,nan,nan Exp9,nan,nan Exp9,nan,nan Exp9,nan,nan Exp9,nan,nan Exp9,nan,nan Exp9,nan,nan Exp9,nan,nan Exp9,nan,nan Exp9,nan,nan Exp9,nan,nan Exp9,nan,nan Exp9,nan,nan Exp9,nan,nan Exp9,nan,nan Exp9,nan,nan Exp9,nan,nan Exp9,nan,nan Exp9,nan,nan Exp9,nan,nan Exp9,nan,nan Exp9,nan,nan Exp9,nan,nan Exp9,nan,nan Exp9,nan,nan Exp9,nan,nan Exp9,nan,nan Exp9,nan,nan Exp9,nan,nan Exp9,nan,nan Exp9,nan,nan Exp9,nan,nan Exp9,nan,nan Exp9,nan,nan Exp9,nan,nan Exp9,nan,nan Exp9,nan,nan Exp9,nan,nan Exp9,nan,nan Exp9,nan,nan Exp9,nan,nan Exp9,nan,nan Exp9,nan,nan Exp9,nan,nan Exp9,nan,nan Exp9,nan,nan Exp9,nan,nan Exp9,nan,nan Exp9,nan,nan Exp9,nan,nan Exp9,nan,nan Exp9,nan,nan Exp9,nan,nan Exp9,nan,nan Exp9,nan,nan Exp9,nan,nan Exp9,nan,nan Exp9,nan,nan Exp9,nan,nan Exp9,nan,nan Exp9,nan,nan Exp10,nan,nan Exp10,nan,nan Exp10,nan,nan Exp10,nan,nan Exp10,nan,nan Exp10,nan,nan Exp10,nan,nan Exp10,nan,nan Exp10,nan,nan Exp10,nan,nan Exp10,nan,nan Exp10,nan,nan Exp10,nan,nan Exp10,nan,nan Exp10,nan,nan Exp10,nan,nan Exp10,nan,nan Exp10,nan,nan Exp10,nan,nan Exp10,nan,nan Exp10,nan,nan Exp10,nan,nan Exp10,nan,nan Exp10,nan,nan Exp10,nan,nan Exp10,nan,nan Exp10,nan,nan Exp10,nan,nan Exp10,nan,nan Exp10,nan,nan Exp10,nan,nan Exp10,nan,nan Exp10,nan,nan Exp10,nan,nan Exp10,nan,nan Exp10,nan,nan Exp10,nan,nan Exp10,nan,nan Exp10,nan,nan Exp10,nan,nan Exp10,nan,nan Exp10,nan,nan Exp10,nan,nan Exp10,nan,nan Exp10,nan,nan Exp10,nan,nan Exp10,nan,nan Exp10,nan,nan Exp10,nan,nan Exp10,nan,nan Exp10,nan,nan Exp10,nan,nan Exp10,nan,nan Exp10,nan,nan Exp10,nan,nan Exp10,nan,nan Exp10,nan,nan Exp10,nan,nan Exp10,nan,nan Exp10,nan,nan Exp10,nan,nan Exp10,nan,nan Exp10,nan,nan Exp10,nan,nan Exp10,nan,nan Exp10,nan,nan Exp10,nan,nan Exp10,nan,nan Exp10,nan,nan Exp10,nan,nan Exp10,nan,nan Exp10,nan,nan Exp10,nan,nan Exp10,nan,nan Exp10,nan,nan Exp10,nan,nan Exp10,nan,nan Exp10,nan,nan Exp10,nan,nan Exp10,nan,nan Exp10,nan,nan Exp10,nan,nan Exp10,nan,nan Exp10,nan,nan Exp10,nan,nan Exp10,nan,nan Exp10,nan,nan Exp10,nan,nan Exp10,nan,nan Exp10,nan,nan Exp10,nan,nan Exp10,nan,nan Exp10,nan,nan Exp10,nan,nan Exp10,nan,nan Exp10,nan,nan Exp10,nan,nan Exp10,nan,nan Exp10,nan,nan Exp10,nan,nan Exp11,nan,nan Exp11,nan,nan Exp11,nan,nan Exp11,nan,nan Exp11,nan,nan Exp11,nan,nan Exp11,nan,nan Exp11,nan,nan Exp11,nan,nan Exp11,nan,nan Exp11,nan,nan Exp11,nan,nan Exp11,nan,nan Exp11,nan,nan Exp11,nan,nan Exp11,nan,nan Exp11,nan,nan Exp11,nan,nan Exp11,nan,nan Exp11,nan,nan Exp11,nan,nan Exp11,nan,nan Exp11,nan,nan Exp11,nan,nan Exp11,nan,nan Exp11,nan,nan Exp11,nan,nan Exp11,nan,nan Exp11,nan,nan Exp11,nan,nan Exp11,nan,nan Exp11,nan,nan Exp11,nan,nan Exp11,nan,nan Exp11,nan,nan Exp11,nan,nan Exp11,nan,nan Exp11,nan,nan Exp11,nan,nan Exp11,nan,nan Exp11,nan,nan Exp11,nan,nan Exp11,nan,nan Exp11,nan,nan Exp11,nan,nan Exp11,nan,nan Exp11,nan,nan Exp11,nan,nan Exp11,nan,nan Exp11,nan,nan Exp11,nan,nan Exp11,nan,nan Exp11,nan,nan Exp11,nan,nan Exp11,nan,nan Exp11,nan,nan Exp11,nan,nan Exp11,nan,nan Exp11,nan,nan Exp11,nan,nan Exp11,nan,nan Exp11,nan,nan Exp11,nan,nan Exp11,nan,nan Exp11,nan,nan Exp11,nan,nan Exp11,nan,nan Exp11,nan,nan Exp11,nan,nan Exp11,nan,nan Exp11,nan,nan Exp11,nan,nan Exp11,nan,nan Exp11,nan,nan Exp11,nan,nan Exp11,nan,nan Exp11,nan,nan Exp11,nan,nan Exp11,nan,nan Exp11,nan,nan Exp11,nan,nan Exp11,nan,nan Exp11,nan,nan Exp11,nan,nan Exp11,nan,nan Exp11,nan,nan Exp11,nan,nan Exp11,nan,nan Exp11,nan,nan Exp11,nan,nan Exp11,nan,nan Exp11,nan,nan Exp11,nan,nan Exp11,nan,nan Exp11,nan,nan Exp11,nan,nan Exp11,nan,nan Exp11,nan,nan Exp11,nan,nan Exp11,nan,nan Exp12,nan,nan Exp12,nan,nan Exp12,nan,nan Exp12,nan,nan Exp12,nan,nan Exp12,nan,nan Exp12,nan,nan Exp12,nan,nan Exp12,nan,nan Exp12,nan,nan Exp12,nan,nan Exp12,nan,nan Exp12,nan,nan Exp12,nan,nan Exp12,nan,nan Exp12,nan,nan Exp12,nan,nan Exp12,nan,nan Exp12,nan,nan Exp12,nan,nan Exp12,nan,nan Exp12,nan,nan Exp12,nan,nan Exp12,nan,nan Exp12,nan,nan Exp12,nan,nan Exp12,nan,nan Exp12,nan,nan Exp12,nan,nan Exp12,nan,nan Exp12,nan,nan Exp12,nan,nan Exp12,nan,nan Exp12,nan,nan Exp12,nan,nan Exp12,nan,nan Exp12,nan,nan Exp12,nan,nan Exp12,nan,nan Exp12,nan,nan Exp12,nan,nan Exp12,nan,nan Exp12,nan,nan Exp12,nan,nan Exp12,nan,nan Exp12,nan,nan Exp12,nan,nan Exp12,nan,nan Exp12,nan,nan Exp12,nan,nan Exp12,nan,nan Exp12,nan,nan Exp12,nan,nan Exp12,nan,nan Exp12,nan,nan Exp12,nan,nan Exp12,nan,nan Exp12,nan,nan Exp12,nan,nan Exp12,nan,nan Exp12,nan,nan Exp12,nan,nan Exp12,nan,nan Exp12,nan,nan Exp12,nan,nan Exp12,nan,nan Exp12,nan,nan Exp12,nan,nan Exp12,nan,nan Exp12,nan,nan Exp12,nan,nan Exp12,nan,nan Exp12,nan,nan Exp12,nan,nan Exp12,nan,nan Exp12,nan,nan Exp12,nan,nan Exp12,nan,nan Exp12,nan,nan Exp12,nan,nan Exp12,nan,nan Exp12,nan,nan Exp12,nan,nan Exp12,nan,nan Exp12,nan,nan Exp12,nan,nan Exp12,nan,nan Exp12,nan,nan Exp12,nan,nan Exp12,nan,nan Exp12,nan,nan Exp12,nan,nan Exp12,nan,nan Exp12,nan,nan Exp12,nan,nan Exp12,nan,nan Exp12,nan,nan Exp12,nan,nan Exp12,nan,nan Exp12,nan,nan Exp13,nan,nan Exp13,nan,nan Exp13,nan,nan Exp13,nan,nan Exp13,nan,nan Exp13,nan,nan Exp13,nan,nan Exp13,nan,nan Exp13,nan,nan Exp13,nan,nan Exp13,nan,nan Exp13,nan,nan Exp13,nan,nan Exp13,nan,nan Exp13,nan,nan Exp13,nan,nan Exp13,nan,nan Exp13,nan,nan Exp13,nan,nan Exp13,nan,nan Exp13,nan,nan Exp13,nan,nan Exp13,nan,nan Exp13,nan,nan Exp13,nan,nan Exp13,nan,nan Exp13,nan,nan Exp13,nan,nan Exp13,nan,nan Exp13,nan,nan Exp13,nan,nan Exp13,nan,nan Exp13,nan,nan Exp13,nan,nan Exp13,nan,nan Exp13,nan,nan Exp13,nan,nan Exp13,nan,nan Exp13,nan,nan Exp13,nan,nan Exp13,nan,nan Exp13,nan,nan Exp13,nan,nan Exp13,nan,nan Exp13,nan,nan Exp13,nan,nan Exp13,nan,nan Exp13,nan,nan Exp13,nan,nan Exp13,nan,nan Exp13,nan,nan Exp13,nan,nan Exp13,nan,nan Exp13,nan,nan Exp13,nan,nan Exp13,nan,nan Exp13,nan,nan Exp13,nan,nan Exp13,nan,nan Exp13,nan,nan Exp13,nan,nan Exp13,nan,nan Exp13,nan,nan Exp13,nan,nan Exp13,nan,nan Exp13,nan,nan Exp13,nan,nan Exp13,nan,nan Exp13,nan,nan Exp13,nan,nan Exp13,nan,nan Exp13,nan,nan Exp13,nan,nan Exp13,nan,nan Exp13,nan,nan Exp13,nan,nan Exp13,nan,nan Exp13,nan,nan Exp13,nan,nan Exp13,nan,nan Exp13,nan,nan Exp13,nan,nan Exp13,nan,nan Exp13,nan,nan Exp13,nan,nan Exp13,nan,nan Exp13,nan,nan Exp13,nan,nan Exp13,nan,nan Exp13,nan,nan Exp13,nan,nan Exp13,nan,nan Exp13,nan,nan Exp13,nan,nan Exp13,nan,nan Exp13,nan,nan Exp13,nan,nan Exp13,nan,nan Exp13,nan,nan Exp13,nan,nan Exp14,nan,nan Exp14,nan,nan Exp14,nan,nan Exp14,nan,nan Exp14,nan,nan Exp14,nan,nan Exp14,nan,nan Exp14,nan,nan Exp14,nan,nan Exp14,nan,nan Exp14,nan,nan Exp14,nan,nan Exp14,nan,nan Exp14,nan,nan Exp14,nan,nan Exp14,nan,nan Exp14,nan,nan Exp14,nan,nan Exp14,nan,nan Exp14,nan,nan Exp14,nan,nan Exp14,nan,nan Exp14,nan,nan Exp14,nan,nan Exp14,nan,nan Exp14,nan,nan Exp14,nan,nan Exp14,nan,nan Exp14,nan,nan Exp14,nan,nan Exp14,nan,nan Exp14,nan,nan Exp14,nan,nan Exp14,nan,nan Exp14,nan,nan Exp14,nan,nan Exp14,nan,nan Exp14,nan,nan Exp14,nan,nan Exp14,nan,nan Exp14,nan,nan Exp14,nan,nan Exp14,nan,nan Exp14,nan,nan Exp14,nan,nan Exp14,nan,nan Exp14,nan,nan Exp14,nan,nan Exp14,nan,nan Exp14,nan,nan Exp14,nan,nan Exp14,nan,nan Exp14,nan,nan Exp14,nan,nan Exp14,nan,nan Exp14,nan,nan Exp14,nan,nan Exp14,nan,nan Exp14,nan,nan Exp14,nan,nan Exp14,nan,nan Exp14,nan,nan Exp14,nan,nan Exp14,nan,nan Exp14,nan,nan Exp14,nan,nan Exp14,nan,nan Exp14,nan,nan Exp14,nan,nan Exp14,nan,nan Exp14,nan,nan Exp14,nan,nan Exp14,nan,nan Exp14,nan,nan Exp14,nan,nan Exp14,nan,nan Exp14,nan,nan Exp14,nan,nan Exp14,nan,nan Exp14,nan,nan Exp14,nan,nan Exp14,nan,nan Exp14,nan,nan Exp14,nan,nan Exp14,nan,nan Exp14,nan,nan Exp14,nan,nan Exp14,nan,nan Exp14,nan,nan Exp14,nan,nan Exp14,nan,nan Exp14,nan,nan Exp14,nan,nan Exp14,nan,nan Exp14,nan,nan Exp14,nan,nan Exp14,nan,nan Exp14,nan,nan Exp14,nan,nan Exp14,nan,nan Exp15,nan,nan Exp15,nan,nan Exp15,nan,nan Exp15,nan,nan Exp15,nan,nan Exp15,nan,nan Exp15,nan,nan Exp15,nan,nan Exp15,nan,nan Exp15,nan,nan Exp15,nan,nan Exp15,nan,nan Exp15,nan,nan Exp15,nan,nan Exp15,nan,nan Exp15,nan,nan Exp15,nan,nan Exp15,nan,nan Exp15,nan,nan Exp15,nan,nan Exp15,nan,nan Exp15,nan,nan Exp15,nan,nan Exp15,nan,nan Exp15,nan,nan Exp15,nan,nan Exp15,nan,nan Exp15,nan,nan Exp15,nan,nan Exp15,nan,nan Exp15,nan,nan Exp15,nan,nan Exp15,nan,nan Exp15,nan,nan Exp15,nan,nan Exp15,nan,nan Exp15,nan,nan Exp15,nan,nan Exp15,nan,nan Exp15,nan,nan Exp15,nan,nan Exp15,nan,nan Exp15,nan,nan Exp15,nan,nan Exp15,nan,nan Exp15,nan,nan Exp15,nan,nan Exp15,nan,nan Exp15,nan,nan Exp15,nan,nan Exp15,nan,nan Exp15,nan,nan Exp15,nan,nan Exp15,nan,nan Exp15,nan,nan Exp15,nan,nan Exp15,nan,nan Exp15,nan,nan Exp15,nan,nan Exp15,nan,nan Exp15,nan,nan Exp15,nan,nan Exp15,nan,nan Exp15,nan,nan Exp15,nan,nan Exp15,nan,nan Exp15,nan,nan Exp15,nan,nan Exp15,nan,nan Exp15,nan,nan Exp15,nan,nan Exp15,nan,nan Exp15,nan,nan Exp15,nan,nan Exp15,nan,nan Exp15,nan,nan Exp15,nan,nan Exp15,nan,nan Exp15,nan,nan Exp15,nan,nan Exp15,nan,nan Exp15,nan,nan Exp15,nan,nan Exp15,nan,nan Exp15,nan,nan Exp15,nan,nan Exp15,nan,nan Exp15,nan,nan Exp15,nan,nan Exp15,nan,nan Exp15,nan,nan Exp15,nan,nan Exp15,nan,nan Exp15,nan,nan Exp15,nan,nan Exp15,nan,nan Exp15,nan,nan Exp15,nan,nan Exp15,nan,nan Exp15,nan,nan Exp16,nan,nan Exp16,nan,nan Exp16,nan,nan Exp16,nan,nan Exp16,nan,nan Exp16,nan,nan Exp16,nan,nan Exp16,nan,nan Exp16,nan,nan Exp16,nan,nan Exp16,nan,nan Exp16,nan,nan Exp16,nan,nan Exp16,nan,nan Exp16,nan,nan Exp16,nan,nan Exp16,nan,nan Exp16,nan,nan Exp16,nan,nan Exp16,nan,nan Exp16,nan,nan Exp16,nan,nan Exp16,nan,nan Exp16,nan,nan Exp16,nan,nan Exp16,nan,nan Exp16,nan,nan Exp16,nan,nan Exp16,nan,nan Exp16,nan,nan Exp16,nan,nan Exp16,nan,nan Exp16,nan,nan Exp16,nan,nan Exp16,nan,nan Exp16,nan,nan Exp16,nan,nan Exp16,nan,nan Exp16,nan,nan Exp16,nan,nan Exp16,nan,nan Exp16,nan,nan Exp16,nan,nan Exp16,nan,nan Exp16,nan,nan Exp16,nan,nan Exp16,nan,nan Exp16,nan,nan Exp16,nan,nan Exp16,nan,nan Exp16,nan,nan Exp16,nan,nan Exp16,nan,nan Exp16,nan,nan Exp16,nan,nan Exp16,nan,nan Exp16,nan,nan Exp16,nan,nan Exp16,nan,nan Exp16,nan,nan Exp16,nan,nan Exp16,nan,nan Exp16,nan,nan Exp16,nan,nan Exp16,nan,nan Exp16,nan,nan Exp16,nan,nan Exp16,nan,nan Exp16,nan,nan Exp16,nan,nan Exp16,nan,nan Exp16,nan,nan Exp16,nan,nan Exp16,nan,nan Exp16,nan,nan Exp16,nan,nan Exp16,nan,nan Exp16,nan,nan Exp16,nan,nan Exp16,nan,nan Exp16,nan,nan Exp16,nan,nan Exp16,nan,nan Exp16,nan,nan Exp16,nan,nan Exp16,nan,nan Exp16,nan,nan Exp16,nan,nan Exp16,nan,nan Exp16,nan,nan Exp16,nan,nan Exp16,nan,nan Exp16,nan,nan Exp16,nan,nan Exp16,nan,nan Exp16,nan,nan Exp16,nan,nan Exp16,nan,nan Exp16,nan,nan Exp16,nan,nan Exp17,nan,nan Exp17,nan,nan Exp17,nan,nan Exp17,nan,nan Exp17,nan,nan Exp17,nan,nan Exp17,nan,nan Exp17,nan,nan Exp17,nan,nan Exp17,nan,nan Exp17,nan,nan Exp17,nan,nan Exp17,nan,nan Exp17,nan,nan Exp17,nan,nan Exp17,nan,nan Exp17,nan,nan Exp17,nan,nan Exp17,nan,nan Exp17,nan,nan Exp17,nan,nan Exp17,nan,nan Exp17,nan,nan Exp17,nan,nan Exp17,nan,nan Exp17,nan,nan Exp17,nan,nan Exp17,nan,nan Exp17,nan,nan Exp17,nan,nan Exp17,nan,nan Exp17,nan,nan Exp17,nan,nan Exp17,nan,nan Exp17,nan,nan Exp17,nan,nan Exp17,nan,nan Exp17,nan,nan Exp17,nan,nan Exp17,nan,nan Exp17,nan,nan Exp17,nan,nan Exp17,nan,nan Exp17,nan,nan Exp17,nan,nan Exp17,nan,nan Exp17,nan,nan Exp17,nan,nan Exp17,nan,nan Exp17,nan,nan Exp17,nan,nan Exp17,nan,nan Exp17,nan,nan Exp17,nan,nan Exp17,nan,nan Exp17,nan,nan Exp17,nan,nan Exp17,nan,nan Exp17,nan,nan Exp17,nan,nan Exp17,nan,nan Exp17,nan,nan Exp17,nan,nan Exp17,nan,nan Exp17,nan,nan Exp17,nan,nan Exp17,nan,nan Exp17,nan,nan Exp17,nan,nan Exp17,nan,nan Exp17,nan,nan Exp17,nan,nan Exp17,nan,nan Exp17,nan,nan Exp17,nan,nan Exp17,nan,nan Exp17,nan,nan Exp17,nan,nan Exp17,nan,nan Exp17,nan,nan Exp17,nan,nan Exp17,nan,nan Exp17,nan,nan Exp17,nan,nan Exp17,nan,nan Exp17,nan,nan Exp17,nan,nan Exp17,nan,nan Exp17,nan,nan Exp17,nan,nan Exp17,nan,nan Exp17,nan,nan Exp17,nan,nan Exp17,nan,nan Exp17,nan,nan Exp17,nan,nan Exp17,nan,nan Exp17,nan,nan Exp17,nan,nan Exp17,nan,nan Exp18,nan,nan Exp18,nan,nan Exp18,1.758,0.1279 Exp18,2.7777,0.1718 Exp18,3.7679,0.212 Exp18,4.7874,0.2447 Exp18,5.8074,0.2752 Exp18,6.8276,0.2997 Exp18,7.8479,0.3194 Exp18,8.8679,0.3362 Exp18,9.8874,0.3562 Exp18,10.9074,0.3726 Exp18,11.8975,0.3856 Exp18,12.918,0.4001 Exp18,13.9378,0.4135 Exp18,14.9578,0.4284 Exp18,15.9773,0.4392 Exp18,16.9974,0.4492 Exp18,18.0179,0.4578 Exp18,19.0378,0.4685 Exp18,20.0276,0.4834 Exp18,21.0478,0.4923 Exp18,22.0674,0.5009 Exp18,23.0875,0.5102 Exp18,24.1079,0.521 Exp18,25.1276,0.5325 Exp18,26.1479,0.5425 Exp18,27.1377,0.5478 Exp18,28.1574,0.5582 Exp18,29.1775,0.569 Exp18,30.2278,0.579 Exp18,31.2479,0.589 Exp18,32.2672,0.5961 Exp18,33.2874,0.6032 Exp18,34.3079,0.6113 Exp18,35.298,0.6236 Exp18,36.3177,0.6314 Exp18,37.3377,0.6389 Exp18,38.3573,0.6452 Exp18,39.3776,0.6549 Exp18,40.3981,0.6668 Exp18,41.4176,0.6753 Exp18,42.408,0.6809 Exp18,43.4274,0.6894 Exp18,44.4474,0.7017 Exp18,45.4675,0.7117 Exp18,46.488,0.7184 Exp18,47.5079,0.727 Exp18,48.5275,0.7352 Exp18,49.5473,0.7456 Exp18,50.5374,0.7556 Exp18,51.5579,0.7642 Exp18,52.5778,0.772 Exp18,53.5981,0.7846 Exp18,54.6173,0.7958 Exp18,55.6373,0.8051 Exp18,56.6578,0.8125 Exp18,57.6781,0.8214 Exp18,58.6678,0.8356 Exp18,59.6879,0.8467 Exp18,60.7072,0.8549 Exp18,61.7275,0.8623 Exp18,62.7479,0.8724 Exp18,63.7676,0.8861 Exp18,64.7878,0.898 Exp18,65.7776,0.9059 Exp18,66.7974,0.9159 Exp18,67.8175,0.93 Exp18,68.8381,0.9427 Exp18,69.8576,0.9531 Exp18,70.8778,0.9627 Exp18,71.8974,0.9724 Exp18,72.9175,0.9843 Exp18,73.9076,0.9988 Exp18,74.928,1.0089 Exp18,75.9479,1.0185 Exp18,76.9676,1.0319 Exp18,77.9872,1.0464 Exp18,79.0074,1.0591 Exp18,80.0281,1.0717 Exp18,81.0179,1.0821 Exp18,82.0378,1.0974 Exp18,83.0571,1.1122 Exp18,84.0774,1.1253 Exp18,85.0978,1.1364 Exp18,86.1179,1.1502 Exp18,87.1379,1.1658 Exp18,88.1575,1.1833 Exp18,89.1472,1.1933 Exp18,90.1675,1.2074 Exp18,91.188,1.2245 Exp18,92.2077,1.2416 Exp18,93.2279,1.2595 Exp18,94.2472,1.2733 Exp18,95.2675,1.2889 Exp18,96.2881,1.3056 Exp18,97.2781,1.3249 Exp18,98.2974,1.3413 Exp18,99.3177,1.3569 Exp18,100,1.3551

  • pgfplots / 2D contour filled plot from a csv file
    by TheBeeTee on December 1, 2024 at 11:19 pm

    Trying to plot a 2D colormap of my data like this: Here's my MWE with a sample of data. x,y are the coordinates. P is the value on which I want to base the shading. \documentclass[border=1 cm]{standalone} \usepackage{pgfplots} \begin{document} \begin{filecontents}{test.csv} x,y,P 0.6029680189,0.7383407645,2.3729000000 0.5323565117,0.6601831742,3.2726000000 0.4677196601,0.5882540709,4.0038000000 0.0946800948,0.6688882286,5.0510000000 0.1884371445,0.6355349568,5.0222000000 0.2792665104,0.5997515545,4.8900000000 0.3623180375,0.5641482523,4.6771000000 0.4853625211,0.1178246418,5.0150000000 0.4696592171,0.2354673908,4.9738000000 0.4525723312,0.3510530681,4.8490000000 0.4353225341,0.4584688067,4.6566000000 \end{filecontents} \begin{tikzpicture} \begin{axis}[ view = {0}{90}, colorbar, ] \addplot3[ contour filled={number = 20} ] table[x=x, y=y, z=P, col sep=comma]{test.csv}; \end{axis} \end{tikzpicture} \end{document} The code above was throwing: ERROR: shader=interp: got unsupported pdf shading type '0'. *****After more searching, I modified my MWE as follows. I don't get any errors, I just get an empty plot 🙁 \documentclass[border=1 cm]{standalone} \usepackage{pgfplots} \usepgfplotslibrary{patchplots} \begin{document} \begin{filecontents}{test.csv} x,y,P 0.6029680189,0.7383407645,2.3729000000 0.5323565117,0.6601831742,3.2726000000 0.4677196601,0.5882540709,4.0038000000 0.0946800948,0.6688882286,5.0510000000 0.1884371445,0.6355349568,5.0222000000 0.2792665104,0.5997515545,4.8900000000 0.3623180375,0.5641482523,4.6771000000 0.4853625211,0.1178246418,5.0150000000 0.4696592171,0.2354673908,4.9738000000 0.4525723312,0.3510530681,4.8490000000 0.4353225341,0.4584688067,4.6566000000 \end{filecontents} \begin{tikzpicture} \begin{axis}[ %view = {0}{90}, colorbar, ] \addplot[contour filled={number = 8,labels={false}}, mesh/rows=100,mesh/cols=100,mesh/check=false, patch type=bilinear, point meta=explicit, ] table [x=x, y=y, z=P, col sep=comma]{test.csv}; \end{axis} \end{tikzpicture} \end{document}

  • Tikz externalization with luacode
    by pschulz on October 23, 2024 at 1:57 pm

    I'm using luacode environments to assemble plot code for pgfplots. For many plots that works perfectly fine even with tikzexternalize. However, I have one plot where it does not work and the error message is cryptic. I reduced it to: \documentclass{article} \usepackage{pgfplots} \usepackage{luacode} \usetikzlibrary{external} \tikzexternalize \begin{document} %\tikzexternaldisable % doesn't compile with externalization, don't know why \begin{tikzpicture} \begin{axis} \begin{luacode*} local t = {} table.insert(t, "(0, 0)") table.insert(t, "(1, 1)") tex.print("\\addplot coordinates {") tex.print(table.concat(t)) tex.print("};") \end{luacode*} \end{axis} \end{tikzpicture} \end{document} So I used to get an error message like this: File ended while scanning use of \tikzexternal@laTeX@collect@until@end@tikzpicture I thought it might be related to a percent sign in the lua code (which I used for string.format), but I removed them. Now the strings are assembled a bit more manually. The problem persists, however, I don't get an error message any more. It just fails and it also does not create a main-figure0.log file, only the .md5 file. So what is going on?

  • Pgf cone drawing
    by Paul A on November 12, 2023 at 7:23 pm

    I used the following code, below which is altered from https://latexdraw.com/draw-a-plane-intersecting-a-cone-in-latex/ \documentclass{standalone} \usepackage{pgfplots} \usepgfplotslibrary{colormaps} \pgfplotsset{compat = newest} \begin{document} %Draw axis x, y and z, with grid on each plane of the axis \begin{tikzpicture} \begin{axis}[ axis equal image, grid = both, minor tick num = 2, xlabel = {$x$}, ylabel = {$y$}, zlabel = {$z$}, major grid style = {draw = lightgray}, minor grid style = {draw = lightgray!25}, legend cell align={left}, xmin = -1, xmax = 1, ymin = -1, ymax = 1, scale = 3, zmin = 0, zmax = 2, z buffer = sort, ] % Here comes the code \addplot3[ surf, shader = interp, samples = 50, samples y = 20, domain = 0:2*pi, domain y = 0:1, colormap/violet, ] ( {cos(deg(x)) * y}, {sin(deg(x)) * y}, {y} ); \end{axis} \end{tikzpicture} \end{document} but it has inverted the cone and I cannot think why, I tried to alter the z-axis to -y but this didn't work. Can anybody help me to turn the cone around? Thanks.

  • ERROR: Missing number, treated as zero
    by RIRM506 on November 3, 2023 at 3:03 am

    I can't find the problem in the code, but it says at the end of that "Missing number, treated as zero" \begin{tikzpicture}[line cap=round,line join=round,>=stealth,x=1.0cm,y=1.0cm] \begin{axis}[ x=1.5cm,y=1.5cm, axis lines=middle, xlabel=$x$, ylabel=$y$, xmin=-0.5, xmax=6.0, ymin=-0.5, ymax=4.5, xticklabels={,,1,,,4}, ytick={\empty},] \clip(-0.5,-0.5) rectangle (6.,4.5); \fill[fill=black,fill opacity=0.20000000298023224] (1.0045836142718776,1.4243770120110515) -- (1.0045836142718776,0.) -- (4,0) -- (3.996318624435588,0.5559251076370629) -- (3.764797284337927,0.5803447447339725) -- (3.5176114060500536,0.609277926604037) -- (3.0369721982680775,0.676251412660451) -- (2.7554549479957773,0.7294953956208646) -- (2.535734167295445,0.7672558117999624) -- (2.309147112198228,0.8185829277750029) -- (2.0550949595134687,0.8866827343500797) -- (1.8010428068287099,0.9697221311676422) -- (1.5401243797470656,1.0769669337835905) -- (1.3135373246498483,1.1965218380095286) -- (1.1487467391245991,1.306084296440851) -- cycle; \draw[line width=1.2,smooth,samples=100,domain=6-6:6.1] plot(\x,{10/(2*(\x)+5*sqrt((\x)))}); \draw [line width=1.2pt] (1.0045836142718776,1.4243770120110515)-- (1.0045836142718776,0); \draw [line width=1.2pt] (3.996318624435216,0.5559251076932408)-- (4.,0.); \draw (-0.4,0.02) node[anchor=north west] {$O$}; \draw (2.2424396505089295,0.6291874906703163) node[anchor=north west] {$\mathbf{R}$}; \end{axis} \end{tikzpicture}

  • pgf: 3D Graphing sqrt(-x-y^2+8) results in a jagged surface
    by tangulo on October 2, 2023 at 1:15 am

    The plot of this specific elliptic paraboloid, sqrt(-x-y^2+8) comes out looking like this. I've tried parameterizing the surface, writing the equation in different forms, and messed around with the domain. The error I get most of the time is something about the z axis and having a mismatched number of rows and cols. Can someone help me by figuring out to make the surface smooth and well just not look like this? \usepackage{pgfplots} \usetikzlibrary{3d, calc} \pgfplotsset{compat=1.18} \usepackage{tikz-3dplot} \begin{document} \begin{tikzpicture} \begin{axis}[axis lines=center] \addplot3[domain=-3:3, y domain=-3:3, samples=10, surf, shader=interp] {sqrt(-x-y^2+8)}; \end{axis} \end{tikzpicture} \end{document}

  • 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

  • How to draw a shaded boundary using TikZ
    by Sid on May 7, 2022 at 11:55 pm

    How can I draw a simple shaded region such as the one shown below using TikZ? The shaded region bounded by the equation r1r2r3 - r1 - r2 - r3 + 2cos(theta) and is r1=r2=r3=4. The boundary will change slightly for different values of theta. For the purpose of this, we can assume theta=0. The idea here is to use TikZ with certain functions and fillbetween commands but this becomes tricky for 3D plots. This example could then be used to draw more involved boundaries Any tips/relevant posts would be helpful! EDIT I would ideally like a solution that just uses TiKZ and not pstricks.

  • Tikz 3D plot of poles zeros
    by Raja Ali Riaz on September 18, 2021 at 4:43 pm

    I need to make a 3D plot in tikz of the form as in the picture. It's the magnitude plot of transfer function H(s)= (s+1)(s+2)/(s+3)(s+1+j)(s+1-j) I am sorry, I have not shared any attempt because I am ignorant in tikz 3d plotting. If somebody provide the solution, it will be kick start for me and then I build up on it. Thanks in advance. My Attempt and still few things to rectify. I have plotted the graph with online help of different resources (code and picture attached). Now the problems are It is not correcting plotting the curve in y-z plane the red line and give this error message Package pgfplots Error: Sorry, you can't use 'y' in this context. PGFPlots expected to sample a line, not a mesh. Please use the [mesh] option combined with [samples y>0] and [domain y!=0:0] to indicate a twodimensional input domain. Labels are too small and not placed properly. If somebody can set view angles so it looks like the picture of the book. If somebody can help in that regard. \documentclass[border=1cm]{standalone} \usepackage{pgfplots} \usetikzlibrary{calc,math} \pgfplotsset{compat=newest} \pgfkeys{/pgf/declare function={H(\x,\y) = 3*((((((\x)^2-(\y)^2+3*(\x)+2)^2+((2*\x*\y)+3*\y)^2)+2.2204e-16)^(1/2))/(((((\x)^3+5*(\x)^2-3*\x*(\y)^2+8*x-5*(\y)^2+6)^2+(3*(\x)^2*y+10*\x*\y-(\y)^3+8*y)^2)+2.2204e-16)^(1/2)));}} \begin{document} \begin{tikzpicture} \begin{axis}[ axis lines=middle, axis on top, axis equal image, width=50cm, view={30}{10}, xmin=-4, xmax=0, ymin=-2, ymax=2, zmin=0, zmax=5, miter limit=1, xlabel=$\sigma$, xlabel style={anchor=east,xshift=-5pt,at={(xticklabel* cs:.95)}}, ylabel=$j\Omega$, zlabel=$\mathopen| H(s)\mathclose|$, zlabel style={anchor=north east}, xtick = {-3,-2,-1,0}, hide obscured x ticks=false, ytick = {-1,0,1}, ztick = {2,4}, ] \addplot3[ smooth, surf, faceted color=gray, line width=0.1pt, fill=white, domain=-4:0, y domain = -2:2, samples = 50, samples y = 50, restrict z to domain*=0:5] {H(\x,\y)}; \addplot3[domain=-2:2,samples=70, samples y = 0,red, thick] ({0},{x},{H(0,x)}); \end{axis} \end{tikzpicture} \end{document}

  • Plotting a 3D graph in Latex
    by TaniaMalik on March 6, 2021 at 6:16 pm

    I am trying to change the 2D scatter graph into 3D which can also take the value of the P column as z-axis. But the output I got is not smooth and I really don't understand how I can change it into 3D graph which shows the regions where cost DR, BR or SC is optimal for (P:Q:R) coordinates. Can any expert please help me draw a nice 3D graph of the given data? In the code, I am using a minimum dataset for illustration purpose although the actual file is so big with many data points. Here is the code: \documentclass[border=5mm]{standalone} \usepackage{pgfplotstable} \pgfplotsset{compat=1.16} \pgfplotstableread[col sep=comma]{ P, Q, R, cost 6, 3, 1, SC 6, 2, 2, SC 6, 1, 3, SC 5, 4, 1, DR 5, 3, 2, BR 5, 2, 3, DR 5, 1, 4, DR 4, 5, 1, DR 4, 4, 2, BR 4, 3, 3, BR }\MyData \begin{document} \begin{tikzpicture} % define a few macros for convenience \newcommand\AxisW{10cm} % width/height of axis \newcommand\AxisXMin{0.5} % xmin/ymin \newcommand\AxisRange{10} % range of axis, x y and z \begin{axis}[ % define how the different cases are drawn % all should have same mark and draw opacity, % but change the color as you prefer scatter/classes={ SC={mark=square*, draw opacity=0, fill=blue}, DR={mark=square*, draw opacity=0, fill=red}, BR={mark=square*, draw opacity=0, fill=green} }, % add labels for the axes xlabel=R, ylabel=Q, zlabel=P, % set up the size of the axis scale only axis, % width/height applies to axis box alone, without labels width=\AxisW, height=\AxisW, % set up the range of the axes xmin=\AxisXMin, xmax=\AxisXMin+\AxisRange, ymin=\AxisXMin, ymax=\AxisXMin+\AxisRange, zmin=\AxisXMin, zmax=\AxisXMin+\AxisRange, % calculate the mark size - divide by 2 because the size is half the width mark size={\AxisW/\AxisRange/2}, % set legend entries in one row legend columns=-1, % move legend outside top of axis legend style={at={(0.5,1.02)}, anchor=south}, % have ticks every 1 unit distance xtick distance=1,ytick distance=1,ztick distance=1, ] \addplot3 [ scatter, % make a scatter plot only marks, scatter src=explicit symbolic ] table[x=R, % use R-column for x-values y=Q, use Q-column for y-values z=P, % use P-column for z-values meta=cost % use cost-column to define which scatter class should be used ] \MyData; \legend{SC, DR, BR} \end{axis} \end{tikzpicture} \end{document}

  • pgfplots: How to draw a Klein bottle?
    by cis on August 19, 2020 at 1:40 pm

    I want to draw an unpretentious Klein bottle like that (that means: surface lines are ok, but not many colors; actually no grayscale either, like in my MWE below) wikipedia says me: But I get with that What do I have to set? \documentclass[border=10pt]{standalone} \usepackage{pgfplots} \pgfplotsset{compat=newest} \begin{document} \begin{tikzpicture}[ declare function={ b=2; h=6; r(\u)=(2-cos(\u)); p(\u)=exp( -(0.5*\u-pi)*(0.5*\u-pi) ); q(\u)=exp( -(\u-1.5*pi)*(\u-1.5*pi) ); X(\u,\v)=b*(1-sin(\u))*cos(\u)+r(\u)*cos(\v)*(2*p(\u)-1); Y(\u,\v)=r(\u)*sin(\v); Z(\u,\v)=h*sin(\u)+0.5*r(\u)*sin(\u)*cos(\v)*q(\u); }, ] \begin{axis}[ xlabel=$x$, ylabel=$y$, zlabel=$z$, %view/h=-10, ] \addplot3[ surf, z buffer=sort, colormap={mycolormap}{% color=(black) color=(white) }, %semitransparent, trig format plots=rad, domain=0:2*pi, domain y=0:2*pi, %restrict y to domain=-1:1, %samples=41, samples y=25, variable=\u, variable y=\v, point meta=u, ] ({X(\u,\v)}, {Y(\u,\v)}, {Z(\u,\v)}); \end{axis} \end{tikzpicture} \end{document}

  • Best practice for plots (pgfplots, gnuplot, etc.)
    by burny on July 27, 2020 at 8:44 am

    I am writing a fairly large article with a lot of different plots. They range from simple ones like abs(x) or x^2 to high-polynomials with their first and second derivative, and nonlinearities (sigmoid, tan, etc.). Sometimes they are also in 3 dimensions. I am using pgfplot within tikzpicture and then gnuplot. For the easy plots, this is straightforward. However, the more complex plots (that may include non-continuity points), the gnuplot expression becomes harder and harder to understand and maintain. For some plots, I need randomly created points anyway (created once, and then fixed), which need to be "classified" according to a function. For all plots, I have (or could create) Python scripts to output a coordinates table that would be possible to use within the pgfplot table import functionality. This may seem overkill for x^2 but is really necessary for the more complex plots. And with the higher polynomials, I don't have to do the derivates manually. This works for plots that are points or lines in 2D but not in 3D because the number of points for the imported table exceeds LaTeX's memory (x and y have 1000 samples each, which results in 1,000,000 coordinates). As I have the functions in Python anyway, I could also use matplotlib (or seaborn, etc.) to create pdfs with the plot. This has the disadvantage that the plots do not look like they would when drawing with LaTeX/gnuplot (different colors, styles, etc.), so I would have to maintain the styles in two different places. Is there a best practice for this type plotting? I want one type of plot (either only gnuplot or only Python) and not a mixture of different methods.

  • Plotting function ℝ² →ℝ with pole at (0,0) smoothly
    by Wizard of Math on May 30, 2020 at 1:56 pm

    I would like to plot the function f: ℝ² →ℝ, definited by f(x,y)=(xy)/(x^2+y^2). But the following problem comes up: At (0,0) the function is not continous and therefore it looks kind of jagged. To solve this problem i could force the function to input specific points but i can't find it anywhere an don't know if that is even possible. Code: \begin{tikzpicture}[] \begin{axis}[axis lines=center, axis on top, xtick=\empty, ytick=\empty, ztick=\empty, xrange=-2:2, yrange=-2:2 ] % function \addplot3[domain=-2:2,y domain=-2:2,colormap/viridis,surf,opacity=0.5,samples = 55] {(x*y)/(x^2+y^2)}; \end{axis} \end{tikzpicture} How do i make this function look smooth? Any help would be greatly appreciated 🙂 (Just increasing the Samples doesnt do that much, and I run into the following error: TeX capacity exceeded, sorry [main memory size=3000000])

  • Plotting 3d surface from data points
    by NaveganTeX on July 26, 2019 at 7:47 pm

    I have the following code which works great and produces the plot I want. This is it: \documentclass[border=5mm]{standalone} \usepackage{pgfplots, filecontents} \begin{filecontents*}{filename.txt} 0 0 -0.64 1 0 -0.5 2 0 -0.4 3 0 -0.31 4 0 -0.23 5 0 -0.2 6 0 -0.24 7 0 -0.32 8 0 -0.42 9 0 -0.59 10 0 -0.76 0 1 -0.54 1 1 -0.4 2 1 -0.27 3 1 -0.17 4 1 -0.08 5 1 -0.03 6 1 -0.05 7 1 -0.14 8 1 -0.27 9 1 -0.45 10 1 -0.63 0 2 -0.46 1 2 -0.31 2 2 -0.16 3 2 -0.03 4 2 0.07 5 2 0.12 6 2 0.11 7 2 0.02 8 2 -0.13 9 2 -0.32 10 2 -0.51 0 3 -0.44 1 3 -0.26 2 3 -0.08 3 3 0.07 4 3 0.18 5 3 0.25 6 3 0.24 7 3 0.14 8 3 -0.01 9 3 -0.2 10 3 -0.41 0 4 -0.44 1 4 -0.26 2 4 -0.04 3 4 0.13 4 4 0.25 5 4 0.32 6 4 0.31 7 4 0.22 8 4 0.07 9 4 -0.14 10 4 -0.37 0 5 -0.44 1 5 -0.26 2 5 -0.05 3 5 0.14 4 5 0.27 5 5 0.34 6 5 0.33 7 5 0.24 8 5 0.09 9 5 -0.12 10 5 -0.36 0 6 -0.48 1 6 -0.29 2 6 -0.08 3 6 0.09 4 6 0.22 5 6 0.29 6 6 0.28 7 6 0.2 8 6 0.06 9 6 -0.13 10 6 -0.35 0 7 -0.55 1 7 -0.34 2 7 -0.15 3 7 -0.0 4 7 0.11 5 7 0.18 6 7 0.18 7 7 0.11 8 7 -0.02 9 7 -0.2 10 7 -0.39 0 8 -0.63 1 8 -0.44 2 8 -0.27 3 8 -0.13 4 8 -0.03 5 8 0.04 6 8 0.04 7 8 -0.02 8 8 -0.13 9 8 -0.29 10 8 -0.45 0 9 -0.71 1 9 -0.59 2 9 -0.43 3 9 -0.28 4 9 -0.18 5 9 -0.13 6 9 -0.13 7 9 -0.17 8 9 -0.26 9 9 -0.38 10 9 -0.53 0 10 -0.83 1 10 -0.75 2 10 -0.59 3 10 -0.45 4 10 -0.35 5 10 -0.3 6 10 -0.3 7 10 -0.34 8 10 -0.42 9 10 -0.52 10 10 -0.66 \end{filecontents*} \begin{document} \begin{tikzpicture} \begin{axis}[view={-20}{20}, grid=both] \addplot3[surf] file {filename.txt}; %\addplot3[surf, point meta=explicit] table [z expr=0.5, meta index=2] {filename.txt}; \end{axis} \end{tikzpicture} \end{document} Now, my data points are the following: \documentclass[border=5mm]{standalone} \usepackage{pgfplots, filecontents} \begin{filecontents*}{filename.txt} 10 0 2.8637 15 0 2.8131 20 0 2.8727 25 0 2.8644 30 0 2.8842 35 0 2.8675 40 0 2.7089 45 0 2.6247 10 0.001 2.8436 15 0.001 2.8692 20 0.001 2.8859 25 0.001 2.4132 30 0.001 2.7664 35 0.001 2.8796 40 0.001 2.8752 45 0.001 2.8782 10 0.002 2.8752 15 0.002 2.8693 20 0.002 2.8703 25 0.002 2.6594 30 0.002 2.8643 35 0.002 2.5554 40 0.002 2.8875 45 0.002 2.8887 10 0.003 2.8151 15 0.003 2.8856 20 0.003 2.8701 25 0.003 2.857 30 0.003 2.8785 35 0.003 2.6176 40 0.003 2.8835 45 0.003 2.9234 10 0.004 2.8815 15 0.004 2.8792 20 0.004 2.8213 25 0.004 2.8877 30 0.004 2.9202 35 0.004 2.8595 40 0.004 2.885 45 0.004 2.8489 10 0.005 2.8907 15 0.005 2.8521 20 0.005 2.6148 25 0.005 2.8762 30 0.005 2.8576 35 0.005 2.8363 40 0.005 2.7048 45 0.005 2.7617 10 0.006 2.8599 15 0.006 2.8941 20 0.006 2.8474 25 0.006 2.876 30 0.006 2.8206 35 0.006 2.5735 40 0.006 2.3208 45 0.006 2.3754 10 0.007 2.8833 15 0.007 2.8886 20 0.007 2.8691 25 0.007 2.6355 30 0.007 2.7528 35 0.007 2.5829 40 0.007 2.583 45 0.007 2.5111 10 0.008 2.8711 15 0.008 2.8815 20 0.008 2.8452 25 0.008 2.7511 30 0.008 2.5907 35 0.008 2.5598 40 0.008 2.6029 45 0.008 2.5253 10 0.009 2.8708 15 0.009 2.6844 20 0.009 2.7038 25 0.009 2.6988 30 0.009 2.4988 35 0.009 2.4059 40 0.009 1.8292 45 0.009 2.2368 10 0.01 2.8806 15 0.01 2.8899 20 0.01 2.386 25 0.01 2.5372 30 0.01 2.3707 35 0.01 2.1165 40 0.01 2.1553 45 0.01 2.3411 10 0.011 2.8725 15 0.011 2.7136 20 0.011 2.5851 25 0.011 2.4942 30 0.011 2.478 35 0.011 2.3578 40 0.011 2.465 45 0.011 2.0726 10 0.012 2.8873 15 0.012 2.6652 20 0.012 2.6406 25 0.012 2.4053 30 0.012 2.3922 35 0.012 2.3308 40 0.012 2.3423 45 0.012 2.0778 10 0.013 2.8902 15 0.013 2.7437 20 0.013 2.6815 25 0.013 2.2707 30 0.013 2.1961 35 0.013 2.1585 40 0.013 2.2469 45 0.013 2.3896 10 0.014 2.8826 15 0.014 2.6679 20 0.014 2.4037 25 0.014 2.2751 30 0.014 2.3569 35 0.014 2.3838 40 0.014 2.2706 45 0.014 2.2171 10 0.015 2.8688 15 0.015 2.5697 20 0.015 2.4726 25 0.015 2.2542 30 0.015 2.344 35 0.015 2.3119 40 0.015 2.0676 45 0.015 2.2591 \end{filecontents*} \begin{document} \begin{tikzpicture} \begin{axis}[view={-20}{35}, grid=both] \addplot3[surf] file {filename.txt}; % \addplot3[surf, point meta=explicit] table [z expr=0.2, meta index=2] {filename.txt}; \end{axis} \end{tikzpicture} \end{document} And get the following disaster: Could you tell me whats going on and how could I fix this issue? I need to fix the scale where it says 10^-2. I want to have on the x axis from 0 to 0.015 with steps of 0.001. This is the desired output:

  • A hyperbolic triangle embedded in a saddle-shaped surface
    by Tony on August 16, 2018 at 5:49 pm

    This is the diagram I would like to recreate. (from https://en.wikipedia.org/wiki/Hyperbolic_triangle) From Is there any easy way to draw a ruled surface like a hyperbolic paraboloid in TikZ?, I found a way to draw the saddle-shaped surface. Is there a way to draw the triangle on it? And get the colours/transparency like the picture? \documentclass{article} \usepackage{pgfplots} \begin{document} \begin{tikzpicture} \begin{axis} \addplot3 [surf,shader=flat,draw=black] {x^2-y^2}; \end{axis} \end{tikzpicture} \end{document}

  • How to deal in pgfplots with repeated symbolic coords using data from a file
    by Yves on September 18, 2016 at 8:44 am

    I am trying to generate a series of industrial plots resulting from a DoE, according to the example of the MWE, but I cannot find a way to generate it directly from a .csv file or \datatable, since the xticks gets duplicated for each occurence found in the .csv file. Is there a way to force all datapoints sharing the same symbolic xcoord to be aligned vertically, as in the example? \documentclass{article} \usepackage{pgfplots} \pgfplotsset{width=4cm, height =8cm} \usepackage{filecontents} \begin{document} \begin{tikzpicture} \begin{axis}[ title= {Fatigue test results.}, only marks, mark size=0.5mm, enlarge x limits=0.3, xlabel={Configuration},ylabel={Cycles before failure}, symbolic x coords={A,C}, xtick={A,C}] \addplot coordinates {(A,1362)(A,2840) (A,687) (A,2771)}; \addplot coordinates {(C,2130)(C,3544) (C,1844)(C,3447)}; \end{axis} \end{tikzpicture} \begin{filecontents}{data1.csv} config;cycles A;1362 A;2840 A;687 A;2771 C;2130 C;3544 C;1844 C;3447 \end{filecontents}{data1.csv} \pgfplotstableread[col sep=semicolon]{data1.csv}{\datatableone} % what code could lead to the same plot, using the file or the datatable ? % see below \begin{tikzpicture} \begin{axis}[ xtick=data, title= {Fatigue test results.}, only marks, mark size=0.5mm, enlarge x limits=0.3, xlabel={Configuration},ylabel={Cycles before failure}, symbolic x coords={A,C}] \addplot table [x= config, y=cycles] \datatableone; \end{axis} \end{tikzpicture} \end{document} I have found a solution and added it to the code.

  • pgfplots 3D plots size versus 2D plots size
    by Nils on December 9, 2015 at 9:31 pm

    I wanted to create a 3D plot but it's not possible for me to set the right size. Should I try out until I find the right values for height and width for the 3D plot or is there an easy way to find them? \documentclass[tikz]{standalone} \usepackage{pgfplots} \pgfplotsset{compat=newest} \begin{document} \begin{tikzpicture} \begin{axis}[ height=5cm, width=5cm, axis lines=center, xtick=\empty, ytick=\empty, xmin=-13,xmax=13,ymin=-13,ymax=13, xlabel=$x$, ylabel=$y$, ] \end{axis} \end{tikzpicture} \begin{tikzpicture} \begin{axis}[ view={30}{25}, height=5cm, width=5cm, axis lines=center, xtick=\empty, ytick=\empty, ztick=\empty, xmin=-13,xmax=13,ymin=-13,ymax=13,zmin=-13,zmax=13, xlabel=$x$, ylabel=$y$, zlabel=$z$, ] \end{axis} \end{tikzpicture} \end{document}

  • PGF: draw longitudinal arcs in 3D axis environment
    by Bloch on February 4, 2015 at 3:54 pm

    I want to draw a sphere similar to the first one here: http://www.texample.net/tikz/examples/map-projections/ But, of course, different. This is what I did so far: The dashed lines are behind the arrows and the solid lines on top to create the illusion of the arrows to be in the sphere. What I did is a bit tricky and probably not the most elegant method. I created a tilted sphere (surface plot) in the background and covered it with a better looking 'ball'. I originally intended the surface plot sphere to be the actual sphere and then decided that it did not look good enough. But I kept it in the background because I needed the axis environment as I did not manage to do it without the axis cs. The latitude lines are basically 360° arcs originating from the (axis cs: 1,0,0) point (arc (0:360:1)). It turned out that arc interpreted the angle as the polar angle (the angle in the x-y-plane), which made it easy. But it seems to make it impossible for longitude lines. Is there something like an arc3D knowing an azimuthal angle in addition to the polar angle? Or could I redraw the latitude lines and rotate them by 90 degrees? Does anyone know another solution? My attempts to do it without the axis environment also failed. Actually I am not unhappy with my axis solution, as it makes it easier to plot the arrows in the right direction (what it will be all about in the end). I hope I could make it clear what my problem is and hope there is someone coming up with an easy arc3D solution. 😉 My code is: \documentclass[tikz]{standalone} \usepackage{pgfplots} \pgfplotsset{compat=1.9} \usetikzlibrary{arrows.meta} \tikzset{>=Latex} \begin{document} \begin{tikzpicture} \def\tilt{45} \def\azimuth{30} \begin{axis}[% axis equal, width=14cm, height=14cm, hide axis, enlargelimits=0.3, view/h=\tilt, view/v=\azimuth, scale uniformly strategy=units only, colormap={bluewhite}{color=(blue) color=(white)}, ] \coordinate (X) at (axis cs: 1,0,0); \coordinate (-X) at (axis cs: -1,0,0); \coordinate (Y) at (axis cs: 0,1,0); \coordinate (-Y) at (axis cs: 0,-1,0); \coordinate (Z) at (axis cs: 0,0,1); \coordinate (-Z) at (axis cs: 0,0,-1); Kugel \addplot3[ surf, shader= interp, opacity = 1, samples=2, domain=-1:1,y domain=0:2*pi, z buffer=sort ] ({sqrt(1-x^2) * cos(deg(y))}, {sqrt( 1-x^2 ) * sin(deg(y))}, x); \filldraw[ball color=white] (axis cs: 0,0,0) circle (2.5cm); %dashed lines %Breitengrade \pgfplotsinvokeforeach {-80,-60,...,80}{ \pgfplotsextra{ \pgfmathsetmacro\sinVis{sin(#1)/cos(#1)*sin(\azimuth)/cos(\azimuth)} % angle of "visibility" \pgfmathsetmacro\angVis{asin(min(1,max(\sinVis,-1)))} \coordinate (X) at (axis cs: {cos(#1)},0,{sin(#1)}); \draw [gray,dashed] (X) arc (0:360:{100*cos(#1)}); } } %Achsen \draw [-{>[scale=2]},gray] (axis cs: -1,0,0) -- (axis cs: 1.5,0,0) node [above] {$\sigma_x$}; %x-Achse \draw [-{>[scale=2]},gray] (axis cs: 0,-1,0) -- (axis cs: 0,1.5,0) node [above] {$\sigma_y$}; %y-Achse \draw [-{>[scale=2]},gray] (axis cs: 0,0,-1) node [below]{$\sigma_-$} -- (axis cs: 0,0,1.3) node [above] {$\sigma_+$}; %z-Achse \draw [-{>[scale=1]},cyan,line width = 3pt] (axis cs: 0,0,0) -- (axis cs: 0,0,1.1); \draw [-{>[scale=1]},blue,line width = 3pt] (axis cs: 0,0,0) -- (axis cs: 1,0,0); %Arcs \pgfplotsinvokeforeach {-80,-60,...,80}{ \pgfplotsextra{ \pgfmathsetmacro\sinVis{sin(#1)/cos(#1)*sin(\azimuth)/cos(\azimuth)} % angle of "visibility" \pgfmathsetmacro\angVis{asin(min(1,max(\sinVis,-1)))} \coordinate (X) at (axis cs: {cos(#1)},0,{sin(#1)}); \draw [gray] (X) arc (0:\tilt+\angVis:{100*cos(#1)}) (X) arc (0:-180+\tilt-\angVis:{100*cos(#1)}); } } \end{axis} \end{tikzpicture} \end{document}

  • plot 3d graphs of functions defined implicitly
    by Jay on October 23, 2013 at 2:52 pm

    How can I plot 3d graphs of functions defined implicitly (quadratic forms, for Linear Algebra course notes -- I'd like to include lots of examples)? As far as I can see it is not possible with pgfplots and not through gnuplot either. Is there any package that will help with that? For example, parabolic and hyperbolic cylinders, hyperboloids, ellipsoids, etc. Concrete examples: 2xy + 2xz = 1 (hyperbolic cylinder) (x^2)/(2^2) + (y^2)/(3^2) + (z^2)/(2^2) = 1 (ellipsoid) I also see that Maxima can do this: (%11) hc:2*x*y+2*x*z=2; (%i2) draw3d(enhanced3d=true,implicit(hc,x,-5,5,y,-5,5,z,-5,5)); This will work fine (the hyperbolic cylinder is correctly plotted on the screen), but I don't know what backend Maxima uses for this, and I'd like to use a plain LaTeX method, or something that could be called from LaTeX, as I may have to send the document for others to compile themselves on different environments.

  • Helix on a cylinder
    by Grimolatto on August 24, 2013 at 8:49 am

    I want to plot geodesics on a cylinder. These are straight lines, circles or helices. I can plot the first two, but I don't know how to draw the helices. To be precise, I would like to know how to draw an helix on this cylinder (passing thru two points A and B, but the location of the points is not relevant), using TikZ exclusively (maybe with pgfplots, but without using pstricks): \documentclass{standalone} \usepackage{tikz} \usetikzlibrary{shapes.geometric} \begin{document} \begin{tikzpicture} \node [cylinder,rotate=90,draw,aspect=2,minimum width=2cm,minimum height=3.5cm](C){}; \draw[fill] (-0.5,-0.5) circle [radius=0.045]node[below]{$A$}; \draw[fill] (0.5,0.75) circle [radius=0.045]node[below]{$B$}; \end{tikzpicture} \end{document}