Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/tfs/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
R 我如何解决ggplot中的错误,它不想更改标签/图例/标题大小?_R_Ggplot2 - Fatal编程技术网

R 我如何解决ggplot中的错误,它不想更改标签/图例/标题大小?

R 我如何解决ggplot中的错误,它不想更改标签/图例/标题大小?,r,ggplot2,R,Ggplot2,我试图更改我的标签、标题和图例大小 我的代码如下所示: ggplot(data = KOEFS, mapping = aes(x = DAY, y = DATA, color = COL, group = GROUP, linetype = LT, shape = LT)) + theme_bw() + theme(panel.border = element_blank(), legend.position = c(0.95,0.05), lege

我试图更改我的标签、标题和图例大小

我的代码如下所示:

ggplot(data = KOEFS, mapping = aes(x = DAY, y = DATA, color = COL, group = GROUP, linetype = LT, shape = LT)) +
  theme_bw() + 
  theme(panel.border = element_blank(), 
        legend.position = c(0.95,0.05), 
        legend.justification = c("right", "bottom"), 
        legend.key = element_rect(fill = "transparent", colour = "transparent"),
        axis.line = element_line(colour = "grey"),        
        axis.title = element_text(size = 15), 
        axis.text = element_text(size = 15), 
        title = element_text(size = 15)) +
  labs(linetype = " ", color = " ", shape = " ", y = "Coefficients", x = "Days", title = "Change of Coefficients") +
  scale_color_manual(values = c("black", "grey80")) + 
  scale_linetype_manual(values = c("solid", "solid", "solid", "solid")) +
  geom_line() + geom_point(size = 2) + 
  scale_x_continuous(limits = c(0,30))
每件事都可以正常工作,直到我将axis.text、title和axis.title包含在
元素中。text(size=15)

我收到以下错误消息:

Error in grid.Call.graphics(C_setviewport, vp, TRUE) : 
  non-finite location and/or size for viewport
我看到有人在以下方面有类似的问题:

但提供和接受的解决方案对我不起作用,因为我在绘图之前已经设置了因子级别

是否有人有类似的问题,以及解决方法

阅读下面的数据后,我进一步运行以下代码行:


KOEFS <- gather(data = KOEFS, "GROUP", "DATA", NTdown:VOLAup)
KOEFS$LT <- as.factor(rep(c("NumTrans","ShareVolume","CurrVolume","Range"), rep(102, 4)))
KOEFS$LT <- factor(KOEFS$LT, levels = c("NumTrans", "ShareVolume", "CurrVolume", "Range"))
KOEFS$COL <- as.factor(rep(c("Decreased","Increased","Decreased","Increased","Decreased","Increased","Decreased","Increased"), rep(51, 8)))
KOEFS$COL <- factor(KOEFS$COL, levels = c("Increased", "Decreased"))

更新包GGALY解决了它…

您能通过包含数据框使问题重现吗?或者是一个复制问题的代表性子集>肯定是,我现在的问题中提供了
       NTdown       NTup     SVdown          SVup        CVdown       CVup     VOLAdown
1  0.14899191 0.08148003 0.15841280  0.0638288369  0.1020302760 0.10222146  0.116851318
2  0.13051269 0.06906892 0.14221577  0.0521486431  0.0810476305 0.09533784  0.065921156
3  0.11694863 0.05831254 0.13024738  0.0451474714  0.0664893707 0.09077826  0.040345412
4  0.10672363 0.05293483 0.12148711  0.0385805473  0.0557626433 0.08649484  0.024490826
5  0.10025098 0.04641818 0.11657800  0.0315967628  0.0495169773 0.08205766  0.013541618
6  0.09430301 0.04358022 0.11170043  0.0273400774  0.0432282882 0.08029605  0.003433474
7  0.08914748 0.03859364 0.10745635  0.0195358450  0.0375492691 0.07476321 -0.004680790
8  0.08552563 0.03646874 0.10480377  0.0188775808  0.0335212013 0.07624625 -0.010468664
9  0.08104235 0.03298945 0.09989953  0.0171805034  0.0276726873 0.07631037 -0.016291156
10 0.07781996 0.02885366 0.09609854  0.0137201041  0.0231783244 0.07440963 -0.018921712
11 0.07450735 0.02524488 0.09296921  0.0085703531  0.0195249830 0.07079881 -0.021992839
12 0.07101033 0.02327362 0.08924211  0.0060817375  0.0155666116 0.06985667 -0.025635913
13 0.06794973 0.02243860 0.08610496  0.0039647108  0.0120529138 0.06938331 -0.026730654
14 0.06530509 0.02179962 0.08357832  0.0028891552  0.0092279622 0.06977909 -0.032178305
15 0.06449438 0.01981794 0.08326299  0.0013067857  0.0084695899 0.06947027 -0.031905011
16 0.06496461 0.01883886 0.08364658  0.0011255086  0.0083090363 0.07052373 -0.032844871
17 0.06603638 0.02020186 0.08564288  0.0008801970  0.0097677186 0.07147915 -0.032976386
18 0.06513171 0.02126113 0.08539987  0.0008289405  0.0092061277 0.07277205 -0.033440267
19 0.06423981 0.02109540 0.08426217 -0.0010669175  0.0078061850 0.07241190 -0.034940167
20 0.06161477 0.02047414 0.08201759 -0.0022199721  0.0053892684 0.07282262 -0.037769731
21 0.06039974 0.02047247 0.08246071 -0.0029129677  0.0056432381 0.07363748 -0.038678841
22 0.05877017 0.02220594 0.08130549 -0.0020284510  0.0041951373 0.07599121 -0.040769355
23 0.05741982 0.02175369 0.08021732 -0.0025503349  0.0027926915 0.07668633 -0.040758564
24 0.05706360 0.02349892 0.07986195 -0.0010521510  0.0021704752 0.07939500 -0.040513944
25 0.05493456 0.02305855 0.07702993 -0.0026068535 -0.0008517291 0.07908119 -0.041880562
26 0.05388527 0.02381083 0.07586362 -0.0017309668 -0.0022191343 0.08120732 -0.042539505
27 0.05142774 0.02446681 0.07273625 -0.0016729749 -0.0055952802 0.08248979 -0.044998980
28 0.05061467 0.02512193 0.07273723  0.0003171961 -0.0059635760 0.08566663 -0.044241771
29 0.04851960 0.02534996 0.07110656 -0.0002278385 -0.0079490309 0.08633063 -0.045656993
30 0.04693144 0.02488648 0.07022198 -0.0010550992 -0.0090203148 0.08675680 -0.046596012
31 0.04579241 0.02567150 0.06909610 -0.0012111583 -0.0103045499 0.08792421 -0.048663873
32 0.04511828 0.02702644 0.06861984 -0.0004991153 -0.0108715265 0.08991500 -0.048500754
33 0.04404680 0.02620342 0.06745473 -0.0018116178 -0.0121999030 0.08980288 -0.049113268
34 0.04271634 0.02486164 0.06646081 -0.0049335565 -0.0133352751 0.08777721 -0.050571724
35 0.04257505 0.02511198 0.06652978 -0.0053467693 -0.0134128003 0.08838432 -0.050643493
36 0.04239646 0.02563825 0.06647117 -0.0052475911 -0.0136475477 0.08951276 -0.050490612
37 0.04249412 0.02676800 0.06714266 -0.0042781634 -0.0130135061 0.09157831 -0.050671154
38 0.04198787 0.02813158 0.06711555 -0.0036592608 -0.0129936343 0.09327154 -0.051863535
39 0.04190203 0.02811825 0.06714777 -0.0047614395 -0.0129498875 0.09329520 -0.052709535
40 0.04208824 0.02700932 0.06703829 -0.0075295995 -0.0131132999 0.09160795 -0.052627407
41 0.04247420 0.02592846 0.06814567 -0.0106101269 -0.0120764881 0.08959655 -0.052779310
42 0.04330288 0.02564733 0.06950863 -0.0108185922 -0.0107857566 0.09032201 -0.051574263
43 0.04231630 0.02614074 0.06899950 -0.0107066574 -0.0113407657 0.09136013 -0.052389933
44 0.04163394 0.02759957 0.06977687 -0.0113231903 -0.0105379041 0.09166803 -0.051792372
45 0.04229685 0.02784572 0.07022608 -0.0117842793 -0.0100144761 0.09211089 -0.051663520
46 0.04266142 0.02851634 0.07118170 -0.0122907058 -0.0090121611 0.09245767 -0.051718855
47 0.04125909 0.02882647 0.06993326 -0.0129900826 -0.0102314745 0.09252886 -0.053156557
48 0.04061323 0.02930907 0.06949844 -0.0133867472 -0.0106371703 0.09285065 -0.054770663
49 0.03967719 0.03098564 0.06853413 -0.0121399320 -0.0116194769 0.09463108 -0.055855444
50 0.04027910 0.03288249 0.06945463 -0.0103513818 -0.0107236133 0.09692312 -0.055243335
51 0.04075332 0.03436526 0.06984241 -0.0093368180 -0.0103067457 0.09842236 -0.055466941
       VOLAup DAY
1  0.14458531   0
2  0.11975179   1
3  0.10051863   2
4  0.09127743   3
5  0.08255025   4
6  0.07959472   5
7  0.07420400   6
8  0.07207079   7
9  0.06909257   8
10 0.06361952   9
11 0.06173837  10
12 0.06021715  11
13 0.05892485  12
14 0.05713567  13
15 0.05446328  14
16 0.05331263  15
17 0.05311597  16
18 0.05395554  17
19 0.05402643  18
20 0.05453807  19
21 0.05412117  20
22 0.05446712  21
23 0.05373710  22
24 0.05493665  23
25 0.05387809  24
26 0.05575779  25
27 0.05743840  26
28 0.05877749  27
29 0.05860256  28
30 0.05826196  29
31 0.05766675  30
32 0.05829412  31
33 0.05680935  32
34 0.05508495  33
35 0.05594698  34
36 0.05595266  35
37 0.05732971  36
38 0.05832081  37
39 0.05735339  38
40 0.05766477  39
41 0.05802200  40
42 0.05898915  41
43 0.05957173  42
44 0.06055118  43
45 0.06015749  44
46 0.06005520  45
47 0.06070907  46
48 0.06078798  47
49 0.06142987  48
50 0.06233575  49
51 0.06338650  50