using greek letters in tmap (in R) - r

I have been trying to include greek letters in my legend title when using functions in the tmap r-library. I have tried several different things, all resulting in mixed results, none of which produce a useable product. Attempts include:
The Tex('$\\mu$') function in the latex2exp r-library
bquote(mu)
finally olde but goodie expression(paste(mu,"g",sep=""))
All of these attempts either result in a line of text not including the greek letter or some variant with strange formatting.
Has anyone ran into this issue? If so could you please share your resources?
Edits/Additions:
Thanks to #James input unicode characters works perfectly in tmap. The next question is how to do superscript or subscripts without using the expression or paste functions since these functions are not 100% compatible with tmap.
Is there a way to have a superscript/subscript in a legend title for tmap? As you can tell units mean a lot to me (*wink).

Related

In R plots, how to have symbol for the set of real numbers with font similar to LaTeX's \mathbb?

Here is what I am trying to achieve.
When designing a plot in R-project, I would like to include in the plot's legend/axes the "R" symbol for the set of real numbers with font similar to that of LaTeX's \mathbb command (i.e. the stylized way to write uppercase letters when referring to sets of real numbers, natural numbers, etc).
Would that be possible to achieve somehow? I found older questions and answers on how to use OS fonts in parts of R plots, but this alone does not solve the issue.

Incorrect label representation with gvisTimeline in the R googleVis

I am using gvisTimeline for performing Gantt charts, and think that this library is brilliant.
But when the barlabel parameter in gvisTimeline function is set to dataframe column name, which contains Russian words, they comes into ��������, when plotting this timeline.
I've tried changing encoding to UTF-8, but as a result I receive the same question marks and also something like <ce><f2><e1><ee><f0> <ef><f0><ee><e1>.
So I guess the problem is with encoding, but I have no idea how to fix it.
The same names in plotly or ggplot2 diagrams are displayed correctly.
I really appreciate any help you can provide.

R How to insert zapf dingbats font characters in text for axis or legend label

I'm using the PDF device in R and I would like if possible to incorporate some characters from the zapf dingbats font in my legend lables (specifically the large open and filled circles for cloud situations of overcast and clear sky).
I found the extrafont package https://cran.r-project.org/web/packages/extrafont/extrafont.pdf but that seems to change the overall font. I also know how to use expression for greek and math symbols, but that doesn't seem to include these symbols.
I attach a plot that I made with NCL to show the kind of lable I am trying to recreate in my R script.
You just specify the appropriate Unicode value.
plot(iris[,3:4])
legend("topleft", legend=c("\U2600", "\U2601", "\U2602", "\U2603"))

Format value in legend in dygraph plot in R

I'm using the excellent dygraphs R package. One thing that I don't seem to find in the documentation is the possibility of passing a formatting function to dyLegend in the same way it's possible for dyAxis (e.g. valueAxisFormatter). The legend defaults to scientific notation for values in the millions, which most of my audience does not like.
Does anyone know of a way to pass a JS formatting function?
Thank you.

TikZ takes more than max LaTeX memory for complex R plot

I have a very complex plot, containing about 56,000 data points. It doesn't look right if I downsample it, so I really need to keep all of them. I would additionally like to add LaTeX captions to the figure. (The expression syntax, IMO, does not produce satisfactory rendering.)
After doing some digging around, TikZ seemed like the way to do it. But I found that it ran out of memory trying to plot the figure. I followed all of the advice I could find for TikZ memory management: this amounted to (1) using externalize and (2) increasing the main_memory for LaTeX to the maximum value (~12M). (I am using MacTeX 2014.) Neither of these solutions seemed to work.
At this point, having looked over SO and some other message boards, I am aware of only two options:
Switch to an alternate TeX interpreter, such as LuaTeX, which will allow me to use more memory, or
Use the native R plot, and then manually superimpose the desired labels onto the figures.
I consider (1) to be an acceptable solution, but the fact that I would need an alternate product makes me wonder if I am missing something. I wonder if there is a way to render complex native R plots, which happen to have TeX-style labels in them.

Resources