[英]How to modify superscripts in Julia (labels of Gadfly plots)?
Could somebody suggest me how to initiate and end the superscript in a Gadfly
plot using Julia
correctly?有人可以建议我如何正确使用Julia
在Gadfly
plot 中启动和结束上标吗? Or if there are any other better solutions instead of using <sup></sup>
, please also share them with me.或者如果有任何其他更好的解决方案而不是使用<sup></sup>
,也请与我分享。 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>
. \^-1<Tab>
应在您按下<Tab>
后转换为⁻¹
。⁻¹
.将此答案中的字符复制到您的字符串: ⁻¹
。*
function to join the output string with the rest of your xlabel
.使用*
function 将 output 字符串与 xlabel 的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
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.