Skip to content

Conversation

@grantmcdermott
Copy link

Closes #585

I added scales to Suggests to demo some label wrapping examples in the vignette. This should already be a recursive dependency of see (via ggplot2), so the net effect should be zero. But just wanted to give a HU.

Some examples from the vignette below (note the "correct" legend title, better consistency when adding layers, etc.)

library(modelbased)
library(tinyplot)
tinytheme("classic", palette.qualitative = "Tableau 10")

data(efc, package = "modelbased")
efc <- datawizard::to_factor(efc, c("e16sex", "c172code", "e42dep"))

m <- lm(neg_c_7 ~ e16sex + c172code + barthtot, data = efc)

estimate_means(m, "c172code") |> plt()
plt_add(type = "l", lty = 2)

estimate_means(m, "c172code") |>
  plt(xaxl = scales::label_wrap(20), flip = TRUE)

m <- lm(neg_c_7 ~ e16sex * c172code + e42dep, data = efc)
estimate_means(m, c("e16sex", "c172code")) |> plt()

m <- lm(neg_c_7 ~ barthtot * c172code + e42dep, data = efc)
estimate_means(m, c("c172code", "barthtot = [fivenum]")) |>
  plt(xaxl = scales::label_wrap(20), flip = TRUE)

Created on 2025-11-28 with reprex v2.1.1

@gemini-code-assist
Copy link

Summary of Changes

Hello @grantmcdermott, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request introduces version 0.6.0 of tinyplot, focusing on enhancing the flexibility and customization options for plotting modelbased objects. It refines the API for plot generation by adding new parameters and improving legend handling, while also updating the documentation and vignette with comprehensive examples to guide users in creating more visually appealing and informative plots, particularly concerning label management and theme application.

Highlights

  • Dependency Update: The scales package has been added to Suggests to facilitate new label wrapping examples in the vignette. This is noted to likely be a recursive dependency already via ggplot2.
  • Plot Customization Parameters: The tinyplot.estimate_means function now includes type and dodge parameters, offering more direct control over plot visualization and grouping behavior. The theme parameter has been removed from this function, encouraging the use of tinytheme() for global theme settings.
  • Enhanced Legend Title Handling: Improved logic has been implemented to dynamically set legend titles, ensuring better consistency and allowing for custom legend options to be respected.
  • Vignette Improvements: The plotting_tinyplot.Rmd vignette has been significantly updated with new examples demonstrating advanced tinyplot features, including plt_add for layering, scales::label_wrap for managing long axis labels, and more flexible theme and facet customizations.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request significantly improves the tinyplot integration by simplifying the API, adding more flexibility with type and dodge parameters, and correctly handling legend titles. The removal of the dedicated theme argument in favor of passing theme options via ... makes the function more consistent with the tinyplot package. The updated examples and the heavily revised vignette are excellent, providing users with much clearer and more practical guidance on creating and customizing plots. The changes are well-thought-out and a great enhancement to the package. I've found one minor typo in the documentation that should be addressed.

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.

tinyplot.<easystats> method improvements

1 participant