Open PavelBal opened 1 year ago
It also yields different results depending on if the plots are generated from:
This package is a lot of trouble and I'm going to be honest: we should get rid of it.
(╯°□°)╯︵ ┻━┻
What we need is that (at least) all symbols available in the plots in PK-Sim/MoBi can be displayed in R in the same default size.
This is not possible with the standard ggplot shapes - as you can see below, the standard shapes list: a) does not provide all required symbols b) displays some symbols in different sizes
That's why @pchelle tried different solutions and ended using showtext
, which fulfills the requirements.
If this can be realized without showtext
- I don't care.
If there`s "Pentagon", I also wanna see an "OvalOffice" symbol.
But actually, I don't care as long we can use cute sheep as symbols.
But actually, I don't care as long we can use cute sheep as symbols.
Agree :)
Other solutions not using showtext can be the package {ggimage}
in which you can use directly images or emojis as geoms.
Or using our own geom like this: https://stackoverflow.com/questions/2181902/how-to-use-an-image-as-a-point-in-ggplot/36172385#36172385
Likewise showtext
for which we stored a font file, we could store a set of vectorized images within the package and link the shapes to these images.
@Yuri05 , @PavelBal , @Felixmil , @KatrinCoboeken Thoughts ? Should we try one of them and get the relevant packages in validR ?
Here is how ggimage renders within the {ggtree}
package
Note that the geom_emoji
is actually relying on {showtext}
in the backend !!
I'm not sure if I agree with Juri, that we need a one to one translation of all PK-Sim/Mobi symbols. How often do we really need so many symbols.
We could try to replace the "showtext option" in ospsuite.plots with ggimage. But I still would use the "pure" ggplot plotting shapes as often as possible. It is the most stable, its what the user knows and I would really miss things like the filled symbols when we usage images.
Moreover, to include the new showtext shapes, I already tuned a geomTLFPoint
so it may also be possible to leverage it and load images instead of using a text layer.
I copied the geomTLFPoint into ospsuite.plots renaming it to geomPointUnicode. it is sued if you switch on the option setDefaults(PointAsUnicode = TRUE)
I found another way to do this without using {showtext}
but {ragg}
and {systemfonts}
instead: https://felixmil.github.io/ggplot2-custom-symbols-demo/
source repo: https://github.com/Felixmil/ggplot2-custom-symbols-demo
According to my tests, the outputs are consistants when rendered from code, html output (vignettes, websites etc) and pdfs.
Previews:
@KatrinCoboeken This preserves the "pure ggplot" approach.
I'm not sure if I agree with Juri, that we need a one to one translation of all PK-Sim/Mobi symbols. How often do we really need so many symbols.
PK-Sim/Mobi provides 11 different symbols. As long as the R plotting solution provides >=11 different symbols - the translation is possible and must be done. Obviously, if a PK-Sim/MoBi symbol is available in R, then that very symbol must be taken; if not - another symbol. So that we end up with the dictionary {PK-Sim/MoBi symbol <=> R symbol}
I found another way to do this without using
{showtext}
but{ragg}
and{systemfonts}
instead: https://felixmil.github.io/ggplot2-custom-symbols-demo/source repo: https://github.com/Felixmil/ggplot2-custom-symbols-demo
According to my tests, the outputs are consistants when rendered from code, html output (vignettes, websites etc) and pdfs. @KatrinCoboeken This preserves the "pure ggplot" approach.
sounds promising :)
The
showtext
packages has been causing us some troubles (plots looks different on different machines/environments). Do we actually need it? If so - why?