Could somebody suggest me how to initiate and end the superscript in a Gadfly
plot using Julia
correctly? Or if there are any other better solutions instead of using <sup></sup>
, please also share them with me.
Thanks so much.
using Gadfly
ticks = [400, 1000, 1500, 2000, 2500, 3000, 3500, 4000]
Gadfly.plot(PET, x = :Wavenumber, y = :Transmittance, Geom.line,
Coord.cartesian(xflip=true, xmin=400, xmax=4000, ymax=100, ymin=0),
Scale.x_continuous(maxticks=2000),
Guide.xticks(ticks=ticks),
Guide.xlabel("Wavenumber (cm<sup>-1</sup>)"),
Guide.ylabel("Transmittance (%)"))
\^-1<Tab>
should transform into ⁻¹
once you press <Tab>
.⁻¹
.*
function to join the output string with the rest of your xlabel
."Finds and prints the appropraite unicode value for any numerical superscript."
function superscriptnumber(i::Int)
if i < 0
c = [Char(0x207B)]
else
c = []
end
for d in reverse(digits(abs(i)))
if d == 0 push!(c, Char(0x2070)) end
if d == 1 push!(c, Char(0x00B9)) end
if d == 2 push!(c, Char(0x00B2)) end
if d == 3 push!(c, Char(0x00B3)) end
if d > 3 push!(c, Char(0x2070+d)) end
end
return join(c)
end