Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

For most of the functions I have to plot with \addplot of pgfplots, I have to set [samples=200] to make them look smooth enough. I was wondering if there is some option to set the default sample number to a specific value so that I don't have to type it over and over again. I could not find one.

Is there such an option?

share|improve this question
    
possible duplicate of Global variables for all tikz drawings in a document –  zeroth Oct 10 '12 at 20:26

1 Answer 1

up vote 8 down vote accepted

Many options in the pgf, TikZ and pgfplots family have all their options defaulted in some way. This also means that you can set them wherever you want and obtain a default.

In this case you can set the option in the preample or where-ever needed as this:

\pgfplotsset{samples=200}

This will make all subsequent plots using the samples key use 200 samples.

Inspired by cmhughes, for another question I have answered describing the scopes of keys and how they can be used in a short generalized manner, see Global variables for TikZ drawings

share|improve this answer
1  
Thanks. I actually tried this, but seems I made a typo... sample instead of samples... –  Foo Bar Oct 10 '12 at 18:05
1  
and of course, it can be overwritten locally, e.g samples=15 –  cmhughes Oct 10 '12 at 18:26
    
@cmhughes maybe this is actually a dublicate of my added link? –  zeroth Oct 10 '12 at 19:04
1  
@zeroth agreed; +1 for both :) –  cmhughes Oct 10 '12 at 19:50

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.