by
104 5
-1
2
99
3
Specified
Debate
Created
Modified Mar 1, 2019
This snippet is Public
No tags for this snippet yet.
Languagepython
LicenseMIT_X11

4D+ Data Visualization

plt, pd, sns, faceting, parallel coordinates
Copy Embed Code
<iframe id="embedFrame" style="width:600px; height:300px;"
src="https://www.snip2code.com/Embed/4383288/4D--Data-Visualization?startLine=0"></iframe>
Click on the embed code to copy it into your clipboard Width Height
Leave empty to retrieve all the content Start End
# Parallel coordinates # Each data point is a line showing the value of each dim as it goes from # left to right. You can se relation between dimensions, particularly # relations with the "class_column", which is the hue variable # Image in comments from pandas.plotting import parallel_coordinates parallel_coordinates(df, class_column='targetCol', color=('#FFE888', '#FF9999')) ### # 2D faceting of 2D scatterplots (4D) # Image in comments g = sns.FacetGrid(data, col="colFacet", row="rowFacet") g = g.map(plt.scatter, "xCol", "yCol", edgecolor="w") ### # Line plot # Computes the mean of the y variable for each of the x values # You can encode a third dim by using a line for each value of the dim # You add a 4th (and 5th if you want) with facets # Image in comments grid = sns.FacetGrid(df, row='facetRowVar', size=2.2, aspect=1.6) grid.map(sns.pointplot, 'xVar', 'yVar', 'lineVar', palette='deep') grid.add_legend()
If you want to be updated about similar snippets, Sign in and follow our Channels

blog comments powered by Disqus