6

I am interested in using Greek letters and math symbols in the title and labels for a Gadfly plot in Julia.

Does anyone know of a way to do this, or is this not supported (yet)?

buruzaemon
  • 3,847
  • 1
  • 23
  • 44

2 Answers2

4

LaTeX strings (i.e. L"string") are not supported, but you can still use greek letters for labels. For example:

using Gadfly
z=linspace(0,2*pi,20)
plot(x=z, y=sin(z), Guide.YLabel("αβγ"))

These greek characters can be made in the Julia REPL or iJulia notebook by typing in the LaTeX command and pressing tab (so typing \alpha and pressing [TAB] makes α, etc.)

You can also get other math symbols this way. For example \sum [TAB] x\dot [TAB] \_j [TAB] \^2 [TAB] will get you ∑ẋⱼ²

Benjamin
  • 690
  • 1
  • 7
  • 14
  • Thanks for sharing that, @Ben. That seems pretty obvious in retrospect, I don't know why I didn't try that first. – buruzaemon Apr 28 '16 at 01:41
3

Sadly, it looks like LaTeX support for plot labels and such in Gadfly does not exist.

However, HTML tags such as <sup> and <sub> let you do a bit of text formatting, and you can also use HTML 4.0 character entity, decimal character and hexadecimal character references.

buruzaemon
  • 3,847
  • 1
  • 23
  • 44