# Tag Info

-1

If you're looking for an easy way to plot implicit equations that doesn't require scripting you may want to try using Graphing Calculator 3D: http://www.runiter.com/blogs/math/plot-implicit-functions-3d.html

1

Many thanks to @martijnn2008 and @cmhughes! Here is the solution: \begin{figure} \centering \begin{minipage}[t]{.50\textwidth} \centering \begin{tikzpicture} \begin{axis}[ domain=-10:10, grid=major, xmin=-10, xmax=10, ...

5

Use scaled x ticks=false to remove the scaling on the x axis. If you also want to elimiante the scaling on the labels for the bars you can use every node near coord/.style={/pgf/number format/fixed}: Notes: I also added xmax=310000 to get the numbers within the box. Code: \documentclass{article} \usepackage{pgfplots} \pgfplotsset{compat=1.11} ...

3

Since you only want to move one tick mark, it is best to simply tweak it with a bit of a space. So something like extra x tick labels={$\frac{5}{6}$, \hspace*{0.5em}$1$, $\frac{5}{3}$} yields: Code: \documentclass[10pt]{amsart} \usepackage{tikz} \usetikzlibrary{calc,angles,positioning,intersections,quotes,decorations.markings} \usepackage{tkz-euclide} ...

4

There is nothing wrong with your code (though I wouldn't add standalone plus signs or I would also add []). The reason why they show up static is because the first 5 cycle definitions are with solid lines and with different markers which you turned off. From the manual If you shift the cycle list you will see that it is working OK. \documentclass[11pt, ...

3

You can add another \addplot command with a different samples at={...} key: \documentclass{article} \usepackage{pgfplots} \pgfplotsset{compat=1.7} \begin{document} \begin{tikzpicture}[ declare function={binom(\k,\n,\p)=\n!/(\k!*(\n-\k)!)*\p^\k*(1-\p)^(\n-\k);} ] \begin{axis}[ymin=0, xmin=-0.5,axis lines=left,xlabel={$k$}, ylabel={$P(X=k)$}, x label ...

5

You use \addplot table, but then provide a coordinate stream instead of a table. Also, you say y=Y, but there's no column called Y in your data: \documentclass{article} \usepackage{pgfplots} \usepackage{pgfplotstable} \pgfplotsset{compat = newest} \begin{document} \begin{tikzpicture} \begin{axis}[ title={BET Plot ...

3

You need to make sure that both your axes have the same width. In this case, that means that you also need to put the x=0.5cm, enlarge x limits=0.05 that you use in the first axis into the options for the second axis. To get the label right, set compat=1.8 or newer: \documentclass{minimal} \usepackage{pgfplots} \usepackage{filecontents} ...

5

You can get the real root using declare function={ realroot(\n,\x) = ((abs(\x))^(1/\n))*(\x)/abs(\x); } Then you get the following plot, which seems to agree with what WolframAlpha does: \documentclass[10pt]{article} \usepackage{pgfplots} \pgfplotsset{compat=1.11} \begin{document} \begin{tikzpicture}[ declare function={ ...

2

You need to add a % at the end of the \addplot[ boxplot prepared={ line. \documentclass[border=3mm]{standalone} \usepackage{pgfplots} \usepgfplotslibrary{statistics} \newcommand{\desboxplot}[6]{% \addplot[ boxplot prepared={% lower whisker={#1}, lower quartile={#2}, median={#3}, upper quartile={#4}, upper whisker={#5}, average={#6}, box extend=0.5, ...

2

I assume that you're satisfied with the code you have for the nine plots, and hence that the remaining task is to group the nine plots on a page. I suggest you create a dedicated environment called, say, "smallpic" to house each file and associated text. That way, you can save yourself a lot of repetitive typing. \documentclass[12pt]{article} ...

4

If you are plotting everything, then use groupplots \documentclass[margin=5mm]{standalone} \usepackage{pgfplots} \usetikzlibrary{positioning} \usepgfplotslibrary{groupplots} \pgfplotsset{compat=1.11} \begin{document} \begin{tikzpicture} \begin{groupplot}[group style={group name=my plots,group ...

4

You can use minipages to place the text within 0.3\linewdith and use \resizebox{}{}{} to scale the figure to fit in the minipage: Notes: As you don't want the images to float don't use a floating environment such as figure. The captions should be added outside of the \resizebox{}{}{} so that the text is not scaled. \vfill was used to vertically spread ...

4

Thanks to Jake for his comment, I plotted what I wanted. The plot seems a liitle ugly because it is crowded with four plots; however it is really nice to show mapped functions besides to their 3d shape plot. Also, the important point in plotting such graph was that the user should take care at which coordinate the side walls of the 2d plot is located. At the ...

4

Just using the standard way to use an optional argument (default value empty): \newcommand{\drawGraph}[1][]{...} % ^ ^----- empty default value % |-------- one argument This relies upon the fact that pgfplots treats xmax= as the key xmax having not been set at all. So the empty default value causes pgfplots to ...

5

It's because labels are in math mode so they don't apply right away. You can change this behavior by redefining the label printing command. I've done it here just for x to show the difference. Alternatively you can use a sanserif math font for the labels via Lua/XELaTeX \documentclass[border=5pt]{standalone} \usepackage{pgfplots} ...

5

You can use the contour gnuplot functionality for this, which uses gnuplot as a backend for doing the actual calculations. To compile the document, you need to have gnuplot installed on your system and shell escape must be enabled (e.g. pdflatex -shell-escape filename). PGFPlots makes the necessary gnuplot calls automatically. \documentclass{article} ...

2

Use unit vector ratio={2 1} to make the y-axis scaling half of the x-axis scaling. I've removed a number of things, which were not really relevant to your question, to more clearly illustrate the changes. The ticks and grid=major are just inserted for visual verification of the correct scaling. \documentclass[border=5pt]{standalone} \usepackage{pgfplots} ...

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 ...

4

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 ...

4

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, ...

2

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] ...

3

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 ...

Top 50 recent answers are included