Contents
Can you use restrict y to domain in pgfplots?
While this might not be that surprising, you will have to notice that you can’t use domain, as well. The domain setting will be assumed to be described by the lowest and the highest sample point defined in your samples at directive. Using restrict y to domain helps you avoiding the pole issue.
What do you need to know about pgfplots?
PGFPlots package provides tools to generate plots and labeled axes easily. It draws normal plots, logplots and semi-logplots, in two and three dimensions. Axis ticks, labels, legends (in case of multiple plots) can be added with key-value options. It can cycle through a set of predefined line/marker/color specifications.
Where can I download pgfplots for my latex?
PGFPlots is freely available and is already part of your LaTeX Distribution. If you want to download it manually, go to and follow the instructions in the pgfplots.pdf manual. Please refer to http://sourceforge.net/projects/pgfplots/ for download information and latest stable releases.
Is the nth point valid in pgfplots?
By the way: every nth point is a valid pgfplots option, as well. Any values for samples or domain won’t help you with poles. To overcome this limitation, you either have to restrict the y range (solution) or to plot the segments separately restricting the x range (kludge).
How to use the pgfplots package in your document?
To use the pgfplots package in your document add following line to your preamble: You also can configure the behaviour of pgfplots in the document preamble. For example, to change the size of each plot and guarantee backwards compatibility (recommended) add the next line:
How to create a pgfplots plot in overleaf?
Open this pgfplots example in Overleaf. The following image shows the result produced by the code above: Because pgfplots is based on tikz the plot must be inside a tikzpicture environment. Then the environment declaration \\begin {axis}, \\end {axis} will set the correct scaling for the plot—check the Reference guide for other axis environments.
Why do you need more samples in pgfplots?
Unfortunately, this is counterintuitive: pgfplots uses a fixed number of samples (default: 25) that are equally spaced within the specified domain. Therefore, using a large domain gives you less precise sampling of the region you are actually displaying. In order to make the curve look smooth, you have to add more samples.