|
84 | 84 | "cell_type": "markdown", |
85 | 85 | "metadata": {}, |
86 | 86 | "source": [ |
87 | | - "\n", |
88 | | - "\n", |
89 | 87 | "Despite Matplotlib's suboptimal x-axis representation, the graph provides a clear understanding of the data distribution.\n", |
90 | 88 | "\n", |
91 | 89 | "#### Versatility\n", |
|
138 | 136 | "cell_type": "markdown", |
139 | 137 | "metadata": {}, |
140 | 138 | "source": [ |
141 | | - "\n", |
142 | | - "\n", |
143 | 139 | "#### Animation capabilities\n", |
144 | 140 | "\n", |
145 | 141 | "Matplotlib provides powerful animation features through the `matplotlib.animation` module, enabling dynamic visualizations that evolve over time. Here are three examples that showcase the animation capabilities:\n", |
|
179 | 175 | "cell_type": "markdown", |
180 | 176 | "metadata": {}, |
181 | 177 | "source": [ |
182 | | - "\n", |
183 | | - "\n", |
184 | 178 | "**Animated Bar Chart Race**" |
185 | 179 | ] |
186 | 180 | }, |
|
229 | 223 | "cell_type": "markdown", |
230 | 224 | "metadata": {}, |
231 | 225 | "source": [ |
232 | | - "\n", |
233 | | - "\n", |
234 | 226 | "These animations demonstrate Matplotlib's versatility for creating engaging dynamic visualizations, from scientific data trends to business dashboards.\n", |
235 | 227 | "\n", |
236 | | - "\n", |
237 | 228 | "#### Publication-quality output\n", |
238 | 229 | "\n", |
239 | 230 | "Matplotlib excels at creating high-resolution, publication-ready visualizations suitable for academic papers, research reports, and professional presentations. The library provides precise control over figure size, DPI, and output formats (PNG, PDF, SVG, EPS), ensuring your plots meet the strict requirements of scientific journals and publications." |
|
284 | 275 | "cell_type": "markdown", |
285 | 276 | "metadata": {}, |
286 | 277 | "source": [ |
287 | | - "\n", |
288 | | - "\n", |
289 | 278 | "### Cons\n", |
290 | 279 | "\n", |
291 | 280 | "#### Steep learning curve\n", |
292 | 281 | "\n", |
293 | 282 | "Matplotlib's extensive functionality comes with complexity. New users often find the syntax overwhelming, especially when transitioning from point-and-click visualization tools. Understanding the figure-axes hierarchy and object-oriented vs. pyplot interfaces requires significant time investment.\n", |
294 | 283 | "\n", |
295 | | - "\n", |
296 | 284 | "#### Extensive styling needed for publication-ready common plots\n", |
297 | 285 | "\n", |
298 | 286 | "While Matplotlib supports virtually any chart type, producing visually polished versions of standard plots like histograms, scatter plots, or bar charts requires substantial customization work.\n", |
|
319 | 307 | "cell_type": "markdown", |
320 | 308 | "metadata": {}, |
321 | 309 | "source": [ |
322 | | - "\n", |
323 | | - "\n", |
324 | 310 | "Creating a readable heatmap in Matplotlib requires several manual steps:\n", |
325 | 311 | "\n", |
326 | 312 | "- Define the visualization layout and color scheme\n", |
|
369 | 355 | "cell_type": "markdown", |
370 | 356 | "metadata": {}, |
371 | 357 | "source": [ |
372 | | - "\n", |
373 | | - "\n", |
374 | 358 | "Creating a basic annotated heatmap shouldn't require this many lines of manual setup and configuration.\n", |
375 | 359 | "\n", |
376 | 360 | "#### Manual statistical processing required\n", |
|
445 | 429 | "cell_type": "markdown", |
446 | 430 | "metadata": {}, |
447 | 431 | "source": [ |
448 | | - "\n", |
449 | | - "\n", |
450 | 432 | "### Key Takeaways\n", |
451 | 433 | "\n", |
452 | 434 | "Matplotlib is capable of producing any plot, but creating complex plots often requires more code compared to other libraries.\n", |
|
514 | 496 | "cell_type": "markdown", |
515 | 497 | "metadata": {}, |
516 | 498 | "source": [ |
517 | | - "\n", |
518 | | - "\n", |
519 | 499 | "Other examples of seaborn's statistical plots:\n", |
520 | 500 | "\n", |
521 | 501 | "**Automatic distribution fitting and visualization:**" |
|
535 | 515 | "cell_type": "markdown", |
536 | 516 | "metadata": {}, |
537 | 517 | "source": [ |
538 | | - "\n", |
539 | | - "\n", |
540 | | - "\n", |
541 | 518 | "**Automatic marginal distribution and correlation computation:**" |
542 | 519 | ] |
543 | 520 | }, |
|
555 | 532 | "cell_type": "markdown", |
556 | 533 | "metadata": {}, |
557 | 534 | "source": [ |
558 | | - "\n", |
559 | | - "\n", |
560 | 535 | "**Automatic pairwise relationships:**" |
561 | 536 | ] |
562 | 537 | }, |
|
574 | 549 | "cell_type": "markdown", |
575 | 550 | "metadata": {}, |
576 | 551 | "source": [ |
577 | | - "\n", |
578 | | - "\n", |
579 | 552 | "**Distribution visualization with kernel density:**" |
580 | 553 | ] |
581 | 554 | }, |
|
593 | 566 | "cell_type": "markdown", |
594 | 567 | "metadata": {}, |
595 | 568 | "source": [ |
596 | | - "\n", |
597 | | - "\n", |
598 | 569 | "**Statistical summary with quartiles:**" |
599 | 570 | ] |
600 | 571 | }, |
|
614 | 585 | "source": [ |
615 | 586 | "These examples demonstrate how seaborn handles complex statistical processing automatically, saving significant manual computation and code complexity.\n", |
616 | 587 | "\n", |
617 | | - "\n", |
618 | 588 | "### Cons\n", |
619 | 589 | "\n", |
620 | 590 | "#### Limited customization compared to Matplotlib\n", |
|
659 | 629 | "cell_type": "markdown", |
660 | 630 | "metadata": {}, |
661 | 631 | "source": [ |
662 | | - "\n", |
663 | | - "\n", |
664 | 632 | "#### Limited plot type collection\n", |
665 | 633 | "\n", |
666 | 634 | "While seaborn excels at statistical plots, it lacks the breadth of Matplotlib's visualization options for specialized scientific or custom chart types.\n", |
|
713 | 681 | "cell_type": "markdown", |
714 | 682 | "metadata": {}, |
715 | 683 | "source": [ |
716 | | - "\n", |
717 | | - "\n", |
718 | 684 | "The resulting SVG can be embedded directly into HTML without additional dependencies or image files.\n", |
719 | 685 | "\n", |
720 | | - "\n", |
721 | 686 | "#### Built-in interactivity with hover tooltips\n", |
722 | 687 | "\n", |
723 | 688 | "Every Pygal chart includes hover tooltips by default through native SVG interactivity. Users can explore data points without requiring additional JavaScript libraries, frameworks, or configuration.\n", |
|
740 | 705 | "cell_type": "markdown", |
741 | 706 | "metadata": {}, |
742 | 707 | "source": [ |
743 | | - "\n", |
744 | | - "\n", |
745 | 708 | "To see Pygal's interactivity in Jupyter notebooks, include the following JavaScript dependencies:" |
746 | 709 | ] |
747 | 710 | }, |
|
825 | 788 | "cell_type": "markdown", |
826 | 789 | "metadata": {}, |
827 | 790 | "source": [ |
828 | | - "\n", |
829 | | - "\n", |
830 | 791 | "**Box Plot - Age Distribution by Passenger Class**\n", |
831 | 792 | "\n", |
832 | 793 | "Compare age distributions across different Titanic passenger classes:" |
|
868 | 829 | "cell_type": "markdown", |
869 | 830 | "metadata": {}, |
870 | 831 | "source": [ |
871 | | - "\n", |
872 | | - "\n", |
873 | 832 | "#### Minimal dependencies and fast loading\n", |
874 | 833 | "\n", |
875 | 834 | "Pygal requires minimal dependencies compared to other visualization libraries, making it ideal for lightweight applications where deployment size and startup speed matter.\n", |
|
917 | 876 | "cell_type": "markdown", |
918 | 877 | "metadata": {}, |
919 | 878 | "source": [ |
920 | | - "\n", |
921 | | - "\n", |
922 | 879 | "#### Simplicity in complex plots\n", |
923 | 880 | "\n", |
924 | 881 | "Plotly simplifies the creation of complex plots that might be challenging with other libraries.\n", |
|
954 | 911 | "cell_type": "markdown", |
955 | 912 | "metadata": {}, |
956 | 913 | "source": [ |
957 | | - "\n", |
958 | | - "\n", |
959 | 914 | "In this example, the color of the bubbles represents the number of stars, while the size corresponds to the number of forks.\n", |
960 | 915 | "\n", |
961 | 916 | "#### Business intelligence features\n", |
|
994 | 949 | "cell_type": "markdown", |
995 | 950 | "metadata": {}, |
996 | 951 | "source": [ |
997 | | - "\n", |
998 | | - "\n", |
999 | 952 | "The following example shows an animated bubble chart with timeline controls. Users can navigate through decades of data evolution with custom timeline controls, play/pause buttons, and range sliders." |
1000 | 953 | ] |
1001 | 954 | }, |
|
1029 | 982 | "cell_type": "markdown", |
1030 | 983 | "metadata": {}, |
1031 | 984 | "source": [ |
1032 | | - "\n", |
1033 | | - "\n", |
1034 | 985 | "### Cons\n", |
1035 | 986 | "\n", |
1036 | 987 | "#### Heavy dependencies\n", |
|
1071 | 1022 | "cell_type": "markdown", |
1072 | 1023 | "metadata": {}, |
1073 | 1024 | "source": [ |
1074 | | - "\n", |
1075 | | - "\n", |
1076 | 1025 | "Altair's concise syntax allows you to focus on the data and its relationships, resulting in efficient and expressive visualizations.\n", |
1077 | 1026 | "\n", |
1078 | 1027 | "#### Easy data transformation\n", |
|
1102 | 1051 | "cell_type": "markdown", |
1103 | 1052 | "metadata": {}, |
1104 | 1053 | "source": [ |
1105 | | - "\n", |
1106 | | - "\n", |
1107 | 1054 | "Altair's `transform_aggregate()` function enables you to aggregate data on the fly and use the results in your visualization.\n", |
1108 | 1055 | "\n", |
1109 | 1056 | "You can also specify the data type, such as nominal (categorical data without any order) or quantitative (measures of values), using the `:N` or `:Q` notation.\n", |
|
1150 | 1097 | "cell_type": "markdown", |
1151 | 1098 | "metadata": {}, |
1152 | 1099 | "source": [ |
1153 | | - "\n", |
1154 | | - "\n", |
1155 | 1100 | "As you select an interval within the scatter plot, the bar chart dynamically updates to reflect the filtered data. Altair's ability to link plots allows for highly interactive visualizations with on-the-fly calculations, without the need for a running Python server.\n", |
1156 | 1101 | "\n", |
1157 | 1102 | "### Cons\n", |
|
1209 | 1154 | "cell_type": "markdown", |
1210 | 1155 | "metadata": {}, |
1211 | 1156 | "source": [ |
1212 | | - "\n", |
1213 | | - "\n", |
1214 | 1157 | "…can be achieved with better resolution and interactivity using Bokeh:" |
1215 | 1158 | ] |
1216 | 1159 | }, |
|
1242 | 1185 | "cell_type": "markdown", |
1243 | 1186 | "metadata": {}, |
1244 | 1187 | "source": [ |
1245 | | - "\n", |
1246 | | - "\n", |
1247 | 1188 | "#### Link between plots\n", |
1248 | 1189 | "\n", |
1249 | 1190 | "Bokeh makes it incredibly easy to establish links between plots. Changes applied to one plot can be automatically reflected in another plot with similar variables. This feature allows for exploring relationships between multiple plots.\n", |
|
1290 | 1231 | "source": [ |
1291 | 1232 | "By utilizing `ColumnDataSource`, the data can be shared among plots. Thus, when a change is applied to one plot, the other plots automatically update accordingly.\n", |
1292 | 1233 | "\n", |
1293 | | - "\n", |
1294 | | - "\n", |
1295 | 1234 | "#### Fine-grained control over web deployment\n", |
1296 | 1235 | "\n", |
1297 | 1236 | "Bokeh offers exceptional control over visualization deployment in web applications. You can embed plots in existing websites, create standalone HTML files, or build complete web applications with custom servers, providing seamless integration flexibility.\n", |
|
1361 | 1300 | "</body>\n", |
1362 | 1301 | "```\n", |
1363 | 1302 | "\n", |
1364 | | - "\n", |
1365 | 1303 | "### Cons\n", |
1366 | 1304 | "\n", |
1367 | | - "\n", |
1368 | 1305 | "#### Verbose code requirements\n", |
1369 | 1306 | "\n", |
1370 | 1307 | "While Bokeh offers powerful customization, it demands considerably more setup code to make even simple plots look professional compared to simpler alternatives like seaborn and Plotly.\n", |
|
1401 | 1338 | "cell_type": "markdown", |
1402 | 1339 | "metadata": {}, |
1403 | 1340 | "source": [ |
1404 | | - "\n", |
1405 | | - "\n", |
1406 | 1341 | "Thus, we need to manually adjust the dimensions to make the plot nicer:" |
1407 | 1342 | ] |
1408 | 1343 | }, |
|
0 commit comments