Note: I'm assuming you're using pgfplots
v1.8.
You're passing the no markers
option to \addplot+
, but no markers
is an option available for the axis
environment, not for \addplot
commands. That's likely the problem.
no markers
(assuming it is passed to axis
) does exactly what you want, i.e. disable all plotmarks on all the graphs within that axis
environment; Torbjørn T.'s comment is sound.
\begin{axis}[no markers,...]
\addplot+[...] ... ;
...
\end{axis}
To disable markers on a given \addplot
(or \addplot+
), you can pass the mark=none
option to that command.
\begin{axis}[...]
\addplot+[mark=none,...] ... ;
...
\end{axis}
However, neither
\addplot+[no markers,...] ... ;
nor
\begin{axis}[mark=none,...]
...
\end{axis}
will produce the desired result, as your MWE demonstrates.
References:
Addendum
(following a conversation with percusse)
Revision 1.8 (2013/03/17) of the pgfplots
manual also makes one reference (in the last code sample of section 5.8.1) to a no marks
option for \addplot
, but this option is documented nowhere in the manual. Perhaps the maintainer can shed some light on the matter if he finds this post, but for now, it's safe to assume that the no marks
option has become obsolete and that it's probably best not to use it from now on.
Edit: the following code produces the desired output for me.

\documentclass[12pt,a4paper]{article}
\usepackage{pgfplots}
\begin{document}
\begin{figure}[htb]
\centering
\pgfplotsset{domain=-1:1}
\begin{tikzpicture}[baseline]
\begin{axis}
[
legend columns=-1,
legend entries={$x^2$;,$x^3$;,$x^4$;,$x^5$},
legend to name=named,
width=6cm, height=6cm,
xlabel= {$x$},
ylabel={$f(x)$},
legend style={draw=none},
no markers,
]
\addplot+[smooth, color=black, dashed]{x^2};
\addplot+[smooth, color=black, solid] {x^3};
\addplot+[smooth, color=black, dashdotdotted] {x^4};
\addplot+[smooth, color=black, dashdotted] {x^5};
\end{axis}
\end{tikzpicture}
\hspace{0cm}
\centering
\begin{tikzpicture}[baseline]
\begin{axis}
[
width=6cm, height=6cm,
xlabel= {$x$},
ylabel={$f'(x)$},
no markers,
]
\addplot+[smooth, color=black, dashed]{2*x};
\addplot+[smooth, color=black, solid] {3*x^2};
\addplot+[smooth, color=black, dashdotdotted] {4*x^3};
\addplot+[smooth, color=black, dashdotted] {5*x^4};
\end{axis}
\end{tikzpicture}
\ref{named}
\caption{Minimum working example.}
\end{figure}
\end{document}
forget plot
. This key leaves the \addplot
in question out of the legend.
\documentclass[a4paper]{article}
\usepackage{pgfplots}
\usepgflibrary{shapes.geometric}
\usetikzlibrary{patterns,arrows}
\begin{document}
\definecolor{plotrangecolor}{HTML}{D8D8D8} %{D8D8D8}
%%
%% http://tex.stackexchange.com/questions/29359/pgfplots-how-to-fill-the-area-under-a-curve-with-oblique-lines-hatching-as-a
%%
\tikzset{
hatch distance/.store in=\hatchdistance,
hatch distance=10pt,
hatch thickness/.store in=\hatchthickness,
hatch thickness=2pt
}
\makeatletter
\pgfdeclarepatternformonly[\hatchdistance,\hatchthickness]{flexible hatch}
{\pgfqpoint{0pt}{0pt}}
{\pgfqpoint{\hatchdistance}{\hatchdistance}}
{\pgfpoint{\hatchdistance-1pt}{\hatchdistance-1pt}}%
{
\pgfsetcolor{\tikz@pattern@color}
\pgfsetlinewidth{\hatchthickness}
\pgfpathmoveto{\pgfqpoint{0pt}{0pt}}
\pgfpathlineto{\pgfqpoint{\hatchdistance}{\hatchdistance}}
\pgfusepath{stroke}
}
\begin{tikzpicture}
\begin{axis}[
xmin=1, xmax=15,
domain=1:15,
ymin=0, ymax=1.1,
no markers,
enlargelimits=false,
xlabel={x},
ylabel={y},
legend style={
cells={anchor=west},
legend pos=south east
}
]
\addplot[mark=none,
domain=2:4,
pattern=flexible hatch,
hatch distance=10pt,
hatch thickness=0.5pt,
draw=none,
pattern color=plotrangecolor,
area legend,
forget plot] {2} \closedcycle;
\addplot[mark=none,
domain=8:14,
pattern=flexible hatch,
hatch distance=10pt,
hatch thickness=0.5pt,
draw=none,
pattern color=plotrangecolor,
area legend,
forget plot] {2} \closedcycle;
\addplot coordinates {(1,1) (4,0.4) (7,0.6) (8,0.5) (14,0.2)};
\addplot coordinates {(1,0.2) (3,0.3) (5,0.7) (9,1) (14,0.5)};
\addlegendentry{value 1}
\addlegendentry{value 2}
\end{axis}
\end{tikzpicture}
\end{document}
Best Answer
Assuming that odd pages are always on one side and even on the other, you can add the package ifthen
and then use the page number to determine the side
i.e. use that line just inside your figure environment if you're wrapping a plot in one. Now replace the line you have with
I'm not sure how this will interact with floats, but I imagine it'll work.