# Is there a common pgfplots styles/templates repository

I (try to) use the same plot layout in pgfplots everytime. I keep having to input the same details and although I do my best to cut and paste, it would be great if there were a simple set of chart types that could be used over and over again.

I know the value of pgfplots and pgfplottables is the ability to change everything and anything but most people use the same simple plots each time.

Basically, is there a simple repository/ set of templates for eg scatter plot, line plots, area charts, (no pie charts;) ), pareto plots, linked axes (like in a previous question of mine how to have linked axes on plots) and similar to this question on how to generate chart templates.

I am not requesting Excel Templates but more simpler pgfplots styles which can be selected out of the box with minimal user adjustment/interaction. By all means have the user change titles, legend, marks etc but the overall layout can be a style.

Should this be a community wiki question?

Or for some hardliners out there should it be closed immediately and removed!

EDIT: Following the comments from @JosephWright and @ChristianFeuersaenger I have decided to add the following:

Would pgfplots users post some code of their favourite plot styles, giving the type of plot (Scatter, Bode, Pareto, Histogram, etc) and maybe a picture of it. (or at least an MWE so people can check it out themselves)

-
I think the problem here is that there are simply too many variables to make a general 'archive' usable. At work, I've set up a set of half a dozen templates for cases which are common for us. These rely on how we present our data, and how we get it as input. –  Joseph Wright Aug 2 '12 at 12:16
@JosephWright I had that feeling, I suppose maybe I should have asked for people to contribute their most used styles/templates and how and where they use it and post an example. –  Leeser Aug 2 '12 at 13:11
Nevertheless, I (as package author) have the feeling that the predefined bar plot styles could be better. My problem is that I do not have the time to extract well-chosen styles from user questions. The same might apply for your styles as well. So, if you believe that you have found some default style which is of value for others as well, then feel free to post it. –  Christian Feuersänger Aug 2 '12 at 13:59
@ChristianFeuersänger Yes, I think that's what I want: examples of "good" "nice" plots and the circumstances they are used in. How you define good and nice are another matter and not for this forum. I will come back to this and post my own examples of what I use and when over the next while –  Leeser Aug 2 '12 at 15:00
@Leeser Do you search something like texample.net/tikz/examples/tag/pgf-20 or my TikZ examples: github.com/MartinThoma/LaTeX-examples ? –  moose Aug 9 '12 at 5:06

A template library for different plots styles would not work, because there a to many different kinds of data and ways to present the data. Futhermore the style depends on the personal taste. For example I prefer to have the ticks outside of the plot, other find it more elegant to have them inside of the plot. Next question is if the opposide axis should have ticks or not.

Coming back to your question, you do not have to repeat yourself by "copy and paste". You can define your own styles and reuse them. Hence if you change your mind or your supervisor you only have to change it in one place. Here is one example:

\documentclass{standalone}

\usepackage{pgfplots}
\pgfplotsset{compat=1.5}
\usepackage{siunitx}
\SendSettingsToPgf

% define a general plot style
\pgfplotsset{general plot/.style={
xtick pos=left,
ytick pos=left,
enlarge x limits=false,
minor x tick num=1,
every x tick/.style={color=black, thin},
every y tick/.style={color=black, thin},
tick align=outside,
xlabel near ticks,
ylabel near ticks,
}
}

% define a plot style for absorbance
\pgfplotsset{ir absorbance/.style={
general plot, % reuse the general plot style
x dir= reverse,
ytick = \empty,
% insteed of hard coding the unit you could also use
% the pgfplots unit library
xlabel=Wavenumber (\si{\per\centi\metre}),
ylabel=Absorbance (a.\,u.),
}
}

\pgfplotsset{ir absorbance data/.style={mark=none}}

\begin{document}
\begin{tikzpicture}
\begin{axis}[ir absorbance,
domain=2000:2200, samples=100 % only needed for the function plottiong
]
\addplot[ir absorbance data] { % here you would have: table[...] {mydata.txt}
exp(-((x-2080)^2/40))
};
\end{axis}
\end{tikzpicture}
\end{document}


-