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

Save sina-plot .rds files #17

Merged
merged 6 commits into from
Dec 19, 2022
Merged

Save sina-plot .rds files #17

merged 6 commits into from
Dec 19, 2022

Conversation

russHyde
Copy link
Collaborator

@russHyde russHyde commented Dec 6, 2022

Fix: #15

Allows cluster sina plots to be exported as an .Rds file containing a ggplot2 object.
Adds a new function that saves sina plots to file (simplifying the plot_cluster_sina function, which now only creates the ggplot object)..
That function has an output_format parameter defining whether a .rds file (cont. ggplot2 object) or a .html file (cont. htmlwidget) is saved.
The main treeview function saves ggplot2 objects. These will be converted to interactive plots in tfpbrowser.

@russHyde russHyde changed the title Sinaplot rds Draft: Save sina-plot .rds files Dec 6, 2022
@russHyde russHyde changed the base branch from master to staging-wp5 December 7, 2022 10:32
@russHyde russHyde changed the title Draft: Save sina-plot .rds files Save sina-plot .rds files Dec 7, 2022
@russHyde russHyde requested a review from jr-nicola December 7, 2022 10:33
Copy link

@jr-nicola jr-nicola left a comment

Choose a reason for hiding this comment

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

Is it possible for a user to save both types of files?


file_path <- file.path(output_dir, glue::glue("sina-{varx}.{output_format}"))

if (output_format == "rds") {

Choose a reason for hiding this comment

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

Does this allow saving both as an rds and as an html?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Ah. Maybe not yet. If they have produced a cluster-sina ggplot object, then they can save that as an .rds or an .html by calling save_sina_plot(ggobj, ..., output_format = "rds") or save_sina_plot(ggobj, ..., output_format = "html").

But a typical user would be calling the treeview() workflow, rather than the internals. I can add a sina_output_format parameter to treeview() so that they can call treeview(input_env_rds, sina_output_format = "rds") or treeview(input_env_rds, sina_output_format = "html").

Will do that now.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Sorry, my misunderstanding. As both "html" and "rds" in the same runthrough? That isn't implemented here, but can easily be done. Give me a minute

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This has been rewritten. Now the user can save cluster-sina plots as either .rds, .html or both (default: both). And they can specify which format to output the cluster-sina plots in the arguments to treeview().

So treeview(input_env_rds) will output both .rds and .html versions of sina-logistic_growth_rate and sina-clock_outlier to "./treeview/".

@russHyde russHyde requested a review from jr-nicola December 15, 2022 15:58
Copy link

@jr-nicola jr-nicola left a comment

Choose a reason for hiding this comment

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

LGTM

@russHyde russHyde merged commit ba25896 into staging-wp5 Dec 19, 2022
@russHyde russHyde deleted the sinaplot-rds branch December 19, 2022 15:43
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.

2 participants