Home > tikz pgf > Thickness of pgfplot line makes data look jagged

# Thickness of pgfplot line makes data look jagged

April 14Hits:3

I am trying to plot some experimental data. When I plot the data using tikzpicture/pgfplots, the data seems "noisy". It becomes less "noisy" when I use the keyword each nth point={n}, where I increased n to 1, 10, 50, 100 (see attached picture). However, when increasing n, I am essentially not being true to my recording. I was wondering if you could help me remove the "noise" that seems artificial while using my whole data set.

every n={1}

every n={10}

every n={50}

every n={100}

The code I use is as follows:

\documentclass[11pt]{article} \usepackage{tikz} \usetikzlibrary{plotmarks} \usepackage{amsmath} \usepackage{pgfplots} \usetikzlibrary{matrix} \usetikzlibrary{decorations.pathmorphing,patterns} \usepgfplotslibrary{external} \tikzsetexternalprefix{figurescache/} \pgfplotsset{compat=newest} \tikzset{external/system call={lualatex \tikzexternalcheckshellescape -shell-escape -synctex=1 -halt-on-error -jobname "\image" "\texsource"}} \tikzexternalize[mode=list and make] \begin{document}  \begin{tikzpicture}[scale=0.6] \begin{axis}[hide x axis, ymax={90}, ymin={-90}, xmin={0}, xmax={400}] \addplot[very thick, color=black, each nth point={1}]table[x=t,y=rec]  {./data/fig1data.dat}; \end{axis}  \end{tikzpicture} \end{document} 


Edit: @Darthbith suggested I add the option /tikz/line join=bevel to my axis. It does a phenomenal job in removing the noise. There is a tiny bit of jaggedness when you zoom in to the plot, but it is already great. Here is the link to data I have used in the plots I have attached to this post.

You can add the option /tikz/line join=bevel to the axis options. This causes PGFPlots to draw the line segments between points with beveled edges instead of sharp (mitered) edges. The other options for line join are miter and round, which are shown below.

With a large number of data points spaced relatively close together in the x-axis and relatively large changes in the y-axis, the miter default option often produces the appearance of noise. Using bevel causes the drawing not to go much past where the point actually is. You can also look at the option /tikz/miter limit. Both of these options are described on page 167 of the PGF 3.0.1a manual.

\documentclass{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=1.12}
\begin{document}

\begin{tikzpicture}
\begin{axis}[
hide x axis,
ymax={90},
ymin={-90},
xmin={0},
xmax={400},
/tikz/line join=bevel,
]
\addplot[very thick, color=black] table[x=t, y=rec]  {texexchange_data.txt};
\end{axis}
\end{tikzpicture}
\end{document}



## Related Articles

• ### Thickness of pgfplot line makes data look jagged April 14

I am trying to plot some experimental data. When I plot the data using tikzpicture/pgfplots, the data seems "noisy". It becomes less "noisy" when I use the keyword each nth point={n}, where I increased n to 1, 10, 50, 100 (see attached

• ### Combining line chart data with bar plotJune 26

Context I recently got a paper published and was told that I need to convert the word file I submitted to latex for camera ready purposes. Problem is, I don't know LaTeX but I have always wanted to learn it. All is fine and straight forward except fo

• ### How to adjust the thickness of SOME lines in a Word tableApril 29

I have a table in Word 2010 and would like sets of rows to be distinguished from other sets, but still all be in the same table. So, I would like a thicker grid line between some of the rows. But I can't see how to do that. I can adjust the thickness

• ### Go to last line with data, Excel 2007May 21

Is there any button combination to jump directly to the last line containing data in Excel rather than scrolling through thousands of lines? --------------Solutions------------- You can also try CTRL+Down Arrow key. This will take you to the last non

• ### xl2tpd[845]: parse_config: line 13: data 'ipsec sared=yes' occurs with no contextSeptember 24

When I executed xl2tpd I amhaving following error. # xl2tpd -D xl2tpd[845]: parse_config: line 13: data 'ipsec sared=yes' occurs with no context xl2tpd[845]: init: Unable to load config file When I remove the "line 13" I having same error with &

• ### 10 Top of the Line jQuery Date Popup PluginsSeptember 27

With these 10 Top of the Line jQuery Date Popup (Datepickers) plugins, you can typically enrich your forms in a matter of minutes and your users will definitely love it! Most of them are designed to open up a clickable calendar popup once users activ

• ### 3D surface in pgfplots with given data January 1

I am trying to make a 3D surface in pgfplots with input data. I am not able to get the expected graph. I would highly appreciate if you could point out to me what I am missing. \documentclass{standalone} \usepackage{pgfplots} \usepackage{filecontents

• ### Counting the numbers of lines of data as it comes in? May 1

This question already has an answer here: How to do a continous 'wc -l' with gnu texttools? 4 answers I am currently connected to the Twitter Stream, and I would like to count the number of lines of data as they come in. I know I can do wc-l to just

• ### extracting a line of data from an excel spreadsheetSeptember 29

I need to extract a line of data from a excel spreadsheet and transfer it to another sheet. I need to search for a series of dashes (- - - - -) and then extract the line of data that is 2 lines below the dashes. --------------Solutions------------- E

• ### Table component for scrolling through lines of dataDecember 3

I'm working on a table component that is able to scroll through millions of lines of data. Not bad for the front end. The way I'm doing this is to only render a small table with 10 rows and then, when the user scrolls, I change the data in that table

• ### Excel - Extracting multiple lines of data from single cell to multiple cellsNovember 6

I have a mailing list that's setup in Excel. Each cell has an entire address list. I need each line of data from each cell extrapolated to the appropriate columns in order to sort the address correctly. For example: John Smith 123 Main St. New York,

• ### Draw a line between data points in two different pgfplots (subfigures)April 26

I have two different pgfplots in two subfigures. I want to draw a line between the red circled data points and the blue ones. I added lines manually with LibreOffice Draw to show you what I mean. My code is the follwing: \begin{figure}[!htbp] \center

• ### PGFPlot no line between data points when reading from tableJuly 5

I have been searching stackexchange aswell as the pgfplots and pdfplotstable documentation. My problem is that when i read into the data from a *.txt file and I select the columns and rows i want to plot only the data points get plotted and no line b

• ### PGFPlots: line opacity gradient?August 3

Imagine a very simple PGFPlot, e.g.: \begin{tikzpicture} \begin{axis} \addplot+[no marks]{x^2}; \end{axis} \end{tikzpicture} How can I have the line "fade out" from the left to the right of the axis? I.e., how can I gradually vary the opacity of

• ### pgfplots: post-processing data created with gnuplotFebruary 8

I have managed to use pgfplots' gnuplot option to solve an implicit equation: \documentclass{standalone} \usepackage{tikz,pgfplots} \begin{document} \begin{tikzpicture} \begin{loglogaxis}[ xmin=8e2, xmax=1e8, ymin=0.008, ymax=0.1 ] \addplot[solid,raw

• ### pgfplots: lines and markers in different colorsOctober 1

With pgfplots, I am creating a simple coordinate plot with error bars like this: \documentclass[crop,10pt]{standalone} \usepackage[english]{babel} \usepackage{pgfplots} \begin{document}% \setlength{\linewidth}{246pt}% \begin{tikzpicture} \begin{axis}

• ### Pgfplots and confidential dataSeptember 13

I have a table which contains confidential informations but there is no problem to publish the boxplot resulting of the table. To produce the boxplot, I am using pfgplot, which reads directly the data from the table. Is it safe to use the resulting b

• ### Contour plot using pgfplots where some data entries are NaNSeptember 16

I would like to make a contour plot of data that has been saved in a text file that consists of three columns where the columns are x_i, y_i and z_i and some elements z_i are NaN. I use MikTex 2.9 with WinEdt 8.0. I have installed gnuplot and can inv

• ### pgfplots with big data: dimension too largeSeptember 26

I am trying to plot a big file of data http://www.warcomeb.it/private/load.csv.zip with this code: \documentclass{standalone} \usepackage{pgfplots} \pgfplotsset{/pgf/number format/use comma,compat=1.12} \begin{document} \begin{tikzpicture} \begin{axi