Tag Info

New answers tagged

1

Maybe I'm missing some obvious option, but I don't think you can reduce the grid to certain coordinates. I'll look into it tomorrow. I set the number of grid lines to a certain value just as a demonstration. But you can increase/decrease their number by changing the value in this command (higher number = more lines): minor tick num=5, Output Code ...


1

I will put @ignasi's answer here since he added it as a comment. Use \pgfplotsset{every axis title/.append style={at={(0.1,0.8)}}} where you can adjust the position of the label by changing the fractions. \documentclass{article} \usepackage{xcolor} \usepackage{graphicx} \usepackage{pgfplots} \usepackage{amsmath} \usetikzlibrary{pgfplots.groupplots} ...


4

A little tedious but gets pretty close with lots of tweaks (shadow is also possible but please don't do it. It's just an Excel trick that, in my opinion doesn't help for anything visually): \documentclass{article} \usepackage{pgfplotstable} \usepackage{sansmath} \sansmath \pgfplotsset{compat=1.12} \pgfplotstableread[col sep=comma]{ a,b,c,d,e 128, ...


2

You need pgfplots package. Note the use of xtick=\empty, extra x ticks, extra x tick labels, extra y ticks and extra y tick labels \documentclass{standalone} \usepackage{tikz,pgfplots} %\pgfplotsset{compat=1.12} \begin{document} \begin{tikzpicture} \begin{loglogaxis}[xtick=\empty,extra x ticks={256, 512, 1024, 2048,4096,8192,16384},extra x tick ...


2

Is this what you are looking for? Sorry I'm in a rush so no time to comment much, but here is the code. I guess you can fiddle to fit your needs. Note that your points do not seem to correspond to the original plot (for example, where is the point $(128, 82.638)$ in the red original curve ? \documentclass{standalone} \usepackage[frenchb]{babel} ...


1

You can't have ymin>ymax. Set ymin=-9 and ymax=0. As for the labeling, you can put the plot inside a figure environment. \documentclass{article} \usepackage[margin=0.5in]{geometry} \usepackage[utf8]{inputenc} \usepackage{textcomp} \usepackage{pgfplots} \pgfplotsset{width=10cm,compat=1.9} %\usepgfplotslibrary{external} %\tikzexternalize ...


3

You have two problems: - standalone packages, which without defined border, for example border=5mm is (to) close to border of picture; - y range of your picture. If you set `point meta max=0.3, than the maximal value of your plot will appear. \documentclass[border=5mm]{standalone} \usepackage{pgfplots} \pgfplotsset{compat=newest} \begin{document} ...


3

This is also an answer to the comment for another answer of another question. To get help lines overprinted, they have to be printed first below the following objects. The \draw command should be placed before the other elements. The next problem are the misplaced lines. The following command adds the grid lines at least in the area (-10, -10) to (10, 10): ...


4

To get the minor ticks to work and to remove the first ytick label, use ytick={-20,-10,0} yticklabels={,-10,0} Which generates:


0

The comment by John Kormylo put me on the right track. The key is to make the legend refer to the third plot only by issuing forget plot to the two previous ones. The following works: \begin{axis} \addplot[name path = upper, draw = none, forget plot] {5 + rand}; \addplot[name path = lower, draw = none, forget plot] {-5 + rand}; \addplot[fill = ...


2

Here's a pstricks solution. The graph box in the fourth quadrant is included as a zoomed.epsfile via \epsfbox (\includegraphics doesn't work, for some reason): \documentclass[11pt, pdf, x11names]{standalone} \usepackage{pstricks-add} \usepackage{graphicx} \usepackage{changes, stackengine} \setstackEOL{\\} \input{binhex} \begin{document} ...


2

To show the mean value on your box plot you can use the average key with boxplot. I've only changed the middle bw plot, but you can see how to do the others. I've also corrected the y-axis label. Read the manual, p.430-450 for how to add labels to the averages, and change the colour. \documentclass{standalone} \usepackage{pgfplots} ...


3

I changed your base code a bit because it was easier for setting the steps in the sheet. If you have any doubts, just ask me in the comments. I wanted to set the top nodes using a \foreach and I was almost there, but unlike the numbering above, the top-top nodes have no logic in their succession, if you know what I mean, so I couldn't think of a rules to ...


1

axis equal specifically keeps the unit length ratios equal as well as the dimensions of the plot. So it will override the xmin, xmax, etc. axis equal image only keeps the unit length ratios equal so you can use it to accomplish your goal. You can also use unit vector ratio=1 1 to accomplish the same task. From Heiko's answer, you can see that you may ...


2

I think, unit vector ratio is what you are looking for: \documentclass{minimal} \usepackage{pgfplots} \pgfplotsset{compat=1.12} \begin{document} \begin{tikzpicture} \begin{axis}[ xmin=-2, xmax=2, ymin=-1, ymax=1, axis lines = middle, unit vector ratio=1 2, ] \addplot[ultra thick, red, ->] coordinates {(0,0) (1,0)}; \addplot[ultra ...


6

You can draw curly braces by using decorations. I shifted the ylabel on the y axis by 1mm because it was right in the middle of the brace, and did a similar thing to the node in the middle of the plot. I also changed the font size to 12pt because my editor was complaining, so you should change it back, but the drawing should be the same. Output Code ...


2

I found a solution. Adding the option trim axis left to the tikzpicture chops off everything left of the axis. Combined with \centering before the subfigure this aligns the plots nicely. \begin{subfigure}[t]{\linewidth} \centering \begin{tikzpicture}[trim axis left] \begin{axis}[my plot] ...


2

Change the key order of axis lines=middle and axis line style={->}. That should fix the arrow tip issue. Also, although you don't mention this in the question, since you specified axis lines=middle, you must also specify a min that goes below 0 for this to come into effect (i.e. having the axis lines intersect at 0). If the minimum is 0 for both axes and ...


2

Many thanks! I knew how to build the common color bar, just not how to force the scale to be common. Solution looks like this \begin{figure} \centering \begin{extikzpicture}[runs=2]{fig6} \begin{groupplot}[point meta min=4,point meta max=15, group style={group size=2 by 1, group name = ...


2

You have a typo. The key name is every loglog axis. Regardless of the code, don't remove the % at the end of lines in the code block. You will get spurious spaces otherwise.


1

I'm glad that meanwhile (when I was occupied with my regular tasks :-)) you find a solution for your problem. My proposition require more "hand work", but it is quit simple: \documentclass[margin=2cm]{standalone} \usepackage{pgfplots} \begin{document} \begin{tikzpicture} \begin{loglogaxis} [ xtick={2,95}, ...


2

Like Jake states in the comments, axis lines center also sets x label style, so it overwrites the options you set in x label style. Moving axis lines=center to the start of the options list solves the problem: \documentclass{standalone} \usepackage{pgfplots}\pgfplotsset{compat=newest} \begin{document} \begin{tikzpicture} \begin{axis} [ ...


3

Set margins by adjusting the bounding box via \pgfresetboundingbox and scale only axis Pgfplots manual describes adjusting the bounding box in Chapter 4.20.1 Bounding Box Restrictions (v1.12) % Measures: % --------- % total width = \columnwidth = 252pt = 3.49in % total height = 4in = 288pt % lmargin = 0.4in % rmargin = 0.1in % bmargin = ...


2

The code \documentclass[margin=1cm]{standalone} \usepackage{pgfplots} \begin{document} \begin{tikzpicture} \begin{loglogaxis} [ log number format code/.code= { \pgfkeys{/pgf/fpu} \pgfmathparse{exp(\tick)} \pgfmathprintnumber[sci,sci ...


2

Well as the macro name implies it is a pretty-printer not the math parser. You need to do the math outside and supply the result to it. But if you do the regular TikZ parsing the numbers are too big to handle. Hence you need to turn on the fpu of TikZ do the math and turn it off. log number format code/.code={% \pgfkeys{/pgf/fpu}% ...


2

You could use on layer=main as an option of fill between. \documentclass{standalone} \usepackage{tikz} \usepackage{pgfplots} \usepgfplotslibrary{fillbetween} \pgfplotsset{compat=1.12, clip bounding box=default tikz} \begin{document} \begin{tikzpicture} \fill[fill=blue] (0,0) rectangle (5,5); \fill[fill=red] (1,1) -- (3,1) -- (2,2) -- cycle; %%line ...


2

I try to husk an MWE and construct a suggestion how to solve your problem: \documentclass[french,12pt,oneside,openright]{memoir} \usepackage[utf8]{inputenc} \usepackage[T1]{fontenc} \usepackage{siunitx} \usepackage{tikz} \begin{document} \begin{tabular}{cc} \begin{tikzpicture} \node[draw,minimum width=80mm, minimum height=65mm] {instead of ...


0

It seems that the problem (building external pgfplots under Windows with MinGW) is not related to the pgfplots package (nor to the code from the MWE) but rather to the make tool that comes with MinGW. The make tool from cygwin builds everything fine with no changes to the code from the MWE.


2

Please make an effort to make your examples more focused. This one did not even compile as you provided it (missing tikzpicture environment), and it is much easier to see (and show) what is going on without all that extra styling code that's unrelated to the issue at hand. You had the right idea, but there was some confusion about when styles are applied. ...


2

You can do so with the code as found at http://tex.stackexchange.com/a/245685/28093 \documentclass[margin=1cm]{standalone} \usepackage{amsmath} \usepackage{pgfplots} \pgfplotsset{compat=newest} \usetikzlibrary{calc} %%% START MACRO FOR ANNOTATION OF TRIANGLE WITH SLOPE %%%. \newcommand{\logLogSlopeTriangle}[5] { % #1. Relative offset in x direction. ...


2

Using relative coordinates instead of absolute coordinates is the solution. Accordingly, rel axis cs is used instead of axis cs. It involves quite some math to derive an expression for \yCrel without using \yC, but this is the result (see code) and it works without giving the Dimension too large error. \documentclass[margin=1cm]{standalone} ...


2

Indeed your legend to name is defined multiple times. Whatever you put in the \begin{groupplot}[#1] as #1 will be put on all axis plots. Doing: \begin{groupplot}[/tikz/font=\small,...] \nextgroupplot ... \nextgroupplot ... \end{groupplot} is thus equivalent to: \begin{axis}[/tikz/font=\small,...] ... \end{axis} ...


3

You need to add axis cs: (axis coordinates) before each coordinate like (axis cs:0,0), because the axis coordinates are different from the actual ones. I changed your code slightly, and enlarged the maximum axis coordinates because your plot gets cut otherwise. Also, there's no need to specify the compatibility in two places. The first one was the right ...


1

In online compiler appears error with compat=1.8. In your code compat=1.8 appears in \pgfplotsset and like option in axis environment. I delete that and produce this \documentclass{standalone} \usepackage{pgfplots} \usepackage{amssymb,amsmath} \definecolor{prune}{rgb}{0.6,0.00,0.48} \definecolor{bleu}{rgb}{0.1,0.05,0.5} \begin{document} \begin{tikzpicture} ...


2

The correct code seems to be \documentclass[margin=1cm]{standalone} \usepackage{amsmath} \usepackage{pgfplots} \pgfplotsset{compat=newest} \usetikzlibrary{calc} \newcommand{\logLogSlopeTriangle}[5] { % #1. Relative offset in x direction. % #2. Width in x direction, so xA-xB. % #3. Relative offset in y direction. % #4. Slope ...


1

\pgfplotsextra is, roughly, the pgfplots command of the TikZ/PGF equivalent \pgfextra. There are two things interacting here. First of all, when it comes to path drawing execution, pgfplots is not TikZ for a very good reason. Because it has to create an axis based on the plotted entities such that the paths are tightly encapsulated by the axis limits, ...


2

This is not so much a solution as a demonstration. In the lower right corner are (\xmin,\xmax,\ymin,\ymax) computed without \pgfplotsextra and in the upper right corner with \pgfplotsextra. Using a calculator one can show thet e^\xmin=5 and e^\xmax=20,000, which correspond to the axis limits. \documentclass{standalone} \usepackage{pgfplots} ...


2

A MetaPost solution. It happens that I have already devised such a macro for a course I'm currently teaching, which can be applied to any function curve. Here it is, slightly modified and applied to the parabola y = 4x-x^2. The slopes are computed by MetaPost itself and rounded to an arbitrary number of digits with the help of the numprint package. (Since ...


2

% Mind section '4.17 Custom annotations' of the PGFplots manual Revision 1.12 (2015/01/31). \documentclass[margin=1cm]{standalone} \usepackage{pgfplots} \pgfplotsset{compat=newest} %%% START MACRO %%% \newcommand{\slopeTriangle}[5] { % #1. Relative offset in x direction. % #2. Width in x direction, so xA-xB. % #3. Relative offset in y ...


2

Please post a complete minimal example, so we can see all of your setup as well. Assuming some default setup, you can have the axis lines in the middle with the axis lines*=middle option. The xticks and yticks are set with their respective keys, and you can set the labels on the y-axis using the yticklabels key: \documentclass[border=1mm]{standalone} ...


2

You need to add the ybar option to the axis options, instead of to each plot individually. Note that the author of pgfplots recommends not to use the newest compat option, and also I think that loading the pgfplotslibrary units is redundant if you also load siunitx. Finally, pgfplots already loads tikz so no need for duplication there either :-) ...


2

Maybe this will help: instead of using a scope, shift the axis in the x direction. Write \begin{axis}[xshift=10cm]. Also, as a sidenote, you can create the triangle using \filldraw[red] (axis cs:1,1) -- (axis cs:2,2) -- (axis cs:3,1) -- cycle; Full MWE: \documentclass{standalone} \usepackage{tikz} \usepackage{pgfplots} \begin{document} ...


4

The percent character in the column header "Score Error (99.9%)" makes trouble because it removes the rest of the line as comment. The following example works around it by ignoring this character. Also the header entries are surrounded by quotes. Quoting seems unsupported by pgfplots. Therefore the example adds the quotes to the column title specification ...


2

PGF needs to know how to generate the special graphics instructions in the output files, and these differ between pdflatex and latex/dvipdfm. Thus, you can either use pdflatex (or latex / dvips) and configure nothing special, or you have to use a special entry in the .tex file in order to make PGF aware of the following dvi utilities (which are beyond PGF's ...


1

You specify compat twice. If you use just \pgfplotsset{compat=1.12} it works fine. At some point in its development, PGFPLOTS made draw commands in an axis environment default to the axis cs coordinate system. Using the earlier compat=1.5, \draw uses the generic PGF coordinates, and it looks like PGF axes are drawn at PGF (0,0).


7

You have used compat two times with \pgfplotsset{compat=1.5.1} at the last. So this prevails over compat=1.12. In older versions of pgfplots the coordinates for drawing should be mentioned as \draw[black] (axis cs: 0,0) ellipse [... Note the axis cs:. If you don't use axis cs:, the tikz coordinates are used for which the origin (0,0) lies at the lower ...


3

According to the pgfplots reference for /pgfplots/xmin, it holds During the visualization phase, i.e. during \end{axis}, these keys will be set to the final axis limits. You can access the values by means of \pgfkeysvalueof{/pgfplots/xmin} Consequently, you only need to enclose your computation and node generation by \pgfplotsextra and your code ...


4

This error message indicates that your version of pgfplots is older than 1.8 . According to your investigation, it is 1.5.1 . That means you have two options: upgrade pgfplots. The current stable is 1.12.1 at the time of this writing. change your files to contain compat=1.5. This might result in slightly different outcome compared to your old results with ...


4

It is because you are doing something that shouldn't be done. What I mean by that is just because you can do it does not imply you should do it. The problem here is a common one which is the \nullfont disabling and making spaces matter. I've tried to describe it here very briefly Setting a length with a key to a TikZ node that inside the node the regular ...


4

Inside an axis environment, all the "normal" TikZ commands are collected when they are first encountered and only executed at a later stage when the axis is finished. At that point, the auxiliary macros contain the values for the second triangle, so the second triangle gets drawn twice and the first triangle doesn't get drawn at all. You can fix this by ...



Top 50 recent answers are included