楼主: jiangqing001
5879 6

[问答] pdf()中若设定paper="a4",如何调整页面边距 [推广有奖]

  • 12关注
  • 5粉丝

教授

84%

还不是VIP/贵宾

-

威望
0
论坛币
10488 个
通用积分
332.3109
学术水平
16 点
热心指数
27 点
信用等级
14 点
经验
26280 点
帖子
1923
精华
0
在线时间
1388 小时
注册时间
2011-12-7
最后登录
2024-4-21

楼主
jiangqing001 发表于 2015-1-8 20:58:29 |AI写论文

+2 论坛币
k人 参与回答

经管之家送您一份

应届毕业生专属福利!

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

经管之家联合CDA

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

感谢您参与论坛问题回答

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

+2 论坛币
求助:

如题,pdf()中若设定paper="a4",如何调整页面边距?
即:纸张大小我要使用“a4”大小,但我想把页面边距调小些,不知如何操作,求助大家!

谢谢!
二维码

扫码加我 拉你入群

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

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

关键词:APE PDF 如何操作 求助大家 如何

回帖推荐

zhangyangsmith 发表于5楼  查看完整内容

Then you just need to set the "width" and "height" options in the "pdf" call. You can set the size of the plotting area within the device the way you like but in inches. According to my search the size of a DIN A4 paper is 8.3*11.7 inches. So, as an example, if you want to leave half an inch in each of the 4 edges you may use "width = 7.3, height = 10.7". As far as I can tell R will do the cente ...

沙发
zhangyangsmith 发表于 2015-1-8 21:32:42
Try changing the "mar" setting in a "par" function call?
  1. # Default setting

  2. par()$mar
  3. # [1] 5.1 4.1 4.1 2.1

  4. # Change the option after starting your plot device and before doing the plot using something like
  5. par(mar = c(4, 3, 3, 1) + 0.1)
复制代码

藤椅
jiangqing001 发表于 2015-1-9 08:50:37
zhangyangsmith 发表于 2015-1-8 21:32
Try changing the "mar" setting in a "par" function call?
It's you! Again!Thank you for your reply!

板凳
jiangqing001 发表于 2015-1-9 09:23:21
zhangyangsmith 发表于 2015-1-8 21:32
Try changing the "mar" setting in a "par" function call?
I've tried your method.
  1. pdf("plot_sigma_mn_.pdf",paper="a4")
  2.   par(oma = c(1.5, 1, 1.5, 1) + 0.1,mar= c(3, 4, 3, 4) + 0.1)
复制代码

It works in a way not like what i want.
Let me rephase my question: I  use layout function to save several(6) plots in pdf device in the papersize of a4;but the margin of paper is huge, kind of waste, so i want to small the paper margin to enlarge each plot.

The parameter mar in this situation smaller each plots' margin which not i want it to and the parameter oma seems to quit working.
But thanks anyway! You are my new hero !

报纸
zhangyangsmith 发表于 2015-1-9 16:30:07
jiangqing001 发表于 2015-1-9 09:23
I've tried your method.
It works in a way not like what i want.
Let me rephase my question: I  ...
Then you just need to set the "width" and "height" options in the "pdf" call. You can set the size of the plotting area within the device the way you like but in inches. According to my search the size of a DIN A4 paper is 8.3*11.7 inches. So, as an example, if you want to leave half an inch in each of the 4 edges you may use "width = 7.3, height = 10.7". As far as I can tell R will do the centering for you.

Here are some dummy plots I have done ("mfrow" was used instead of "layout" just for simplicity):
  1. pdf(file = "tmp2.pdf", width = 7.3, height = 10.7, paper = "a4")
  2. par(mfrow = c(3, 2))
  3. sapply(1:6, function(i) plot(rnorm(50), rnorm(50), col = rainbow(6)[i], xlab = "x", ylab = "y", xlim = c(-3, 3), ylim = c(-3, 3)))
  4. dev.off()
复制代码

And the result was attached.

tmp2.pdf
下载链接: https://bbs.pinggu.org/a-1711048.html

8 KB

Dummy Plots

地板
jiangqing001 发表于 2015-1-10 08:53:58
zhangyangsmith 发表于 2015-1-9 16:30
Then you just need to set the "width" and "height" options in the "pdf" call. You can set the size ...
Many thanks!

7
he1187835438 发表于 2023-7-28 18:25:44
say chinese

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

本版微信群
加好友,备注cda
拉您进交流群
GMT+8, 2026-1-8 10:54