# Tag Info

## New answers tagged pgfplots

0

You can change the color of the edge lines by setting faceted color=<color>, or disable them completely by setting faceted color=none. \documentclass{article} \usepackage{pgfplots} \pgfplotsset{compat=1.9} \pagestyle{empty} \begin{document} \begin{tikzpicture} \begin{axis}[% view={-213.5}{18}, xmin=0, xmax=1, ymin=0, ...

0

I found out that the color can be specified with the c argument of the table. As changing the values for every triangle is quite tedious, a simple (but not very elegant) solution is to modify the underlying color map of the axis: colormap={mymap}{rgb=(0,0,0); rgb=(0,0,0)} Now every edge is drawn in black.

5

The modifications: Added font=\scriptsize in legend style. Moved legend to the top by at={(rel axis cs: 0.5,1.05)} Changed width to width=1.5\fwidth, Removed all \phantom{...} Added \\[-2.5ex] \underbrace{\hphantom{\text{roposed},\pi_{\text{Th}}}}\\[-0.5ex] With these, we get Code: \documentclass{scrartcl} \usepackage{pgfplots} % Import der ...

2

A doubtless naïve possibility: \documentclass{article} % UNITS \usepackage{siunitx} \sisetup{per=slash, load=abbr} % GRAPHICS \usepackage{tikz} \usepackage{pgfplots} \pgfplotsset{width=7cm,compat=1.3} \begin{document} \begin{tikzpicture} \pgfplotsset{ scale only axis, scaled x ticks=base 10:3, xmin=0, xmax=0.06 } \begin{axis}[ ...

3

You have missed a parentheses (2 places) in \foreach[count=\i,evaluate={\s=int(4*\i-1)},evaluate={\e=int(4*(\i-1)) %<-- this one, you have only one of them. You forgot to load the subfig package which provides \subfloatcommand. Having said that, you can use the standard method of \resizebox: \documentclass[preprint,12pt,3p]{elsarticle} ...

1

Another trick is to define coordinates inside the axis environment then use them later. Note: One can also use relative coordinates instead of xshift and yshift. \documentclass[11pt]{report} \usepackage[T1]{fontenc} \usepackage{titlesec} \usepackage{calc} \usepackage{lmodern} \usepackage{lipsum} \usepackage{graphicx} \usepackage{tikz} ...

0

Based on egreg answer, here, I used picture to overcome the problem. The problem with \pic was the scale, the inserted picture was not originally scaled, it fit with the graph scale in x and y. Furthermore, it was difficult to handle minipages using \pic. The difference between them is depicted in the picture: \documentclass[11pt]{report} ...

2

You need to use axis cs: for specifying the coordinates of the point. With axis cs: 500,4 in \pic [scale=50] at (axis cs: 500,4) {m2}; and x=.006mm (it is too campy), you get

7

Since PGFPlots can't combine the plots from different \addplot commands, you'll have to use a single \addplot command. To only show the larger of the two distributions at each point, you can use \addplot3 [...] { max( bivar(mu11,sigma11,mu12,sigma12,rho), bivar(mu21,sigma21,mu22,sigma22,rho) )}; To use different colours for the two ...

3

The builtin methods of pgfplots only supports dates and has limited support for datetime. The following is a manually assembled solution to convert input seconds to some time format. Perhaps this might become a part of pgfplots eventually? \documentclass{article} \usepackage{pgfplots} \pgfplotsset{compat=1.10}% CF %use same colors as in foo.gp ...

2

Firstly x tick label style = {color=pie7,text width=2cm,align=center}, will specify a width for the labels and an alignment. Now the symbolic coords are really just an internal label (and so could be shorter) but what is printed as the label can be specified as xticklabels. Here you can use \slash instead of / allowing line breaks at these points. ...

7

pgfplots expects a different input format, namely a table of the form X Y Z . . . . . . . . . in which the matrix data is serialized into a long stream. It resembles matlab's matrix(:) syntax. Consequently, you can export you data by means of data = [ X(:) Y(:) Z(:) ] save -ascii P.dat data % save P.dat data -ASCII size(Z) data = -1.00000 ...

3

label and pin are node options, but the plot markers are not nodes, that's why those options don't produce any output. In this case, I wouldn't recommend using an \addplot command, since each of the points requires quite different styling. I'd simply use normal TikZ commands: \documentclass[varwidth=true, border=5pt]{article} ...

3

(I'm not entirely sure if this is what you're after.) By adding name=leg to the legend style, the legend box will get the (node) name leg. You can add nodes relative to this, if you place them outside the axis. For example: \documentclass[ a4paper ]{scrartcl} \usepackage{ amsmath, tikz, pgfplots, } \usepackage{lmodern} \usepackage[T1]{fontenc} ...

0

I tried this MWE (that you have not provided) and it seems work fine: % !TEX program = xelatex % !TEX encoding = utf8 \begin{filecontents*}{pdf.dat} 0 1 1 2 \end{filecontents*} \documentclass{memoir} \usepackage{pgfplots} \begin{document} \begin{tikzpicture} \begin{axis} \addplot file{pdf.dat}; \end{axis} \end{tikzpicture} \end{document}

6

This is old but I found it when I had the same problem. Now there is a new solution called trig format plots=rad. \begin{axis}[trig format plots=rad] ... See the manual section 4.3.3 Computing Coordinates with Mathematical Expressions. Just for search engines: pgfplots, trigonometric functions, radian, degree, wrong result, wrong plot

1

By default, matlab2tikz produces the code that enable scale only axis option of the axis environment (see 4.10.1 Common Scaling Options of the pgfplots documentation). Just remove that line from your .tikz file to solve the first issue. The second problem is more about your personal representation of the data, so I may only suggest to reduce the font or ...

4

Your const variable appears to be like a y variable and the plotted function is actually f(x,y) = sin(-x*y). This can be plotted directly in pgfplots: \documentclass{standalone} \usepackage{pgfplots} \pgfplotsset{ compat=1.11, trig format plots=rad, } \begin{document} \begin{tikzpicture} \begin{axis}[ view={0}{0}, enlarge z ...

6

You can use the approach from pgfplots: Placing node on a specific x-position (which used the same basic idea as Thruston's answer: finding the intersection with a vertical line). I've removed stuff from your example that wasn't related to the problem at hand, and used the PGF math engine instead of gnuplot, which works fine in this case. ...

6

Just for fun with PSTricks. The functions are intentionally made different from your case to let you modify them by yourself as an exercise. As the question is not easy to understand, I provide two answers. One of them should meet your requirement. Option 1: Equidistant tangent segments In this option, I make the tangent segments have the same length. ...

9

You can fix this problem by using the ybar interval style for both plots, but reversing the direction for the lower sum by using domain=17:1 instead of domain=1:17: \documentclass[border=5mm]{standalone} \usepackage{pgfplots} \pgfplotsset{compat=1.9} \begin{document} \begin{tikzpicture} \begin{axis}[ ...

3

Another option is use of clip within scope environment, based on the existing code. Code: \documentclass[border=10pt]{standalone}%[11pt]{article} \usepackage{pgfplots} \pgfplotsset{compat=newest} \usepgfplotslibrary{fillbetween} \usepackage{xcolor} \usetikzlibrary{patterns} \begin{document} \pgfdeclarepatternformonly[\LineSpace]{my north west ...

0

You can put the lower rectangles in a scope environment and also clip to the correct height. Try replacing \addplot [draw=green, fill=green!10, const plot mark right, samples=9, domain=1:17] {x^-1}\closedcycle; with \begin{scope} \clip (0,0) rectangle (6.5cm,1.6cm); \addplot [draw=green, fill=green!10, const plot mark right, samples=9, domain=1:17] ...

8

\documentclass[11pt]{article} \usepackage{tikz} \usetikzlibrary{patterns,angles} \begin{document} \tikz \draw (2,0) coordinate (A) -- (0,0) coordinate (B) -- (-1,-1) coordinate (C) pic [draw,->,red,pattern=north west lines] {angle = A--B--C} pic [draw,<-,blue,pattern=north east lines,thick,angle radius=1cm] {angle = C--B--A}; \end{document} ...

4

Here's a way to plot what you want in Metapost. MP provides an intersectiontimes operation which finds the points where two paths cross - here I've used it to find the points where each curve intersects an invisible vertical line at x=57/27. I then used the direction t of p and point t of p constructs to find the tangent and draw it in the right place on ...

2

The simplest solution in PSTricks just for fun. \documentclass{beamer} \usepackage{pst-plot} \begin{document} \begin{frame}{Test} \psgraph(0,0)(-3,0)(3,9){5cm}{6cm} \psplot[algebraic,linecolor=blue]{-3}{3}{x^2} \psframe[dimen=m,fillstyle=vlines,hatchcolor=red](-2,0)(-1.5,9) \endpsgraph \end{frame} \end{document}

3

This is unrelated to the use of beamer. To specify the colour for the pattern, you have to use draw=red, pattern color=red instead of just red: \documentclass{article} \usepackage{pgfplots} \usetikzlibrary{patterns} \begin{document} \begin{tikzpicture} \begin{axis}[ width=\textwidth, minor tick ...

3

Use pattern color=red should do the trick Code \documentclass{beamer} \usepackage{tikz,pgfplots} \usetikzlibrary{patterns} \begin{document} \begin{frame}{Test} \begin{tikzpicture}[remember picture] \begin{axis}[ width=\textwidth, minor tick num=1, axis y line=center, ...

3

Use a \foreach loop (part of pgf): \documentclass[crop]{standalone} \usepackage{pgfplots} \pgfplotsset{compat=1.11} \usepackage{filecontents} \begin{document} \begin{filecontents}{data01.dat} 0 0 1 1 2 2 \end{filecontents} \begin{filecontents}{data02.dat} 0 1 1 2 2 0 \end{filecontents} \begin{tikzpicture} \begin{axis} \foreach \num in ...

4


6

You can transform a color map to a PGF shading by means of \pgfplotscolormaptoshadingspec. Afterwards you can use tikz techniques to clip the resulting shading such that it shows only the visible area: \documentclass{article} \usepackage{pgfplots} \pgfplotsset{compat=1.10} \begin{document} \thispagestyle{empty} % #1: left offset in [0,1] % #2: width ...

5

\documentclass[]{standalone} \usepackage{pgfplots} \begin{document} \begin{tikzpicture} \definecolor{C1}{RGB}{19,128,67} \definecolor{C2}{RGB}{255,255,255} \definecolor{C3}{RGB}{154,0,79} \pgfdeclarehorizontalshading{someShading}{50bp}{ color(0bp)=(C1); color(25bp)=(C2); color(50bp)=(C3) } \clip (0,0) rectangle ++(6,2.5); \shade [shading=someShading](0,0) ...

3

If I understand correctly, your marker color should be taken from a color map, right? I believe a simple solution would be to use error as input for point meta. That way, you get the mapping into the color map for free. Of course, we will need to use a different key to satisfy scatter/classes. My idea is that we simply exchange the value of point meta right ...

5

While it is possible to access table elements by means of \pgfplotstablegetelem{0}{RED}\of{\test}, I would recommend to move the code which defines colors into the \addplot command: pgfplots supports advanced scatter plots in which you can define how each scatter point it is to be drawn. This is more efficient in TeX. A solution could be ...

6

You are clearly a mathematician or something pretty close since your sentences are always inverted in an (ε, δ) way. You have to read the math backwards but the sentence forwards to decode :P \documentclass[]{article} \usepackage{pgfplotstable} \pgfplotsset{compat=1.10, perf name table/.default=mytable} \pgfplotstableread{ ode23 ode45 ...

2

Since the axis environment is postponing evaluation of some things until \end{axis}, the variables \temps and \angle don't exist anymore by then. In that case, you can use \pgfplotsinvokeforeach that immediately substitutes the loop counter for any #1 given in the loop body. The only drawback is that it doesn't support multiple loop variables, so you have to ...

3

Add axis line style = {draw=white,line width=0.0001pt}, to the options (bit of a hack though). You can even omit draw=white and simply put axis line style = {line width=0.0001pt},. Line is there but invisible. \documentclass{article} \usepackage{tikz} \usepackage{pgfplots} \usetikzlibrary{pgfplots.polar} \pgfplotsset{compat=newest} \begin{document} ...

3

If you add the lines axis on top,% Question 2 axis line style = {very thick,shorten <=-0.5\pgflinewidth}, %Question 1 in your %Axis option section, then you are done.

4

Instead of restructuring your input data, you can also do this automatically via PGFPlots restrict y to domain* feature. Your example would then be plotted by the following source code: \documentclass[border=5mm]{standalone} \usepackage{pgfplots} \pgfplotstableread{ Year OneCol SecCol ThirdCol ForthCol 2005 10 50 -10 30 2006 -40 ...

1

There is another workaround to the described problem. By adding disabledatascaling to the list of axis parameters, the weird behavior is gone. Unfortunately, this does not work in case of numbers larger than +/- 16,000 and in case of very small floating point numbers, but for many other cases it works. Here is the resulting source code: ...

2

\documentclass[pstricks,border=0pt,12pt,dvipsnames]{standalone} \usepackage{amsmath} \usepackage{pst-plot} \usepackage{pst-math} \usepackage[nomessages]{fp} \FPeval\XMin{0-0} \FPeval\XMax{6} \FPeval\YMin{0-0} \FPeval\YMax{36} \FPeval\XOL{0} % of DeltaX \FPeval\XOR{1/3} % of DeltaX \FPeval\YOB{0} % of DeltaY \FPeval\YOT{1/3} % of DeltaY \FPeval\DeltaX{1} ...

3

I guess you want to continue the previous curve with a new one, so I cooked up semi-automatic style but can be automated by placing a node in the end of the previous curve converting its coordinates into axis coordinates and supplying to the next as the initial point. It mainly abuses the expr accum column type with an initial value. You need to add a zero ...

4

A solution with PGFPlots. I made the parameters similar to Paul's post, the differences are I showed \pgfplotsinvokeforeach which is capable of expanding it's argument, not needed here but good to know for the case \foreach would not work \addplot instead of plot directly working with radian instead of multiplying a 180/pi factor, a new feature of pgfplots ...

4

Combining our chat and the comment to give some ideas though the real solution is mostly art instead of technique. pgfplots doesn't create a miracle within TeX. It simply uses PGF for harvesting all the points(or data points) and then tells TikZ there you go these are the points these are the colors and linetypes, deal with it. When harvesting it collects ...

4

It's a typo since options in the key value syntax needs a separating comma. This would work; \pgfplotsset{ colormap={something}{ color(0cm)=(blue); color(1cm)=(orange!75!red) },%<---- comma here colormap={somethingelse}{ color(0cm)=(white); color(1cm)=(orange!75!red) } }

3

\documentclass[tikz]{standalone} \usepackage{pgfplots} \pgfplotsset{compat=newest} \usetikzlibrary{plotmarks, calc, intersections} \usepackage{amsmath} \newlength{\radius} \begin{document} \begin{tikzpicture} \begin{axis}[% width=10cm, height=10cm, axis x line = middle, axis y line = middle, scale only axis, xlabel={x [mm]}, ...

5

When you compile your code, you get this warning: Package pgfplots Warning: running in backwards compatibility mode (unsuitable t ick labels; missing features). Consider writing \pgfplotsset{compat=1.10} into your preamble. on input line 5. For more details on compatibility please read pgfplots manual, section 2.2 Upgrade remarks, page 8 (in my ...

12

pgfplots extensively uses \edef and it's not easy to find which one is responsible for this. My suggestion is to redefine \mathbb so it uses \protected instead of the traditional LaTeX protection mechanism, which fails in \edef. The \protected method, instead, is safe. \documentclass[varwidth=true, border=2pt]{standalone} \usepackage[utf8]{inputenc} % this ...

4

Comparison matplotlib's PGF backend Plots will be saved as PGF commands, which are lower-level and thus less suitable for manual editing. This only really matters if you aren't going to go back to Python when you need to change things. (You can also save plots directly to PDF instead.) The layout will be (more or less) what the matplotlib developers ...

4

Here's a quick bash script to check for instances of RGB colors: #!/bin/sh pdftops $1.pdf -eps$1.eps status=$(grep -o "RGB"$1.eps | wc -l) echo "$status instance(s) of RGB colorspaces found in file$1.eps" exit \$status And a .bat version for Windows: @echo off pdftops %1.pdf -eps %1.eps type %1.eps | find "RGB" /c > __my%1.tmp set /p ...

Top 50 recent answers are included