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

plot_layout_properties(): current slide's layout as default, layout id as selector, add ph ids to plot #595

Closed
markheckmann opened this issue Aug 30, 2024 · 3 comments

Comments

@markheckmann
Copy link
Contributor

markheckmann commented Aug 30, 2024

I have three feature suggestions concerning plot_layout_properties()

@davidgohel Please let me know if these suggestions appear sensible to you and I will be happy to implement them.


1. Use current slide as default layout

Currently, plot_layout_properties() requires the layout arg to be supplied. In my workflow, however, I often want to plot the layout of the slide I just added. Instead of having to enter its full name again, it would be convenient if plot_layout_properties() used the current slide's layout as a default for plotting (if layout is NULL). Then one could simply do the following, which is nice when working with officer interactively.

x <- read_pptx() |> add_slide("Title Slide", "Office Theme")
x |> plot_layout_properties()

As alternative to this approach, there could be a new function plot_slide() that plots the current slide.

2. Allow layout index as alternative to the layout name

It would be convenient to be able to use the layout's id (always shown when printing the rpptx object) as an alternative to the layout's name for the parameter layout. So one could just do:

x <- read_pptx()
x |> plot_layout_properties(1)
x |> plot_layout_properties(2)

This makes it very quick to flip throught the layouts.

3. Add placeholder id to plot

It would be helpful to optionally show the placeholder's id (column id from layout_properties(), i.e. the placeholder's shape id) in the plot. ph_location_type(), for example, has the id argument to disambiguate between placeholders of the same type. Showing the ph id in the plot will make it easier for the user to see which ph is which.

It could look like this, with the ph id in the upper right corner, for plot_layout_properties(x, id = TRUE).

Optionally, the ph type could be added as well, like in annotate_base().

image

@davidgohel
Copy link
Owner

Sure, see my comment here :) #596 (comment)

@markheckmann
Copy link
Contributor Author

Suggestion 3 commited via #608

markheckmann added a commit to markheckmann/officer that referenced this issue Oct 1, 2024
Accept the layout index (see `layout_summary()`) as alternative to
the layout name (suggestion 2 in davidgohel#595).
markheckmann added a commit to markheckmann/officer that referenced this issue Oct 1, 2024
Accept the layout index (see `layout_summary()`) as alternative to
the layout name (suggestion 2 in davidgohel#595).
markheckmann added a commit to markheckmann/officer that referenced this issue Oct 1, 2024
- `plot_layout_properties()`: Now prints the current slide's layout
   by default, if not layout name is provided explicitly (davidgohel#595).
- `add_slide()`: Accept a layout index (see `layout_summary()`) as
   alternative to the layout name.
markheckmann added a commit to markheckmann/officer that referenced this issue Oct 1, 2024
Accept the layout index (see `layout_summary()`) as alternative to
the layout name (suggestion 2 in davidgohel#595).
markheckmann added a commit to markheckmann/officer that referenced this issue Oct 2, 2024
…layout

- `plot_layout_properties()`: Now prints the current slide's layout
   by default, if not layout name is provided explicitly (davidgohel#595).
-  Accept the layout index (see `layout_summary()`) as alternative to
   the layout name (suggestion 2 in davidgohel#595).
markheckmann added a commit to markheckmann/officer that referenced this issue Oct 3, 2024
…layout

- `plot_layout_properties()`: Now prints the current slide's layout
   by default, if not layout name is provided explicitly (davidgohel#595).
-  Accept the layout index (see `layout_summary()`) as alternative to
   the layout name (suggestion 2 in davidgohel#595).
davidgohel pushed a commit that referenced this issue Oct 5, 2024
…current slide by default

- `plot_layout_properties()`: Now prints the current slide's layout
   by default, if not layout name is provided explicitly (#595).
-  Accept the layout index (see `layout_summary()`) as alternative to
   the layout name (suggestion 2 in #595).
- `plot_layout_properties()`: Gains arg `legend` to add a legend to plot
@markheckmann
Copy link
Contributor Author

Suggestion 1 + 2 completed in PR #620

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

No branches or pull requests

2 participants