Skip to content

[WIP] add ms_piechart#82

Open
JanMarvin wants to merge 2 commits intoardata-fr:masterfrom
JanMarvin:pie_chart
Open

[WIP] add ms_piechart#82
JanMarvin wants to merge 2 commits intoardata-fr:masterfrom
JanMarvin:pie_chart

Conversation

@JanMarvin
Copy link
Contributor

Work in progress to add a piechart #55. Originally I wanted to add box and whisker plots and histograms, but these look like they are x14 functions. Therefore I ended up with the nasty pie chart (don't tell anyone I created this function, I have a name to lose).

library(officer)
library(mschart)

pie_plot <- ms_piechart(
  data = iris,
  x = "Species",
  y = "Sepal.Length",
  group = "Species",
  label = "Sepal.Length"
)

doc <- read_pptx()
doc <- add_slide(doc, layout = "Title and Content", master = "Office Theme")
doc <- ph_with(doc, value = pie_plot, location = ph_location_fullsize())
print(doc, target = "example.pptx")

Screenshot 2022-11-26 at 23 18 17

The function is a bit ugly to be honest. If I'm not mistaken, pie charts behave a little different. Every cell of a column is piece in the pie. Therefore I had to construct a function to calculate some unique values. Currently I simply calculate group wise averages

@davidgohel
Copy link
Member

Hello @JanMarvin

It's obvious I'm having trouble finding time to maintain mschart. @eli-daniels will handle that maintenance now. He needs some time to get up to speed with my help. I am sorry your PR are still not accepted but Eli will help with that too :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants