2017-11-23 1 views
0

다음 코드를 사용하여 R에 일부 플롯을 만들었습니다. 데이터 파일은 아래에 붙여 넣습니다. 여기에 업로드 할 그림 파일을 만들지 못했지만 아래 코드와 제공된 데이터 및 InkScape 지침을 사용하여 그림을 다시 만들 수 있습니다. Windows를 사용하고 있습니다.InkScape를 사용하여 R 줄거리로 자르기

c.low <- read.csv('c.low.csv', header = TRUE, stringsAsFactors = FALSE, na.strings = "NA") 
e.high <- read.csv('e.high.csv', header = TRUE, stringsAsFactors = FALSE, na.strings = "NA") 

my.plot <- 'small_plot_with_inkscape_to_crop_lines.svg' 

library(Cairo) 
CairoSVG(my.plot, onefile = TRUE, pointsize = 12, width=6, height=9, bg="white") 
par(mfrow=c(3,2), oma=c(0.5,0.5,0.5,0.5), cex.lab=1.0, asp=1) 

plot(c.low$TT, c.low$point, xlab = 'TT', ylab = 'C', type = 'l', col = 'green', lwd = 2, lty = 1, 
    ylim = c(0, (max(c.low$point)+0.1)), cex.lab = 1.5) 
    lines(c.low$TT, c.low$lower95CI, type = 'l', col = 'brown', lwd = 2, lty = 3) 
    lines(c.low$TT, c.low$upper95CI, type = 'l', col = 'brown', lwd = 2, lty = 3) 

plot(e.high$TT, e.high$point, xlab = 'TT', ylab = 'E', type = 'l', col = 'green', lwd = 2, lty = 1, 
    ylim = c(0, (max(e.high$point)+0.1)), cex.lab = 1.5) 
    lines(e.high$TT, e.high$lower95CI, type = 'l', col = 'blue', lwd = 2, lty = 3) 
    lines(e.high$TT, e.high$upper95CI, type = 'l', col = 'blue', lwd = 2, lty = 3) 

dev.off() 

그때 InkScape으로 svg 파일을 열 및 emf 파일로 파일을 저장합니다. emf 파일을 저장할 때 을 EMF Output 창에서 선택합니다.

파일을 MSWord으로 열면 emf 파일의 일부 줄이 플롯 프레임을 넘어서 확장되는 것이 문제입니다. 이 선은 R 또는 InkScape에서 볼 때 플롯 프레임 외부에 표시되지 않습니다.

MSWord에서 볼 때 emf 파일의 줄을 자르거나 플롯 프레임 외부에 표시되지 않게하려면 어떻게해야합니까?

내가 여기 비슷한 질문 찾은

: 여기 https://bugs.launchpad.net/inkscape/+bug/1405292

c.low.csv 파일의 내용은 다음과 같습니다

point,lower95CI,upper95CI,TT 
0.2048022,0.1050293,0.3611121,-11.05 
0.2021779,0.1039115,0.356411,-11.0036180904523 
0.1995788,0.1028025,0.3517418,-10.9572361809045 
0.1970049,0.1017022,0.3471054,-10.9108542713568 
0.1944561,0.1006105,0.3425023,-10.864472361809 
0.1919324,0.09952735,0.3379333,-10.8180904522613 
0.1894337,0.09845275,0.3333989,-10.7717085427136 
0.1869601,0.09738664,0.3288999,-10.7253266331658 
0.1845114,0.09632895,0.3244367,-10.6789447236181 
0.1820876,0.09527966,0.32001,-10.6325628140704 
0.1796886,0.09423869,0.3156203,-10.5861809045226 
0.1773143,0.09320602,0.3112681,-10.5397989949749 
0.1749648,0.09218158,0.3069539,-10.4934170854271 
0.1726398,0.09116533,0.3026782,-10.4470351758794 
0.1703394,0.09015722,0.2984413,-10.4006532663317 
0.1680634,0.0891572,0.2942438,-10.3542713567839 
0.1658117,0.08816522,0.2900859,-10.3078894472362 
0.1635842,0.08718124,0.2859681,-10.2615075376884 
0.1613809,0.0862052,0.2818907,-10.2151256281407 
0.1592016,0.08523705,0.2778539,-10.168743718593 
0.1570463,0.08427675,0.2738582,-10.1223618090452 
0.1549147,0.08332425,0.2699036,-10.0759798994975 
0.1528068,0.0823795,0.2659906,-10.0295979899497 
: 여기

point,lower95CI,upper95CI,TT 
0.5082851,0.363055,0.6521302,-3.99994974874372 
0.5087905,0.3633061,0.6528011,-3.95356783919598 
0.5092959,0.363551,0.6534776,-3.90718592964824 
0.5098013,0.3637897,0.6541595,-3.8608040201005 
0.5103066,0.3640223,0.6548468,-3.81442211055276 
0.5108119,0.3642487,0.6555395,-3.76804020100503 
0.5113172,0.3644691,0.6562376,-3.72165829145729 
0.5118225,0.3646834,0.6569409,-3.67527638190955 
0.5123277,0.3648916,0.6576495,-3.62889447236181 
0.512833,0.3650939,0.6583633,-3.58251256281407 
0.5133382,0.3652902,0.6590821,-3.53613065326633 
0.5138433,0.3654805,0.6598061,-3.48974874371859 
0.5143485,0.3656649,0.660535,-3.44336683417086 
0.5148536,0.3658434,0.6612689,-3.39698492462312 
0.5153587,0.3660161,0.6620078,-3.35060301507538 
0.5158637,0.366183,0.6627514,-3.30422110552764 
0.5163688,0.3663441,0.6634999,-3.2578391959799 
0.5168738,0.3664994,0.664253,-3.21145728643216 
0.5173787,0.366649,0.6650109,-3.16507537688442 
0.5178836,0.3667929,0.6657734,-3.11869346733668 
0.5183885,0.3669312,0.6665404,-3.07231155778895 
0.5188934,0.3670639,0.6673119,-3.02592964824121 
0.5193982,0.3671911,0.6680879,-2.97954773869347 
0.5199029,0.3673126,0.6688682,-2.93316582914573 
0.5204077,0.3674287,0.6696529,-2.88678391959799 
0.5209123,0.3675394,0.6704418,-2.84040201005025 
0.521417,0.3676446,0.6712349,-2.79402010050251 
0.5219216,0.3677444,0.6720322,-2.74763819095477 
0.5224261,0.3678389,0.6728335,-2.70125628140704 
0.5229306,0.3679281,0.6736388,-2.6548743718593 
0.5234351,0.3680121,0.6744481,-2.60849246231156 
0.5239395,0.3680908,0.6752613,-2.56211055276382 
0.5244439,0.3681643,0.6760783,-2.51572864321608 
0.5249482,0.3682327,0.6768991,-2.46934673366834 
0.5254524,0.368296,0.6777235,-2.4229648241206 
0.5259567,0.3683542,0.6785517,-2.37658291457286 
0.5264608,0.3684074,0.6793834,-2.33020100502513 
0.5269649,0.3684557,0.6802186,-2.28381909547739 
0.527469,0.368499,0.6810573,-2.23743718592965 
0.527973,0.3685374,0.6818994,-2.19105527638191 
0.5284769,0.3685709,0.6827448,-2.14467336683417 
0.5289808,0.3685996,0.6835935,-2.09829145728643 
0.5294846,0.3686236,0.6844454,-2.05190954773869 
0.5299884,0.3686428,0.6853004,-2.00552763819096 
0.5304921,0.3686573,0.6861585,-1.95914572864322 
0.5309957,0.3686672,0.6870197,-1.91276381909548 
0.5314993,0.3686725,0.6878838,-1.86638190954774 
0.5320028,0.3686732,0.6887508,-1.82 

e.high.csv 파일의 내용입니다

답변

0

명백하게 pr 원래 게시물에 설명 된 oblem은 오랜 시간의 버그와 관련이 있습니다. 나는 R 안에 줄을 자르기에 의하여 해결책을 jerry-rig 할 수 있습니다. 아래에서 위로 테두리의 위치를 ​​확인하는 데 grconvertY을 사용한 다음 ifelse 문을 사용하여 해당 값 이상의 요소를 NA으로 설정합니다.

사람들은 일반적으로 상단 테두리의 위치를 ​​식별하기 위해 "usr"을 사용하는 것이 좋습니다.하지만 그림에서 두 개의 패널을 만드는 경우 주어진 옵션을 사용할 수 없습니다.

처리 후도는 다음과 같다 (PowerPoint로 포맷 변환 InkScape 내에 반입 한 후 [다음 Stack Overflow하는 jpeg으로 저장).

T <- 1:20 
x <- 5 + 0.5 * T 
x.u <- 6 + 0.5 * T 
x.l <- 4 + 0.5 * T 

T2 <- 20:40 
x2 <- 40 + 2 * T2 
x.u2 <- 60 + 2 * T2 
x.l2 <- 20 + 2 * T2 

library(Cairo) 
CairoSVG('my.plot.svg', onefile = TRUE, pointsize = 12, width=6, height=9, bg="white") 

par(mfrow=c(2,1), xpd=NA) 

plot(T, x, xlab = 'x', ylab = 'y', type = 'l', col = 'green', lwd = 2, lty = 1, 
    ylim = c(0, (max(x)+0.1)), cex.lab = 1.5) 

    top.y <- grconvertY(1, from='npc') 
    x.u = ifelse(x.u >= top.y, NA, x.u) 

    lines(T, x.u, type = 'l', col = 'brown', lwd = 2, lty = 3) 
    lines(T, x.l, type = 'l', col = 'brown', lwd = 2, lty = 3) 

plot(T2, x2, xlab = 'x2', ylab = 'y2', type = 'l', col = 'green', lwd = 2, lty = 1, 
    ylim = c(0, (max(x2)+0.1)), cex.lab = 1.5) 

    top.y <- grconvertY(1, from='npc') 
    x.u2 = ifelse(x.u2 >= top.y, NA, x.u2) 

    lines(T2, x.u2, type = 'l', col = 'brown', lwd = 2, lty = 3) 
    lines(T2, x.l2, type = 'l', col = 'brown', lwd = 2, lty = 3) 

dev.off() 

enter image description here

관련 문제