New answers tagged

3

Just an idea using pencil and ruler from symbols of pencil, ruler and compass First I've taken Harish code and adapted to: \documentclass[tikz,border=0cm]{standalone} \usepackage{tikz} \tikzset{ pencil/.pic={ \fill[gray!50] (0,4) -- (0.4,4) -- (0.4,0) --(0.3,-0.15) -- (0.2,0) -- (0.1,-0.14) -- (0,0) -- cycle; \draw[color=white] (0.2,4) ...


1

I'm adding a new answer because the MWE given by Jake is not working for me. \documentclass{article} \usepackage{pgfplots} %To create a .dat file (not required if you already have the file in the same folder) \begin{filecontents}{vector_field.dat} x y u v 0 0 1 0 1 1 1 1 2 4 1 4 3 9 1 6 4 16 1 8 \end{filecontents} \begin{document} ...


1

Maybe you are looking for something like Code: \documentclass[oneside,12pt]{scrbook} \usepackage[T1]{fontenc} \usepackage{lmodern,textcomp} \usepackage{pgfplots} \pgfplotsset{compat=1.13} \begin{document} \begin{center} \begin{minipage}{\linewidth} \centering \begin{tikzpicture} \begin{axis}[ xbar, y axis line style ...


2

Following the comments from @Jake I set-up the axis in the following way: \begin{polaraxis} [xmin=-90,xmax=90,rotate=-90,xticklabel=$\pgfmathprintnumber{\tick}^\circ$, xtick={-45,-20,0,20,45},xticklabel style={anchor=-\tick-90},x dir=reverse,yticklabel style={anchor=south, yshift=-6mm},ymin=-40, ymax=0, y coord trafo/.code=\pgfmathparse{#1+40},y coord ...


2

When setting xmin=0, xmax=1 in your example, I get a dimension too large error. This happens because the point 1000,50 is still processed, even though it lies outside the visible axis domain, and causes an overflow error. To fix this, set restrict x to domain=0:1. That key specifies that points with x coordinates outside the specified range are filtered out ...


0

To plot coordinates from a file use \addplot table [<column selection>]{<file name>}; If the optional argument for table is missing, the first column (with index 0) is used as x values and the second column (with index 1) is used as y-values. To plot f(x) with your file \begin{tikzpicture} \begin{axis} \addplot table {heat.txt}; \end{axis} \...


2

There are several reasons for using pgfplots rather than tikz, here are some that I could think of right now: Automatic scaling: pgfplots will scale things so that the plot doesn't become very large. Try plotting exp(x) for example, instead of sin(x). Automatic ticklabels and axis lines. This doesn't apply for your example of course, but often you want to ...


1

I ended up taking Willie Wong's advice and used a domain of 2.02:15. It seems that since (-3)ln(x-2) is undefined for x=2 it doesn't try a different point that would display the graph appropriately.


1

You just need to create the legend before \addplot adds the default line definition. (I renamed the graph file when I copied it. Sorry about that.) \documentclass{article} \usepackage{graphicx} \usepackage{epstopdf} \usepackage{pgfplots} \begin{document} \begin{tikzpicture} \begin{loglogaxis} [ ...


2

I do not have your data file, so I will use a mathematical expression. You can use the color argument directly in the options of the plot. Then it would be possible to change not only the color but also e.g. the line style of a plot. \documentclass{standalone} \usepackage{pgfplots} \pgfplotsset{compat=1.13} \newcommand{\plotvtf}[2][]{% \addplot+[ultra ...


3

If you want to change the fontsize of nodes inserted by an \addplot command you can use something like every axis plot/.append style = {font = \scriptsize} Code: \documentclass[margin=5pt]{standalone} \usepackage{pgfplots} \usepackage{amsmath} \pgfplotsset{compat=newest} \pgfplotsset{ tick label style = {font = \tiny}, label style = {font = \...


0

Note: I am not really sure what output you are expecting here. The documentation for arrayjob under \readarray (currently page 3) specifies that one should use & between each entry in the array. Note that you can always locate the documentation using the command-line/terminal by writing texdoc arrayjob, and that works for any package. The ...


1

You can define a new legend image style: \pgfplotsset{ /pgfplots/line legend with two nodes/.style 2 args={ legend image code/.code={ \draw[##1,no markers] plot coordinates { (0cm,0cm) (0.3cm,0cm) (0.6cm,0cm) } node[pos=0,#1]{} node[#2]{};% } } } Code: \documentclass[border=5pt]{...


0

Remove ybar from the axis options. Even if the bars are not drawn or filled, they have a width (default 10pt) and the bars of different plots in the same axis are shifted. The error bars are centered horizontally to the plotted bars. \documentclass{elsarticle} \usepackage{pgfplots} \pgfplotsset{compat=1.13} \begin{document} \begin{figure} \centering \...


2

With \pgfplotsset{ errorBars/.style={ error bars/error bar style={ thick, }, error bars/y dir=both, error bars/y explicit, } } you can use \addplot[errorBars,style={red, fill=red}] or \addplot[style={red, fill=red},errorBars]. If all plots inside an axis environment should have error bars with this style, you can use every axis ...


3

You could use width = {ifthenelse(.9\linewidth>3in,3in,.9\linewidth)} Example: \documentclass{article} \usepackage{pgfplots} \pgfplotsset{ compat=1.13, every axis/.append style={ width = {ifthenelse(.9\linewidth>3in,3in,.9\linewidth)} } } \begin{document} \begin{tikzpicture} \begin{axis} \addplot{x}; \end{axis} \end{tikzpicture} \...


2

Yes. You asked to surpess the warning. I am not sure if you really want to have this solution. \documentclass{article} \usepackage[utf8]{inputenc} \usepackage{silence} \WarningFilter{ctable}{Transparency disabled:} \usepackage{pgfplots} \usepackage{ctable} \begin{document} Content here. \end{document} It only surpress the warning. A bugreport has been ...


1

A few (possible) problems with your code: By issuing domain=0:4 you are telling TikZ to plot between t = 0 and t = 4. It appears from your desired output you want to plot between approximately x = 0 and x=4. By issuing deg(30) you are not plotting cosine and sine of 30 degrees; instead you are plotting cosine and sine of 30 radians. (The deg function ...


2

The cause of your problem is discovered and described in above comments of samcarter and cfr (thanks to both!). As temporary solution of this problem can be: as suggested cfr in her comment with existing MWE generate pdf file and than it include in your document as image: \includegraphics{<flowchart name>} instead diamond use different shape, for ...


1

Slightly different from image which you like to obtain: MWE: \documentclass{article} \usepackage{pgfplots} \begin{document} \begin{tikzpicture}[ Levels/.style = {above right, font=\footnotesize, align=left}% <-- added ] \begin{axis}[ ybar, xtick=data, ymin = 50, ymax = 75, xmin=0.5, xmax=3.5, ...


1

You had not: nested subfigure environments in tikzpicture environments! have caption inside tikzpicture define font size of caption in caption. It and other options should be defined with captionsetup in preamble. After reorganizing of your MWE I obtain: In MWE I also add showframe package that oage layout is wisibel In document production it had to ...


2

One option is to use etoolbox's \csxdef to store the value and \csuse to retrieve it: ##Code: \documentclass{article} \usepackage{pgfplots,pgfplotstable} \usepackage{etoolbox} \pgfplotsset{ compat=1.13 } \begin{document} %% Dummy data \pgfplotstableread{ x1 y1 x2 y2 1 1 1 2 2 2 2 4 3 3 3 6 4 4 4 8 }{\mytable} ...


2

clip=false works like a charm!


1

You can increase the width of the bars with bar width. In addition I think you need enlarge x limits to avoid clipping of bars. \documentclass[border=5mm]{standalone} \usepackage{pgfplots} \begin{document} \begin{tikzpicture} \begin{axis}[ ybar, bar width=25,enlarge x limits=0.25, % <--- added legend style={at={(0.5,-0.15)}, anchor=...


2

Use ybar=0pt instead ybar interval. Adjust the width of the bars to your needs. Set width and height for the axis environment. Remove legend columns=-1. \documentclass{article} \usepackage{pgfplots} \pgfplotsset{compat=1.13} \begin{document} \begin{center} \begin{tikzpicture} \begin{axis}[ width=\textwidth,height=75mm,% <- added x ...


0

Edit: From new MWE is seems tha nature of data influence on function fill between. It seems that it expect that series of data don't have two different values of path D at the same A. For example, if in given MWE you change path D to \addplot[name path=D] coordinates {(0,1) (0.000001,0.5) (1,2)}; You will get expected result: With other words, I cant ...


0

From the manual: ... the plot gnuplot command employs the external program gnuplot to compute coordinates. The resulting coordinates are written to a text file which will be plotted with plot file. So gnuplot is only used for the calculation of coordinates from an expression. The plot itself is done by pgfplots. To plot only each 10th coordinate ...


2

If you add the remember picture option you can then access these nodes in a different tikzpicture environment: Notes: This is just to show how to use remember picture option and then connect the nodes. I am not recommending nesting tikzpicture environments. Code: \documentclass{article} \usepackage{pgfplots} \pgfplotsset{compat=newest} \...


1

This solution used \pgfplotsextra, \path and \draw instead of \addplot. \documentclass{article} \usepackage[a4paper,landscape, left=1.5cm,right=1cm, top=1.5cm,bottom=1.5cm, headsep=0cm,footskip=0cm] {geometry} \usepackage{pxfonts} % palatino con símbolos matemáticos (incompatible amsmath) ...


1

Your figure are aligned -- aligned to the bottom of the figure. If you desire alignment elsewhere you could adjust your figure so that they are the same size. One solution would be to ensure that the figures are the same size be "drawing" the line which is the cause of the size difference with a draw=none option: \addplot[draw=none] coordinates { (90,-30) (...


0

As you can see here, in other answers in SE, and as @JPi pointed out in a comment, LuaLaTeX can be the solution to you problem. In particular you have to run lualatex instead of pdflatex, with the same option (-shell-escape or -enable-write18). After the image has been externalized, you can fall back on pdflatex, as long as you don't introduce a new picture ...


0

How about creating an abstraction of the data to better grasp it? Then comes the possibility to implement procedures to highlight regions that would not be visible at that level. To finally provide the viewer with the means to drill down and investigate into a portion of the data. EDIT A MWE could be formulated as follows: I have a question I'd like to ...


2

No doubt the packages will get updated to current luatex at some point, but until then: \RequirePackage{luatex85,shellesc} \documentclass{article} \usepackage{pgfplots} \usepgfplotslibrary{external} \tikzexternalize \begin{document} \begin{tikzpicture} \begin{axis}[enlargelimits=false] \addplot[domain=-2*pi:2*pi, samples=100]{cos(deg(x))}; \end{axis} \...


0

I also deleted the row sep=crcr options and all \\ line endings and also got a picture with lualatex: \documentclass{article} \usepackage{pgfplots} \usepgfplotslibrary{external} %\tikzset{external/system call={lualatex -shell-escape -halt-on-error % -interaction=batchmode -jobname "\image" "\texsource"}} \begin{document} \input{Downloads/...


0

lualatex on \documentclass{article} \usepackage{pgfplots} \begin{document} \input{phase_portrait.tex} \end{document} runs fine and produces If you want to externalize, you could produce a standalone latex file, compile that, and include the pdf in your document as an image.


5

You have error in writing of the following coordinate: \draw[] (-5+\imdeg*0.4,(-5+\imdeg*0.4)^2) circle (2pt); Correct is: \draw[] (-5+\imdeg*0.4,{(-5+\imdeg*0.4)^2}) circle (2pt); If you like to nest paranthesis (...) inside of some coordinates, you had to enclose them with curtly braces. Complete code \documentclass[]{standalone} \usepackage{...


0

For MikTeX a very simpley way to get around it is described here.


1

You encountered an internal limitation in pgfplots: the axis range must not become "too small" when using log scales (and it does not report that it reached the limit, unfortunately). You can file a feature request if you believe that this should be added. In order to get the idea of @percusse up and running, you can modify both ymin and log plot exponent ...


2

This is due to a bug in pgfplots. I will take care that it gets addressed eventually. The problem is that the numbers are so close to 0 that the TeX-based arithmetic runs into some number range issues (while computing the intermediate result of exp(-4.08893e7)). That said, the argument domain=0:1000 for you function in question does not contain anything ...


1

In its default config, pgfplots has lots of freedom to scale the image as it seems fit: the default is scale mode=auto which boils down to scale mode=stretch to fill. As the name suggests, stretch to fill is likely to distort the angles between unit vectors, although the image is still correct internally. This is also true for your axis: pgfplots merely ...


2

That is expected behavior. In particular, the scaling is correct: it is a log scale. What is unexpected at first glance is that the exponent is not an integer. That, in turn, is a result of the small axis range. But a small axis range is not "a problem". If you want a bigger axis range, you an simply enlarge it. If you prefer integer exponents, you can use ...


4

Use nodes near coords style={/pgf/number format/.cd,precision=1} or nodes near coords style={/pgf/number format/.cd,fixed zerofill,precision=1} With fixed zerofill a value like 4.00 will be printed as 4.0. Code: \documentclass{standalone} \usepackage{pgfplots} \pgfplotsset{compat=1.12} \begin{document} \begin{tikzpicture} \begin{axis}[ xlabel=...


8

When treating big vector data like this, I fear a lot the possibility of having (undetected) visual aliasing. Consider for example a sinusoidal signal with period 10 (arbitrary units), with a noise of period 0.11. #! /usr/bin/env python3 # import math import numpy as np import scipy as sp t1 = np.arange(0.0, 100.0, 1e-3) y1 = np.sin(2*math.pi*t1/10) + 0.2*...


1

See page 258 of the pgfplots manual. Actually, your code also puts the labels at the tops, rather than centered in the blocks. \documentclass{standalone} \usepackage{pgfplots} \usepackage{pgfplotstable} \begin{document} \pgfplotstableread[col sep=comma,header=false]{ All,192,37 completed,61,11 dropped,64,17 in study,47,3 changed,26,6 }\...


4

Sometimes when you want lots of flexibility and extra details in a graph it's worth taking the trouble to draw it "from scratch" in Metapost. Here I've wrapped it up in luamplib so you need to process this with lualatex (or adapt it for plain MP). \documentclass[border=5mm]{standalone} \usepackage{luamplib} \begin{document} \mplibtextextlabel{enable} \...


3

You can get the minimum and maximum values with \pgfkeysvalueof{/pgfplots/ymin} and \pgfkeysvalueof{/pgfplots/ymax}} I only have TL 2015 so I need 1.12, but I don't see why this wouldn't work in 1.13 \documentclass{article} \usepackage{tikz,pgfplots} \pgfplotsset{compat=1.12} \usepgfplotslibrary{patchplots} \begin{document} \begin{tikzpicture} \begin{axis}[...


3

Cause of observed problem is scaling of TikZ pictures. If you omit, the font in legend will not not change. This lead me to thought that use of fillbetween library doesn't allow scaling, i.e. make scaling work as expected: it should not change font size (as far I understand how it works, maybe I'm wrong). I made some changes in your MWE: omit scaling, ...


0

The command \date is defined to set the internal variable \@date to whatever you type. e.g \date{2016-07-05} sets the variable to 2016-07-05. Variables contain a @ so you can easily spot them. Quite simple up to here. If you want to print the value of that variable, you cannot simply type \@date, this will produce an error as the @ is not allowed in "...


0

I guess all you want is to store the symbolic coordinate list in \ylabels. In order to achive that you can use \xdef as in my code below. \documentclass{article} \usepackage{pgffor,tikz, pgfplots} \pgfplotsset{compat=1.9} \def\lab{Foo,Bar} \let\labb\lab % use this to store the result of your for loop to \ylabelscmd \def\ylabelscmd{} \foreach \label/\val ...


1

See below. Add nodes near coords to the axis options. xticklabel style={rotate=90} You've basically answered that one yourself: xtick style={draw=none} \documentclass[border=4mm,tikz]{standalone} \usepackage{pgfplots,pgfplotstable} \begin{document} \begin{tikzpicture} \pgfplotstableread{ % Read the data into a table macro Label ...



Top 50 recent answers are included