# [ Data Visualization and Interpretation ] {CheatSheet}
1. Basic Plotting with Matplotlib
● Line Plot: [Link](x, y)
● Scatter Plot: [Link](x, y)
● Bar Chart: [Link](x, height)
● Histogram: [Link](data)
● Pie Chart: [Link](sizes, labels=labels)
● Boxplot: [Link](data)
● Subplots: fig, ax = [Link]()
● Error Bars: [Link](x, y, yerr=error)
2. Plot Customization
● Title and Labels: [Link]('Title'); [Link]('X Label');
[Link]('Y Label')
● Legend: [Link](['label1', 'label2'])
● Axis Limits: [Link]([xmin, xmax]); [Link]([ymin, ymax])
● Color and Style: [Link](x, y, color='blue', linestyle='--',
marker='o')
● Custom Ticks: [Link]([ticks], [labels]); [Link]([ticks],
[labels])
● Gridlines: [Link](True)
● Text Annotations: [Link](x, y, 'annotation')
3. Plotting with Seaborn
● Density Plot: [Link](data)
● Pair Plot: [Link](df)
● Heatmap: [Link](data)
● Violin Plot: [Link](x='x', y='y', data=df)
● Facet Grid: g = [Link](df, col='col'); [Link]([Link],
'target')
● Count Plot: [Link](x='x', data=df)
● Joint Plot: [Link](x='x', y='y', data=df)
By: Waleed Mousa
4. Time Series Visualization
● Time Series Line Plot: [Link](date, values)
● Seasonal Decompose Plot: from [Link] import
seasonal_decompose; decomposition = seasonal_decompose(ts);
[Link]()
● Autocorrelation Plot: [Link].autocorrelation_plot(series)
5. Geospatial Data Visualization
● Basic Map with Folium: import folium; m = [Link](location=[lat,
long]); m
● Choropleth Maps: [Link](geo_data=geo_json,
data=df).add_to(m)
● Geopandas Basic Plot: [Link](column='column')
6. Advanced Plotting Techniques
● 3D Plotting with Matplotlib: from mpl_toolkits.mplot3d import
Axes3D; fig = [Link](); ax = fig.add_subplot(111,
projection='3d')
● Parallel Coordinates: [Link].parallel_coordinates(df,
'class_column')
● Radar/Spider Chart: from math import pi; N = len(categories);
angles = [n / float(N) * 2 * pi for n in range(N)]; ax =
[Link](111, polar=True)
7. Plotting with Pandas
● DataFrame Line Plot: [Link]()
● DataFrame Bar Plot: [Link]()
● DataFrame Histogram: [Link]()
● Area Plot: [Link]()
● Scatter Matrix: [Link].scatter_matrix(df)
8. Interactive Visualizations
By: Waleed Mousa
● Interactive Plot with Plotly: import [Link] as px; fig =
[Link](df, x='x', y='y'); [Link]()
● Bokeh Line Plot: from [Link] import figure, show; p =
figure(); [Link](x, y); show(p)
● Streamlit for Web Apps: import streamlit as st; st.line_chart(df)
9. Visualization Customization and Aesthetics
● Seaborn Themes: sns.set_style('whitegrid')
● Matplotlib Colormap: [Link](x, y, c=z, cmap='viridis')
● Seaborn Palette: sns.set_palette('pastel')
● Customizing with Matplotlib rcParams:
[Link]({'[Link]': 12, '[Link]': (10, 8)})
10. Statistical Data Visualization
● Distribution Plot: [Link](data)
● Boxplot with Outliers: [Link](x='x', y='y', data=df)
● Swarm Plot: [Link](x='x', y='y', data=df)
● Violin Plot with Split: [Link](x='x', y='y', data=df,
split=True)
11. Advanced Seaborn Plots
● Regplot for Regression: [Link](x='x', y='y', data=df)
● LM Plot for Linear Models: [Link](x='x', y='y', data=df)
● Cluster Map: [Link](data)
● PairGrid Customization: g = [Link](df);
g.map_upper([Link]); g.map_lower([Link]);
g.map_diag([Link])
12. Multi-plot Grids and Layouts
● Subplots in Matplotlib: fig, axs = [Link](2, 2)
● Facet Grid in Seaborn: g = [Link](df, col='col');
[Link]([Link], 'target')
● PairGrid in Seaborn: g = [Link](df); [Link]([Link])
By: Waleed Mousa
● JointGrid in Seaborn: g = [Link](x='x', y='y', data=df);
[Link]([Link], [Link])
13. Text and Annotation
● Adding Text Annotation: [Link](x, y, 'Text')
● Annotating with Arrows: [Link]('Text', xy=(x, y), xytext=(x2,
y2), arrowprops=dict(facecolor='black'))
● Styling Text: [Link](x, y, 'Styled text', style='italic',
fontsize=12)
14. Saving and Exporting Plots
● Save Plot as Image File: [Link]('[Link]')
● Save Plotly Figure: fig.write_image('[Link]')
● Export Plot to HTML with Bokeh: from [Link] import output_file;
output_file('[Link]')
15. Specialized Plots
● Hexbin Plot for Density: [Link](x, y, gridsize=30,
cmap='Blues')
● Treemap with Squarify: import squarify; [Link](sizes,
label=labels, color=colors)
● Bubble Chart: [Link](x, y, s=size)
16. Plotting with Plotly
● Interactive Scatter Plot with Plotly: fig = [Link](df, x='x',
y='y', color='color')
● 3D Surface Plot with Plotly: fig = [Link](df, x='x', y='y',
z='z')
● Candlestick Chart for Financial Data: fig =
[Link](data=[[Link](x=df['date'], open=df['open'],
high=df['high'], low=df['low'], close=df['close'])])
17. Plotting with Bokeh
By: Waleed Mousa
● Bokeh Scatter Plot: p = figure(); [Link](x, y, size=10,
fill_color='color')
● Bokeh Time Series Plot: p = figure(x_axis_type='datetime');
[Link](df['date'], df['value'])
● Adding Hover Tool in Bokeh: from [Link] import HoverTool;
hover = HoverTool(tooltips=[('X-value', '@x'), ('Y-value', '@y')]);
p.add_tools(hover)
18. Dashboard and Reporting
● Creating Dashboards with Dash: import dash; import
dash_core_components as dcc; import dash_html_components as html;
app = [Link](); [Link] = [Link]([[Link](figure=fig)])
● Automated Reporting with Jupyter Notebook: !jupyter nbconvert --to
html [Link]
19. Advanced Customization
● Creating a Custom Matplotlib Style:
[Link]({'[Link]': 'white', '[Link]':
'lightgray'})
● Customizing Seaborn Context: sns.set_context('talk',
font_scale=1.2)
20. Data Interpretation Techniques
● Analyzing Trends in Time Series: Identify patterns and trends using
moving averages or smoothing techniques
● Interpreting Correlation Matrices: Use heatmaps or corrplot to
assess relationships between variables
● Identifying Outliers and Anomalies: Use boxplots or scatter plots
to spot outliers in data
● Comparing Groups or Categories: Employ bar charts or violin plots
for comparison between different groups
● Understanding Distribution of Data: Utilize histograms, density
plots, or Q-Q plots to explore data distribution
● Analyzing Impact of a Variable: Use bar charts, line graphs, or
area plots to understand how changes in one variable affect another
By: Waleed Mousa
21. Interactive Dashboard Tools
● Building Dashboards with Tableau or Power BI: Use business
intelligence tools for creating interactive and business-focused
dashboards
● Interactive Web Dashboards with Plotly Dash: Create web
applications with interactive Plotly graphs using Dash framework
● Real-time Data Visualization with Bokeh Server: Deploy live data
streams in visualizations using Bokeh server applications
22. Advanced Graphical Techniques
● Network Graphs with NetworkX or Gephi: Visualize complex
relationships and network structures
● Creating Geographical Maps with GeoPandas: Use GeoPandas along
with Matplotlib or Bokeh for plotting geographical data
● 3D Visualizations with Plotly or Mayavi: Develop 3D plots for more
complex data representations
23. Data Storytelling
● Narrative Visualization with Sequential Panels: Combine multiple
plots with annotations to tell a story
● Interactive Storytelling with Jupyter Widgets: Use Jupyter widgets
to create an interactive narrative around the data
● Combining Visuals and Text in Reports: Integrate visualizations
with descriptive text for comprehensive reports
24. Visualization for Machine Learning
● Feature Importance Plot: Visualize model's feature importances to
interpret which features contribute most to the prediction
● Confusion Matrix Visualization: Graphically represent the
performance of a classification model
● ROC Curve Plotting: Plot ROC curves to assess the performance of
binary classifiers
25. Performance and Scalability in Visualization
By: Waleed Mousa
● Optimizing Plot Performance in Matplotlib: Use Matplotlib's
interactive mode wisely for large datasets
● Handling Large Datasets with Datashader: Render massive datasets
as images with Datashader
● Efficient Plotting with HDF5 or Parquet Files: Utilize HDF5 or
Parquet formats for efficient loading and plotting of large data
26. Custom Visualization Tools and Libraries
● Using [Link] for Custom Web Visualizations: Leverage [Link] for
intricate and interactive web visualizations
● Highcharts or Echarts for Interactive Charts: Use JavaScript
libraries like Highcharts or Echarts for rich, interactive charts
● Creating Custom Plots with ggplot2 in R: For R users, utilize
ggplot2 for creating sophisticated and layered graphics
27. Scientific and Statistical Visualization
● Visualizing Statistical Models with Seaborn or Statsmodels: Plot
statistical estimates using Seaborn's advanced plots or
Statsmodels' graphics
● Scientific Visualization with SciPy or Matplotlib: Use SciPy and
Matplotlib for detailed scientific plots, such as spectrograms or
advanced histograms
By: Waleed Mousa