Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] add ms_piechart #82

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

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.

None yet

3 participants