楼主: kaifengedu
2883 5

[问答] 画图时带公式的图例的修改 [推广有奖]

  • 0关注
  • 18粉丝

已卖:641份资源

学科带头人

4%

还不是VIP/贵宾

-

威望
0
论坛币
1674 个
通用积分
475.3180
学术水平
85 点
热心指数
128 点
信用等级
60 点
经验
32847 点
帖子
913
精华
0
在线时间
1637 小时
注册时间
2010-2-2
最后登录
2025-12-15

楼主
kaifengedu 发表于 2013-3-13 14:31:43 |AI写论文

+2 论坛币
k人 参与回答

经管之家送您一份

应届毕业生专属福利!

求职就业群
赵安豆老师微信:zhaoandou666

经管之家联合CDA

送您一个全额奖学金名额~ !

感谢您参与论坛问题回答

经管之家送您两个论坛币!

+2 论坛币
各位好:
有下列代码
  1. x <- 1:10
  2. plot(x^2,type = "n",ylab = "y" , xlab = "x")
  3. lines(x, lty = 1)
  4. lines(x^2, lty = 2)
  5. legend.txt <- c("x",expression(paste("2",x_2,",",sigma,"=1000")))
  6. legend("topleft", legend = legend.txt, lty = c(1,2))
复制代码


生成如下图形:
Rplot.png

现在有两个问题:
第一:请问图例下标怎么不能正确显示,应该如何写呢?
第二:图例的小窗口可以变长一点吗,可以看到1000和右边界重合了。
谢谢!
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

关键词:带公式 各位好 画图

沙发
hgswz 发表于 2013-3-13 14:35:17
非常感谢你的经验分享

藤椅
zhangyangsmith 发表于 2013-3-13 17:02:41
For the first question:
  1. plot(x^2,type = "n",ylab = "y" , xlab = "x")
  2. lines(x, lty = 1)
  3. lines(x^2, lty = 2)
  4. legend.txt <- c("x",expression(paste("2",x[2],",",sigma,"=1000")))
  5. legend("topleft", legend = legend.txt, lty = c(1,2))
复制代码


subscriptInLengend.png

The second issue was solved at the same time in my case...
已有 1 人评分学术水平 热心指数 信用等级 收起 理由
kaifengedu + 1 + 1 + 1 热心帮助其他会员

总评分: 学术水平 + 1  热心指数 + 1  信用等级 + 1   查看全部评分

板凳
kaifengedu 发表于 2013-3-13 17:36:28
zhangyangsmith 发表于 2013-3-13 17:02
For the first question:
多谢,原来下标是中括号[],第二个问题在你的里面是解决了,呵呵。但是可以写代码调整吗?

报纸
zhangyangsmith 发表于 2013-3-13 21:19:41
Insert a few spaces before the last double quote on line 4 of my code?
I was not sure if there are other elegenter solution to this...
Anyway I always disable the boxes for legends using bty = "n"
已有 1 人评分学术水平 热心指数 信用等级 收起 理由
kaifengedu + 1 + 1 + 1 热心帮助其他会员

总评分: 学术水平 + 1  热心指数 + 1  信用等级 + 1   查看全部评分

地板
kaifengedu 发表于 2013-3-14 07:35:25
zhangyangsmith 发表于 2013-3-13 21:19
Insert a few spaces before the last double quote on line 4 of my code?
I was not sure if there are  ...
^_^,我昨天想的解决方法和你说的一样。

您需要登录后才可以回帖 登录 | 我要注册

本版微信群
加好友,备注cda
拉您进交流群
GMT+8, 2025-12-21 08:03