# pgfplots - How can I set all the default line widths / thickness values to a certain value?

Upon discussion and examining a few printouts (by my own printer) of some pages of a document, I decided to try and change the line widths to another default value, e.g. semithick (a little increase to 0.6pt from the default 0.4pt, which equal thin). The printouts by the big commercial machines in a shop might produce satisfactory results for thin but I'd like to do it the 'rather safe than sorry'-way.

How can one do this?

## MWE

\documentclass{scrartcl}

\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{lmodern}

\usepackage{
tikz,
pgfplots,
}

\usetikzlibrary{
intersections,
calc
}

\begin{document}
\begin{center}
\begin{tikzpicture}
\draw
(0,0) coordinate (A)
(3,3) coordinate (B)
(0.5,1) coordinate (C)
(2.5,1) coordinate (D)
;
\draw[thick] (A) rectangle (B);
\draw[orange, ultra thick, ->] (C) -- (D);
\end{tikzpicture}
\end{center}
\begin{center}
\begin{tikzpicture}
\begin{axis}
\end{axis}
\end{tikzpicture}
\end{center}
\end{document}


On page 126 in "12.2.1 Creating a Picture Using an Environment", the TikZ 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 directly. For instance, if you want to use a line width of 1pt by default, do not try to say \tikzset{line width=1pt} at the beginning of your document. This will not work since the line width is changed in many places. Instead, say \tikzset{every picture/.style={line width=1pt}}. This will have the desired effect.

For creating the the intended effect on

• axis line width,

• plot line width,

• grid line width and

• legend line width,

I implemented the relevant code in the MWE. Implied and accepted is of course that \draw commands without any further detailed line widths will adhere to these settings.

If anyone has experience with this or spotted an error please do leave a comment or a reply with improvements.

## Solution

\documentclass{scrartcl}

\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{lmodern}

\usepackage{
tikz,
pgfplots,
}

\usetikzlibrary{
calc
}

%===================================================
%SOLUTION STARTS HERE - comment out to see change
%===================================================
\newcommand{\mybasiclinewidth}{semithick}
%source is page 126 in the manual
\tikzset{
every picture/.style={
\mybasiclinewidth} %or use: "line width=1 pt,"<-- note:if you write line width, you must use a value with unit
}
\pgfplotsset{
every axis/.append style={
\mybasiclinewidth,
grid style={
\mybasiclinewidth,
},
tick style={
\mybasiclinewidth,
},
},
}
%===================================================
%SOLUTION ENDS HERE - comment out to see change
%===================================================

\newcommand{\linevertspace}{-0.3cm}

\begin{document}
\begin{center}
\begin{tikzpicture}[font=\footnotesize\sffamily]
\draw
(0,0) coordinate (thinLEFT)
($(thinLEFT)+(0,\linevertspace)$) coordinate (semithicktestLEFT)
($(semithicktestLEFT)+(0,\linevertspace)$) coordinate (semithickLEFT)
($(semithickLEFT)+(0,\linevertspace)$) coordinate (thickLEFT)
%
($(thinLEFT)+(3,0)$) coordinate (thinRIGHT)
($(semithicktestLEFT)+(3,0)$) coordinate (semithicktestRIGHT)
($(semithickLEFT)+(3,0)$) coordinate (semithickRIGHT)
($(thickLEFT)+(3,0)$) coordinate (thickRIGHT)
;
\draw[thin] (thinLEFT) -- (thinRIGHT) node [right] {thin};
\draw (semithicktestLEFT) -- (semithicktestRIGHT) node [right] {$\leftarrow$ default line width!};
\draw[semithick] (semithickLEFT) -- (semithickRIGHT) node [right] {semithick};
\draw[thick] (thickLEFT) -- (thickRIGHT) node [right] {thick};
\end{tikzpicture}
\end{center}
\begin{center}
\begin{tikzpicture}
\begin{axis}
`