I'm trying to create a plot with pgfplots which has

  1. a solid marker filled in with a specified color
  2. a dashed line.

The dashed line makes the marker dashed as well, so I put "solid" as an option to retain the marker outline. However, if I combine this with a filled in marker, pgfplots fills in everything above the line as well.

enter image description here

Is there a way to fix this? The code to generate the figure is attached:



\definecolor{markercolor}{RGB}{124.9, 255, 160.65}


\addplot+[color=blue,mark=*,mark options={fill=markercolor}]
\addplot+[dashed,color=blue,mark=*,mark options={fill=markercolor}]
\addplot+[dashed,color=blue,mark=*,mark options=solid,{fill=markercolor}]
\legend{Solid line, Dashed line with dashed marker, Dashed line with solid marker}


You have

\addplot+[dashed,color=blue,mark=*,mark options=solid,{fill=markercolor}]

so the only thing in mark options is solid, while fill=markercolor is a separate entry in the list of options, and applies to the plotted line, not the markers. You want to move that brace, so you have

\addplot+[dashed,color=blue,mark=*,mark options={solid,fill=markercolor}]

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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