Default style for more than 6 data series
See original GitHub issueHi all,
Just using the lineplot
example but extending this to 8 series:
rs = np.random.RandomState(365)
values = rs.randn(365, 8).cumsum(axis=0)
dates = pd.date_range("1 1 2016", periods=365, freq="D")
data = pd.DataFrame(values, dates, columns=["A", "B", "C", "D", "E", "F", "G", "H"])
data = data.rolling(7).mean()
sns.lineplot(data=data, palette="tab10", linewidth=2.5)
I get this exception, which seems to indicate that I need to specify styles for data series beyond the 6th.
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
<ipython-input-12-272055c27972> in <module>()
----> 1 sns.lineplot(data=data, palette="tab10", linewidth=2.5)
C:\Program Files\Anaconda3\envs\py35\lib\site-packages\seaborn\relational.py in
lineplot(x, y, hue, size, style, data, palette, hue_order, hue_norm, sizes, size
_order, size_norm, dashes, markers, style_order, units, estimator, ci, n_boot, s
ort, err_style, err_kws, legend, ax, **kwargs)
1076 dashes=dashes, markers=markers, style_order=style_order,
1077 units=units, estimator=estimator, ci=ci, n_boot=n_boot,
-> 1078 sort=sort, err_style=err_style, err_kws=err_kws, legend=legend,
1079 )
1080
C:\Program Files\Anaconda3\envs\py35\lib\site-packages\seaborn\relational.py in
__init__(self, x, y, hue, size, style, data, palette, hue_order, hue_norm, sizes
, size_order, size_norm, dashes, markers, style_order, units, estimator, ci, n_b
oot, sort, err_style, err_kws, legend)
670 self.parse_hue(plot_data["hue"], palette, hue_order, hue_norm)
671 self.parse_size(plot_data["size"], sizes, size_order, size_norm)
--> 672 self.parse_style(plot_data["style"], markers, dashes, style_orde
r)
673
674 self.units = units
C:\Program Files\Anaconda3\envs\py35\lib\site-packages\seaborn\relational.py in
parse_style(self, data, markers, dashes, order)
492
493 dashes = self.style_to_attributes(
--> 494 levels, dashes, self.default_dashes, "dashes"
495 )
496
C:\Program Files\Anaconda3\envs\py35\lib\site-packages\seaborn\relational.py in
style_to_attributes(self, levels, style, defaults, name)
303 if any(missing_levels):
304 err = "These `style` levels are missing {}: {}"
--> 305 raise ValueError(err.format(name, missing_levels))
306
307 return attrdict
ValueError: These `style` levels are missing dashes: {'H', 'G'}
Is there a way to automatically set style for large datasets?
[Edit] Seems like it’s because relational.py:30 defines 6 default dashes. Setting sns.lineplot(data=data, dashes=False)
fixes the issue.
Issue Analytics
- State:
- Created 5 years ago
- Comments:8 (3 by maintainers)
Top Results From Across the Web
Change the format of data labels in a chart - Microsoft Support
Tip: Make sure that only one data label is selected, and then to quickly apply custom data label formatting to the other data...
Read more >Style Sheets in HTML documents - W3C
Setting the default style sheet language; Inline style information ... people are more concerned with the content of their documents than the presentation....
Read more >How to Create a Graph with Multiple Lines in Excel
Our default line chart makes it difficult to see how each state has performed over time. Click the Switch Row/Column button on the...
Read more >Change the look of bars, wedges, and more in Numbers on Mac
In Numbers on your Mac, change the look of a data series by adjusting the position, color, shape, and more.
Read more >Excel charts: add title, customize chart axis, legend and data ...
Even more customization options can be found on the Format Chart pane that appears on the ... Hiding and editing data series in...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
sns.scatterplot with a dataframe with more than 6 columns of data has the same problem, it runs out of markers. A workaround for 15 markers is to define
filled_markers = ('o', 'v', '^', '<', '>', '8', 's', 'p', '*', 'h', 'H', 'D', 'd', 'P', 'X')
and set markers to filled_markerssns.scatterplot(data=df, markers=filled_markers)
Source: https://matplotlib.org/2.0.2/api/markers_api.htmlIf somebody is trying to add additional styles to default 6 styles:
Styles tuple must have even number of elements (segment, gap)