1

Updated: (See plot below)

I'm new to using PGFPlots and am trying to only display a mark in my plot legend instead of a mark with a line through it. I saw that a user posted a similar question here: Display mark instead of line in tikz legend1 but I'm still having trouble. I want my legend to show a red line for "Expected pvalue" and a black point for "Adjusted pvalue". I tried adding "only marks" to addplot but the legend still shows a point with a line through it.

This is what I have so far:

\begin{tikzpicture}

\begin{axis}[%
width=3.373in,
height=3.667in,
at={(0.699in,0.495in)},
scale only axis,
xmin=0,
xmax=605764,
xtick={0,151441,302882,454323,605764},
scaled x ticks=false,
reverse legend,
xticklabels={{0},{0.25},{0.50},{0.75},{1.00}},
xlabel={Index},
ymin=0,
ymax=1,
ytick={0,0.25,0.5,0.75,1},
ylabel={Probability},
axis background/.style={fill=white},
title style={font=\bfseries},
title={Title},
axis x line*=bottom,
axis y line*=left,
legend style={at={(0.97,0.03)}, anchor=south east, legend cell align=left, align=left, draw=white!15!black}
]

\addplot [color=red, line width=1.0pt]
  table[row sep=crcr]{%
0   0\\
605764  1\\
};
\addlegendentry{Expected pvalue}

\addplot [only marks, color=black, draw=none, mark size=1.3pt, mark=*, 

mark options={solid, black}] 
      table[row sep=crcr]{%       
1   1.65286473929882e-06\\
53  9.91721171885729e-05\\
57  0.000119006494060159\\
137 0.000284293317236006\\
169 0.000345449429005384\\
};
\addlegendentry{Adjusted pvalue}

\end{axis}
\end{tikzpicture}%

The plot on the left is from my MWE and it looks great. The plot on my right contains the full number of data points I have and the legend remains incorrect. Any ideas why? The number of data points is the only difference between these two plots.

enter image description here enter image description here

closed as unclear what you're asking by Stefan Pinnow, Andrew Swann, egreg, Jesse, CarLaTeX Sep 26 '17 at 7:25

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • 3
    remove the forget plot option – percusse Aug 19 '17 at 6:57
  • It's hard to say when your example doesn't reproduce the bad behaviour. Can you make a complete working example that does reproduce the problem? – Torbjørn T. Aug 24 '17 at 20:09
  • Did the trick of percusse help to solve your problem or do you need further assistance? – Stefan Pinnow Sep 14 '17 at 8:04

Browse other questions tagged or ask your own question.