nhs-r-community / NHSRplotthedots

An SPC package to support NHSE/I 'Making Data Count' programme
https://nhs-r-community.github.io/NHSRplotthedots/
Other
48 stars 23 forks source link

changing from ggplot to plotly #175

Closed marcosfabietti closed 1 year ago

marcosfabietti commented 1 year ago

added a new function and changed ptd_create_ggplot. This was done by mapping the ggplot to plotly command (90% of the heavy load), and for the icons I added them via plotly afterwards by mapping top/bottom/left/right to plotly syntax, while images are extracted from the online repo as plotly doesn't like so much the local files. If there were few data points, the warning is also added under the figure (it isn't mapped otherwise).

comment: sizes work differently in plotly, so the default isn't 8 but 0.15.

tomjemmett commented 1 year ago

I think this is a breaking change as it is directly changing the output from ggplot to plotly, which I think in the main package would be an undesirable use.

That said, we should either make it so the code works for plotly directly, or create a separate method that creates a plotly object

tomjemmett commented 1 year ago

Will also need unit tests creating, though I'm happy to write those after merging this PR

marcosfabietti commented 1 year ago

The new commit does this now, with ptd_create_ggplot being restored as it was.

I have searched everywhere, but plotly only handles URLs as image sources. There doesn't seem to be a work around this.

Let me know what do you think of these changes and whether we change the readme file!.