Tag Info

New answers tagged

3

In addition to the other answer, more recent versions of pgfplots come with the style log ticks with fixed point. It does almost the same: it reconfigures the number printer such that ticks are displayed in fixed point format. Its logic is somewhat more complicated to avoid rounding inaccuracies and different log bases. Here is the result with this new ...


2

This here is actually more a comment than an answer. But since it is too long and contains an image, I would like to post it here. The short comment is: I cannot reproduce the problem. I tried it with \documentclass{standalone} \usepackage{pgfplots} \pgfplotsset{compat=1.9} \begin{document} \pgfplotsset{ S/.style={ scale only axis, ...


2

Here's the final result: The key to get rid of those sqrt values is to use none of the default ticks. Then you lose the default minor ticks, so you have to define minor ticks manually: logaxisx/.style={ xmode=log, xtick={0.02,0.05,0.2,0.5,2,5,20,50}, extra x ticks={0.01,0.1,1,10,100}, minor ...


2

You can modify the grid style (here say x axis) via adding major x grid style={draw=cyan!20}, to the axis options.


1

I plotted something similar to what you want using pgfplots. You can edit the legend transparency and its location to best fit what your plot you want to look like. %pdflatex \documentclass[margin=5mm]{standalone} \usepackage{tikz,pgfplots,pgfplotstable} \usetikzlibrary{patterns} \begin{document} \begin{tikzpicture} \begin{axis} [ ybar stacked, ...


1

Instead of enlargelimits=0.25, you need to specify how much pgfplots should introduce slack space around the plot. For example, using enlarge y limits={0.25,upper}, enlarge x limits=0.25, instead of enlargelimits=0.25 will give otherwise the extra space is added to both sides of the plot for both axis.


4

You can use \ifnum to test to see if \n is 1 or -1 and adjust the label: \ifnum\n=1 \textcolor{red}{$i$} \else \ifnum\n=-1 \textcolor{red}{$-i$} \else $\n i$ \fi \fi Notes: Added red color to make the changes more obvious. It is better to use pgfplots for graphing instead of just tikz. Code: ...


2

You can plot your question in imaginary plane with an easier code, using pgfplots. %pdflatex \documentclass[margin=5mm]{standalone} \usepackage{pgfplots} \pgfplotsset{compat=1.9} \begin{document} \begin{tikzpicture} \begin{axis} [ ytick ={-7,...,8}, yticklabels={$-7i$, $-6i$, $-5i$, $-4i$, $-3i$, $-2i$, $-i$, $0$, $i$, $2i$, $3i$, $+3i$, $+4i$, ...


2

This is your original plot: I think you want to edit the scale factor which is mentioned automatically by the pgfplots on your plots. I found a sample code on this answer on this site, which may help you. This is possible by using two codes bellow which are added to the \begin{axis}[] If you want to write your own preferred scale factor on the axis, ...


7

The current stable version of pgfplots is version 1.11 (released August 2014). It supports this if you write \pgfplotsset{compat=1.11} into your preamble. Without this statement, it will remain compatible with the old behavior. \documentclass{standalone} \usepackage{pgfplots} \pgfplotsset{compat=1.11} \begin{document} \begin{tikzpicture} \begin{axis}[ ...


1

This is because you are actually seeing a 3D box from above and not actually drawing a true 2D box. Hence the drawing order makes the line cornering different. You can enforce a workaround via extending the axis lines by adding axis line style = {shorten <=-0.5\pgflinewidth,shorten >=-0.5\pgflinewidth} to the 3D plot axis options and that would ...


4

The function is sampled with radians points however assumes degree input. You either need to add trig format=rad or use the function as sin(deg(x)). Then it draws correctly.


0

First you have some spurious end of line spaces. Second, you can use \hfil or \hfill along with \begin{tikzpicture}[trim axis left, trim axis right]. Third subfigure is deprecated, use subfig instead. \documentclass{article} \usepackage{subfig} \usepackage{tikz,pgfplots} \pgfplotsset{compat=newest} %% better use 1.11 instead of newest ...


8

This function can be declared and evaluated directly in PGFPlots, without the need for lua. You can declare the function for the binomial coefficient using declare function={binomcoeff(\n,\k)=\n!/(\k!*(\n-\k)!);} and then use that in the declaration of the hypergeometric distribution probability mass function: declare function={ ...


2

Turn my comments with OP into an answer so that the question won't be unanswered. Code \documentclass[tikz,border=10pt]{standalone} \usepackage{lmodern} \usepackage{pgfplots} \pgfplotsset{compat=newest} \usepackage{pgfplotstable} \begin{document} \pgfplotstableread[col sep=comma]{ month, 2012, 2013, 2014 January, 112798, 110052, 108772 February, ...


1

I've found an answer myself, although I'm not quite happy with it. It is possible to write out the restricted data set to disc, then read it in to a new table, and run the regression on the new table. I'm attaching a MWE below. I would prefer if this could be done without having to write to disc, but this solution at least works. \documentclass{article} ...


6

The atan function returns the value in degrees. You need to convert it into radians: \documentclass[a4paper,11pt]{article} \usepackage{pgfplots} \begin{document} \begin{tikzpicture} \begin{axis}[ domain=-10:10, xscale=1.5,yscale=1, xmin=-6, xmax=6, ymin=-2, ymax= 2, samples=1000, axis lines=center, ] \addplot+[mark=none] ...


4

pgfplots generates color bars if you add the colorbar key to the axis environment. A horizontal colorbar is possible by means of colorbar horizontal. Colorbars are (only) useful if there is some kind of "color data" in your axis: data which is mapped into a colormap. This is the case for scatter, mesh, surf, contour, and some other plot types. A simple ...


2

To automatically position the non-numeric data above the highest bar for each x coordinate, you can use y expr={max(\thisrow{ColHeadAA}, \thisrow{ColHeadBB})}. To print the non-numeric data, set point meta=explicit symbolic, nodes near coords in the \addplot options, and meta=TEST in the table options. \documentclass{scrartcl} \usepackage{pgfplots, ...


3

PGFPlots only prints minor ticks for logarithmic axes if the distance between consecutive major ticks is exactly one logarithmic unit. For example, consider this minimal example: \documentclass{article} \usepackage{pgfplots} \begin{document} \begin{tikzpicture} \begin{axis}[ ymode=log, domain=0:5, ymin=1e0, ymax=1e7, title={\texttt ymin = ...


0

you should set yminorticks=true in your axis options, if you want them and false if you don't want them. What I would also recommend you is to set ymin, ymax and ytick manually.


4

Since all your bars have the same width, there's no reason to use ybar interval. Instead, you can use ybar, bar width=1, bar shift=-0.5 (this requires \pgfplotsset{compat=1.8} or greater). \documentclass{standalone} \usepackage{pgfplots} \pgfplotsset{compat=1.11} \begin{document} \begin{tikzpicture} \begin{axis}[ xmin=0,xmax=5, ...


5

\documentclass[border=3mm,tikz]{standalone} \begin{document} \begin{tikzpicture} \foreach \i in {0,10,20,...,90} \fill[black!\i] (\i mm,0) rectangle ++(10mm,10mm); \end{tikzpicture} \end{document}


6

The default behavior of PGFplots is to use x coordinates as... well, coordinates. So naturally, the point with the lowest x value will appear on the left. What you want to achieve is to use the x column as symbolic tick labels instead of coordinates, and additionally use the line number as the proper x coordinate of the plot. The latter can be achieved with ...


1

You are right, the options are not reset for colorbar. I have fixed this in pgfplots. You can activate the fix in your tex files by means of \pgfplotsset{ every colorbar global/.append style={ zmin=,zmax=, } } Adding this to your preamble leads to


6

May be some thing like this: \documentclass{article} \usepackage{colortbl} \usepackage{arydshln,graphicx,xcolor,array} \begin{document} \arrayrulecolor{magenta}% \setlength{\arrayrulewidth}{1pt}% \begin{tabular}{c;{2pt/2pt}c|} \includegraphics[width=3cm]{example-image-a} & \includegraphics[width=3cm]{example-image-b} \end{tabular} ...


4

Instead of xtick=data, use some thing like xtick={0.5,1,1.5}. Change the values as you like. \documentclass{standalone} \usepackage{pgfplots} \usepgfplotslibrary{groupplots} \begin{document} \begin{tikzpicture}[scale=1.0, transform shape] \begin{groupplot}[group style={group size= 1 by 2, vertical sep=2cm},height=7cm,width=1.0\textwidth] ...


2

You can also use ticklabel style = {font=\tiny} in the axis options or \pgfplotsset. If you want separate styles, you can use yticklabel style = {font=\tiny,xshift=0.5ex}, xticklabel style = {font=\tiny,yshift=0.5ex} Full code: % arara: pdflatex % arara: pdflatex % arara: open \documentclass{standalone} \usepackage{pgfplots} ...


2

You can use to adjust the style to the tick labels: \pgfplotsset{every tick label/.append style={font=\tiny}} If you want to also shift the tick labels closer to the axis you can use: \pgfplotsset{every x tick label/.append style={font=\tiny, yshift=0.5ex}} \pgfplotsset{every y tick label/.append style={font=\tiny, xshift=0.5ex}}


3

Two approaches were proposed here. Since the every pin style is defined. Use of pin skill will have yellow color as shown on the top. However, the OP wants the [19] to be blue without yellow background then label skill is used. The basic idea: to draw the extra lines is needed for one pin to multiple points. If label style is prefered. \node[label ={[label ...


2

What you need is some kind of decomposition into intersection segments of your path with the X axis. There is the fillbetween library in pgfplots which allows to compute (and, typically, fill) intersection segments of path segments. It can also be used to draw individual intersection segments: \documentclass[tikz]{standalone} \usepackage{filecontents} ...


5

Using a slight variation of the command you provided: \draw[|<->|,red] ($(2,2.30288)!3mm!90:(2,1.60206)$) -- ($(2,1.60206)!3mm!-90:(2,2.30288)$) node[midway, right] {$\delta y$}; which yields: Notes: As you had hard coded the coordinates for (A) and (B), I inserted those into the above \draw. I also find it easier to place the ...


2

The reason for this is because of the big numbers but small differences at some point internal calculations exceed the dimension limit in TeX. A possible solution is to transform the coordinates to a smaller domain. This can be achieved by adding \pgfplotsset{x coord trafo/.code={\pgfmathparse{#1-735784.4}\pgfmathresult}} where the last number has to be ...


2

You can customize your nodes near coords key for your own needs. For example, if you use nodes near coords={% \pgfmathfloatparsenumber{\pgfplotspointmeta}% \pgfmathfloattomacro{\pgfmathresult}{\F}{\M}{\E}% \pgfmathsetmacro\mypostfix{\E<=2?0:(\E<=5?"k":(\E<=8?"M":"G"))}% \pgfkeys{/pgf/fpu}% \pgfmathparse{(\pgfplotspointmeta< 1Y1.0e3] ...


2

On page 126 in "12.2.1 Creating a Picture Using an Environment", the manual provides the following information: /tikz/every picture (style, initially empty) This style is installed at the beginning of each picture. \tikzset{every picture/.style=semithick} Note that you should not use \tikzset to set options ...


3

This is configuration bug in pgfplots: the default legend for mesh/surface plots relies on a colormap -- but it does not set mesh/color input=colormap. Consequently, it inherits the choice of the plot and is confused. A simple work-around is to add legend image post style={/pgfplots/mesh/color input=colormap}, to your option list (or to configure this in ...


1

The only builtin support to style grid colors is the distinction between x,y,z grid lines, major/minor grid lines, and the same choices for extra ticks. There is no builtin support for individually styled grid lines. You may need to use custom \draw commands to draw the special grid lines, perhaps combined with layered graphics to ensure that they are on ...


4

Observing @Peter Grill's comment, a workaround is to use the obtained data and extend the drawing. \pgfplotstableregressiona*x+\pgfplotstableregressionb Code \documentclass[tikz,border=5pt]{standalone} \usepackage{pgfplots,filecontents} \usepackage{pgfplotstable} \pgfplotsset{compat = newest} \begin{document} \begin{tikzpicture} \begin{axis}[ ...


4

The problem are the different tick formats of your axis. Here is an example with only 2x2 where it is solved. First of all, I created a 2x2 figure in Matlab using subplot(2,2,x) with x from 1 to 4. I exported the figure to tikz and got the following code: % This file was created by matlab2tikz v0.4.6 running on MATLAB 8.3. % Copyright (c) 2008--2014, Nico ...


3

Why TikZ? You could just save the figures from Matlab as an eps file and use the package subcaption. \documentclass{article} \usepackage[demo]{graphicx} \usepackage{subcaption}% http://ctan.org/pkg/subcaption \captionsetup[subfigure]{labelformat = parens, labelsep = space, font = small} \begin{document} \begin{figure} \centering ...


2

I've rechecked the pgfplots manual and setting axis equal=true in the axis options fixes the issue.


5

You don't need to use pgfplots, only (x,y,z) coordinates. The relation between them can be fixed in tikzpicture options. Next figure uses x=2cm,y=2cm,z=1cm. \documentclass{article} \usepackage{tikz} \usetikzlibrary{calc,arrows,positioning} \begin{document} \begin{tikzpicture}[ vector/.style={thick,black,>=stealth,->}, atom/.style={blue}, ...


5

"Templates" are called styles in pgf/TikZ/pgfplots parlance. These can be written once in the preamble (or even in a separate file which is then \input) and used throughout the document. The advantage here is that the code is cleaner and you can update the style in one place to update all plots consistently. See the preamble of the example for definitions, ...


4

When using xtick=data, PGFPlots only uses the x coordinates of the first \addplot command for determining the label positions. You can work around this by setting xtick={1,...,6}. To get the correct position of the bars, you should also set bar shift=0pt: \documentclass[border=5mm]{standalone} \usepackage{pgfplots} \begin{document} \begin{tikzpicture} ...


2

Run with latex->dvips->ps2pdf or with xelatex \documentclass{article} \usepackage{pst-func} \begin{document} \psset{xunit=1.2cm,yunit=10cm,plotpoints=200} \begin{pspicture}(-0.75,-0.06)(6.6,0.45) \pscustom[fillstyle=solid,fillcolor=blue!20,linestyle=none]{% fill area \psGammaDist[alpha=1.8,beta=0.9]{0.01}{3} \psline[](3,0)(0,0) } ...


9

To limit the domain used for evaluating the function, set domain=0:6. If you want the x axis to extend further than the domain, set xmax=10 (for example): \documentclass{article} \usepackage{pgfplots} \begin{document} \begin{tikzpicture}[ declare function={gamma(\z)= 2.506628274631*sqrt(1/\z)+ 0.20888568*(1/\z)^(1.5)+ 0.00870357*(1/\z)^(2.5)- ...


7

This would get you started \documentclass{standalone} \usepackage{pgfplots} \pgfplotstableread[header=false]{ 50 0.800 0.28135 0.283 100 0.800 0.28145 0.283 200 0.808 0.28150 0.286 500 0.808 0.28152 0.286 1000 0.808 0.28153 0.286 2000 0.808 0.28153 ...


6

I think what is going on is that hide axis is somehow still drawing the axis lines (but in white) and these are fading out portions your graph. If you comment out the hide axis in your MWE you will see this. According the pgfplots manual: hide axis=true|false: Allows to hide either a selected axis or all of them. No outer rectangle, no tick marks and ...


3

You are inside pgfplotsset which sets pgfplots keys. Bar width is a PGF key. You can supply the options to the axis in which the keys are also tried PGF key family if it can't find it inside the pgfplots family. If you want to use these options more than once you can save it in a style and provide to every axis or alternatively you can set it via ...


5

Converting my comment into an answer: As of pgf v3.0, the datavis library is released to CTAN (no longer CVS-only). So the objective answer is "use whichever you prefer". You will likely find proponents on both sides of the fence. But there is a greater user/community support base for pgfplots because, as you note, it is more mature at this point. I ...



Top 50 recent answers are included