Skip to main content

Template for qmd presenations

Project description

brandtemplate

Enable the creation of Quarto branded presentations to share the output of your python based analysis to stakeholders. To create your own branded template from this base see the repo on github for how to easily customise this to be used with your own branding.

The template uses plotnine and great-tables to create graphs and tables and has themes for both of these that go with the quarto template.

The template uses the presoutput package (PYPI or github) to convert the .qmd files into either PDF or PPTX documents that can be shared with stakeholders.

Installation

Install the package via pip install brandtemplate

Usage

Add the quarto template to a project

Run the following command via command line to import the template into the current working directory.

brandtemplate-import

This command has the following optional arguments:

  • -n or --name: Renames the qmd file when importing the template. Defaults to "template.qmd" if omitted.
  • -d or --directory: Specifies what directory to copy the template into. Defaults to the current working directory if omitted.

The below line of code would create a qmd file called presentation.qmd in the output folder within the current directory and would copy all the files needed for the template into _extensions/brandtemplate.

brandtemplate-import -n presentation.qmd -d output

Plotnine helper functions

Add theme to graph

from plotnine import *
from plotnine.data import mpg

from brandtemplate import brandtemplate_plotnine_theme #import theme function

(
ggplot(mpg, aes(x='class')) +
  geom_bar() +
  scale_y_continuous(expand=(0,0)) +
  brandtemplate_plotnine_theme() #adds base formatting theme to graph
)

Add standard titles to graph

from plotnine import *
from plotnine.data import mpg

from brandtemplate import brandtemplate_plotnine_theme, plotnine_titles

graph = (
ggplot(mpg, aes(x='class')) +
  geom_bar() +
  scale_y_continuous(expand=(0,0)) +
  brandtemplate_plotnine_theme() 
)

#add titles to the graph
plotnine_titles(
  graph,
  title='The graph title goes here',
  subtitle='The subtitle goes here',
  caption='The graph caption goes here'
  )

Add complex titles to the graph

The below example shows how can add mutiple colours to the title of a graph but the same can be done for the subtitle and caption and for the colour and size of each title.

from plotnine import *
from plotnine.data import mpg

from brandtemplate import brandtemplate_plotnine_theme, plotnine_titles

graph = (
ggplot(mpg, aes(x='class')) +
  geom_bar() +
  scale_y_continuous(expand=(0,0)) +
  brandtemplate_plotnine_theme() 
)

plotnine_titles(
  graph,
  title=['The graph title is ', 'partially red', ' coloured'],
  title_color=['black', 'red', 'black']
  )

Recolour axis labels

from plotnine import *
from plotnine.data import mpg

from brandtemplate import brandtemplate_plotnine_theme, plotnine_coloured_axis_labels

graph = (
ggplot(mpg, aes(x='class')) +
  geom_bar() +
  scale_y_continuous(expand=(0,0)) +
  brandtemplate_plotnine_theme() 
)

plotnine_coloured_axis_labels(
  graph,
  label_color_dict={'compact':'blue', 'suv':'red'},
  axis='X'
  )

Features

Quarto template

The quarto template has been designed to match your current brand presentation theme so that you can focus on the content rather than having to focus on the formatting.

  • New slides are created by creating a H2 in the qmd file (using ## Slide title goes here).
  • To create a section divider slide you can add the following line ## Slide title goes here {.section-slide}
  • To create a final thank you slide you can add the following line ## Thank you {.thank-you-slide}
  • Multiple columns can be created using the following code:
    :::: {.columns}
    
    ::: {.column width="50%"}
    Left column
    :::
    
    ::: {.column width="50%"}
    Right column
    :::
    
    ::::
    

See full documentation on revealjs in quarto here.

Once ready to share then can use the presoutput package (PYPI or github) to convert the file to either PDF or PPTX format.

plotnine helper functions

The following functions are available for use with the template

  • brandtemplate_plotnine_theme: A base theme for plotnine graphs that removes a lot of the unnecessary elements.
  • plotnine_titles: Create better titles for plotnine including being left aligned to the graph and the ability to recolour / resize different parts of a title.
  • plotnine_text: Add text anywhere on the graph. The text can have multiple colours, size, weight, style.
  • plotnine_coloured_axis_labels: Recolour individual axis labels to highlight a data point on your graph.

great-tables helper functions

To be added.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

brandtemplate-0.1.2.tar.gz (829.1 kB view details)

Uploaded Source

Built Distribution

brandtemplate-0.1.2-py3-none-any.whl (832.1 kB view details)

Uploaded Python 3

File details

Details for the file brandtemplate-0.1.2.tar.gz.

File metadata

  • Download URL: brandtemplate-0.1.2.tar.gz
  • Upload date:
  • Size: 829.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.10.11 Darwin/23.5.0

File hashes

Hashes for brandtemplate-0.1.2.tar.gz
Algorithm Hash digest
SHA256 0c9c9ad3b4eb4fef3ad51102a79827e841b5fb41b762f662583ca8cbd31952a9
MD5 6564f48c25f296c76083164f9f4eaaa9
BLAKE2b-256 379bde1bc4f10e73189061d2ab4998ecdfbe62ca9f7b0fa769bcd837c65c542b

See more details on using hashes here.

File details

Details for the file brandtemplate-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: brandtemplate-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 832.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.10.11 Darwin/23.5.0

File hashes

Hashes for brandtemplate-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 e798e51160276029c9b67f018de79c22908ad9318e319899cb26b8f9e441e4ee
MD5 7f28f07939688ac0f5a157359c0e6884
BLAKE2b-256 034458830b682bb43a8efbd25a926cf916b29369b8e66a622a36083941c9cbe1

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page