Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

577
Visualizações
Editable plots in PowerPoint from python: equivalent of officer and rvg

I am using the officer and rvg packages to get plots from R into MS PowerPoint as editable vector graphics. Reproducible example below.

I am looking for a way to implement an equivalent solution with python, preferably using matplotlib. The critical part is not the creation of slides from the IDE but rather the editable vector graphics part, i.e. plots should end up in PowerPoint as grouped objects comprised of a range of simple powerpoint geometries such as lines, squares, and text fields.

R example:

library(tidyverse)
library(officer)
library(rvg)

# Get some data and make a plot
ggp <- diamonds %>% 
  group_by(clarity) %>%
  summarise(price = mean(price)) %>%
  ggplot(aes(x = clarity, y = price, fill = clarity)) +
  geom_bar(stat = 'identity', colour = 'black')

# Create a new powerpoint document
doc <- read_pptx()
doc <- add_slide(doc, 'Title and Content', 'Office Theme')
# Add the plot 
doc <- ph_with_vg(doc, ggobj = ggp, type = 'body')  

# Write the document to a file
print(doc, target = 'plots.pptx')

The resulting chart is completely editable:

enter image description here

over 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

Since the 2019 version of MS office you can add svg files as images and then ungroup them to make them editable. See 'Convert an SVG image to an Office shape' on this MS page. In my personal experience, this is however neither very stable nor complete.

Another way, which is more stable and complete although still not perfect, is importing it in powerpoint as emf file, which is also a vector-format. Old version of matplotlib could export to this format. For newer version, I export as svg and then use inkscape --file "input.svg" --export-emf "output.emf" to convert to emf, which I then load in powerpoint. Ungrouping the object again allows you to edit, if everything works well.

over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda