Closed psobolewskiPhD closed 3 years ago
Thank you for reporting, I will look into it.
I just updated the font handling can you try the newest development version from github?
Plots do look a bit broken for me with that package on any graphics device:
(This is with the R studio GD)
On my end, the test plot
ggplot(mtcars) +
geom_point(aes(x = wt, y = mpg, colour = factor(gear))) +
labs(title = "Fuel Economy",
subtitle = "Fuel economy declines as weight increases, 1973-74",
caption = "Data from the 1974 Motor Trend US magazine.",
x = "Weight (1000 lbs)",
y = "MPG",
colour = "Gears") +
facet_grid(vs ~ am) +
sf_set_inter(theme_linedraw()) +
scale_colour_ios_light()
looks correct in VS Code (and Chrome) This is with the save to PNG in httpgd. Resolution lower than ggsave() but the font handling appears correct and the behavior is proper with (+)/zoom.
BTW in Safari now the fonts are even more interesting: The font is not respected anywhere but the Legend title?
Can you attach the SVG file?
Here's the dark theme with bumping the font size up: PNG from VS Code (using the icon in httpgd) SVG from safari (zipped, apparently not supported by GitHub) plot-2.svg.zip
PNG from Safari (using the icon in httpgd)
It seems like Safari can not find the "Inter" font on your computer. Have you tried restarting your computer? You can also embed it into the SVGs if you start httpgd with:
hgd(extra_css = "@import url('https://fonts.googleapis.com/css2?family=Inter&display=swap');")
So doing:
httpgd::hgd(extra_css = "@import url('https://fonts.googleapis.com/css2?family=Inter&display=swap');")
gives me a blank screen in VS Code and Safari and Chrome...
I'm pretty sure I've restarted numerous times since installing Inter, but probably not since installing the sfthemes and httpgd? Can't be sure..
I'm going to restart VS Code et al. and see what that does. (sometimes I still get the blank canvas in httpgd randomly).
If you have used the script of Kun Ren for using httpgd in vscode, make sure to add the extra_css argument to the hgd(..., extra_css = ...) call in your .Rprofile
The blank screen issue is most likely this https://github.com/nx10/httpgd/issues/50 bug in R itself which will be fixed in the upcoming R version.
OK! I'll try that—will it make all plots render with Inter? I actually prefer Fira, just noticed this strange issue with this theme that uses Inter... Edit: using {firatheme} which is my default Safari also doesn't render it. Chrome is fine, likewise when switching back to Inter.
The extra_css argument will just include an URL for Inter as a source in all plots, in case that font is used but not available.
Thanks for the info. Honestly, I never use Safari for this stuff, just VS Code and the issues seem resolved there. I rather control the font in the theme/ggplot call and not at the .Rprofile level, so I think the current behavior is fine. Now I'm getting broken PDFs generated via ggsave() with this {sftheme} so something else seems to be an issue...
Thank you for for your reports, yes it does seem like sftheme is a bit unstable at the moment. Glad it works as expected in vscode now!
No no, thank you for httpgd which is legit awesome and for being patient with me and my crappy issues!
I originally reported this as an issue with the {sftheme} https://github.com/amirmasoudabdol/sfthemes/issues/3 This is occurring with When using this theme that uses the Inter family of fonts, everything works well, except for a strange issue where ggplot legend title doesn't respect the font settings. The wrong face is used for the bold legend title in VS Code WebView or in Chrome, as well as when saved to png. (Incidentally, in Mac OS Safari I don't get any of the text elements in Inter...) Here's the output from ggsave():
I have the whole Inter family installed, MacOS Big Sur, M1, using {systemfonts} and {extrafont} if that helps.