|
611 | 611 | "### Main author per directory" |
612 | 612 | ] |
613 | 613 | }, |
614 | | - { |
615 | | - "cell_type": "code", |
616 | | - "execution_count": null, |
617 | | - "id": "29069753", |
618 | | - "metadata": {}, |
619 | | - "outputs": [], |
620 | | - "source": [ |
621 | | - "# TODO delete unused code" |
622 | | - ] |
623 | | - }, |
624 | | - { |
625 | | - "cell_type": "raw", |
626 | | - "id": "7ccca44e", |
627 | | - "metadata": {}, |
628 | | - "source": [ |
629 | | - "# TODO experiment again with plotly express\n", |
630 | | - "\n", |
631 | | - "import plotly.express as plotly_express\n", |
632 | | - "\n", |
633 | | - "plotly_treemap_color_settings = dict(\n", |
634 | | - " color_continuous_scale='Hot_r', # Hot_r, amp, Reds, Blackbody_r, RdGy_r, RdBu_r\n", |
635 | | - " color_discrete_sequence=plotly_express.colors.qualitative.Vivid,\n", |
636 | | - ")\n", |
637 | | - "plotly_treemap_commit_statistics_custom_data= dict(\n", |
638 | | - " custom_data=['fileCount', 'commitCount', 'authorCount', 'mainAuthor', 'lastCommitDate', 'daysSinceLastCommit', 'lastCreationDate', 'daysSinceLastCreation', 'lastModificationDate', 'daysSinceLastModification', 'directoryPath'],\n", |
639 | | - ")\n", |
640 | | - "plotly_treemap_traces_base_settings = dict(\n", |
641 | | - " root_color=\"lightgrey\",\n", |
642 | | - " textinfo=\"label+value\",\n", |
643 | | - " marker=dict(cornerradius=5),\n", |
644 | | - ")\n", |
645 | | - "plotly_treemap_traces_commit_statistics_settings = dict(\n", |
646 | | - " **plotly_treemap_traces_base_settings,\n", |
647 | | - " hovertemplate='<b>%{label}</b><br>Files: %{customdata[0]}<br>Commits: %{customdata[1]}<br>Authors: %{customdata[2]}<br>Main Author: %{customdata[3]}<br>Last Commit: %{customdata[4]} (%{customdata[5]} days ago)<br>Last Created: %{customdata[6]} (%{customdata[7]} days ago)<br>Last Modified: %{customdata[8]} (%{customdata[9]} days ago)<br>Path: %{customdata[10]}',\n", |
648 | | - ")\n", |
649 | | - "plotly_treemap_layout_base_settings = dict(\n", |
650 | | - " margin=dict(t=50, l=15, r=15, b=15),\n", |
651 | | - ")\n", |
652 | | - "\n", |
653 | | - "# Extract unique authors for category orders\n", |
654 | | - "#unique_authors = git_files_with_commit_statistics['mainAuthor'].unique()\n", |
655 | | - "\n", |
656 | | - "figure = plotly_express.treemap(\n", |
657 | | - " git_files_with_commit_statistics,\n", |
658 | | - " **plotly_treemap_color_settings,\n", |
659 | | - " **plotly_treemap_commit_statistics_custom_data,\n", |
660 | | - " ids='directoryPath',\n", |
661 | | - " names='directoryName',\n", |
662 | | - " parents='directoryParentPath',\n", |
663 | | - " # Without values, much more squares are shown which gives a much better overview\n", |
664 | | - " # values='fileCount', \n", |
665 | | - " color='mainAuthor',\n", |
666 | | - " title='Directories and their main author (discrete coloring, no legend?)',\n", |
667 | | - ")\n", |
668 | | - "figure.update_traces(\n", |
669 | | - " **plotly_treemap_traces_commit_statistics_settings,\n", |
670 | | - ")\n", |
671 | | - "figure.update_layout(\n", |
672 | | - " **plotly_treemap_layout_base_settings,\n", |
673 | | - " # coloraxis_colorbar=dict(title=\"Author\"),\n", |
674 | | - " legend_title_text='Main Author',\n", |
675 | | - " showlegend=True,\n", |
676 | | - " legend_visible=True,\n", |
677 | | - ") \n", |
678 | | - "\n", |
679 | | - "figure.show(**plotly_treemap_figure_show_settings)" |
680 | | - ] |
681 | | - }, |
682 | 614 | { |
683 | 615 | "cell_type": "code", |
684 | 616 | "execution_count": null, |
|
0 commit comments