# Визуализация данных Гущин Александр, DMIA, осень 2019 [TOC] --- 1. Визуализации в анализе данных: что и зачем :notebook_with_decorative_cover: 1. Инструменты для визуализации :key: 1. Типы графиков и ситуации их применения :eyeglasses: 1. Советы по демонстрации найденных закономерностей и результатов вычислительных экспериментов :vertical_traffic_light: <!-- 2. Советы, как добиться большей наглядности --> --- ![](https://cdn.pixabay.com/photo/2014/06/06/20/59/earth-363842_960_720.jpg =600x) <!-- ![](https://upload.wikimedia.org/wikipedia/commons/1/12/Rotating_earth_axial_tiles_to_orbit.gif) --> --- ## Основные типы визуализаций Визуализации распределений ![](https://python-graph-gallery.com/wp-content/uploads/DensityBig.png =300x) ![](https://python-graph-gallery.com/wp-content/uploads/Box1Big.png =300x) ![](https://python-graph-gallery.com/wp-content/uploads/HistogramBig.png =300x) density, boxplot, histogram https://python-graph-gallery.com --- Визуализации корреляций ![](https://python-graph-gallery.com/wp-content/uploads/ScatterPlotBig.png =300x) ![](https://python-graph-gallery.com/wp-content/uploads/2dDensityBig.png =300x) ![](https://python-graph-gallery.com/wp-content/uploads/HeatmapBig.png =300x) scatterplot, 2D-density, heatmap --- Визуализации изменений ![](https://python-graph-gallery.com/wp-content/uploads/LineBig.png =300x) ![](https://python-graph-gallery.com/wp-content/uploads/StackedAreaBig.png =300x) ![](https://python-graph-gallery.com/wp-content/uploads/Parallel2Big.png =300x) lineplot, stacked area plot, parrallel plot --- Визуализации карт ![](https://python-graph-gallery.com/wp-content/uploads/ChoroplethBig.png =300x) ![](https://python-graph-gallery.com/wp-content/uploads/ConnectedMapBig.png =300x) ![](https://python-graph-gallery.com/wp-content/uploads/BubbleMapBig.png =300x) Choropleth map, Connection map, Bubble map --- ![](https://python-graph-gallery.com/wp-content/uploads/NetworkBig.png =300x) ![](https://python-graph-gallery.com/wp-content/uploads/DendrogramBig.png =300x) ![](https://python-graph-gallery.com/wp-content/uploads/TreeBig.png =300x) Network chart, Dendrogram, Tree plot --- ![](https://python-graph-gallery.com/wp-content/uploads/WordcloudBig.png =300x) ![](https://python-graph-gallery.com/wp-content/uploads/SpiderBig.png =300x) ![](https://python-graph-gallery.com/wp-content/uploads/PieBig.png =300x) Word cloud, Spider map, Pie plot <!-- --- с которыми встречаются в анализе данных - lineplot - scatterplot - histogram - boxplots - kdeplot - matrix plot - maps - graphs (это отдельная большая тема) - images - многие другие --> --- ## Инструменты и примеры --- matplotlib ![](https://matplotlib.org/_images/sphx_glr_cohere_001.png) --- matplotlib ```python import matplotlib.pyplot as plt fig, axs = plt.subplots(2, 1) axs[0].plot(t, s1, t, s2) axs[0].set_xlim(0, 2) axs[0].set_xlabel('time') axs[0].set_ylabel('s1 and s2') axs[0].grid(True) cxy, f = axs[1].cohere(s1, s2, 256, 1. / dt) axs[1].set_ylabel('coherence') fig.tight_layout() plt.show() ``` https://matplotlib.org/gallery/index.html --- seaborn ![](https://seaborn.pydata.org/_images/scatterplot_matrix.png =600x) --- seaborn ```python import seaborn as sns sns.set(style="ticks") df = sns.load_dataset("iris") sns.pairplot(df, hue="species") ``` --- seaborn ![](https://seaborn.pydata.org/_images/many_pairwise_correlations.png) --- seaborn ```python import seaborn as sns import matplotlib.pyplot as plt sns.set(style="white") # Set up the matplotlib figure f, ax = plt.subplots(figsize=(11, 9)) # Generate a custom diverging colormap cmap = sns.diverging_palette(220, 10, as_cmap=True) # Draw the heatmap with the mask and correct aspect ratio sns.heatmap(corr, mask=mask, cmap=cmap, vmax=.3, center=0, square=True, linewidths=.5, cbar_kws={"shrink": .5}) ``` https://seaborn.pydata.org/examples/index.html --- plotly ```python import plotly.express as px gapminder = px.data.gapminder() fig = px.scatter(gapminder.query("year==2007"), x="gdpPercap", y="lifeExp", size="pop", color="continent", hover_name="country", log_x=True, size_max=60) fig.show() ``` https://plot.ly/python/bubble-charts/ --- plotly ```python import plotly.graph_objects as go fig =go.Figure(go.Sunburst( labels=["Eve", "Cain", "Seth", "Enos", "Noam", "Abel", "Awan", "Enoch", "Azura"], parents=["", "Eve", "Eve", "Seth", "Seth", "Eve", "Eve", "Awan", "Eve" ], values=[10, 14, 12, 10, 2, 6, 6, 4, 4], )) # Update layout for tight margin # See https://plot.ly/python/creating-and-updating-figures/ fig.update_layout(margin = dict(t=0, l=0, r=0, b=0)) fig.show() ``` https://plot.ly/python/sunburst-charts/ --- Другие инструменты, о которых полезно знать - Altair https://altair-viz.github.io - Bokeh https://bokeh.pydata.org - Graphviz https://graphviz.readthedocs.io --- ## Советы для большей наглядности 1. Подписывайте оси (достаточно крупно :) 1. Оставляйте данные и код для воспроизведения рисунков https://www.data-to-viz.com/caveats.html --- https://www.data-to-viz.com ![](https://www.data-to-viz.com/img/poster/poster_big.png =750x) --- Ещё пара интересных ссылок: - 11 Awesome Data Visualizations Way Ahead of Their Time https://www.investintech.com/resources/blog/archives/5692-data-visualizations-infographic.html - 3 Awesome Visualization Techniques for every dataset https://mlwhiz.com/blog/2019/04/19/awesome_seaborn_visuals/
{"metaMigratedAt":"2023-06-15T00:39:08.774Z","metaMigratedFrom":"YAML","title":"Visualisations","breaks":true,"description":"View the slide with \"Slide Mode\".","slideOptions":"{\"theme\":\"white\",\"transition\":\"slide\"}","contributors":"[{\"id\":\"e0bc91de-98f7-46f8-a3a9-852912833a93\",\"add\":94052,\"del\":90762}]"}
    495 views