tesorotools-python 0.1.13__tar.gz → 0.1.14__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {tesorotools_python-0.1.13 → tesorotools_python-0.1.14}/PKG-INFO +1 -1
- {tesorotools_python-0.1.13 → tesorotools_python-0.1.14}/src/tesorotools/__init__.py +3 -0
- {tesorotools_python-0.1.13 → tesorotools_python-0.1.14}/src/tesorotools/artists/__init__.py +2 -0
- {tesorotools_python-0.1.13 → tesorotools_python-0.1.14}/src/tesorotools/artists/names.py +3 -1
- {tesorotools_python-0.1.13 → tesorotools_python-0.1.14}/src/tesorotools/artists/plotly_backend.py +28 -0
- tesorotools_python-0.1.14/src/tesorotools/artists/treemap.py +379 -0
- {tesorotools_python-0.1.13 → tesorotools_python-0.1.14}/src/tesorotools/assets/plots.yaml +14 -0
- {tesorotools_python-0.1.13 → tesorotools_python-0.1.14}/src/tesorotools/note/skill/SKILL.md +4 -4
- {tesorotools_python-0.1.13 → tesorotools_python-0.1.14}/src/tesorotools/palette.py +2 -1
- {tesorotools_python-0.1.13 → tesorotools_python-0.1.14}/src/tesorotools/presentation/builder.py +10 -2
- {tesorotools_python-0.1.13 → tesorotools_python-0.1.14}/src/tesorotools/presentation/charts.py +13 -15
- {tesorotools_python-0.1.13 → tesorotools_python-0.1.14}/src/tesorotools/presentation/house.py +3 -1
- {tesorotools_python-0.1.13 → tesorotools_python-0.1.14}/src/tesorotools/presentation/native.py +42 -22
- {tesorotools_python-0.1.13 → tesorotools_python-0.1.14}/.gitignore +0 -0
- {tesorotools_python-0.1.13 → tesorotools_python-0.1.14}/pyproject.toml +0 -0
- {tesorotools_python-0.1.13 → tesorotools_python-0.1.14}/src/tesorotools/_build_context.py +0 -0
- {tesorotools_python-0.1.13 → tesorotools_python-0.1.14}/src/tesorotools/_registry.py +0 -0
- {tesorotools_python-0.1.13 → tesorotools_python-0.1.14}/src/tesorotools/artists/_bars.py +0 -0
- {tesorotools_python-0.1.13 → tesorotools_python-0.1.14}/src/tesorotools/artists/_common.py +0 -0
- {tesorotools_python-0.1.13 → tesorotools_python-0.1.14}/src/tesorotools/artists/_dates.py +0 -0
- {tesorotools_python-0.1.13 → tesorotools_python-0.1.14}/src/tesorotools/artists/bar_line.py +0 -0
- {tesorotools_python-0.1.13 → tesorotools_python-0.1.14}/src/tesorotools/artists/barh_plot.py +0 -0
- {tesorotools_python-0.1.13 → tesorotools_python-0.1.14}/src/tesorotools/artists/box_plot.py +0 -0
- {tesorotools_python-0.1.13 → tesorotools_python-0.1.14}/src/tesorotools/artists/compact.py +0 -0
- {tesorotools_python-0.1.13 → tesorotools_python-0.1.14}/src/tesorotools/artists/intraday_plot.py +0 -0
- {tesorotools_python-0.1.13 → tesorotools_python-0.1.14}/src/tesorotools/artists/line_plot.py +0 -0
- {tesorotools_python-0.1.13 → tesorotools_python-0.1.14}/src/tesorotools/artists/matrix.py +0 -0
- {tesorotools_python-0.1.13 → tesorotools_python-0.1.14}/src/tesorotools/artists/review.py +0 -0
- {tesorotools_python-0.1.13 → tesorotools_python-0.1.14}/src/tesorotools/artists/sankey.py +0 -0
- {tesorotools_python-0.1.13 → tesorotools_python-0.1.14}/src/tesorotools/artists/scatter.py +0 -0
- {tesorotools_python-0.1.13 → tesorotools_python-0.1.14}/src/tesorotools/artists/sharing.py +0 -0
- {tesorotools_python-0.1.13 → tesorotools_python-0.1.14}/src/tesorotools/artists/shock_plot.py +0 -0
- {tesorotools_python-0.1.13 → tesorotools_python-0.1.14}/src/tesorotools/artists/stacked.py +0 -0
- {tesorotools_python-0.1.13 → tesorotools_python-0.1.14}/src/tesorotools/artists/tikz_backend.py +0 -0
- {tesorotools_python-0.1.13 → tesorotools_python-0.1.14}/src/tesorotools/artists/type_curve.py +0 -0
- {tesorotools_python-0.1.13 → tesorotools_python-0.1.14}/src/tesorotools/artists/vector_plot.py +0 -0
- {tesorotools_python-0.1.13 → tesorotools_python-0.1.14}/src/tesorotools/artists/waterfall.py +0 -0
- {tesorotools_python-0.1.13 → tesorotools_python-0.1.14}/src/tesorotools/assets/README.md +0 -0
- {tesorotools_python-0.1.13 → tesorotools_python-0.1.14}/src/tesorotools/assets/fonts/CabinetGrotesk-Black.otf +0 -0
- {tesorotools_python-0.1.13 → tesorotools_python-0.1.14}/src/tesorotools/assets/fonts/CabinetGrotesk-Bold.otf +0 -0
- {tesorotools_python-0.1.13 → tesorotools_python-0.1.14}/src/tesorotools/assets/fonts/CabinetGrotesk-Extrabold.otf +0 -0
- {tesorotools_python-0.1.13 → tesorotools_python-0.1.14}/src/tesorotools/assets/fonts/CabinetGrotesk-Extralight.otf +0 -0
- {tesorotools_python-0.1.13 → tesorotools_python-0.1.14}/src/tesorotools/assets/fonts/CabinetGrotesk-Light.otf +0 -0
- {tesorotools_python-0.1.13 → tesorotools_python-0.1.14}/src/tesorotools/assets/fonts/CabinetGrotesk-Medium.otf +0 -0
- {tesorotools_python-0.1.13 → tesorotools_python-0.1.14}/src/tesorotools/assets/fonts/CabinetGrotesk-Regular.otf +0 -0
- {tesorotools_python-0.1.13 → tesorotools_python-0.1.14}/src/tesorotools/assets/fonts/CabinetGrotesk-Thin.otf +0 -0
- {tesorotools_python-0.1.13 → tesorotools_python-0.1.14}/src/tesorotools/assets/fonts/README.md +0 -0
- {tesorotools_python-0.1.13 → tesorotools_python-0.1.14}/src/tesorotools/assets/nota_template.dotx +0 -0
- {tesorotools_python-0.1.13 → tesorotools_python-0.1.14}/src/tesorotools/assets/template.docx +0 -0
- {tesorotools_python-0.1.13 → tesorotools_python-0.1.14}/src/tesorotools/assets/tesoro.mplstyle +0 -0
- {tesorotools_python-0.1.13 → tesorotools_python-0.1.14}/src/tesorotools/data_sources/__init__.py +0 -0
- {tesorotools_python-0.1.13 → tesorotools_python-0.1.14}/src/tesorotools/data_sources/debug.py +0 -0
- {tesorotools_python-0.1.13 → tesorotools_python-0.1.14}/src/tesorotools/database/__init__.py +0 -0
- {tesorotools_python-0.1.13 → tesorotools_python-0.1.14}/src/tesorotools/database/local.py +0 -0
- {tesorotools_python-0.1.13 → tesorotools_python-0.1.14}/src/tesorotools/database/push.py +0 -0
- {tesorotools_python-0.1.13 → tesorotools_python-0.1.14}/src/tesorotools/database/shared.py +0 -0
- {tesorotools_python-0.1.13 → tesorotools_python-0.1.14}/src/tesorotools/dates.py +0 -0
- {tesorotools_python-0.1.13 → tesorotools_python-0.1.14}/src/tesorotools/dependencies/__init__.py +0 -0
- {tesorotools_python-0.1.13 → tesorotools_python-0.1.14}/src/tesorotools/dependencies/node.py +0 -0
- {tesorotools_python-0.1.13 → tesorotools_python-0.1.14}/src/tesorotools/dependencies/resolution.py +0 -0
- {tesorotools_python-0.1.13 → tesorotools_python-0.1.14}/src/tesorotools/driver.py +0 -0
- {tesorotools_python-0.1.13 → tesorotools_python-0.1.14}/src/tesorotools/extend.py +0 -0
- {tesorotools_python-0.1.13 → tesorotools_python-0.1.14}/src/tesorotools/latex/__init__.py +0 -0
- {tesorotools_python-0.1.13 → tesorotools_python-0.1.14}/src/tesorotools/latex/cli.py +0 -0
- {tesorotools_python-0.1.13 → tesorotools_python-0.1.14}/src/tesorotools/latex/scaffold.py +0 -0
- {tesorotools_python-0.1.13 → tesorotools_python-0.1.14}/src/tesorotools/latex/templates/article/main.tex.tmpl +0 -0
- {tesorotools_python-0.1.13 → tesorotools_python-0.1.14}/src/tesorotools/latex/templates/article/sections/01-introduccion.tex +0 -0
- {tesorotools_python-0.1.13 → tesorotools_python-0.1.14}/src/tesorotools/latex/templates/article/sections/02-analisis.tex +0 -0
- {tesorotools_python-0.1.13 → tesorotools_python-0.1.14}/src/tesorotools/latex/templates/article/sections/03-conclusiones.tex +0 -0
- {tesorotools_python-0.1.13 → tesorotools_python-0.1.14}/src/tesorotools/latex/templates/beamer/main.tex.tmpl +0 -0
- {tesorotools_python-0.1.13 → tesorotools_python-0.1.14}/src/tesorotools/latex/templates/beamer/slides/01-contexto.tex +0 -0
- {tesorotools_python-0.1.13 → tesorotools_python-0.1.14}/src/tesorotools/latex/templates/beamer/slides/02-analisis.tex +0 -0
- {tesorotools_python-0.1.13 → tesorotools_python-0.1.14}/src/tesorotools/latex/templates/beamer/slides/03-conclusiones.tex +0 -0
- {tesorotools_python-0.1.13 → tesorotools_python-0.1.14}/src/tesorotools/latex/templates/beamer/style/beamerthemeTesoro.sty +0 -0
- {tesorotools_python-0.1.13 → tesorotools_python-0.1.14}/src/tesorotools/latex/templates/book/appendices/a-fuentes.tex +0 -0
- {tesorotools_python-0.1.13 → tesorotools_python-0.1.14}/src/tesorotools/latex/templates/book/chapters/01-introduccion.tex +0 -0
- {tesorotools_python-0.1.13 → tesorotools_python-0.1.14}/src/tesorotools/latex/templates/book/chapters/02-analisis.tex +0 -0
- {tesorotools_python-0.1.13 → tesorotools_python-0.1.14}/src/tesorotools/latex/templates/book/frontmatter/resumen.tex +0 -0
- {tesorotools_python-0.1.13 → tesorotools_python-0.1.14}/src/tesorotools/latex/templates/book/main.tex.tmpl +0 -0
- {tesorotools_python-0.1.13 → tesorotools_python-0.1.14}/src/tesorotools/latex/templates/common/README.md.tmpl +0 -0
- {tesorotools_python-0.1.13 → tesorotools_python-0.1.14}/src/tesorotools/latex/templates/common/dot-gitignore +0 -0
- {tesorotools_python-0.1.13 → tesorotools_python-0.1.14}/src/tesorotools/latex/templates/common/dot-vscode/settings.json +0 -0
- {tesorotools_python-0.1.13 → tesorotools_python-0.1.14}/src/tesorotools/latex/templates/common/figures/dot-gitkeep +0 -0
- {tesorotools_python-0.1.13 → tesorotools_python-0.1.14}/src/tesorotools/latex/templates/common/fonts/README.md +0 -0
- {tesorotools_python-0.1.13 → tesorotools_python-0.1.14}/src/tesorotools/latex/templates/common/latexmkrc +0 -0
- {tesorotools_python-0.1.13 → tesorotools_python-0.1.14}/src/tesorotools/latex/templates/common/refs.bib +0 -0
- {tesorotools_python-0.1.13 → tesorotools_python-0.1.14}/src/tesorotools/latex/templates/common/style/tesoro.sty +0 -0
- {tesorotools_python-0.1.13 → tesorotools_python-0.1.14}/src/tesorotools/latex/templates/common/style/tesorobrand.sty.tmpl +0 -0
- {tesorotools_python-0.1.13 → tesorotools_python-0.1.14}/src/tesorotools/latex/templates/common/style/tesorolocal.sty.tmpl +0 -0
- {tesorotools_python-0.1.13 → tesorotools_python-0.1.14}/src/tesorotools/manifest.py +0 -0
- {tesorotools_python-0.1.13 → tesorotools_python-0.1.14}/src/tesorotools/note/__init__.py +0 -0
- {tesorotools_python-0.1.13 → tesorotools_python-0.1.14}/src/tesorotools/note/builder.py +0 -0
- {tesorotools_python-0.1.13 → tesorotools_python-0.1.14}/src/tesorotools/note/charts.py +0 -0
- {tesorotools_python-0.1.13 → tesorotools_python-0.1.14}/src/tesorotools/note/cli.py +0 -0
- {tesorotools_python-0.1.13 → tesorotools_python-0.1.14}/src/tesorotools/note/inline.py +0 -0
- {tesorotools_python-0.1.13 → tesorotools_python-0.1.14}/src/tesorotools/note/issues.py +0 -0
- {tesorotools_python-0.1.13 → tesorotools_python-0.1.14}/src/tesorotools/note/lint.py +0 -0
- {tesorotools_python-0.1.13 → tesorotools_python-0.1.14}/src/tesorotools/note/markdown.py +0 -0
- {tesorotools_python-0.1.13 → tesorotools_python-0.1.14}/src/tesorotools/note/pdf.py +0 -0
- {tesorotools_python-0.1.13 → tesorotools_python-0.1.14}/src/tesorotools/note/skeleton.md +0 -0
- {tesorotools_python-0.1.13 → tesorotools_python-0.1.14}/src/tesorotools/note/skill/reglas.md +0 -0
- {tesorotools_python-0.1.13 → tesorotools_python-0.1.14}/src/tesorotools/note/template.py +0 -0
- {tesorotools_python-0.1.13 → tesorotools_python-0.1.14}/src/tesorotools/offsets/__init__.py +0 -0
- {tesorotools_python-0.1.13 → tesorotools_python-0.1.14}/src/tesorotools/offsets/offsets.py +0 -0
- {tesorotools_python-0.1.13 → tesorotools_python-0.1.14}/src/tesorotools/offsets/outliers.py +0 -0
- {tesorotools_python-0.1.13 → tesorotools_python-0.1.14}/src/tesorotools/orchestration.py +0 -0
- {tesorotools_python-0.1.13 → tesorotools_python-0.1.14}/src/tesorotools/pipeline/__init__.py +0 -0
- {tesorotools_python-0.1.13 → tesorotools_python-0.1.14}/src/tesorotools/pipeline/diagnose.py +0 -0
- {tesorotools_python-0.1.13 → tesorotools_python-0.1.14}/src/tesorotools/pipeline/engine.py +0 -0
- {tesorotools_python-0.1.13 → tesorotools_python-0.1.14}/src/tesorotools/pipeline/rules.py +0 -0
- {tesorotools_python-0.1.13 → tesorotools_python-0.1.14}/src/tesorotools/presentation/__init__.py +0 -0
- {tesorotools_python-0.1.13 → tesorotools_python-0.1.14}/src/tesorotools/presentation/cli.py +0 -0
- {tesorotools_python-0.1.13 → tesorotools_python-0.1.14}/src/tesorotools/presentation/fit.py +0 -0
- {tesorotools_python-0.1.13 → tesorotools_python-0.1.14}/src/tesorotools/presentation/fonts.py +0 -0
- {tesorotools_python-0.1.13 → tesorotools_python-0.1.14}/src/tesorotools/presentation/glossary.py +0 -0
- {tesorotools_python-0.1.13 → tesorotools_python-0.1.14}/src/tesorotools/presentation/lint.py +0 -0
- {tesorotools_python-0.1.13 → tesorotools_python-0.1.14}/src/tesorotools/presentation/markdown.py +0 -0
- {tesorotools_python-0.1.13 → tesorotools_python-0.1.14}/src/tesorotools/presentation/pdf.py +0 -0
- {tesorotools_python-0.1.13 → tesorotools_python-0.1.14}/src/tesorotools/presentation/sections.py +0 -0
- {tesorotools_python-0.1.13 → tesorotools_python-0.1.14}/src/tesorotools/presentation/skeleton.md +0 -0
- {tesorotools_python-0.1.13 → tesorotools_python-0.1.14}/src/tesorotools/presentation/skill/SKILL.md +0 -0
- {tesorotools_python-0.1.13 → tesorotools_python-0.1.14}/src/tesorotools/presentation/skill/reglas.md +0 -0
- {tesorotools_python-0.1.13 → tesorotools_python-0.1.14}/src/tesorotools/presentation/template.py +0 -0
- {tesorotools_python-0.1.13 → tesorotools_python-0.1.14}/src/tesorotools/providers/__init__.py +0 -0
- {tesorotools_python-0.1.13 → tesorotools_python-0.1.14}/src/tesorotools/providers/base.py +0 -0
- {tesorotools_python-0.1.13 → tesorotools_python-0.1.14}/src/tesorotools/providers/bde.py +0 -0
- {tesorotools_python-0.1.13 → tesorotools_python-0.1.14}/src/tesorotools/providers/ecb.py +0 -0
- {tesorotools_python-0.1.13 → tesorotools_python-0.1.14}/src/tesorotools/providers/fred.py +0 -0
- {tesorotools_python-0.1.13 → tesorotools_python-0.1.14}/src/tesorotools/providers/imf_irfcl.py +0 -0
- {tesorotools_python-0.1.13 → tesorotools_python-0.1.14}/src/tesorotools/providers/lseg.py +0 -0
- {tesorotools_python-0.1.13 → tesorotools_python-0.1.14}/src/tesorotools/py.typed +0 -0
- {tesorotools_python-0.1.13 → tesorotools_python-0.1.14}/src/tesorotools/render/__init__.py +0 -0
- {tesorotools_python-0.1.13 → tesorotools_python-0.1.14}/src/tesorotools/render/content/__init__.py +0 -0
- {tesorotools_python-0.1.13 → tesorotools_python-0.1.14}/src/tesorotools/render/content/content.py +0 -0
- {tesorotools_python-0.1.13 → tesorotools_python-0.1.14}/src/tesorotools/render/content/images.py +0 -0
- {tesorotools_python-0.1.13 → tesorotools_python-0.1.14}/src/tesorotools/render/content/section.py +0 -0
- {tesorotools_python-0.1.13 → tesorotools_python-0.1.14}/src/tesorotools/render/content/subtitle.py +0 -0
- {tesorotools_python-0.1.13 → tesorotools_python-0.1.14}/src/tesorotools/render/content/table.py +0 -0
- {tesorotools_python-0.1.13 → tesorotools_python-0.1.14}/src/tesorotools/render/content/text.py +0 -0
- {tesorotools_python-0.1.13 → tesorotools_python-0.1.14}/src/tesorotools/render/content/title.py +0 -0
- {tesorotools_python-0.1.13 → tesorotools_python-0.1.14}/src/tesorotools/render/document.py +0 -0
- {tesorotools_python-0.1.13 → tesorotools_python-0.1.14}/src/tesorotools/render/report.py +0 -0
- {tesorotools_python-0.1.13 → tesorotools_python-0.1.14}/src/tesorotools/scaffold.py +0 -0
- {tesorotools_python-0.1.13 → tesorotools_python-0.1.14}/src/tesorotools/testing/__init__.py +0 -0
- {tesorotools_python-0.1.13 → tesorotools_python-0.1.14}/src/tesorotools/testing/compare.py +0 -0
- {tesorotools_python-0.1.13 → tesorotools_python-0.1.14}/src/tesorotools/utils/__init__.py +0 -0
- {tesorotools_python-0.1.13 → tesorotools_python-0.1.14}/src/tesorotools/utils/config.py +0 -0
- {tesorotools_python-0.1.13 → tesorotools_python-0.1.14}/src/tesorotools/utils/format.py +0 -0
- {tesorotools_python-0.1.13 → tesorotools_python-0.1.14}/src/tesorotools/utils/globals.py +0 -0
- {tesorotools_python-0.1.13 → tesorotools_python-0.1.14}/src/tesorotools/utils/matplotlib.py +0 -0
- {tesorotools_python-0.1.13 → tesorotools_python-0.1.14}/src/tesorotools/utils/series.py +0 -0
- {tesorotools_python-0.1.13 → tesorotools_python-0.1.14}/src/tesorotools/utils/shortcuts.py +0 -0
- {tesorotools_python-0.1.13 → tesorotools_python-0.1.14}/src/tesorotools/utils/template.py +0 -0
- {tesorotools_python-0.1.13 → tesorotools_python-0.1.14}/src/tesorotools/web/__init__.py +0 -0
- {tesorotools_python-0.1.13 → tesorotools_python-0.1.14}/src/tesorotools/web/app.py +0 -0
- {tesorotools_python-0.1.13 → tesorotools_python-0.1.14}/src/tesorotools/web/brand.py +0 -0
- {tesorotools_python-0.1.13 → tesorotools_python-0.1.14}/src/tesorotools/web/cli.py +0 -0
- {tesorotools_python-0.1.13 → tesorotools_python-0.1.14}/src/tesorotools/web/components.py +0 -0
- {tesorotools_python-0.1.13 → tesorotools_python-0.1.14}/src/tesorotools/web/formatting.py +0 -0
- {tesorotools_python-0.1.13 → tesorotools_python-0.1.14}/src/tesorotools/web/launcher.py +0 -0
- {tesorotools_python-0.1.13 → tesorotools_python-0.1.14}/src/tesorotools/web/palette.py +0 -0
- {tesorotools_python-0.1.13 → tesorotools_python-0.1.14}/src/tesorotools/web/period.py +0 -0
- {tesorotools_python-0.1.13 → tesorotools_python-0.1.14}/src/tesorotools/web/plotting.py +0 -0
- {tesorotools_python-0.1.13 → tesorotools_python-0.1.14}/src/tesorotools/web/scaffold.py +0 -0
- {tesorotools_python-0.1.13 → tesorotools_python-0.1.14}/src/tesorotools/web/templates/Dockerfile.tmpl +0 -0
- {tesorotools_python-0.1.13 → tesorotools_python-0.1.14}/src/tesorotools/web/templates/README.md.tmpl +0 -0
- {tesorotools_python-0.1.13 → tesorotools_python-0.1.14}/src/tesorotools/web/templates/dot-dockerignore.tmpl +0 -0
- {tesorotools_python-0.1.13 → tesorotools_python-0.1.14}/src/tesorotools/web/templates/dot-gitignore.tmpl +0 -0
- {tesorotools_python-0.1.13 → tesorotools_python-0.1.14}/src/tesorotools/web/templates/dot-streamlit/config.toml.tmpl +0 -0
- {tesorotools_python-0.1.13 → tesorotools_python-0.1.14}/src/tesorotools/web/templates/pyproject.toml.tmpl +0 -0
- {tesorotools_python-0.1.13 → tesorotools_python-0.1.14}/src/tesorotools/web/templates/src/$package/__init__.py.tmpl +0 -0
- {tesorotools_python-0.1.13 → tesorotools_python-0.1.14}/src/tesorotools/web/templates/src/$package/cli.py.tmpl +0 -0
- {tesorotools_python-0.1.13 → tesorotools_python-0.1.14}/src/tesorotools/web/templates/src/$package/main.py.tmpl +0 -0
- {tesorotools_python-0.1.13 → tesorotools_python-0.1.14}/src/tesorotools/web/templates/src/$package/sections.py.tmpl +0 -0
- {tesorotools_python-0.1.13 → tesorotools_python-0.1.14}/src/tesorotools/web/templates/tests/__init__.py.tmpl +0 -0
- {tesorotools_python-0.1.13 → tesorotools_python-0.1.14}/src/tesorotools/web/templates/tests/test_app.py.tmpl +0 -0
- {tesorotools_python-0.1.13 → tesorotools_python-0.1.14}/src/tesorotools/web/theme.py +0 -0
|
@@ -79,6 +79,7 @@ from tesorotools.artists import (
|
|
|
79
79
|
ShockChart,
|
|
80
80
|
StackedAreaPlot,
|
|
81
81
|
StackedBarPlot,
|
|
82
|
+
TreemapChart,
|
|
82
83
|
TypeCurve,
|
|
83
84
|
VectorPlot,
|
|
84
85
|
Waterfall,
|
|
@@ -134,6 +135,7 @@ def _register_builtins() -> None:
|
|
|
134
135
|
register_artist("waterfall", Waterfall)
|
|
135
136
|
register_artist("sankey", SankeyPlot)
|
|
136
137
|
register_artist("scatter", ScatterPlot)
|
|
138
|
+
register_artist("treemap", TreemapChart)
|
|
137
139
|
|
|
138
140
|
register_tag("format", Format)
|
|
139
141
|
register_tag("legend", Legend)
|
|
@@ -191,6 +193,7 @@ __all__ = [
|
|
|
191
193
|
"TemplateLoader",
|
|
192
194
|
"Text",
|
|
193
195
|
"Title",
|
|
196
|
+
"TreemapChart",
|
|
194
197
|
"TypeCurve",
|
|
195
198
|
"VectorPlot",
|
|
196
199
|
"Waterfall",
|
|
@@ -66,6 +66,7 @@ from tesorotools.artists.sharing import (
|
|
|
66
66
|
)
|
|
67
67
|
from tesorotools.artists.shock_plot import ShockChart
|
|
68
68
|
from tesorotools.artists.stacked import StackedAreaPlot, StackedBarPlot
|
|
69
|
+
from tesorotools.artists.treemap import TreemapChart
|
|
69
70
|
from tesorotools.artists.type_curve import TypeCurve
|
|
70
71
|
from tesorotools.artists.vector_plot import VectorPlot
|
|
71
72
|
from tesorotools.artists.waterfall import Waterfall
|
|
@@ -90,6 +91,7 @@ __all__ = [
|
|
|
90
91
|
"ShockChart",
|
|
91
92
|
"StackedAreaPlot",
|
|
92
93
|
"StackedBarPlot",
|
|
94
|
+
"TreemapChart",
|
|
93
95
|
"TypeCurve",
|
|
94
96
|
"VectorPlot",
|
|
95
97
|
"Waterfall",
|
|
@@ -68,9 +68,11 @@ KIND_NAMES: dict[str, KindName] = {
|
|
|
68
68
|
"type_curve": KindName(("curva", "curva_de_tipos", "curva_tipos")),
|
|
69
69
|
"vector_plot": KindName(("vectores", "flechas")),
|
|
70
70
|
"matrix": KindName(("matriz", "mapa_de_calor")),
|
|
71
|
-
|
|
71
|
+
# known by its English name too: «sankey» is the one printed
|
|
72
|
+
"sankey": KindName(("sankey", "diagrama_de_flujos", "flujos")),
|
|
72
73
|
"shock_plot": KindName(("impactos", "choques", "perturbaciones")),
|
|
73
74
|
"intraday": KindName(("intradia",)),
|
|
75
|
+
"treemap": KindName(("treemap", "mapa_de_arbol", "mapa_de_rectangulos")),
|
|
74
76
|
}
|
|
75
77
|
|
|
76
78
|
|
{tesorotools_python-0.1.13 → tesorotools_python-0.1.14}/src/tesorotools/artists/plotly_backend.py
RENAMED
|
@@ -70,6 +70,7 @@ if TYPE_CHECKING:
|
|
|
70
70
|
from tesorotools.artists.scatter import ScatterPlot
|
|
71
71
|
from tesorotools.artists.shock_plot import ShockChart
|
|
72
72
|
from tesorotools.artists.stacked import StackedAreaPlot, StackedBarPlot
|
|
73
|
+
from tesorotools.artists.treemap import TreemapChart
|
|
73
74
|
from tesorotools.artists.type_curve import TypeCurve
|
|
74
75
|
from tesorotools.artists.vector_plot import VectorPlot
|
|
75
76
|
from tesorotools.artists.waterfall import Waterfall
|
|
@@ -87,6 +88,7 @@ __all__ = [
|
|
|
87
88
|
"shock_chart_to_figure",
|
|
88
89
|
"stacked_area_to_figure",
|
|
89
90
|
"stacked_bar_to_figure",
|
|
91
|
+
"treemap_to_figure",
|
|
90
92
|
"type_curve_to_figure",
|
|
91
93
|
"vector_plot_to_figure",
|
|
92
94
|
"waterfall_to_figure",
|
|
@@ -1258,6 +1260,32 @@ def sankey_to_figure(chart: SankeyPlot) -> go.Figure:
|
|
|
1258
1260
|
return fig
|
|
1259
1261
|
|
|
1260
1262
|
|
|
1263
|
+
def treemap_to_figure(chart: TreemapChart) -> go.Figure:
|
|
1264
|
+
"""Interactive ``Figure`` from a :class:`TreemapChart` (``go.Treemap``).
|
|
1265
|
+
|
|
1266
|
+
The same parts in the same colours, each labelled with its name and
|
|
1267
|
+
the figure (and share) of the PNG; Plotly lays the rectangles out on
|
|
1268
|
+
its own, with the same squarified algorithm.
|
|
1269
|
+
"""
|
|
1270
|
+
tiles = chart.tiles()
|
|
1271
|
+
fig = _new_figure()
|
|
1272
|
+
fig.add_trace(
|
|
1273
|
+
go.Treemap(
|
|
1274
|
+
ids=[t.id for t in tiles],
|
|
1275
|
+
labels=[t.label for t in tiles],
|
|
1276
|
+
parents=[""] * len(tiles),
|
|
1277
|
+
values=[t.value for t in tiles],
|
|
1278
|
+
customdata=[chart.figure_text(t) for t in tiles],
|
|
1279
|
+
texttemplate="<b>%{label}</b><br>%{customdata}",
|
|
1280
|
+
hovertemplate="%{label}: %{customdata}<extra></extra>",
|
|
1281
|
+
marker={"colors": [t.color for t in tiles]},
|
|
1282
|
+
sort=False,
|
|
1283
|
+
tiling={"packing": "squarify", "pad": 2},
|
|
1284
|
+
)
|
|
1285
|
+
)
|
|
1286
|
+
return fig
|
|
1287
|
+
|
|
1288
|
+
|
|
1261
1289
|
#: ``ScatterPlot`` label side -> Plotly ``textposition``.
|
|
1262
1290
|
_TEXT_POSITION = {
|
|
1263
1291
|
"above right": "top right",
|
|
@@ -0,0 +1,379 @@
|
|
|
1
|
+
"""Treemap: the parts of a total as rectangles, each as big as its share.
|
|
2
|
+
|
|
3
|
+
Defines :class:`TreemapChart`, the YAML-tag-aware artist registered as
|
|
4
|
+
``!treemap``. Input is the shape :class:`HorizontalBarChart` reads: a
|
|
5
|
+
``pd.DataFrame`` indexed by id with the figure in ``value_column``, and
|
|
6
|
+
``series`` choosing and naming the parts (all the rows when omitted).
|
|
7
|
+
Typical use: who holds the debt, what the budget is spent on, the
|
|
8
|
+
weight of each country in an index.
|
|
9
|
+
|
|
10
|
+
The rectangles are laid out with the *squarified* algorithm (Bruls,
|
|
11
|
+
Huizing and van Wijk, 2000) in the real proportions of the figure, so
|
|
12
|
+
they come out as close to squares as the figures allow, the largest at
|
|
13
|
+
the top left. Each one is filled in a ramp of the house blue (the
|
|
14
|
+
largest the darkest) unless ``colors`` says otherwise, and carries its
|
|
15
|
+
name, its figure and its share of the total when they fit; a part too
|
|
16
|
+
small to hold its name stays unlabelled.
|
|
17
|
+
|
|
18
|
+
Styling constants come from ``PLOT_CONFIG['treemap']``.
|
|
19
|
+
"""
|
|
20
|
+
|
|
21
|
+
from __future__ import annotations
|
|
22
|
+
|
|
23
|
+
from collections.abc import Sequence
|
|
24
|
+
from dataclasses import dataclass
|
|
25
|
+
from pathlib import Path
|
|
26
|
+
from typing import Any, ClassVar, Self
|
|
27
|
+
|
|
28
|
+
import matplotlib.pyplot as plt
|
|
29
|
+
import pandas as pd
|
|
30
|
+
from matplotlib.axes import Axes
|
|
31
|
+
from matplotlib.colors import to_hex, to_rgba
|
|
32
|
+
from matplotlib.figure import Figure
|
|
33
|
+
from matplotlib.patches import Rectangle
|
|
34
|
+
from matplotlib.text import Text
|
|
35
|
+
from yaml.nodes import MappingNode
|
|
36
|
+
|
|
37
|
+
from tesorotools import palette
|
|
38
|
+
from tesorotools.artists._common import (
|
|
39
|
+
FigureLifecycle,
|
|
40
|
+
Format,
|
|
41
|
+
compact_figure_kwargs,
|
|
42
|
+
compact_font_pt,
|
|
43
|
+
resolve_data,
|
|
44
|
+
)
|
|
45
|
+
from tesorotools.utils.matplotlib import PLOT_CONFIG, chart_number
|
|
46
|
+
from tesorotools.utils.template import TemplateLoader
|
|
47
|
+
|
|
48
|
+
__all__ = ["TreemapChart", "squarify"]
|
|
49
|
+
|
|
50
|
+
TREEMAP_CONFIG: dict[str, Any] = PLOT_CONFIG.get("treemap", {})
|
|
51
|
+
|
|
52
|
+
Rect = tuple[float, float, float, float]
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
@dataclass(frozen=True)
|
|
56
|
+
class Tile:
|
|
57
|
+
"""One part of the treemap: its id, label, figure, share of the total
|
|
58
|
+
(0-1), colour and rectangle ``(x, y, width, height)``, ``y`` growing
|
|
59
|
+
downwards from the top."""
|
|
60
|
+
|
|
61
|
+
id: str
|
|
62
|
+
label: str
|
|
63
|
+
value: float
|
|
64
|
+
share: float
|
|
65
|
+
color: str
|
|
66
|
+
rect: Rect
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
def _worst(row: Sequence[float], side: float) -> float:
|
|
70
|
+
"""The worst aspect ratio of the areas *row* laid along *side*."""
|
|
71
|
+
total = sum(row)
|
|
72
|
+
return max(
|
|
73
|
+
max(
|
|
74
|
+
side * side * a / (total * total), total * total / (side * side * a)
|
|
75
|
+
)
|
|
76
|
+
for a in row
|
|
77
|
+
)
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
def squarify(
|
|
81
|
+
values: Sequence[float], width: float, height: float
|
|
82
|
+
) -> list[Rect]:
|
|
83
|
+
"""The rectangles of *values* (positive, largest first) in a
|
|
84
|
+
*width* x *height* box, each with the area of its share.
|
|
85
|
+
|
|
86
|
+
Rectangles are ``(x, y, width, height)`` with ``y`` growing
|
|
87
|
+
downwards: the first value sits at the top left. Each strip is laid
|
|
88
|
+
along the shorter side of what is left, and takes values while that
|
|
89
|
+
keeps its worst aspect ratio from getting worse.
|
|
90
|
+
"""
|
|
91
|
+
scale = width * height / sum(values)
|
|
92
|
+
areas = [v * scale for v in values]
|
|
93
|
+
x, y, w, h = 0.0, 0.0, float(width), float(height)
|
|
94
|
+
rects: list[Rect] = []
|
|
95
|
+
i = 0
|
|
96
|
+
while i < len(areas):
|
|
97
|
+
side = min(w, h)
|
|
98
|
+
row = [areas[i]]
|
|
99
|
+
i += 1
|
|
100
|
+
while i < len(areas) and _worst([*row, areas[i]], side) <= _worst(
|
|
101
|
+
row, side
|
|
102
|
+
):
|
|
103
|
+
row.append(areas[i])
|
|
104
|
+
i += 1
|
|
105
|
+
strip = sum(row)
|
|
106
|
+
if w >= h: # a column on the left, top to bottom
|
|
107
|
+
across = strip / h
|
|
108
|
+
top = y
|
|
109
|
+
for a in row:
|
|
110
|
+
rects.append((x, top, across, a / across))
|
|
111
|
+
top += a / across
|
|
112
|
+
x, w = x + across, w - across
|
|
113
|
+
else: # a row on top, left to right
|
|
114
|
+
across = strip / w
|
|
115
|
+
left = x
|
|
116
|
+
for a in row:
|
|
117
|
+
rects.append((left, y, a / across, across))
|
|
118
|
+
left += a / across
|
|
119
|
+
y, h = y + across, h - across
|
|
120
|
+
return rects
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
def _ramp(n: int) -> list[str]:
|
|
124
|
+
"""*n* colours from the dark to the light end of the house ramp."""
|
|
125
|
+
dark = to_rgba(TREEMAP_CONFIG.get("dark", f"#{palette.BLUE}"))
|
|
126
|
+
light = to_rgba(TREEMAP_CONFIG.get("light", f"#{palette.BLUE_PALE}"))
|
|
127
|
+
steps = max(n - 1, 1)
|
|
128
|
+
|
|
129
|
+
def mix(k: int) -> tuple[float, float, float, float]:
|
|
130
|
+
r, g, b, a = (d + (lt - d) * k / steps for d, lt in zip(dark, light))
|
|
131
|
+
return (r, g, b, a)
|
|
132
|
+
|
|
133
|
+
return [to_hex(mix(k)) for k in range(n)]
|
|
134
|
+
|
|
135
|
+
|
|
136
|
+
def _text_color(fill: str) -> str:
|
|
137
|
+
"""White on a dark fill, the dark text on a light one."""
|
|
138
|
+
r, g, b, _ = to_rgba(fill)
|
|
139
|
+
luminance = 0.299 * r + 0.587 * g + 0.114 * b
|
|
140
|
+
if luminance < float(TREEMAP_CONFIG.get("luminance_threshold", 0.55)):
|
|
141
|
+
return str(TREEMAP_CONFIG.get("light_text", "white"))
|
|
142
|
+
return str(TREEMAP_CONFIG.get("dark_text", "#1a1a1a"))
|
|
143
|
+
|
|
144
|
+
|
|
145
|
+
class TreemapChart(FigureLifecycle):
|
|
146
|
+
"""Treemap of the parts of a total.
|
|
147
|
+
|
|
148
|
+
Parameters
|
|
149
|
+
----------
|
|
150
|
+
out_path
|
|
151
|
+
``.png`` path the rendered chart is saved to.
|
|
152
|
+
data, data_path
|
|
153
|
+
Provide one. A DataFrame indexed by the ids of the parts with
|
|
154
|
+
their figure in ``value_column``.
|
|
155
|
+
series
|
|
156
|
+
``id -> label`` of the parts to draw; all the rows of ``data``,
|
|
157
|
+
by their id, when omitted. The order does not matter: the
|
|
158
|
+
parts are drawn from the largest.
|
|
159
|
+
value_column
|
|
160
|
+
Column of ``data`` with the figures (default ``value``); they
|
|
161
|
+
must be positive.
|
|
162
|
+
colors
|
|
163
|
+
``id -> colour`` (``"C0"``..., names or hex) of the parts that
|
|
164
|
+
do not take the blue ramp.
|
|
165
|
+
fmt
|
|
166
|
+
Number format of the figures.
|
|
167
|
+
show_share
|
|
168
|
+
Add the share of the total to each label (``45,2 (38 %)``).
|
|
169
|
+
Default ``True``.
|
|
170
|
+
figsize, compact, font_pt
|
|
171
|
+
As in the other artists. ``compact`` renders at the fixed
|
|
172
|
+
compact size with ``compact.font_pt`` text (or ``font_pt``).
|
|
173
|
+
"""
|
|
174
|
+
|
|
175
|
+
#: Keys that change the PNG but never the ``to_plotly()`` figure
|
|
176
|
+
#: (see :func:`plotly_unsupported`); checked against real renders
|
|
177
|
+
#: by ``tests/test_plotly_support.py``.
|
|
178
|
+
PLOTLY_UNSUPPORTED: ClassVar[frozenset[str]] = frozenset(
|
|
179
|
+
{
|
|
180
|
+
"compact",
|
|
181
|
+
"figsize",
|
|
182
|
+
"font_pt",
|
|
183
|
+
}
|
|
184
|
+
)
|
|
185
|
+
|
|
186
|
+
def __init__(
|
|
187
|
+
self,
|
|
188
|
+
out_path: Path,
|
|
189
|
+
*,
|
|
190
|
+
data: pd.DataFrame | None = None,
|
|
191
|
+
data_path: Path | None = None,
|
|
192
|
+
series: dict[str, str] | None = None,
|
|
193
|
+
value_column: str = "value",
|
|
194
|
+
colors: dict[str, str] | None = None,
|
|
195
|
+
fmt: Format | None = None,
|
|
196
|
+
show_share: bool = True,
|
|
197
|
+
figsize: tuple[float, float] | None = None,
|
|
198
|
+
compact: bool = False,
|
|
199
|
+
font_pt: float | None = None,
|
|
200
|
+
) -> None:
|
|
201
|
+
if out_path.suffix != ".png":
|
|
202
|
+
raise ValueError(f"out_path must be .png: {out_path}")
|
|
203
|
+
self.out_path = out_path
|
|
204
|
+
self.data = resolve_data(data, data_path)
|
|
205
|
+
#: Feather the data came from (None: built from in-memory data);
|
|
206
|
+
#: kept so the chart can be written back to YAML.
|
|
207
|
+
self.data_path = data_path
|
|
208
|
+
self.series = series
|
|
209
|
+
self.value_column = value_column
|
|
210
|
+
self.colors = colors or {}
|
|
211
|
+
self.fmt = fmt or Format(decimals=1)
|
|
212
|
+
self.show_share = show_share
|
|
213
|
+
self.figsize = figsize
|
|
214
|
+
self.compact = compact
|
|
215
|
+
self.font_pt = font_pt
|
|
216
|
+
|
|
217
|
+
@classmethod
|
|
218
|
+
def from_yaml(cls, loader: TemplateLoader, node: MappingNode) -> Self:
|
|
219
|
+
"""Build a :class:`TreemapChart` from the ``!treemap`` YAML tag.
|
|
220
|
+
|
|
221
|
+
Required keys: ``out_path`` and ``data_path`` (``.feather``).
|
|
222
|
+
Every other ``__init__`` keyword is forwarded.
|
|
223
|
+
|
|
224
|
+
Example
|
|
225
|
+
-------
|
|
226
|
+
.. code-block:: yaml
|
|
227
|
+
|
|
228
|
+
tenedores: !treemap
|
|
229
|
+
out_path: out/tenedores.png
|
|
230
|
+
data_path: data/tenedores.feather
|
|
231
|
+
series: {bancos: Bancos, fondos: Fondos, bce: Eurosistema}
|
|
232
|
+
fmt: !format {decimals: 1, units: " mm"}
|
|
233
|
+
"""
|
|
234
|
+
cfg: dict[str, Any] = loader.construct_mapping( # type: ignore[assignment]
|
|
235
|
+
node, deep=True
|
|
236
|
+
)
|
|
237
|
+
cfg.pop("id", None)
|
|
238
|
+
cfg["out_path"] = Path(cfg["out_path"])
|
|
239
|
+
if "data_path" in cfg:
|
|
240
|
+
cfg["data_path"] = Path(cfg["data_path"])
|
|
241
|
+
return cls(**cfg)
|
|
242
|
+
|
|
243
|
+
# ------------------------------------------------------------------
|
|
244
|
+
# Backend-neutral layout
|
|
245
|
+
# ------------------------------------------------------------------
|
|
246
|
+
|
|
247
|
+
def parts(self) -> list[tuple[str, str, float]]:
|
|
248
|
+
"""``(id, label, value)`` of each part, the largest first."""
|
|
249
|
+
if self.value_column not in self.data.columns:
|
|
250
|
+
raise KeyError(
|
|
251
|
+
f"TreemapChart value_column {self.value_column!r} not in data"
|
|
252
|
+
)
|
|
253
|
+
series = self.series or {str(i): str(i) for i in self.data.index}
|
|
254
|
+
index = {str(i): i for i in self.data.index}
|
|
255
|
+
missing = [s for s in series if s not in index]
|
|
256
|
+
if missing:
|
|
257
|
+
raise KeyError(f"TreemapChart ids not found in data: {missing}")
|
|
258
|
+
values = self.data[self.value_column]
|
|
259
|
+
parts = [
|
|
260
|
+
(s, label, float(values[index[s]])) for s, label in series.items()
|
|
261
|
+
]
|
|
262
|
+
bad = [label for _, label, v in parts if not v > 0]
|
|
263
|
+
if bad:
|
|
264
|
+
raise ValueError(f"a treemap draws positive figures only: {bad}")
|
|
265
|
+
return sorted(parts, key=lambda p: -p[2])
|
|
266
|
+
|
|
267
|
+
def tiles(self, width: float = 1.0, height: float = 1.0) -> list[Tile]:
|
|
268
|
+
"""The parts laid out in a *width* x *height* box."""
|
|
269
|
+
parts = self.parts()
|
|
270
|
+
total = sum(v for _, _, v in parts)
|
|
271
|
+
ramp = _ramp(len(parts))
|
|
272
|
+
rects = squarify([v for _, _, v in parts], width, height)
|
|
273
|
+
return [
|
|
274
|
+
Tile(
|
|
275
|
+
s,
|
|
276
|
+
label,
|
|
277
|
+
v,
|
|
278
|
+
v / total,
|
|
279
|
+
to_hex(self.colors[s]) if s in self.colors else ramp[n],
|
|
280
|
+
rect,
|
|
281
|
+
)
|
|
282
|
+
for n, ((s, label, v), rect) in enumerate(
|
|
283
|
+
zip(parts, rects, strict=True)
|
|
284
|
+
)
|
|
285
|
+
]
|
|
286
|
+
|
|
287
|
+
def figure_text(self, tile: Tile) -> str:
|
|
288
|
+
"""The figure of *tile*, and its share when ``show_share``."""
|
|
289
|
+
text = chart_number(tile.value, self.fmt.decimals, self.fmt.units)
|
|
290
|
+
if not self.show_share:
|
|
291
|
+
return text
|
|
292
|
+
decimals = int(TREEMAP_CONFIG.get("share_decimals", 0))
|
|
293
|
+
share = chart_number(100 * tile.share, decimals, " %")
|
|
294
|
+
return f"{text} ({share})"
|
|
295
|
+
|
|
296
|
+
# ------------------------------------------------------------------
|
|
297
|
+
# Renderers
|
|
298
|
+
# ------------------------------------------------------------------
|
|
299
|
+
|
|
300
|
+
def to_plotly(self) -> Any:
|
|
301
|
+
"""Render the same treemap as an interactive Plotly figure.
|
|
302
|
+
|
|
303
|
+
Requires the optional ``interactive_plots`` extra (``plotly``),
|
|
304
|
+
imported lazily.
|
|
305
|
+
"""
|
|
306
|
+
from tesorotools.artists.plotly_backend import treemap_to_figure
|
|
307
|
+
|
|
308
|
+
return treemap_to_figure(self)
|
|
309
|
+
|
|
310
|
+
def build(self) -> tuple[Figure, Axes]:
|
|
311
|
+
"""Render the treemap in memory and return ``(Figure, Axes)``."""
|
|
312
|
+
fig: Figure = plt.figure( # type: ignore[reportUnknownMemberType]
|
|
313
|
+
**compact_figure_kwargs(self.compact, self.figsize)
|
|
314
|
+
)
|
|
315
|
+
# one axes over the whole figure: nothing for a layout engine to do
|
|
316
|
+
fig.set_layout_engine("none") # type: ignore[reportUnknownMemberType]
|
|
317
|
+
ax: Axes = fig.add_axes( # type: ignore[reportUnknownMemberType]
|
|
318
|
+
(0.0, 0.0, 1.0, 1.0)
|
|
319
|
+
)
|
|
320
|
+
# laid out in inches, so that the squares look square
|
|
321
|
+
width, height = (float(v) for v in fig.get_size_inches())
|
|
322
|
+
tiles = self.tiles(width, height)
|
|
323
|
+
gap = float(TREEMAP_CONFIG.get("gap_pt", 2.0))
|
|
324
|
+
for tile in tiles:
|
|
325
|
+
x, y, w, h = tile.rect
|
|
326
|
+
ax.add_patch(
|
|
327
|
+
Rectangle(
|
|
328
|
+
(x, y),
|
|
329
|
+
w,
|
|
330
|
+
h,
|
|
331
|
+
facecolor=tile.color,
|
|
332
|
+
edgecolor="white",
|
|
333
|
+
linewidth=gap,
|
|
334
|
+
)
|
|
335
|
+
)
|
|
336
|
+
ax.set_xlim(0, width)
|
|
337
|
+
ax.set_ylim(height, 0) # the first part at the top
|
|
338
|
+
ax.axis("off")
|
|
339
|
+
size = (
|
|
340
|
+
compact_font_pt(self.font_pt)
|
|
341
|
+
if self.compact
|
|
342
|
+
else self.font_pt or float(plt.rcParams["font.size"])
|
|
343
|
+
)
|
|
344
|
+
for tile in tiles:
|
|
345
|
+
self._label(fig, ax, tile, float(size or plt.rcParams["font.size"]))
|
|
346
|
+
return fig, ax
|
|
347
|
+
|
|
348
|
+
def _label(self, fig: Figure, ax: Axes, tile: Tile, size: float) -> None:
|
|
349
|
+
"""The name and figure of *tile* in its middle, as big as fits down
|
|
350
|
+
to ``min_font_scale`` of *size*; only the name if both do not fit,
|
|
351
|
+
and nothing if the name does not either."""
|
|
352
|
+
x, y, w, h = tile.rect
|
|
353
|
+
renderer: Any = fig.canvas.get_renderer() # type: ignore[attr-defined]
|
|
354
|
+
corner0 = ax.transData.transform((x, y + h))
|
|
355
|
+
corner1 = ax.transData.transform((x + w, y))
|
|
356
|
+
pad = 2 * float(TREEMAP_CONFIG.get("pad_pt", 4.0)) * fig.dpi / 72
|
|
357
|
+
room_w = corner1[0] - corner0[0] - pad
|
|
358
|
+
room_h = corner1[1] - corner0[1] - pad
|
|
359
|
+
smallest = size * float(TREEMAP_CONFIG.get("min_font_scale", 0.75))
|
|
360
|
+
figure = self.figure_text(tile)
|
|
361
|
+
for text in (f"{tile.label}\n{figure}", tile.label):
|
|
362
|
+
pt = size
|
|
363
|
+
while pt >= smallest:
|
|
364
|
+
label: Text = ax.text( # type: ignore[reportUnknownMemberType]
|
|
365
|
+
x + w / 2,
|
|
366
|
+
y + h / 2,
|
|
367
|
+
text,
|
|
368
|
+
ha="center",
|
|
369
|
+
va="center",
|
|
370
|
+
color=_text_color(tile.color),
|
|
371
|
+
fontsize=pt,
|
|
372
|
+
fontweight="bold",
|
|
373
|
+
linespacing=1.3,
|
|
374
|
+
)
|
|
375
|
+
box = label.get_window_extent(renderer) # pyright: ignore[reportUnknownArgumentType]
|
|
376
|
+
if box.width <= room_w and box.height <= room_h:
|
|
377
|
+
return
|
|
378
|
+
label.remove()
|
|
379
|
+
pt -= 0.5
|
|
@@ -119,6 +119,20 @@ sankey:
|
|
|
119
119
|
x_margin: 0.14 # margen lateral para los rótulos de los nodos
|
|
120
120
|
x_margin_two_stages: 0.2 # con solo dos columnas hay más sitio por lado
|
|
121
121
|
|
|
122
|
+
treemap:
|
|
123
|
+
# Partes de un total como rectángulos del tamaño de su peso (algoritmo
|
|
124
|
+
# squarified: lo más cuadrados posible, el mayor arriba a la izquierda).
|
|
125
|
+
dark: "#001E93" # color de la parte mayor (azul de la casa)
|
|
126
|
+
light: "#AEBAE7" # color de la menor: las demás, en degradado
|
|
127
|
+
gap_pt: 2.0 # filete blanco entre rectángulos (puntos)
|
|
128
|
+
pad_pt: 4.0 # margen del rótulo dentro de su rectángulo
|
|
129
|
+
min_font_scale: 0.75 # el rótulo encoge hasta esta fracción de la
|
|
130
|
+
# letra antes de quedarse solo con el nombre
|
|
131
|
+
share_decimals: 0 # decimales del peso (38 %)
|
|
132
|
+
luminance_threshold: 0.55 # por debajo, texto blanco
|
|
133
|
+
light_text: white
|
|
134
|
+
dark_text: "#1a1a1a"
|
|
135
|
+
|
|
122
136
|
barh:
|
|
123
137
|
highlight_factor: 0.4
|
|
124
138
|
padding: 5
|
|
@@ -317,13 +317,13 @@ with note_palette(): # colores de la guía, en su orden
|
|
|
317
317
|
del 90 % da aviso: genera las dos con `chart_size(pair=True)`.
|
|
318
318
|
- `chart_size` vale para LinePlot, StackedAreaPlot, StackedBarPlot,
|
|
319
319
|
BarLinePlot, HorizontalBarChart, GroupedBarChart, BoxPlot, IntradayPlot,
|
|
320
|
-
TypeCurve, ScatterPlot, Waterfall y
|
|
321
|
-
MatrixChart ni ShockChart).
|
|
320
|
+
TypeCurve, ScatterPlot, Waterfall, SankeyPlot y TreemapChart (no para
|
|
321
|
+
VectorPlot, MatrixChart ni ShockChart).
|
|
322
322
|
- `legend=True` pone la leyenda debajo del eje, como pide la guía cuando no
|
|
323
323
|
cabe dentro. Úsalo solo con los artists que admiten leyenda: LinePlot,
|
|
324
324
|
StackedAreaPlot, StackedBarPlot, BarLinePlot, GroupedBarChart, BoxPlot,
|
|
325
|
-
IntradayPlot, TypeCurve y ScatterPlot (no HorizontalBarChart, Waterfall
|
|
326
|
-
ni
|
|
325
|
+
IntradayPlot, TypeCurve y ScatterPlot (no HorizontalBarChart, Waterfall,
|
|
326
|
+
SankeyPlot ni TreemapChart). HorizontalBarChart pide además `series`.
|
|
327
327
|
- `fmt=axis_format(df)` elige los decimales del eje según el rango de los
|
|
328
328
|
datos (un tipo del 3,2 % no se lee como «3»); `axis_format(df,
|
|
329
329
|
decimals=1)` los fija. ScatterPlot no admite `fmt`.
|
|
@@ -31,7 +31,8 @@ BLUE_PALE = "AEBAE7"
|
|
|
31
31
|
BLUE_FAINT = "ECF0FD"
|
|
32
32
|
#: Secondary text: captions, metadata, stale rows.
|
|
33
33
|
GREY = "6D6D6D"
|
|
34
|
-
#:
|
|
34
|
+
#: Light grey of the slides: the track of the rings and progress bars and
|
|
35
|
+
#: the first column and total row of the tables.
|
|
35
36
|
GREY_PANEL = "EFEFEF"
|
|
36
37
|
#: Tesoro yellow: highlights of the presentations (bands, frames, the
|
|
37
38
|
#: section subtitles of the index) and its light shade for fills.
|
{tesorotools_python-0.1.13 → tesorotools_python-0.1.14}/src/tesorotools/presentation/builder.py
RENAMED
|
@@ -4221,9 +4221,14 @@ class Presentation:
|
|
|
4221
4221
|
)
|
|
4222
4222
|
if key in ranges:
|
|
4223
4223
|
_tab_stop(paragraph, tab)
|
|
4224
|
+
# the tab in a run of its own, out of the link: linked, its
|
|
4225
|
+
# underline would join the title to the slides
|
|
4226
|
+
gap = paragraph.add_run()
|
|
4227
|
+
gap.text = "\t"
|
|
4228
|
+
gap.font.size = Pt(size)
|
|
4224
4229
|
_write(
|
|
4225
4230
|
paragraph,
|
|
4226
|
-
|
|
4231
|
+
ranges[key],
|
|
4227
4232
|
size=size,
|
|
4228
4233
|
bold=False,
|
|
4229
4234
|
color=BLUE if here else GREY,
|
|
@@ -4753,13 +4758,16 @@ def _link_index(
|
|
|
4753
4758
|
starts: Mapping[tuple[str, int], Any],
|
|
4754
4759
|
) -> None:
|
|
4755
4760
|
"""Each line of the index (*keys*, in its order) a link to the first
|
|
4756
|
-
slide of its section, in the colour it has
|
|
4761
|
+
slide of its section, in the colour it has: its title and its slides,
|
|
4762
|
+
not the tab between them."""
|
|
4757
4763
|
for paragraph, key in zip(shape.text_frame.paragraphs, keys):
|
|
4758
4764
|
target = starts.get(key)
|
|
4759
4765
|
if target is None:
|
|
4760
4766
|
continue
|
|
4761
4767
|
rid = slide.part.relate_to(target.part, RT.SLIDE)
|
|
4762
4768
|
for run in paragraph.runs:
|
|
4769
|
+
if run.text == "\t":
|
|
4770
|
+
continue
|
|
4763
4771
|
props = run._r.get_or_add_rPr() # pyright: ignore[reportPrivateUsage]
|
|
4764
4772
|
link = props.add_hlinkClick(rid)
|
|
4765
4773
|
link.set("action", "ppaction://hlinksldjump")
|
{tesorotools_python-0.1.13 → tesorotools_python-0.1.14}/src/tesorotools/presentation/charts.py
RENAMED
|
@@ -4,8 +4,7 @@ The same artists, palette and axis format as the notes
|
|
|
4
4
|
(:func:`tesorotools.note.note_palette`, :func:`~tesorotools.note.axis_format`);
|
|
5
5
|
only the size changes: each chart is drawn at the size of its frame in
|
|
6
6
|
the template, with 12-point text that reads on a projected slide, the
|
|
7
|
-
legend too,
|
|
8
|
-
by the white of the slide::
|
|
7
|
+
legend too, on white with the dashed grid lines of the notes::
|
|
9
8
|
|
|
10
9
|
with slide_style():
|
|
11
10
|
LinePlot(
|
|
@@ -27,7 +26,7 @@ import matplotlib as mpl
|
|
|
27
26
|
|
|
28
27
|
from tesorotools.artists._common import Legend
|
|
29
28
|
from tesorotools.note.charts import note_palette
|
|
30
|
-
from tesorotools.palette import
|
|
29
|
+
from tesorotools.palette import BLUE_LIGHT
|
|
31
30
|
|
|
32
31
|
__all__ = [
|
|
33
32
|
"SLIDE_CHART_CM",
|
|
@@ -60,19 +59,18 @@ SLIDE_CHART_CM: dict[str, tuple[float, float]] = {
|
|
|
60
59
|
#: The end of the size of a frame with no text under it.
|
|
61
60
|
ALONE = "_solo"
|
|
62
61
|
_CM_TO_IN = 1 / 2.54
|
|
63
|
-
#: What a slide chart
|
|
64
|
-
#: the
|
|
65
|
-
#:
|
|
66
|
-
#: solid white grid lines.
|
|
62
|
+
#: What a slide chart fixes of the house style, whatever the machine:
|
|
63
|
+
#: the figure and the plot area on white, the one of the slide, and the
|
|
64
|
+
#: dashed light blue grid lines of the notes (``tesoro.mplstyle``).
|
|
67
65
|
SLIDE_STYLE: dict[str, Any] = {
|
|
68
66
|
"figure.facecolor": "white",
|
|
69
|
-
"axes.facecolor":
|
|
67
|
+
"axes.facecolor": "white",
|
|
70
68
|
"savefig.facecolor": "white",
|
|
71
69
|
"savefig.transparent": False,
|
|
72
|
-
"grid.color": "
|
|
73
|
-
"grid.linestyle": "
|
|
74
|
-
"grid.linewidth":
|
|
75
|
-
"grid.alpha":
|
|
70
|
+
"grid.color": f"#{BLUE_LIGHT}",
|
|
71
|
+
"grid.linestyle": "dashed",
|
|
72
|
+
"grid.linewidth": 0.8,
|
|
73
|
+
"grid.alpha": 0.9,
|
|
76
74
|
}
|
|
77
75
|
|
|
78
76
|
_rc_context: Callable[[dict[str, Any]], Any] = mpl.rc_context # pyright: ignore[reportUnknownMemberType, reportUnknownVariableType]
|
|
@@ -81,9 +79,9 @@ _rc_context: Callable[[dict[str, Any]], Any] = mpl.rc_context # pyright: ignore
|
|
|
81
79
|
@contextmanager
|
|
82
80
|
def slide_style() -> Generator[None]:
|
|
83
81
|
"""Draw the charts inside the block for a slide: the colours of the
|
|
84
|
-
guide (:func:`~tesorotools.note.note_palette`) on the
|
|
85
|
-
|
|
86
|
-
|
|
82
|
+
guide (:func:`~tesorotools.note.note_palette`) on the white of the
|
|
83
|
+
slides (:data:`SLIDE_STYLE`). Only while the block runs: the notes
|
|
84
|
+
keep their own style."""
|
|
87
85
|
with note_palette(), _rc_context(SLIDE_STYLE):
|
|
88
86
|
yield
|
|
89
87
|
|
{tesorotools_python-0.1.13 → tesorotools_python-0.1.14}/src/tesorotools/presentation/house.py
RENAMED
|
@@ -363,7 +363,9 @@ LAYOUTS: dict[str, list[str]] = {
|
|
|
363
363
|
_text(
|
|
364
364
|
3,
|
|
365
365
|
1,
|
|
366
|
-
(
|
|
366
|
+
# 3 cm from each side of the slide (33.87 cm wide), where the
|
|
367
|
+
# titles of the charts start
|
|
368
|
+
(3.0, 4.6, 27.87, 12.6),
|
|
367
369
|
size=20,
|
|
368
370
|
prompt="1. Sección. Subtítulo de la sección",
|
|
369
371
|
bullets=False,
|