Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to lineplot more than 6 columns with seaborn?

Is it possible to plot more than 6 columns using seaborn.lineplot?

When I try to plot it I receive following error message:

These `style` levels are missing dashes: {'LOGAN', 'HB20S', 'GOL'}

It works if I index the dataframe for 6 columns.

Here's the code that works:

sns.lineplot(data=movida_2.iloc[:,:6])
like image 550
Rafael Avatar asked Oct 08 '18 19:10

Rafael


People also ask

How do you plot multiple lines in Seaborn LinePlot?

Multiple Line Plot in Seaborn. Seaborn's lineplot() function plots data as a line. We must pass the x and y-axis values to the function to plot a line. If we want to plot multiple lines, we must make a data frame of the given data where each column corresponds to each line.

How do you put markers on Seaborn LinePlot?

You can also plot markers on a Seaborn line plot. Markers are special symbols that appear at the places in a line plot where the values for x and y axes intersect. To plot markers, you have to pass a list of symbols in a list to the markers attribute. Each symbol corresponds to one line plot.

How do I change my line style in Seaborn?

Customize line style by passing a list to “dashes” “dashes” parameter is used along with “style” parameter. You can pass a list of values to the “dashes” parameter. The number of elements in this list should match the number of categories in the column passed to “style” parameter.

How do I make a line plot in Seaborn?

x, y: Input data variables; must be numeric. data: Dataframe where each column is a variable and each row is an observation. size: Grouping variable that will produce lines with different widths. style: Grouping variable that will produce lines with different dashes and/or markers.


2 Answers

The problem is that lineplot uses dashed lines for the second and any further column but the standard style only supports dashes for the first 6 colors.

This should work for you:

sns.lineplot(data=movida_2, dashes=False)
like image 139
Thilo Avatar answered Sep 23 '22 00:09

Thilo


sns.lineplot(data=movida_2, marker = "0", dashes=False)

You can change the marker type as well.

like image 43
Prax Avatar answered Sep 22 '22 00:09

Prax