scale_colour_hue问题越来越错误:离散值提供给连续刻度

时间:2019-06-19 18:43:03

标签: r ggplot2

我试图使用与ggplo集成的small_multiple绘制昆虫订单的系数估计,但是当我使用scale_colour_hue对每个订单进行颜色编码时,我得到了错误:连续值提供给离散比例。

任何帮助将不胜感激。

数据:

m123456_df:
term  estimate std.error statistic group    by_2sd  model Order
insecticidearea -1.87   1.84    -1.01   fixed   TRUE     
AcariInsecticideFor Acari
insecticidearea 3.02    1.66    1.80    fixed   TRUE     
AraneaeInsecticideFor       Araneae
insecticidearea 28.18   5.76    4.89    fixed   TRUE  
ColeopteraInsecticideFor    Coleoptera
insecticidearea -2.60   3.52    -0.73   fixed   TRUE  
DipteraInsecticideFor       Diptera
insecticidearea -6.97   7.85    -0.88   fixed   TRUE   
HemipteraInsecticideFor     Hemiptera
insecticidearea 5.47    2.96    1.84    fixed   TRUE   
HomopteraInsecticideFor     Homoptera
insecticidearea -3.98   4.13    -0.96   fixed   TRUE 
HymenopteraInsecticideFor   Hymenoptera
insecticidearea -0.07   0.68    -0.11   fixed   TRUE 
LepidopteraInsecticideFor   Lepidoptera
insecticidearea -9.98   3.28    -3.03   fixed   TRUE     
OdonataInsecticideFor       Odonata
insecticidearea -0.60   0.83    -0.72   fixed   TRUE 
OrthopteraInsecticideFor    Orthoptera
insecticidearea -1.97   1.70    -1.15   fixed   TRUE 
ThysanopInsecticideFor  Thysanoptera

为了更好地查看数据结构, dput(m123456_df):

    "structure(list(X = c(49L, 50L, 51L, 52L, 53L, 169L, 170L, 171L, 
    172L, 173L, 1L, 2L, 3L, 4L, 109L, 110L, 111L, 112L, 113L, 54L, 
    55L, 56L, 57L, 58L, 174L, 175L, 176L, 177L, 178L, 5L, 6L, 7L, 
    8L, 114L, 115L, 116L, 117L, 118L, 59L, 60L, 61L, 62L, 63L, 179L, 
    180L, 181L, 182L, 183L, 9L, 10L, 11L, 12L, 119L, 120L, 121L, 
    122L, 123L, 69L, 70L, 71L, 72L, 73L, 189L, 190L, 191L, 192L, 
    193L, 17L, 18L, 19L, 20L, 129L, 130L, 131L, 132L, 133L, 74L, 
75L, 76L, 77L, 78L, 194L, 195L, 196L, 197L, 198L, 21L, 22L, 23L, 
24L, 134L, 135L, 136L, 137L, 138L, 79L, 80L, 81L, 82L, 83L, 199L, 
200L, 201L, 202L, 203L, 25L, 26L, 27L, 28L, 139L, 140L, 141L, 
142L, 143L, 84L, 85L, 86L, 87L, 88L, 204L, 205L, 206L, 207L, 
208L, 29L, 30L, 31L, 32L, 144L, 145L, 146L, 147L, 148L, 89L, 
90L, 91L, 92L, 93L, 209L, 210L, 211L, 212L, 213L, 33L, 34L, 35L, 
36L, 149L, 150L, 151L, 152L, 153L, 94L, 95L, 96L, 97L, 98L, 214L, 
215L, 216L, 217L, 218L, 37L, 38L, 39L, 40L, 154L, 155L, 156L, 
157L, 158L, 99L, 100L, 101L, 102L, 103L, 219L, 220L, 221L, 222L, 
223L, 41L, 42L, 43L, 44L, 159L, 160L, 161L, 162L, 163L, 104L, 
105L, 106L, 107L, 108L, 224L, 225L, 226L, 227L, 228L, 45L, 46L, 
47L, 48L, 164L, 165L, 166L, 167L, 168L), term = structure(c(1L, 
3L, 2L, 6L, 7L, 1L, 4L, 2L, 6L, 7L, 1L, 2L, 6L, 7L, 1L, 5L, 2L, 
6L, 7L, 1L, 3L, 2L, 6L, 7L, 1L, 4L, 2L, 6L, 7L, 1L, 2L, 6L, 7L, 
1L, 5L, 2L, 6L, 7L, 1L, 3L, 2L, 6L, 7L, 1L, 4L, 2L, 6L, 7L, 1L, 
2L, 6L, 7L, 1L, 5L, 2L, 6L, 7L, 1L, 3L, 2L, 6L, 7L, 1L, 4L, 2L, 
6L, 7L, 1L, 2L, 6L, 7L, 1L, 5L, 2L, 6L, 7L, 1L, 3L, 2L, 6L, 7L, 
1L, 4L, 2L, 6L, 7L, 1L, 2L, 6L, 7L, 1L, 5L, 2L, 6L, 7L, 1L, 3L, 
2L, 6L, 7L, 1L, 4L, 2L, 6L, 7L, 1L, 2L, 6L, 7L, 1L, 5L, 2L, 6L, 
7L, 1L, 3L, 2L, 6L, 7L, 1L, 4L, 2L, 6L, 7L, 1L, 2L, 6L, 7L, 1L, 
5L, 2L, 6L, 7L, 1L, 3L, 2L, 6L, 7L, 1L, 4L, 2L, 6L, 7L, 1L, 2L, 
6L, 7L, 1L, 5L, 2L, 6L, 7L, 1L, 3L, 2L, 6L, 7L, 1L, 4L, 2L, 6L, 
7L, 1L, 2L, 6L, 7L, 1L, 5L, 2L, 6L, 7L, 1L, 3L, 2L, 6L, 7L, 1L, 
4L, 2L, 6L, 7L, 1L, 2L, 6L, 7L, 1L, 5L, 2L, 6L, 7L, 1L, 3L, 2L, 
6L, 7L, 1L, 4L, 2L, 6L, 7L, 1L, 2L, 6L, 7L, 1L, 5L, 2L, 6L, 7L
), .Label = c("(Intercept)", "doy", "insecticidearea", "neonicarea", 
"pesticidearea", "sd_(Intercept).SiteID.x", "sd_Observation.Residual"
), class = "factor"), estimate = c(5.833565955, -1.872580966, 
0.227436188, 9.992583603, 6.852396625, 5.142632969, -0.678674828, 
0.254534918, 9.864923466, 6.97100003, 4.477798595, 0.039781365, 
9.850994785, 6.987034948, 4.3283009, 0.123013649, 0.022392237, 
9.838260007, 6.994754179, 17.88900765, 3.029762821, 10.65695216, 
2.226434694, 16.74910855, 23.73870445, -6.329202795, 11.20683527, 
3.142802325, 16.38385835, 19.72583775, 10.76829079, 1.846216149, 
16.86087792, 20.66463849, -0.908216649, 10.86819106, 2.09135404, 
16.82721692, 23.13229672, 28.18575111, 7.732269676, 18.27238254, 
56.95696509, 46.09461569, -8.045705619, 10.81339723, 19.1102249, 
58.22254846, 40.85473609, 10.14359574, 18.64465552, 58.48404924, 
36.83632929, 4.404336962, 9.931425672, 18.16739664, 58.57271159, 
39.6406962, -2.605713718, 9.307524378, 15.82145387, 34.13815459, 
36.98723437, 1.498641219, 8.947675916, 15.38990904, 34.28639819, 
37.99163279, 9.083495066, 15.55045251, 34.24464848, 38.25136135, 
-0.276226574, 9.096730123, 15.56422095, 34.24013774, 26.01030204, 
-6.971380003, 9.152834977, 0, 76.54684844, 18.81324754, 4.584413346, 
8.566929469, 0, 76.59232376, 21.71528903, 8.750358994, 0, 76.62612401, 
21.52279232, 0.204300155, 8.743035747, 0, 76.62605563, 23.1671264, 
5.474675587, 10.61361745, 7.81542411, 27.03810868, 34.70000476, 
-11.75757077, 11.81009181, 9.412199453, 26.11205322, 27.01646276, 
11.12642064, 7.617789448, 27.21673834, 30.33676716, -3.179909206, 
11.50125637, 8.155250611, 27.04250033, 49.27043746, -3.98632448, 
5.038285369, 19.08368393, 36.3099002, 44.65665992, 3.305098051, 
4.660102066, 19.15206617, 36.29619993, 46.86770473, 4.875937397, 
19.07213112, 36.36348295, 43.97229941, 3.034326999, 4.717080506, 
19.16011396, 36.30805912, 5.398084837, -0.079315577, 2.151502251, 
0, 5.373302675, 5.618080493, -0.492859394, 2.150411138, 0, 5.367888491, 
5.34786557, 2.145072919, 0, 5.373448857, 6.696394307, -1.214487209, 
2.183364895, 0, 5.338975281, 7.142053223, -9.981494663, -6.62191384, 
6.870891062, 0.081012541, 7.347328261, -0.955827518, 4.837078368, 
6.183147924, 0.245901403, 6.703342056, 4.82069418, 6.322801182, 
0.729648159, 12.34478985, -4.615010887, 4.343005964, 4.884578148, 
0.209518655, 5.332438336, -0.604879396, 0.877454525, 8.290188235, 
4.675812692, 5.70857201, -1.066255113, 1.034587249, 8.238516889, 
4.671352748, 4.962001457, 0.863341599, 8.327281966, 4.669175273, 
5.976663938, -1.049824638, 0.915523839, 8.275547511, 4.677431349, 
5.945020749, -1.977904212, -1.231110798, 2.537802029, 10.77392762, 
5.579913084, -1.248700513, -1.384542346, 2.633756398, 10.77936693, 
4.732988096, -1.412934304, 2.432763407, 10.84148556, 5.62838417, 
-1.108552993, -1.46904816, 2.412972399, 10.83202785), std.error = c(2.345020833, 
1.840768317, 1.750080908, NA, NA, 2.554842927, 1.701707856, 1.833883917, 
NA, NA, 1.937814035, 1.755048913, NA, NA, 3.153724651, 2.050476456, 
1.779085063, NA, NA, 1.814657198, 1.663420324, 1.66101237, NA, 
NA, 1.837869979, 1.636172422, 1.643826419, NA, NA, 1.517843621, 
1.665313905, NA, NA, 2.32233174, 1.679925176, 1.67454475, NA, 
NA, 6.545154384, 5.761076413, 5.699062437, NA, NA, 6.737162579, 
5.737241184, 5.834839768, NA, NA, 5.593994125, 5.82677481, NA, 
NA, 7.906973554, 6.089892019, 5.829353741, NA, NA, 3.99576339, 
3.52936854, 3.444993938, NA, NA, 3.983759621, 3.318339418, 3.446513164, 
NA, NA, 3.310686622, 3.436527267, NA, NA, 4.845766085, 3.764235629, 
3.440400053, NA, NA, 8.628004354, 7.855856109, 7.876962746, NA, 
NA, 8.728305686, 7.915196489, 7.874937593, NA, NA, 7.150052148, 
7.872039214, NA, NA, 10.28405417, 7.845041369, 7.87705336, NA, 
NA, 3.377133084, 2.967940792, 2.915310064, NA, NA, 3.233316178, 
2.815957854, 2.853379324, NA, NA, 2.666723896, 2.914377219, NA, 
NA, 4.171797935, 3.048878466, 2.928824718, NA, NA, 4.479237651, 
4.131956214, 4.007895041, NA, NA, 4.519776015, 3.863296489, 4.011682605, 
NA, NA, 3.722679065, 4.008923785, NA, NA, 5.663222384, 4.498583965, 
4.011828348, NA, NA, 0.7259094, 0.686957844, 0.690230788, NA, 
NA, 0.693440783, 0.691612154, 0.687328516, NA, NA, 0.581187607, 
0.687999626, NA, NA, 0.952040753, 0.681680334, 0.683923538, NA, 
NA, 3.810333838, 3.28639311, 1.520388256, NA, NA, 3.276429106, 
0.336977305, 3.998119731, NA, NA, 3.278016524, 4.193948156, NA, 
NA, 3.162247377, 1.072403509, 2.824905614, NA, NA, 1.125687092, 
0.833751484, 0.810504208, NA, NA, 1.120076008, 0.722188325, 0.815860562, 
NA, NA, 1.00910672, 0.809981199, NA, NA, 1.508858442, 1.172058637, 
0.81176584, NA, NA, 1.839933156, 1.709077899, 1.713608126, NA, 
NA, 1.909498614, 1.709505119, 1.711082298, NA, NA, 1.51769132, 
1.713651686, NA, NA, 2.06553118, 1.737291954, 1.713781907, NA, 
NA), statistic = c(2.487639287, -1.017282267, 0.129957528, NA, 
NA, 2.012895946, -0.398819824, 0.138795545, NA, NA, 2.310747324, 
0.022666813, NA, NA, 1.372440964, 0.059992715, 0.012586378, NA, 
NA, 9.85806447, 1.821405437, 6.41593787, NA, NA, 12.91642212, 
-3.868298175, 6.817529602, NA, NA, 12.99596182, 6.466222833, 
NA, NA, 8.898228507, -0.540629227, 6.49023626, NA, NA, 3.534262962, 
4.89244528, 1.356761706, NA, NA, 6.841844047, -1.402364893, 1.853246646, 
NA, NA, 7.303321237, 1.740859407, NA, NA, 4.658714113, 0.723220863, 
1.703692401, NA, NA, 9.920681566, -0.738294595, 2.701753485, 
NA, NA, 9.28450456, 0.451623849, 2.596153123, NA, NA, 11.47545423, 
2.643219261, NA, NA, 7.89376967, -0.07338185, 2.644090798, NA, 
NA, 3.014637102, -0.887411875, 1.161975151, NA, NA, 2.155429497, 
0.579191351, 1.087872681, NA, NA, 3.037081209, 1.11157462, NA, 
NA, 2.092831481, 0.026041947, 1.109937352, NA, NA, 6.85999806, 
1.844604044, 3.640647895, NA, NA, 10.73201718, -4.175336201, 
4.138984155, NA, NA, 10.13095612, 3.817769562, NA, NA, 7.271868781, 
-1.042976702, 3.926918637, NA, NA, 10.9997373, -0.964754773, 
1.257090148, NA, NA, 9.880281628, 0.8555124, 1.161632792, NA, 
NA, 12.58977847, 1.216270914, NA, NA, 7.764536942, 0.674507139, 
1.175793204, NA, NA, 7.436306566, -0.115459162, 3.11707662, NA, 
NA, 8.101745142, -0.712623963, 3.12865113, NA, NA, 9.201616665, 
3.117840238, NA, NA, 7.033726533, -1.781608106, 3.192410809, 
NA, NA, 1.874390415, -3.037218716, -4.355409753, NA, NA, 2.242480463, 
-2.836474455, 1.209838297, NA, NA, 2.044938458, 1.149440575, 
NA, NA, 3.903802699, -4.303427628, 1.53739861, NA, NA, 4.737052041, 
-0.725491237, 1.082603294, NA, NA, 5.096593419, -1.476422528, 
1.268093222, NA, NA, 4.917221697, 1.065878567, NA, NA, 3.961050137, 
-0.895709997, 1.127817647, NA, NA, 3.231106918, -1.157293189, 
-0.718431933, NA, NA, 2.922187554, -0.730445612, -0.80916175, 
NA, NA, 3.118544617, -0.824516625, NA, NA, 2.72490884, -0.638092515, 
-0.857196679, NA, NA), group = structure(c(1L, 1L, 1L, 3L, 2L, 
1L, 1L, 1L, 3L, 2L, 1L, 1L, 3L, 2L, 1L, 1L, 1L, 3L, 2L, 1L, 1L, 
1L, 3L, 2L, 1L, 1L, 1L, 3L, 2L, 1L, 1L, 3L, 2L, 1L, 1L, 1L, 3L, 
2L, 1L, 1L, 1L, 3L, 2L, 1L, 1L, 1L, 3L, 2L, 1L, 1L, 3L, 2L, 1L, 
1L, 1L, 3L, 2L, 1L, 1L, 1L, 3L, 2L, 1L, 1L, 1L, 3L, 2L, 1L, 1L, 
3L, 2L, 1L, 1L, 1L, 3L, 2L, 1L, 1L, 1L, 3L, 2L, 1L, 1L, 1L, 3L, 
2L, 1L, 1L, 3L, 2L, 1L, 1L, 1L, 3L, 2L, 1L, 1L, 1L, 3L, 2L, 1L, 
1L, 1L, 3L, 2L, 1L, 1L, 3L, 2L, 1L, 1L, 1L, 3L, 2L, 1L, 1L, 1L, 
3L, 2L, 1L, 1L, 1L, 3L, 2L, 1L, 1L, 3L, 2L, 1L, 1L, 1L, 3L, 2L, 
1L, 1L, 1L, 3L, 2L, 1L, 1L, 1L, 3L, 2L, 1L, 1L, 3L, 2L, 1L, 1L, 
1L, 3L, 2L, 1L, 1L, 1L, 3L, 2L, 1L, 1L, 1L, 3L, 2L, 1L, 1L, 3L, 
2L, 1L, 1L, 1L, 3L, 2L, 1L, 1L, 1L, 3L, 2L, 1L, 1L, 1L, 3L, 2L, 
1L, 1L, 3L, 2L, 1L, 1L, 1L, 3L, 2L, 1L, 1L, 1L, 3L, 2L, 1L, 1L, 
1L, 3L, 2L, 1L, 1L, 3L, 2L, 1L, 1L, 1L, 3L, 2L), .Label = c("fixed", 
"Residual", "SiteID.x"), class = "factor"), by_2sd = c(TRUE, 
TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, 
TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, 
TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, 
TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, 
TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, 
TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, 
TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, 
TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, 
TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, 
TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, 
TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, 
TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, 
TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, 
TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, 
TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, 
   TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, 
    TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, 
    TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, 
    TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE), 
    model = structure(c(1L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 2L, 
    3L, 3L, 3L, 3L, 4L, 4L, 4L, 4L, 4L, 5L, 5L, 5L, 5L, 5L, 6L, 
    6L, 6L, 6L, 6L, 7L, 7L, 7L, 7L, 8L, 8L, 8L, 8L, 8L, 9L, 9L, 
    9L, 9L, 9L, 10L, 10L, 10L, 10L, 10L, 11L, 11L, 11L, 11L, 
    12L, 12L, 12L, 12L, 12L, 13L, 13L, 13L, 13L, 13L, 14L, 14L, 
    14L, 14L, 14L, 15L, 15L, 15L, 15L, 16L, 16L, 16L, 16L, 16L, 
    17L, 17L, 17L, 17L, 17L, 18L, 18L, 18L, 18L, 18L, 19L, 19L, 
    19L, 19L, 20L, 20L, 20L, 20L, 20L, 21L, 21L, 21L, 21L, 21L, 
    22L, 22L, 22L, 22L, 22L, 23L, 23L, 23L, 23L, 24L, 24L, 24L, 
    24L, 24L, 25L, 25L, 25L, 25L, 25L, 26L, 26L, 26L, 26L, 26L, 
    27L, 27L, 27L, 27L, 28L, 28L, 28L, 28L, 28L, 29L, 29L, 29L, 
    29L, 29L, 30L, 30L, 30L, 30L, 30L, 31L, 31L, 31L, 31L, 32L, 
    32L, 32L, 32L, 32L, 33L, 33L, 33L, 33L, 33L, 34L, 34L, 34L, 
    34L, 34L, 35L, 35L, 35L, 35L, 36L, 36L, 36L, 36L, 36L, 37L, 
    37L, 37L, 37L, 37L, 38L, 38L, 38L, 38L, 38L, 39L, 39L, 39L, 
    39L, 40L, 40L, 40L, 40L, 40L, 41L, 41L, 41L, 41L, 41L, 42L, 
    42L, 42L, 42L, 42L, 43L, 43L, 43L, 43L, 44L, 44L, 44L, 44L, 
    44L), .Label = c("AcariInsecticideFor", "AcariNeonicFor", 
    "AcariNullFor", "AcariPesticideFor", "AraneaeInsecticideFor", 
    "AraneaeNeonicFor", "AraneaeNullFor", "AraneaePesticideFor", 
    "ColeopteraInsecticideFor", "ColeopteraNeonicFor", "ColeopteraNullFor", 
    "ColeopteraPesticideFor", "DipteraInsecticideFor", "DipteraNeonicFor", 
    "DipteraNullFor", "DipteraPesticideFor", "HemipteraInsecticideFor", 
    "HemipteraNeonicFor", "HemipteraNullFor", "HemipteraPesticideFor", 
    "HomopteraInsecticideFor", "HomopteraNeonicFor", "HomopteraNullFor", 
    "HomopteraPesticideFor", "HymenopteraInsecticideFor", 
    "HymenopteraNeonicFor", 
    "HymenopteraNullFor", "HymenopteraPesticideFor", 
    "LepidopteraInsecticideFor", 
    "LepidopteraNeonicFor", "LepidopteraNullFor", "LepidopteraPesticideFor", 
    "OdonataInsecticideFor", "OdonataNeonicFor", "OdonataNullFor", 
    "OdonataPesticideFor", "OrthopteraInsecticideFor", "OrthopteraNeonicFor", 
    "OrthopteraNullFor", "OrthopteraPesticideFor", 
    "ThysanopteraInsecticideFor", 
    "ThysanopteraNeonicFor", "ThysanopteraNullFor", "ThysanopteraPesticideFor"
    ), class = "factor"), Order = structure(c(1L, 1L, 1L, 1L, 
    1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 
    2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 
    2L, 2L, 2L, 2L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 
    3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 
    4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 5L, 5L, 5L, 
    5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 
    5L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 
    6L, 6L, 6L, 6L, 6L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 
    7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 8L, 8L, 8L, 8L, 8L, 8L, 
    8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 9L, 9L, 
    9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 
    9L, 9L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 
    10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 11L, 11L, 11L, 
    11L, 11L, 11L, 11L, 11L, 11L, 11L, 11L, 11L, 11L, 11L, 11L, 
    11L, 11L, 11L, 11L), .Label = c("Acari", "Araneae", "Coleoptera", 
    "Diptera", "Hemiptera", "Homoptera", "Hymenoptera", "Lepidoptera", 
    "Odonata", "Orthoptera", "Thysanoptera"), class = "factor")), row.names = 
    c(NA, 
    -209L), class = "data.frame")

地块代码:

 #required packages
library(dotwhisker)
library(broom)
library(lme4)

m123456_df<-read.csv("C:/Users/breiley/Desktop/m123456_df.csv")
m123456_df$Order=as.factor(m123456_df$Order)


# Relabel predictors (they will appear as facet labels)
m123456_df <- m123456_df %>% 
relabel_predictors(c("(Intercept)" = "Intercept",
                 neonicarea = "Neonictinoid",
                 insecticidearea= "All insecticide",
                 pesticidearea = "All pesticide" ))

 m123456_df$Order=as.factor(m123456_df$Order)                    

 # Generate a 'small multiple' plot
 small_multiple(m123456_df) +
 theme_bw() + theme(axis.title.x=element_blank(),
   axis.text.x=element_blank(),
   axis.ticks.x=element_blank())+ylab("Coefficient estimate") +
  geom_hline(yintercept = 0, colour = "grey60", linetype = 2) +  
  scale_colour_hue(name = "Order",
                 breaks = c(0,1,2,3,4,5,6,7,8,9,10),
                 labels = c("Acari", 
 "Araneae","Coleoptera","Diptera","Hemiptera","Homoptera", 
 "Hymenoptera","Lepidoptera","Odonata","Orthoptera","Thysanoptera"))+ 
theme(legend.position = c(0.02, 0.008), 
legend.justification=c(0, 0),legend.title = element_text(size=8),
legend.background = element_rect(color="gray90"),
legend.spacing = unit(-4, "pt"),
legend.key.size = unit(10, "pt")) 

  ggtitle("Arthropod temporal trends") +
  theme(plot.title = element_text(face = 
 "bold"))+scale_colour_discrete(na.translate = F)   


   ggsave("C:/Users/breiley/Desktop/ForestPesticide.png",width=10, 
   height=10,dpi=300)

0 个答案:

没有答案