织梦CMS - 轻松建站从此开始!

欧博ABG官网-欧博官方网址-会员登入

欧博Use superscripts in text with paste (for a vecto

时间:2025-07-30 17:35来源: 作者:admin 点击: 1 次
I want labels with superscripts in my legend. Furthermore, I want to construct the labels with paste function. I have figured out how to have a legend

I want labels with superscripts in my legend. Furthermore, I want to construct the labels with paste function. I have figured out how to have a legend that uses my vector of values using paste. I have also used expression to get superscripts. But I can't use them together.

Here are my attempts:

A plot with the legend successfully plotting three legend items based on a vector of values but no superscript in legend.

#set-up size=c(50, 100, 150) paste(size, "km^2", sep=" ") #output: paste function works # "50 km^2" "100 km^2" "150 km^2" #plot sample graph plot(x=c(1:10)*100, y=c(1:10)*10, col="red") points(x=c(8:17)*50, y=c(1:10)*7, col="green") points(x=c(8:17)*50, y=c(1:10)*12, col="blue") #legend legend(x = 'topleft', legend = paste(size, "km^2", sep=" "), col = c("red", "green", "blue"), pch=19,bty = 'n', xjust = 1, cex=0.8)

And here I can print with superscripts on the graph but without paste.

#print with superscript mtext(line=-4,adj=0,expression('km'^'2'*' size '))

FAILED GRAPHS

enter image description here

(责任编辑:)
------分隔线----------------------------
发表评论
请自觉遵守互联网相关的政策法规,严禁发布色情、暴力、反动的言论。
评价:
表情:
用户名: 验证码:
发布者资料
查看详细资料 发送留言 加为好友 用户等级: 注册时间:2025-08-01 02:08 最后登录:2025-08-01 02:08
栏目列表
推荐内容