Skip to content

Conversation

SAADAT-Abu
Copy link

@SAADAT-Abu SAADAT-Abu commented Oct 6, 2025

Interactive Plot Support

  • Added new run_r_plotly_code tool that enables the AI to generate interactive plotly visualisations
  • AI automatically chooses between static ggplot2 and interactive plotly based on user request or data characteristics
    Download Button
  • Added PNG download button in plot card header that allows plot download in 300 DPI.
    Other improvements
  • Added plot history
  • Added dark mode
  • Fixed initial mic button state to correctly reflect muted status

@Copilot Copilot AI review requested due to automatic review settings October 6, 2025 18:46
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds interactive plotly visualization support and high-resolution plot downloads to the ggbot2 application. The AI can now automatically choose between static ggplot2 and interactive plotly visualizations based on user requests or data characteristics.

  • Added run_r_plotly_code function and tool for generating interactive plotly plots
  • Implemented PNG download functionality with 300 DPI resolution for both static and interactive plots
  • Fixed initial microphone button state to properly reflect muted status

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.

File Description
inst/prompts/prompt.md Updated AI instructions to support both static and interactive plot generation
R/ggbot2.R Added plotly support, download functionality, and UI improvements
NAMESPACE Added grDevices imports for PNG generation
DESCRIPTION Added plotly and image export dependencies

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

R/ggbot2.R Outdated
kaleido_worked <- FALSE
if (requireNamespace("kaleido", quietly = TRUE)) {
tryCatch({
kaleido::save_image(plotly_obj, file, width = 3000, height = 2400)
Copy link

Copilot AI Oct 6, 2025

Choose a reason for hiding this comment

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

The kaleido::save_image function parameters may not match this signature. The kaleido package typically uses different parameter names or structure. Verify the correct API usage for kaleido image export.

Suggested change
kaleido::save_image(plotly_obj, file, width = 3000, height = 2400)
kaleido::save_image(plotly_obj, file, options = list(width = 3000, height = 2400))

Copilot uses AI. Check for mistakes.

R/ggbot2.R Outdated
if (!kaleido_worked) {
tryCatch({
# plotly::save_image uses kaleido under the hood
plotly::save_image(plotly_obj, file, width = 3000, height = 2400)
Copy link

Copilot AI Oct 6, 2025

Choose a reason for hiding this comment

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

The plotly::save_image function may require different parameters than specified. Verify that width and height parameters are supported in this format, as plotly typically expects different argument structures for image dimensions.

Suggested change
plotly::save_image(plotly_obj, file, width = 3000, height = 2400)
plotly::save_image(plotly_obj, file, export = list(width = 3000, height = 2400))

Copilot uses AI. Check for mistakes.

R/ggbot2.R Outdated
Comment on lines 382 to 384
webshot2::webshot(temp_html, file, vwidth = 3000, vheight = 2400)
} else {
webshot::webshot(temp_html, file, vwidth = 3000, vheight = 2400)
Copy link

Copilot AI Oct 6, 2025

Choose a reason for hiding this comment

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

Using 3000x2400 pixel dimensions for webshot may cause performance issues or memory problems, especially for complex plotly visualizations. Consider using more reasonable dimensions and scaling appropriately.

Suggested change
webshot2::webshot(temp_html, file, vwidth = 3000, vheight = 2400)
} else {
webshot::webshot(temp_html, file, vwidth = 3000, vheight = 2400)
webshot2::webshot(temp_html, file, vwidth = 1200, vheight = 900)
} else {
webshot::webshot(temp_html, file, vwidth = 1200, vheight = 900)

Copilot uses AI. Check for mistakes.

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.

1 participant