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])
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.
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.
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.
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.
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)
sns.lineplot(data=movida_2, marker = "0", dashes=False)
You can change the marker type as well.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With