\documentclass[10pt,a4paper]{article} % Packages \usepackage{fancyhdr} % For header and footer \usepackage{multicol} % Allows multicols in tables \usepackage{tabularx} % Intelligent column widths \usepackage{tabulary} % Used in header and footer \usepackage{hhline} % Border under tables \usepackage{graphicx} % For images \usepackage{xcolor} % For hex colours %\usepackage[utf8x]{inputenc} % For unicode character support \usepackage[T1]{fontenc} % Without this we get weird character replacements \usepackage{colortbl} % For coloured tables \usepackage{setspace} % For line height \usepackage{lastpage} % Needed for total page number \usepackage{seqsplit} % Splits long words. %\usepackage{opensans} % Can't make this work so far. Shame. Would be lovely. \usepackage[normalem]{ulem} % For underlining links % Most of the following are not required for the majority % of cheat sheets but are needed for some symbol support. \usepackage{amsmath} % Symbols \usepackage{MnSymbol} % Symbols \usepackage{wasysym} % Symbols %\usepackage[english,german,french,spanish,italian]{babel} % Languages % Document Info \author{Arshdeep} \pdfinfo{ /Title (matplotlib.pdf) /Creator (Cheatography) /Author (Arshdeep) /Subject (Matplotlib Cheat Sheet) } % Lengths and widths \addtolength{\textwidth}{6cm} \addtolength{\textheight}{-1cm} \addtolength{\hoffset}{-3cm} \addtolength{\voffset}{-2cm} \setlength{\tabcolsep}{0.2cm} % Space between columns \setlength{\headsep}{-12pt} % Reduce space between header and content \setlength{\headheight}{85pt} % If less, LaTeX automatically increases it \renewcommand{\footrulewidth}{0pt} % Remove footer line \renewcommand{\headrulewidth}{0pt} % Remove header line \renewcommand{\seqinsert}{\ifmmode\allowbreak\else\-\fi} % Hyphens in seqsplit % This two commands together give roughly % the right line height in the tables \renewcommand{\arraystretch}{1.3} \onehalfspacing % Commands \newcommand{\SetRowColor}[1]{\noalign{\gdef\RowColorName{#1}}\rowcolor{\RowColorName}} % Shortcut for row colour \newcommand{\mymulticolumn}[3]{\multicolumn{#1}{>{\columncolor{\RowColorName}}#2}{#3}} % For coloured multi-cols \newcolumntype{x}[1]{>{\raggedright}p{#1}} % New column types for ragged-right paragraph columns \newcommand{\tn}{\tabularnewline} % Required as custom column type in use % Font and Colours \definecolor{HeadBackground}{HTML}{333333} \definecolor{FootBackground}{HTML}{666666} \definecolor{TextColor}{HTML}{333333} \definecolor{DarkBackground}{HTML}{2C83A3} \definecolor{LightBackground}{HTML}{F1F7F9} \renewcommand{\familydefault}{\sfdefault} \color{TextColor} % Header and Footer \pagestyle{fancy} \fancyhead{} % Set header to blank \fancyfoot{} % Set footer to blank \fancyhead[L]{ \noindent \begin{multicols}{3} \begin{tabulary}{5.8cm}{C} \SetRowColor{DarkBackground} \vspace{-7pt} {\parbox{\dimexpr\textwidth-2\fboxsep\relax}{\noindent \hspace*{-6pt}\includegraphics[width=5.8cm]{/web/www.cheatography.com/public/images/cheatography_logo.pdf}} } \end{tabulary} \columnbreak \begin{tabulary}{11cm}{L} \vspace{-2pt}\large{\bf{\textcolor{DarkBackground}{\textrm{Matplotlib Cheat Sheet}}}} \\ \normalsize{by \textcolor{DarkBackground}{Arshdeep} via \textcolor{DarkBackground}{\uline{cheatography.com/201979/cs/43037/}}} \end{tabulary} \end{multicols}} \fancyfoot[L]{ \footnotesize \noindent \begin{multicols}{3} \begin{tabulary}{5.8cm}{LL} \SetRowColor{FootBackground} \mymulticolumn{2}{p{5.377cm}}{\bf\textcolor{white}{Cheatographer}} \\ \vspace{-2pt}Arshdeep \\ \uline{cheatography.com/arshdeep} \\ \end{tabulary} \vfill \columnbreak \begin{tabulary}{5.8cm}{L} \SetRowColor{FootBackground} \mymulticolumn{1}{p{5.377cm}}{\bf\textcolor{white}{Cheat Sheet}} \\ \vspace{-2pt}Not Yet Published.\\ Updated 14th April, 2024.\\ Page {\thepage} of \pageref{LastPage}. \end{tabulary} \vfill \columnbreak \begin{tabulary}{5.8cm}{L} \SetRowColor{FootBackground} \mymulticolumn{1}{p{5.377cm}}{\bf\textcolor{white}{Sponsor}} \\ \SetRowColor{white} \vspace{-5pt} %\includegraphics[width=48px,height=48px]{dave.jpeg} Measure your website readability!\\ www.readability-score.com \end{tabulary} \end{multicols}} \begin{document} \raggedright \raggedcolumns % Set font size to small. Switch to any value % from this page to resize cheat sheet text: % www.emerson.emory.edu/services/latex/latex_169.html \footnotesize % Small font. \begin{multicols*}{2} \begin{tabularx}{8.4cm}{x{2.96 cm} x{5.04 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{Line Plots}} \tn % Row 0 \SetRowColor{LightBackground} Line Plots & Line plots are fundamental in Matplotlib and are used to visualize data points connected by straight lines. They are particularly useful for displaying trends over time or any ordered data. \tn % Row Count 8 (+ 8) % Row 1 \SetRowColor{white} Basic Syntax & `import matplotlib.pyplot as plt \{\{nl\}\}plt.plot(x, y) \{\{nl\}\}plt.show()` \tn % Row Count 11 (+ 3) % Row 2 \SetRowColor{LightBackground} Plotting Lines & The plot() function is used to create line plots. Pass arrays of data for the x-axis and y-axis. \tn % Row Count 15 (+ 4) % Row 3 \SetRowColor{white} Customizing Lines & You can customize the appearance of lines using parameters like color, linestyle, and marker. \tn % Row Count 19 (+ 4) % Row 4 \SetRowColor{LightBackground} Multiple Lines & Plot multiple lines on the same plot by calling plot() multiple times before show(). \tn % Row Count 23 (+ 4) % Row 5 \SetRowColor{white} Adding Labels & Always add labels to the axes using xlabel() and ylabel() to provide context to the plotted data. \tn % Row Count 27 (+ 4) % Row 6 \SetRowColor{LightBackground} Example & `import matplotlib.pyplot as plt` \tn % Row Count 29 (+ 2) % Row 7 \SetRowColor{white} Sample data & `x = {[}1, 2, 3, 4, 5{]} \{\{nl\}\}y = {[}2, 4, 6, 8, 10{]}` \tn % Row Count 31 (+ 2) \end{tabularx} \par\addvspace{1.3em} \vfill \columnbreak \begin{tabularx}{8.4cm}{x{2.96 cm} x{5.04 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{Line Plots (cont)}} \tn % Row 8 \SetRowColor{LightBackground} Plotting the line & `plt.plot(x, y, color='blue', \{\{nl\}\}linestyle='-', marker='o', \{\{nl\}\}label='Line 1')` \tn % Row Count 4 (+ 4) % Row 9 \SetRowColor{white} Adding labels and title & `plt.xlabel('X-axis') \{\{nl\}\}plt.ylabel('Y-axis') \{\{nl\}\}plt.title('Example Line Plot')` \tn % Row Count 8 (+ 4) % Row 10 \SetRowColor{LightBackground} Adding legend & `plt.legend()` \tn % Row Count 9 (+ 1) % Row 11 \SetRowColor{white} Display plot & `plt.show()` \tn % Row Count 10 (+ 1) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{x{2.72 cm} x{5.28 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{Bar Plots}} \tn % Row 0 \SetRowColor{LightBackground} Bar Plots & Bar plots are used to represent categorical data with rectangular bars. They are commonly used to compare the quantities of different categories. Matplotlib provides a simple way to create bar plots using the bar() function. \tn % Row Count 9 (+ 9) % Row 1 \SetRowColor{white} Basic Bar Plot: & `import matplotlib.pyplot as plt \{\{nl\}\}categories = {[}'A', 'B', 'C', 'D'{]} \{\{nl\}\}values = {[}25, 30, 35, 40{]} \{\{nl\}\}plt.bar(categories, values) \{\{nl\}\}plt.xlabel('Categories') \{\{nl\}\}plt.ylabel('Values') \{\{nl\}\}plt.title('Basic Bar Plot') \{\{nl\}\}plt.show()` \tn % Row Count 19 (+ 10) % Row 2 \SetRowColor{LightBackground} Customizing Bar Plots & You can customize bar plots by changing colors, adding labels, adjusting bar width, and more using various parameters of the bar() function. \tn % Row Count 25 (+ 6) % Row 3 \SetRowColor{white} Grouped Bar Plots & To compare data across multiple categories, you can create grouped bar plots by plotting multiple sets of bars side by side. \tn % Row Count 30 (+ 5) \end{tabularx} \par\addvspace{1.3em} \vfill \columnbreak \begin{tabularx}{8.4cm}{x{2.72 cm} x{5.28 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{Bar Plots (cont)}} \tn % Row 4 \SetRowColor{LightBackground} Horizontal Bar Plots & Matplotlib also supports horizontal bar plots using the barh() function. These are useful when you have long category names or want to emphasize certain categories. \tn % Row Count 7 (+ 7) % Row 5 \SetRowColor{white} Stacked Bar Plots & Stacked bar plots allow you to represent parts of the data as segments of each bar. This is useful for showing the composition of each category. \tn % Row Count 13 (+ 6) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{x{4 cm} x{4 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{Handling Missing Data}} \tn % Row 0 \SetRowColor{LightBackground} Check for Missing Data & Before plotting, check your data for any missing values. This can be done using functions like isnull() or isna() from libraries like Pandas or NumPy. \tn % Row Count 8 (+ 8) % Row 1 \SetRowColor{white} Drop or Impute Missing Values & Depending on your analysis and the nature of missing data, you may choose to either drop the missing values using dropna() or impute them using techniques like mean, median, or interpolation. \tn % Row Count 18 (+ 10) % Row 2 \SetRowColor{LightBackground} Masking & Matplotlib supports masking, allowing you to ignore specific data points when plotting. You can create a mask array to filter out missing values from your dataset. \tn % Row Count 27 (+ 9) % Row 3 \SetRowColor{white} Handle Missing Data in Specific Plot Types & Different plot types may have different strategies for handling missing data. For example, in a line plot, you might interpolate missing values, while in a bar plot, you might choose to leave gaps or replace missing values with zeros. \tn % Row Count 39 (+ 12) \end{tabularx} \par\addvspace{1.3em} \vfill \columnbreak \begin{tabularx}{8.4cm}{x{4 cm} x{4 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{Handling Missing Data (cont)}} \tn % Row 4 \SetRowColor{LightBackground} Communicate Missing Data & Make sure your plots communicate clearly when data is missing. You can use annotations or legends to indicate where data has been removed or imputed. \tn % Row Count 8 (+ 8) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{8.4cm}}{\bf\textcolor{white}{Pie Charts}} \tn % Row 0 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{{\bf{Pie Charts}}} \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{Pie charts are circular statistical graphics that are divided into slices to illustrate numerical proportions. Each slice represents a proportionate part of the whole data set.} \tn % Row Count 5 (+ 4) % Row 2 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{{\bf{Usage}}} \tn % Row Count 6 (+ 1) % Row 3 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{Ideal for displaying the relative sizes of various categories within a dataset.} \tn % Row Count 8 (+ 2) % Row 4 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{Best suited for representing data with fewer categories (around 6 or fewer) to maintain clarity.} \tn % Row Count 10 (+ 2) % Row 5 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{{\bf{Creating a Pie Chart}}} \tn % Row Count 11 (+ 1) % Row 6 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{`import matplotlib.pyplot as plt \{\{nl\}\}labels = {[}'Category 1', 'Category 2', 'Category 3'{]} \{\{nl\}\}sizes = {[}30, 40, 30{]} \{\{nl\}\}\# Proportions of each category \{\{nl\}\}plt.pie(sizes, labels=labels, autopct='\%1.1f\%\%') \{\{nl\}\}plt.axis('equal') \{\{nl\}\}\# Equal aspect ratio ensures that pie is drawn as a circle. \{\{nl\}\}plt.show()`} \tn % Row Count 18 (+ 7) % Row 7 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{{\bf{Customization}}} \tn % Row Count 19 (+ 1) % Row 8 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{Colors: You can specify custom colors for each slice.} \tn % Row Count 21 (+ 2) % Row 9 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{Exploding Slices: Emphasize a particular slice by pulling it out of the pie.} \tn % Row Count 23 (+ 2) % Row 10 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{Labels: Adjust label font size, color, and position.} \tn % Row Count 25 (+ 2) % Row 11 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{Shadow: Add a shadow effect for better visual appeal.} \tn % Row Count 27 (+ 2) % Row 12 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{Legend: Include a legend to clarify the meaning of each slice.} \tn % Row Count 29 (+ 2) % Row 13 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{{\bf{Example}}} \tn % Row Count 30 (+ 1) \end{tabularx} \par\addvspace{1.3em} \vfill \columnbreak \begin{tabularx}{8.4cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{8.4cm}}{\bf\textcolor{white}{Pie Charts (cont)}} \tn % Row 14 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{`\# Customizing a Pie Chart \{\{nl\}\}colors = {[}'gold', 'yellowgreen',\{\{nl\}\} 'lightcoral'{]} \{\{nl\}\}explode = (0, 0.1, 0) \{\{nl\}\}\# Explode the 2nd slice (Category 2) \{\{nl\}\}plt.pie(sizes, explode=explode, \{\{nl\}\}labels=labels, colors=colors, \{\{nl\}\}autopct='\%1.1f\%\%', shadow=True) \{\{nl\}\}plt.axis('equal') \{\{nl\}\}plt.show()`} \tn % Row Count 7 (+ 7) % Row 15 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{{\bf{Considerations}}} \tn % Row Count 8 (+ 1) % Row 16 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{Avoid using pie charts for datasets with many categories, as slices become small and difficult to interpret.} \tn % Row Count 11 (+ 3) % Row 17 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{Ensure that the proportions of the data are clear and easy to understand.} \tn % Row Count 13 (+ 2) % Row 18 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{Double-check labels and legend to avoid confusion.} \tn % Row Count 14 (+ 1) \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{x{3.12 cm} x{4.88 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{Customizing Plots}} \tn % Row 0 \SetRowColor{LightBackground} Customizing Plots & You can customize the color, linestyle, and marker style of lines and markers using parameters like color, linestyle, and marker. \tn % Row Count 6 (+ 6) % Row 1 \SetRowColor{white} Line and Marker Properties & Adjust the width of lines with the linewidth parameter and the size of markers with markersize. \tn % Row Count 10 (+ 4) % Row 2 \SetRowColor{LightBackground} Axes Limits & Set the limits of the x and y axes using xlim and ylim to focus on specific regions of your data. \tn % Row Count 15 (+ 5) % Row 3 \SetRowColor{white} Axis Labels and Titles & Add descriptive labels to the x and y axes using xlabel and ylabel, and give your plot a title with title. \tn % Row Count 20 (+ 5) % Row 4 \SetRowColor{LightBackground} Grids & Display grid lines on your plot using grid. \tn % Row Count 22 (+ 2) % Row 5 \SetRowColor{white} Legends & Add a legend to your plot to label different elements using legend. \tn % Row Count 25 (+ 3) % Row 6 \SetRowColor{LightBackground} Ticks & Customize the appearance and positioning of ticks on the axes using functions like xticks and yticks. \tn % Row Count 30 (+ 5) \end{tabularx} \par\addvspace{1.3em} \vfill \columnbreak \begin{tabularx}{8.4cm}{x{3.12 cm} x{4.88 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{Customizing Plots (cont)}} \tn % Row 7 \SetRowColor{LightBackground} Text Annotations & Annotate specific points on your plot with text using text or annotate. \tn % Row Count 3 (+ 3) % Row 8 \SetRowColor{white} Figure Size & Adjust the size of your figure using the figsize parameter when creating a figure. \tn % Row Count 7 (+ 4) % Row 9 \SetRowColor{LightBackground} Background Color & Change the background color of your plot using set\_facecolor. \tn % Row Count 10 (+ 3) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{8.4cm}}{\bf\textcolor{white}{Introduction to Matplotlib}} \tn % Row 0 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{Matplotlib is a powerful Python library widely used for creating static, interactive, and publication-quality visualizations. It provides a flexible and comprehensive set of plotting tools for generating a wide range of plots, from simple line charts to complex 3D plots.} \tn % Row Count 6 (+ 6) % Row 1 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{{\bf{Key Features:}}} \tn % Row Count 7 (+ 1) % Row 2 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{Simple Interface: Matplotlib offers a straightforward interface for creating plots with just a few lines of code.} \tn % Row Count 10 (+ 3) % Row 3 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{Flexibility: Users have fine-grained control over the appearance and layout of their plots, allowing for customization according to specific needs.} \tn % Row Count 13 (+ 3) % Row 4 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{Wide Range of Plot Types: Matplotlib supports various plot types, including line plots, scatter plots, bar plots, histograms, pie charts, and more.} \tn % Row Count 16 (+ 3) % Row 5 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{Integration with NumPy: Matplotlib seamlessly integrates with NumPy, making it easy to visualize data stored in NumPy arrays.} \tn % Row Count 19 (+ 3) % Row 6 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{Publication-Quality Output: Matplotlib produces high-quality, publication-ready plots suitable for both digital and print media.} \tn % Row Count 22 (+ 3) % Row 7 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{Extensibility: Users can extend Matplotlib's functionality through its object-oriented interface, enabling the creation of custom plot types and enhancements.} \tn % Row Count 26 (+ 4) % Row 8 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{`import matplotlib.pyplot as plt \{\{nl\}\}\# Sample data \{\{nl\}\}x = {[}1, 2, 3, 4, 5{]} \{\{nl\}\}y = {[}2, 4, 6, 8, 10{]} \{\{nl\}\}\# Create a line plot \{\{nl\}\}plt.plot(x, y) \{\{nl\}\}plt.xlabel('X-axis label') \{\{nl\}\}plt.ylabel('Y-axis label') \{\{nl\}\}plt.title('Simple Line Plot') \{\{nl\}\}plt.show()`} \tn % Row Count 32 (+ 6) \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{x{2.16 cm} x{5.84 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{Annotations and Text}} \tn % Row 0 \SetRowColor{LightBackground} Adding Text & `plt.text(x, y, 'Your Text Here', fontsize=12, color='blue')` \tn % Row Count 3 (+ 3) % Row 1 \SetRowColor{white} \seqsplit{Annotations} & `plt.annotate('Important Point', \{\{nl\}\}xy=(x, y), xytext=(x\_text, y\_text), \{\{nl\}\}arrowprops=dict(facecolor='black', \{\{nl\}\}arrowstyle='-\textgreater{}'), fontsize=10)` \tn % Row Count 9 (+ 6) % Row 2 \SetRowColor{LightBackground} Text \seqsplit{Properties} & Matplotlib allows you to customize text properties such as font size, color, and style. Use keyword arguments like fontsize, color, fontweight, etc., to modify text appearance. \tn % Row Count 16 (+ 7) % Row 3 \SetRowColor{white} Latex Support & `plt.text(x, y, \{\{nl\}\}r'\$\textbackslash{}alpha \textgreater{} \textbackslash{}beta\$', fontsize=12)` \tn % Row Count 18 (+ 2) % Row 4 \SetRowColor{LightBackground} Multiline Text & `plt.text(x, y, 'Line 1\textbackslash{}nLine 2', \{\{nl\}\}fontsize=12)` \tn % Row Count 20 (+ 2) % Row 5 \SetRowColor{white} Rotation & `plt.text(x, y, 'Rotated Text', \{\{nl\}\}fontsize=12, rotation=45)` \tn % Row Count 23 (+ 3) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{x{3.76 cm} x{4.24 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{Advanced Plotting Techniques}} \tn % Row 0 \SetRowColor{LightBackground} Multiple Axes and Figures & Use plt.subplots() to create multiple plots in a single figure. Control layout with plt.subplot() or plt.GridSpec(). \tn % Row Count 6 (+ 6) % Row 1 \SetRowColor{white} Customizing Line Styles & Change line styles with linestyle parameter (e.g., '-', '-{}-', '-.', ':'). Adjust line width using linewidth. \tn % Row Count 12 (+ 6) % Row 2 \SetRowColor{LightBackground} Color Mapping and Colormaps & Utilize colormaps for visualizing data with color gradients. Apply colormaps using the cmap parameter in functions like plt.scatter() or plt.imshow(). \tn % Row Count 20 (+ 8) % Row 3 \SetRowColor{white} Error Bars and Confidence Intervals & Represent uncertainties in data with error bars. Add error bars using plt.errorbar() or ax.errorbar(). \tn % Row Count 25 (+ 5) % Row 4 \SetRowColor{LightBackground} Layering Plots & Overlay plots to visualize multiple datasets in one figure. Use plt.plot() or ax.plot() multiple times with different data. \tn % Row Count 31 (+ 6) \end{tabularx} \par\addvspace{1.3em} \vfill \columnbreak \begin{tabularx}{8.4cm}{x{3.76 cm} x{4.24 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{Advanced Plotting Techniques (cont)}} \tn % Row 5 \SetRowColor{LightBackground} Plotting with Logarithmic Scale & Use logarithmic scales for axes with plt.xscale() and plt.yscale(). Helpful for visualizing data that spans several orders of magnitude. \tn % Row Count 7 (+ 7) % Row 6 \SetRowColor{white} Polar Plots & Create polar plots with plt.subplot() and projection='polar'. Useful for visualizing cyclic data, such as compass directions or periodic phenomena. \tn % Row Count 14 (+ 7) % Row 7 \SetRowColor{LightBackground} 3D Plotting & Visualize 3D data with \seqsplit{mpl\_toolkits.mplot3d.} Create 3D scatter plots, surface plots, and more. \tn % Row Count 19 (+ 5) % Row 8 \SetRowColor{white} Animations & Animate plots using FuncAnimation. Ideal for displaying dynamic data or simulations. \tn % Row Count 23 (+ 4) % Row 9 \SetRowColor{LightBackground} Streamplots & Visualize vector fields with streamlines using plt.streamplot(). Useful for displaying fluid flow or electromagnetic fields. \tn % Row Count 29 (+ 6) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{x{2.64 cm} x{5.36 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{Interactive Plotting}} \tn % Row 0 \SetRowColor{LightBackground} Zooming and Panning & Users can zoom in on specific regions of the plot to examine details more closely or pan across the plot to explore different sections. \tn % Row Count 6 (+ 6) % Row 1 \SetRowColor{white} Data Selection & Interactive plots allow users to select and highlight specific data points or regions of interest within the plot. \tn % Row Count 11 (+ 5) % Row 2 \SetRowColor{LightBackground} Interactive Widgets & Matplotlib provides widgets such as sliders, buttons, and text input boxes that enable users to dynamically adjust plot parameters, such as plot range, line styles, or data filters. \tn % Row Count 18 (+ 7) % Row 3 \SetRowColor{white} Dynamic Updates & Plots can update dynamically in response to user interactions or changes in the underlying data, providing real-time feedback and visualization. \tn % Row Count 24 (+ 6) % Row 4 \SetRowColor{LightBackground} Custom \seqsplit{Interactivity} & Users can define custom interactive behavior using Matplotlib's event handling system, allowing for complex interactions tailored to specific use cases. \tn % Row Count 30 (+ 6) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{x{3.68 cm} x{4.32 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{Adding Labels and Titles}} \tn % Row 0 \SetRowColor{LightBackground} Adding Axis Labels & `plt.xlabel("X-axis Label") \{\{nl\}\}plt.ylabel("Y-axis Label")` \tn % Row Count 3 (+ 3) % Row 1 \SetRowColor{white} Adding Titles & `plt.title("Plot Title")` \tn % Row Count 5 (+ 2) % Row 2 \SetRowColor{LightBackground} Customizing Labels and Titles & `plt.xlabel("X-axis Label", \{\{nl\}\}fontsize=12, fontweight='bold', \{\{nl\}\}color='blue') \{\{nl\}\}plt.title("Plot Title", \{\{nl\}\}fontsize=14, fontweight='bold', \{\{nl\}\}color='green')` \tn % Row Count 14 (+ 9) % Row 3 \SetRowColor{white} Mathematical Expressions in Labels & `plt.xlabel(r"\$\textbackslash{}alpha\$") \{\{nl\}\}plt.title(r"\$\textbackslash{}beta\$")` \tn % Row Count 17 (+ 3) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{x{4 cm} x{4 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{3D Plotting}} \tn % Row 0 \SetRowColor{LightBackground} To create a 3D plot in Matplotlib, you typically start by importing the necessary modules: & `import matplotlib.pyplot as plt \{\{nl\}\}from \seqsplit{mpl\_toolkits.mplot3d} import Axes3D` \tn % Row Count 5 (+ 5) % Row 1 \SetRowColor{white} Then, you can create a 3D axes object using plt.figure() and passing the projection='3d' argument: & `fig = plt.figure() \{\{nl\}\}ax = \seqsplit{fig.add\_subplot(111}, \{\{nl\}\}projection='3d')` \tn % Row Count 10 (+ 5) % Row 2 \SetRowColor{LightBackground} Once you have your 3D axes object, you can plot various types of 3D data using methods such as plot(), scatter(), bar3d(), etc. For example, to create a simple 3D scatter plot: & `ax.scatter(x\_data, y\_data, z\_data)` \tn % Row Count 19 (+ 9) % Row 3 \SetRowColor{white} You can also customize the appearance of your 3D plot by setting properties such as labels, titles, axis limits, colors, and more: & `ax.set\_xlabel('X Label') \{\{nl\}\}ax.set\_ylabel('Y Label') \{\{nl\}\}ax.set\_zlabel('Z Label') \{\{nl\}\}ax.set\_title('3D Scatter Plot') \{\{nl\}\}\# Set axis limits \{\{nl\}\}ax.set\_xlim(x\_min, x\_max) \{\{nl\}\}ax.set\_ylim(y\_min, y\_max) \{\{nl\}\}ax.set\_zlim(z\_min, z\_max) \{\{nl\}\}\# Customize colors \{\{nl\}\}ax.scatter(x\_data, y\_data, \{\{nl\}\}z\_data, c=color\_data, \{\{nl\}\}cmap='viridis')` \tn % Row Count 37 (+ 18) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{x{2.72 cm} x{5.28 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{Plotting Images}} \tn % Row 0 \SetRowColor{LightBackground} Example & `import matplotlib.pyplot as plt \{\{nl\}\}import numpy as np` \tn % Row Count 3 (+ 3) % Row 1 \SetRowColor{white} Create a random image & `image\_data = np.random.random((\{\{nl\}\}100, 100))` \tn % Row Count 5 (+ 2) % Row 2 \SetRowColor{LightBackground} Plot the image & `plt.imshow(image\_data, cmap='gray') \{\{nl\}\}plt.axis('off') \{\{nl\}\}\# Turn off axis \{\{nl\}\}plt.show()` \tn % Row Count 9 (+ 4) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{x{2.8 cm} x{5.2 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{Working with Different Plot Styles}} \tn % Row 0 \SetRowColor{LightBackground} Default Style & Matplotlib's default style is functional and simple. Suitable for most basic plots without any specific styling requirements. \tn % Row Count 5 (+ 5) % Row 1 \SetRowColor{white} \seqsplit{FiveThirtyEight} Style & Mimics the style used by the FiveThirtyEight website. Bold colors and thicker lines for emphasis. \tn % Row Count 9 (+ 4) % Row 2 \SetRowColor{LightBackground} ggplot Style & Emulates the style of plots generated by the ggplot library in R. Clean and modern appearance with gray backgrounds. \tn % Row Count 14 (+ 5) % Row 3 \SetRowColor{white} Seaborn Style & Similar to the default Seaborn plotting style. Features muted colors and grid backgrounds. \tn % Row Count 18 (+ 4) % Row 4 \SetRowColor{LightBackground} Dark Background Styles & Various styles with dark backgrounds, suitable for presentations or dashboards. Examples include 'dark\_background' and 'Solarize\_Light2'. \tn % Row Count 24 (+ 6) % Row 5 \SetRowColor{white} XKCD Style & Creates plots with a hand-drawn, cartoonish appearance. Adds a playful touch to visualizations. \tn % Row Count 28 (+ 4) % Row 6 \SetRowColor{LightBackground} Example & `import matplotlib.pyplot as plt \{\{nl\}\}plt.style.use('ggplot')` \tn % Row Count 31 (+ 3) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{x{3.04 cm} x{4.96 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{Saving Plots}} \tn % Row 0 \SetRowColor{LightBackground} Using savefig() Function & `import matplotlib.pyplot as plt \{\{nl\}\}\# Plotting code here \{\{nl\}\}plt.savefig('plot.png') \{\{nl\}\}\# Save the plot as 'plot.png'` \tn % Row Count 6 (+ 6) % Row 1 \SetRowColor{white} Customizing Output & `plt.savefig('plot.png', dpi=300, \{\{nl\}\}bbox\_inches='tight', \{\{nl\}\}transparent=True)` \tn % Row Count 10 (+ 4) % Row 2 \SetRowColor{LightBackground} Supported Formats & \seqsplit{`plt.savefig('plot.pdf')} \{\{nl\}\}\# Save as PDF \{\{nl\}\}plt.savefig('plot.svg') \{\{nl\}\}\# Save as SVG` \tn % Row Count 15 (+ 5) % Row 3 \SetRowColor{white} Interactive Saving & `plt.savefig('plot.png', \{\{nl\}\}bbox\_inches='tight', \{\{nl\}\}pad\_inches=0)` \tn % Row Count 18 (+ 3) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{x{4 cm} x{4 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{Legends}} \tn % Row 0 \SetRowColor{LightBackground} For example: & `import matplotlib.pyplot as plt` \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} Plotting data & `plt.plot(x1, y1, label='Line 1') \{\{nl\}\}plt.plot(x2, y2, label='Line 2')` \tn % Row Count 6 (+ 4) % Row 2 \SetRowColor{LightBackground} Adding legend & `plt.legend() \{\{nl\}\}plt.show()` \tn % Row Count 8 (+ 2) % Row 3 \SetRowColor{white} You can customize the appearance of the legend by specifying its location, adjusting the font size, changing the background color, and more. & \seqsplit{`plt.legend(loc='upper} right', \{\{nl\}\}fontsize='large', shadow=True, \{\{nl\}\}facecolor='lightgray')` \tn % Row Count 15 (+ 7) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{x{2.8 cm} x{5.2 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{Subplots}} \tn % Row 0 \SetRowColor{LightBackground} Subplots & Subplots allow you to display multiple plots within the same figure. This is useful for comparing different datasets or visualizing related information. \tn % Row Count 6 (+ 6) % Row 1 \SetRowColor{white} Creating Subplots & `import matplotlib.pyplot as plt \{\{nl\}\}\# Create a figure with 2 rows and 2 columns of subplots \{\{nl\}\}fig, axs = plt.subplots(2, 2)` \tn % Row Count 12 (+ 6) % Row 2 \SetRowColor{LightBackground} Accessing Subplot Axes & `ax1 = axs{[}0, 0{]} \{\{nl\}\}\# Top-left subplot \{\{nl\}\}ax2 = axs{[}0, 1{]} \{\{nl\}\}\# Top-right subplot \{\{nl\}\}ax3 = axs{[}1, 0{]} \{\{nl\}\}\# Bottom-left subplot \{\{nl\}\}ax4 = axs{[}1, 1{]} \{\{nl\}\}\# Bottom-right subplot` \tn % Row Count 20 (+ 8) % Row 3 \SetRowColor{white} Plotting on Subplots & `ax1.plot(x1, y1) \{\{nl\}\}ax2.scatter(x2, y2) \{\{nl\}\}ax3.bar(x3, y3) \{\{nl\}\}ax4.hist(data)` \tn % Row Count 24 (+ 4) % Row 4 \SetRowColor{LightBackground} Customizing Subplots & `ax1.set\_title('Plot 1') \{\{nl\}\}ax2.set\_xlabel('X Label') \{\{nl\}\}ax3.set\_ylabel('Y Label')` \tn % Row Count 28 (+ 4) % Row 5 \SetRowColor{white} Adjusting Layout & \seqsplit{`plt.subplots\_adjust(hspace=0.5}, wspace=0.5) \{\{nl\}\}\# Adjust horizontal and vertical spacing` \tn % Row Count 32 (+ 4) \end{tabularx} \par\addvspace{1.3em} \vfill \columnbreak \begin{tabularx}{8.4cm}{x{2.8 cm} x{5.2 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{Subplots (cont)}} \tn % Row 6 \SetRowColor{LightBackground} Conclusion & Subplots are a powerful feature in Matplotlib for creating multi-panel figures, allowing you to efficiently visualize and compare multiple datasets within the same plot. \tn % Row Count 7 (+ 7) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{8.4cm}}{\bf\textcolor{white}{Histograms}} \tn % Row 0 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{{\bf{Histograms}}} \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{Histograms are graphical representations of the distribution of data. They display the frequency or probability of occurrence of different values in a dataset, typically depicted as bars. Histograms are commonly used to visualize the distribution of continuous data.} \tn % Row Count 7 (+ 6) % Row 2 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{{\bf{Creating a Histogram}}} \tn % Row Count 8 (+ 1) % Row 3 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{`import matplotlib.pyplot as plt \{\{nl\}\}data = {[}1, 2, 3, 3, 4, 4, 4, 5, 5, 6, 7, 7, \{\{nl\}\}8, 8, 8{]} \{\{nl\}\}plt.hist(data, bins=5, color='skyblue', \{\{nl\}\}edgecolor='black') \{\{nl\}\}plt.xlabel('Values') \{\{nl\}\}plt.ylabel('Frequency') \{\{nl\}\}plt.title('Histogram of Data') \{\{nl\}\}plt.show()`} \tn % Row Count 14 (+ 6) % Row 4 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{{\bf{Parameters}}} \tn % Row Count 15 (+ 1) % Row 5 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{data: The input data to be plotted.} \tn % Row Count 16 (+ 1) % Row 6 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{bins: Number of bins or intervals for the histogram.} \tn % Row Count 18 (+ 2) % Row 7 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{color: Color of the bars.} \tn % Row Count 19 (+ 1) % Row 8 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{edgecolor: Color of the edges of the bars.} \tn % Row Count 20 (+ 1) % Row 9 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{{\bf{Customizations}}} \tn % Row Count 21 (+ 1) % Row 10 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{Adjust the number of bins to control the granularity of the histogram.} \tn % Row Count 23 (+ 2) % Row 11 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{Change colors, edge colors, and bar width for aesthetic appeal.} \tn % Row Count 25 (+ 2) % Row 12 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{Add labels and titles for clarity.} \tn % Row Count 26 (+ 1) % Row 13 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{{\bf{Interpretation}}} \tn % Row Count 27 (+ 1) % Row 14 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{Histograms help in understanding the distribution of data, including its central tendency, spread, and shape.} \tn % Row Count 30 (+ 3) \end{tabularx} \par\addvspace{1.3em} \vfill \columnbreak \begin{tabularx}{8.4cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{8.4cm}}{\bf\textcolor{white}{Histograms (cont)}} \tn % Row 15 \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{They are useful for identifying patterns, outliers, and data skewness.} \tn % Row Count 2 (+ 2) % Row 16 \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{Histograms are often used in exploratory data analysis and statistical analysis.} \tn % Row Count 4 (+ 2) \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{x{3.04 cm} x{4.96 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{Scatter Plots}} \tn % Row 0 \SetRowColor{LightBackground} Scatter Plot & A Scatter Plot is a type of plot that displays values for two variables as points on a Cartesian plane. Each point represents an observation in the dataset, with the x-coordinate corresponding to one variable and the y-coordinate corresponding to the other variable. \tn % Row Count 12 (+ 12) % Row 1 \SetRowColor{white} Visualizing Relationships & Scatter plots are particularly useful for visualizing relationships or patterns between two variables. They can reveal trends, clusters, correlations, or outliers in the data. \tn % Row Count 20 (+ 8) % Row 2 \SetRowColor{LightBackground} Marker Style and Color & Points in a scatter plot can be customized with different marker styles, sizes, and colors to enhance visualization and highlight specific data points or groups. \tn % Row Count 27 (+ 7) % Row 3 \SetRowColor{white} Adding Third Dimension & Sometimes, scatter plots can incorporate additional dimensions by mapping variables to marker size, color intensity, or shape. \tn % Row Count 33 (+ 6) \end{tabularx} \par\addvspace{1.3em} \vfill \columnbreak \begin{tabularx}{8.4cm}{x{3.04 cm} x{4.96 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{Scatter Plots (cont)}} \tn % Row 4 \SetRowColor{LightBackground} Regression Lines & In some cases, regression lines or curves can be added to scatter plots to indicate the overall trend or relationship between the variables. \tn % Row Count 6 (+ 6) % Row 5 \SetRowColor{white} Example & `import matplotlib.pyplot as plt` \tn % Row Count 8 (+ 2) % Row 6 \SetRowColor{LightBackground} Sample data & `x = {[}1, 2, 3, 4, 5{]} \{\{nl\}\}y = {[}2, 3, 5, 7, 11{]}` \tn % Row Count 10 (+ 2) % Row 7 \SetRowColor{white} Create a scatter plot & `plt.scatter(x, y, color='blue', \{\{nl\}\}marker='o', s=100)` \tn % Row Count 13 (+ 3) % Row 8 \SetRowColor{LightBackground} Adding labels and title & `plt.xlabel('X-axis Label') \{\{nl\}\}plt.ylabel('Y-axis Label') \{\{nl\}\}plt.title('Scatter Plot Example')` \tn % Row Count 18 (+ 5) % Row 9 \SetRowColor{white} Show plot & `plt.show()` \tn % Row Count 19 (+ 1) % Row 10 \SetRowColor{LightBackground} Data Scaling & Ensure that both variables are on a similar scale to avoid distortion in the visualization. \tn % Row Count 23 (+ 4) % Row 11 \SetRowColor{white} Data Exploration & Use scatter plots as an initial step in data exploration to identify potential patterns or relationships before further analysis. \tn % Row Count 29 (+ 6) % Row 12 \SetRowColor{LightBackground} Interpretation & Interpretation of scatter plots should consider the overall distribution of points, any evident trends or clusters, and the context of the data. \tn % Row Count 35 (+ 6) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{x{3.2 cm} x{4.8 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{Basic Plotting}} \tn % Row 0 \SetRowColor{LightBackground} Importing Matplotlib & `import matplotlib.pyplot as plt` \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} Creating a Plot & `plt.plot(x\_values, y\_values)` \tn % Row Count 4 (+ 2) % Row 2 \SetRowColor{LightBackground} Displaying the Plot & `plt.show()` \tn % Row Count 6 (+ 2) % Row 3 \SetRowColor{white} Adding Labels and Title & `plt.xlabel('X-axis Label') \{\{nl\}\}plt.ylabel('Y-axis Label') \{\{nl\}\}plt.title('Plot Title')` \tn % Row Count 10 (+ 4) % Row 4 \SetRowColor{LightBackground} Customizing Plot Appearance & `plt.plot(x\_values, y\_values, \{\{nl\}\}color='red', linestyle='-{}-', \{\{nl\}\}marker='o')` \tn % Row Count 14 (+ 4) % Row 5 \SetRowColor{white} Adding Gridlines & `plt.grid(True)` \tn % Row Count 15 (+ 1) % Row 6 \SetRowColor{LightBackground} Saving the Plot & \seqsplit{`plt.savefig('plot.png')`} \tn % Row Count 17 (+ 2) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{x{2.72 cm} x{5.28 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{Plotting with Dates}} \tn % Row 0 \SetRowColor{LightBackground} Datetime Objects & Matplotlib accepts datetime objects for plotting dates. You can create datetime objects using Python's datetime module. \tn % Row Count 5 (+ 5) % Row 1 \SetRowColor{white} Date Formatting & You can customize the appearance of dates on the plot using formatting strings. Matplotlib's DateFormatter class enables you to specify the format of date labels. \tn % Row Count 12 (+ 7) % Row 2 \SetRowColor{LightBackground} Plotting Time Series & Matplotlib provides various plotting functions like plot(), scatter(), and bar() that accept datetime objects as input for the x-axis. \tn % Row Count 18 (+ 6) % Row 3 \SetRowColor{white} Customizing Date Axes & You can customize the appearance of the date axis, including the range, tick frequency, and formatting. Matplotlib's DateLocator class helps in configuring date ticks on the axis. \tn % Row Count 25 (+ 7) % Row 4 \SetRowColor{LightBackground} Handling Time Zones & Matplotlib supports handling time zones in date plotting. You can convert datetime objects to different time zones using Python libraries like pytz and then plot them accordingly. \tn % Row Count 32 (+ 7) \end{tabularx} \par\addvspace{1.3em} \vfill \columnbreak \begin{tabularx}{8.4cm}{x{2.72 cm} x{5.28 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{Plotting with Dates (cont)}} \tn % Row 5 \SetRowColor{LightBackground} Plotting Date Ranges & Matplotlib allows you to plot specific date ranges by filtering your dataset based on date values before passing them to the plotting functions. \tn % Row Count 6 (+ 6) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} % That's all folks \end{multicols*} \end{document}