[R] Error message from "patternbar_s"

John m|@ojpm @end|ng |rom gm@||@com
Mon Aug 17 10:57:59 CEST 2020


Hi ,

   I got warning message from the following code and the graph did not show
as expected; I don't have the date on the x-axis and I do not have legend.
Graph is attached.
   How can I fix it?
******
x<-df_c_m$date
y<-df_c_m$percentage
group <- df_c_m$direction
patternbar_s(df_c_m, x,y, group, xlab='', ylab='%', label.size=3,
pattern.type=c( 'hlines', 'vlines','bricks'), pattern.line.size=c(5, 5,
5),frame.size=1,
             #,background.color=c('grey', 'chartreuse3',  'bisque')
             pixel=16, density=c(18, 72, 54),frame.color='black',
             legend.type='h', legend.h=12, legend.y.pos=0.49,
legend.pixel=6, legend.w=0.275, legend.x.pos=1.05,
             legend.label=c("up", "uc", "dn" ),
 bar.width=0.8)+scale_y_continuous(limits = c(0, 100))+ggtitle('')
******

> df_c_m
      date direction percentage
1  2019M08       up1  71.751356
2  2019M09       up1  75.247309
3  2019M10       up1  73.748786
4  2019M11       up1  72.412511
5  2019M12       up1  72.391628
6  2020M01       up1  73.431773
7  2020M02       up1  72.093799
8  2020M03       up1  65.852532
9  2020M04       up1  53.943831
10 2020M05       up1  49.841939
11 2020M06       up1  64.906832
12 2020M07       up1  64.419087
13 2019M08       uc1  26.538817
14 2019M09       uc1  22.657967
15 2019M10       uc1  24.500303
16 2019M11       uc1  25.870263
17 2019M12       uc1  25.969088
18 2020M01       uc1  25.248130
19 2020M02       uc1  25.272400
20 2020M03       uc1  27.652675
21 2020M04       uc1  33.452643
22 2020M05       uc1  41.622761
23 2020M06       uc1  31.469979
24 2020M07       uc1  32.572614
25 2019M08       dn1   1.709827
26 2019M09       dn1   2.094724
27 2019M10       dn1   1.750911
28 2019M11       dn1   1.717225
29 2019M12       dn1   1.639284
30 2020M01       dn1   1.320097
31 2020M02       dn1   2.633801
32 2020M03       dn1   6.494793
33 2020M04       dn1  12.603527
34 2020M05       dn1   8.535300
35 2020M06       dn1   3.623188
36 2020M07       dn1   3.008299
> x
 [1] "2019M08" "2019M09" "2019M10" "2019M11" "2019M12" "2020M01" "2020M02"
 [8] "2020M03" "2020M04" "2020M05" "2020M06" "2020M07" "2019M08" "2019M09"
[15] "2019M10" "2019M11" "2019M12" "2020M01" "2020M02" "2020M03" "2020M04"
[22] "2020M05" "2020M06" "2020M07" "2019M08" "2019M09" "2019M10" "2019M11"
[29] "2019M12" "2020M01" "2020M02" "2020M03" "2020M04" "2020M05" "2020M06"
[36] "2020M07"
> y
 [1] 71.751356 75.247309 73.748786 72.412511 72.391628 73.431773 72.093799
 [8] 65.852532 53.943831 49.841939 64.906832 64.419087 26.538817 22.657967
[15] 24.500303 25.870263 25.969088 25.248130 25.272400 27.652675 33.452643
[22] 41.622761 31.469979 32.572614  1.709827  2.094724  1.750911  1.717225
[29]  1.639284  1.320097  2.633801  6.494793 12.603527  8.535300  3.623188
[36]  3.008299
> group
 [1] up1 up1 up1 up1 up1 up1 up1 up1 up1 up1 up1 up1 uc1 uc1 uc1 uc1 uc1
uc1 uc1
[20] uc1 uc1 uc1 uc1 uc1 dn1 dn1 dn1 dn1 dn1 dn1 dn1 dn1 dn1 dn1 dn1 dn1
Levels: up1 uc1 dn1

-------------- next part --------------
A non-text attachment was scrubbed...
Name: Rplot_pattern.pdf
Type: application/pdf
Size: 183476 bytes
Desc: not available
URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20200817/3e0bee55/attachment.pdf>


More information about the R-help mailing list