# Tag Info

11

I suspect this was the desired result? Large values of \w will cause your function to blow up, and will return an error message. \documentclass{standalone} \usepackage{pgfplots} \def\mycolone{yellow} \def\mycoltwo{green} \pgfplotsset{every axis legend/.append style={ at={(.5,-.2)}, anchor=north}} \begin{document} \begin{tikzpicture} ...

11

First of all, I want to thank you for asking this question; I am a basic user of LaTeX and by thinking about your question, I learned so many things. Here is the code and my solution to your problem; % pdflatex \documentclass{standalone} \usepackage{siunitx} \sisetup{round-mode=places,round-precision=1} % \usepackage{tikz} ...

5

A MetaPost solution, which was a very interesting exercise to do, greatly inspired by “1010011010”'s answer. I have used two macros of my own for this task. The one simply called function allows to enter the function expression as an argument, as it is defined, and returns its associated curve. The define_cartouche macro produces a cartouche containing the ...

5

\documentclass{standalone} \usepackage{pgfplots} \def\mycolone{yellow} \def\mycoltwo{green} %\pgfplotsset{every axis legend/.append style={ %at={(.5,-.2)}, %anchor=north}} \begin{document} \begin{tikzpicture} \begin{axis}[xmin=-5,xmax=5,ymin=-0.5,ymax=100,no markers, grid=both] \foreach \w in {5,10,...,100} { ...

5

There are two ways atleast for doing this. First using subcaption and its subfigure environment and two using groupplots library of pgfplots. First using grouplots: \documentclass[border=5]{standalone} \usepackage{pgfplotstable} \pgfplotsset{width=10cm,compat=1.9} \usepgfplotslibrary{groupplots} \begin{document} \pgfplotstableread[col ...

5

pgfplots understands the macro and the character versions of the variables. From the manual What really goes on is a loop which assigns the current sample coordinate to the macro \x. pgfplots defines a math constant x which always has the same value as \x. In short: it is the same whether you write \x or just x inside of math expressions. So ...

4

This is just one possibility. \documentclass[tikz,border=3mm]{standalone} %\documentclass{article} \usepackage{pgfplots} %\pgfplotsset{compat=1.7} \begin{document} \begin{tikzpicture}[>=latex] \begin{axis}[grid=both, %grid=none axis x line=center, axis y line=center, black, ...

4

From page 95 in the pgfplots documentation. Use the axis background/.style for the axis environment! \documentclass{article} \usepackage{pgfplots} \pgfplotsset{compat=newest} \begin{document} \begin{tikzpicture} \begin{axis}[axis background/.style={fill=gray!10}] \addplot {x^2}; \end{axis} \end{tikzpicture} \end{document}

3

You can use this answer by percusse and adjust the anchors \documentclass{standalone} \usepackage{pgfplots} \pgfplotsset{compat=1.9} \usepackage{filecontents} \begin{filecontents*}{mydata.dat} x_0 f(x) label anchor %some comment 0.5 0.24 0 east 0.5 0.21 0.1 west 0.5 0.18 0.5 east 0.5 0.21 0.9 east \end{filecontents*} \begin{document} ...

3

Here is an attempt using shorten. I have extended the red line in both directions. However, to add legend, you have to do some more work otherwise, the legend line gets extended too. Here, I have defined a custom legend image and used it. \documentclass{standalone} \usepackage{pgfplotstable} \pgfplotsset{width=12cm,compat=1.9} \usepackage{filecontents} ...

2

A PSTricks solution using the expl3 package: \documentclass{article} \usepackage{pstricks-add} % approximation to Euler's number \def\PSEuler{2.71828182845904523536 } % point on x-axis \def\point{1.5 } \begin{document} \psset{yunit = 2} \begin{figure} \begin{pspicture}(-0.73,-0.27)(7.04,2.5)% found manually \psaxes[Dy = ...

2

The problems are caused by the different coordinate systems, I believe. Therefore I moved the \path-commands into the axis environment and adjusted their position slightly. \documentclass{standalone} \usepackage{tikz} \usepackage{pgfplots}\pgfplotsset{compat=1.9} \begin{document} \begin{tikzpicture}[scale=0.8] \begin{axis}[clip=false, width=12cm, ...

2

Replace table with table[meta = label] and you should be fine. \documentclass{standalone} \usepackage{pgfplots} \pgfplotsset{compat=1.9} \usepackage{filecontents} \begin{filecontents*}{mydata.dat} x_0 f(x) label %some comment 0 10 0 0.1 9 0.1 0.5 6 0.5 0.9 5 0.9 \end{filecontents*} \begin{document} \begin{tikzpicture} ...

2

It's hard to understand from your question what you are trying to do but looking at your plot I think that you just want to move the legend box: this can be one using legend style. In addition, the labels on the axis bump into each other so you probably want to use x tick label style to rotate them. All of this is described in detail in the pgfplots manual. ...

2

You can control the position of nodes most easily, in this case, by using the co-ordinate system of the plot itself to define co-ordinates/nodes, and drawing them in the normal TiKZ style. Source \documentclass{standalone} \usepackage{pgfplots} \pgfplotsset{compat=1.7} \begin{document} \begin{tikzpicture}[>=latex] \begin{axis}[grid=both, ...

1

You can use a double like postaction={double=purple,double distance=1pt}, or simply double=purple,double distance=1pt to draw that broad line. \documentclass[12pt]{article} \usepackage{tikz} \usepackage{pgfplots} \begin{document} \begin{figure} \begin{tikzpicture} \begin{semilogyaxis}[ width=\textwidth, height=10cm, ...

1

A MetaPost solution, for whom it interests. The middle of a path is easily found with the Metafun format of MetaPost: it is point .5 along curve if curve is the name of the path. For MetaPost experts, here is the definition of the along binary operator in the Metafun format: primarydef pct along pat = % also negative (arctime (pct * (arclength pat)) of ...

1

One solution is to use y post scale and x post scale to scale the axis so that the lines are bit more separated. Also, you may decrease the mark size a bit. \documentclass{article} \usepackage{amsmath} \usepackage{pgfplots} \pgfplotsset{compat=1.12} \begin{document} \begin{tikzpicture}[font=\sffamily] \begin{axis}[ height=5cm, width=6.5cm, ...

1

Here's one attempt, where I've added some conditional code to add the leading zero if the number is less than 10. The idea is like this (for the minutes part): \pgfmathparse{ifthenelse(\minutes<10,0,)}\pgfmathresult\pgfmathprintnumber{\minutes}:% The \pgfmathparse will store either 0 or an empty string depending on whether a leading zero is required ...

1

Going with simplicity, and the most common use case for the win I'm copying my edits here as the answer. According to How can LaTeX code in a data file be read by pgfplotstable? it is impossible to insert expandable material in headers to be formatted by pgfplotstable. Therefore, as in percusse comment use column name key to access and format any column ...

1

Ok, I ended up doing the following: I first defined a style outside of the actual \tikzpicture: \pgfplotsset{ default style/.style={ xbar, xmin=0, width=12cm,enlarge y limits=0.5, xlabel={Travel time [s]}, ytick=data, nodes near coords, nodes near coords align={horizontal}, every node near coord/.append style={/pgf/number ...

Only top voted, non community-wiki answers of a minimum length are eligible