19

Here is an example:

import seaborn as sns
ax = sns.lineplot(range(10), range(10), markers=True)

enter image description here

Why aren't there any markers although I set markers=True?

khelwood
  • 55,782
  • 14
  • 81
  • 108
user5054
  • 1,056
  • 1
  • 7
  • 22

2 Answers2

44

Basically, because that's not what markers= is for. As per the documentation:

markers : boolean, list, or dictionary, optional

Object determining how to draw the markers for different levels of the style variable. Setting to True will use default markers, or you can pass a list of markers or a dictionary mapping levels of the style variable to markers. Setting to False will draw marker-less lines. Markers are specified as in matplotlib.

Therefore, markers= is only useful when you also specify a style= parameter. For example:

fmri = sns.load_dataset("fmri")
ax = sns.lineplot(x="timepoint", y="signal", style="event", data=fmri, markers=True)

However, other kwargs are passed to plt.plot(), therefore, you can instruct lineplot to use markers by using the marker= kwarg (notice the lack of "s"):

ax = sns.lineplot(range(10), range(10), marker='o')
Diziet Asahi
  • 38,379
  • 7
  • 60
  • 75
  • 1
    I do not want to use a dataframe to specify the data to visualize, though, I just want to pass lists as `x` and `y` values.. I think what is intuitive is that if there is no `data` passed, it should just use the default marker type when `markers=True`, given style is not a valid argument if there is no `data`. – user5054 Aug 13 '19 at 21:39
  • Understood, but as ImportanceOfBeingErnest said in his other comment, seaborn is simply a helper designed to facilitate plotting dataframes. If you don't need those functionalities, then there is no reason to use it and you should instead plot directly using matplotlib – Diziet Asahi Aug 14 '19 at 06:48
6

A similar problem was found here. If you specify the matplotlib argument using marker='*' for example the markers will show up.

BenT
  • 3,172
  • 3
  • 18
  • 38