How to fix degree symbol not showing correctly in R on Linux/Fedora 31
As it turns out, this misbehaviour is caused by legacy use of symbols in R itself.
This will likely be fixed upstream in R itself:
https://bugs.r-project.org/bugzilla/show_bug.cgi?id=17748
which references the downstream issue I opened for Fedora after the feedback I received to this question:
https://bugzilla.redhat.com/show_bug.cgi?id=1815128
A functioning workaround has been published by Iñaki Ucar on the R mailing list:
https://stat.ethz.ch/pipermail/r-devel/2020-March/079185.html
I copy it here for reference:
$ sudo dnf install gdouros-symbola-fonts
Then add the following to /etc/fonts/local.conf (system-wide) or
~/.fonts.conf (just for your user):<fontconfig>
<match target="pattern">
<test name="family"><string>Symbol</string></test>
<edit name="family" mode="prepend" binding="same">
<string>Symbola</string>
</edit>
</match>
</fontconfig>
Now you should see this:
$ fc-match Symbol
Symbola.ttf: "Symbola" "Regular"
and symbols should render correctly.
Again, credit for this solution goes to Iñaki Ucar.
Thank you all who provided answers to this question for assistance in troubleshooting and facilitating this process. Hopefully, this will be fixed upstream in R core itself.
degree symbol incorrect in map axis labels
Finally managed to track down the answer:
From ?X11 it says:
Problems with incorrect rendering of symbols (e.g., of quote(pi) and
expression(10^degree)) have been seen on Linux systems which have the
Wine symbol font installed – fontconfig then prefers this and
misinterprets its encoding. Adding the following lines to
‘~/.fonts.conf’ or ‘/etc/fonts/local.conf’ may circumvent this problem
by preferring the URW Type 1 symbol font.
<fontconfig>
<match target="pattern">
<test name="family"><string>Symbol</string></test>
<edit name="family" mode="prepend" binding="same">
<string>Standard Symbols L</string>
</edit>
</match>
</fontconfig>
Adding these lines to /etc/fonts/local.conf
solved the problem for me.
ggplot2 issue: graph text shown with weird unicode blocks
This looks a lot like a font issue. Maybe the default ggplot
font is not installed or damaged? Try querying installed fonts (for Linux):
system("fc-list")
Output should be a list of entries like this:
/usr/share/fonts/truetype/dejavu/DejaVuSerif.ttf: DejaVu Serif:style=Book
Then you can set the font as a default for your ggplot
theme (name of the ttf file is the correct way to name it as far as I can tell):
theme_set(theme_gray(base_family = "DejaVuSerif"))
If this returns the same result, try another one.
Related Topics
Cannot Install Rgdal Package in R on Rhel6, Unable to Load Shared Object Rgdal.So
Ggplot2 Ggsave Function Causes Graphics Device to Not Display Plots
An Error in R: When I Try to Apply Outer Function:
Embed Instagram/Youtube into Shiny R App
How to Use Custom Cross Validation Folds with Xgboost
How to Uninstall R Completely from Os X
Heatmap with Values and Some Additional Features in R
R: Raster Mosaic from List of Rasters
Fill Missing Values Rowwise (Right/Left)
How to Read All Files in One Directory into R at Once
How to Show Only The Lower Triangle in Ggpairs
How to Force Ggplot's Geom_Tile to Fill Every Facet
How to Find All Possible Subsets of a Set Iteratively in R
Optimization of a Function in R ( L-Bfgs-B Needs Finite Values of 'Fn')
How to Make Install.Packages Return an Error If an R Package Cannot Be Installed