Removing entire lines from a plot without changing the colors used for the lines

29 views
Skip to first unread message

Zack Weinberg

unread,
Nov 29, 2010, 8:52:19 PM11/29/10
to ggplot2
I'm trying to remove some of the lines from a plot, without changing
the colours of the lines that remain. This is the base plot (data
frame at end of message):

ggplot(d.p, aes(x=K, y=err, group=I, colour=ordered(I))) + geom_line()

I thought that setting breaks on scale_colour_hue would get rid of the
lines not mentioned in the breaks list, but what it does instead is
remove those entries from the legend but not the graph.

ggplot(d.p, aes(x=K, y=err, group=I, colour=ordered(I))) + geom_line() +
scale_colour_hue(breaks=c(-.4, -.2, 0))

I also tried setting limits= but that just came out wrong (it drew two
of the three lines, in the correct colours). And if I use subset() to
remove the unwanted lines from the data frame before plotting, then I
get different colours. How do I do this?

thanks,
zw

d.p <- structure(list(K = c(0L, 1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L,
10L, 11L, 12L, 13L, 14L, 15L, 16L, 17L, 18L, 19L, 20L, 21L, 22L,
23L, 24L, 25L, 26L, 27L, 28L, 29L, 30L, 31L, 32L, 33L, 34L, 35L,
36L, 37L, 38L, 39L, 40L, 41L, 42L, 43L, 44L, 45L, 46L, 47L, 48L,
49L, 50L, 51L, 52L, 53L, 54L, 55L, 56L, 57L, 58L, 59L, 60L, 61L,
62L, 63L, 64L, 65L, 66L, 67L, 68L, 69L, 70L, 71L, 72L, 73L, 74L,
75L, 76L, 77L, 78L, 79L, 80L, 81L, 82L, 83L, 84L, 85L, 86L, 87L,
88L, 89L, 90L, 91L, 92L, 93L, 94L, 95L, 96L, 97L, 98L, 99L, 100L,
101L, 102L, 103L, 104L, 105L, 106L, 107L, 108L, 109L, 110L, 111L,
112L, 113L, 114L, 115L, 116L, 117L, 118L, 119L, 120L, 121L, 122L,
123L, 124L, 125L, 126L, 127L, 128L, 129L, 130L, 131L, 132L, 133L,
134L, 135L, 136L, 137L, 138L, 139L, 140L, 141L, 142L, 143L, 144L,
145L, 146L, 147L, 148L, 149L, 150L, 151L, 152L, 153L, 154L, 155L,
156L, 157L, 158L, 159L, 160L, 161L, 162L, 163L, 164L, 165L, 166L,
167L, 168L, 169L, 170L, 171L, 172L, 173L, 174L, 175L, 176L, 177L,
178L, 179L, 180L, 181L, 182L, 183L, 184L, 185L, 186L, 187L, 188L,
189L, 190L, 191L, 192L, 193L, 194L, 195L, 196L, 197L, 198L, 199L,
200L, 201L, 202L, 203L, 204L, 205L, 206L, 207L, 208L, 209L, 210L,
211L, 212L, 213L, 214L, 215L, 216L, 217L, 218L, 219L, 220L, 221L,
222L, 223L, 224L, 225L, 226L, 227L, 228L, 229L, 230L, 231L, 232L,
233L, 234L, 235L, 236L, 237L, 238L, 239L, 240L, 241L, 242L, 243L,
244L, 245L, 246L, 247L, 248L, 249L, 250L, 251L, 252L, 253L, 254L,
255L, 256L, 257L, 258L, 259L, 260L, 261L, 262L, 263L, 264L, 265L,
266L, 0L, 1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L, 11L, 12L,
13L, 14L, 15L, 16L, 17L, 18L, 19L, 20L, 21L, 22L, 23L, 24L, 25L,
26L, 27L, 28L, 29L, 30L, 31L, 32L, 33L, 34L, 35L, 36L, 37L, 38L,
39L, 40L, 41L, 42L, 43L, 44L, 45L, 46L, 47L, 48L, 49L, 50L, 51L,
52L, 53L, 54L, 55L, 56L, 57L, 58L, 59L, 60L, 61L, 62L, 63L, 64L,
65L, 66L, 67L, 68L, 69L, 70L, 71L, 72L, 73L, 74L, 75L, 76L, 77L,
78L, 79L, 80L, 81L, 82L, 83L, 84L, 85L, 86L, 87L, 88L, 89L, 90L,
91L, 92L, 93L, 94L, 95L, 96L, 97L, 98L, 99L, 100L, 101L, 102L,
103L, 104L, 105L, 106L, 107L, 108L, 109L, 110L, 111L, 112L, 113L,
114L, 115L, 116L, 117L, 118L, 119L, 120L, 121L, 122L, 123L, 124L,
125L, 126L, 127L, 128L, 129L, 130L, 131L, 132L, 133L, 134L, 135L,
136L, 137L, 138L, 139L, 140L, 141L, 142L, 143L, 144L, 145L, 146L,
147L, 148L, 149L, 150L, 151L, 152L, 153L, 154L, 155L, 156L, 157L,
158L, 159L, 160L, 161L, 162L, 163L, 164L, 165L, 166L, 167L, 168L,
169L, 170L, 171L, 172L, 173L, 174L, 175L, 176L, 177L, 178L, 179L,
180L, 181L, 182L, 183L, 184L, 185L, 186L, 187L, 188L, 189L, 190L,
191L, 192L, 193L, 194L, 195L, 196L, 197L, 198L, 199L, 200L, 201L,
202L, 203L, 204L, 205L, 206L, 207L, 208L, 209L, 210L, 211L, 212L,
213L, 214L, 215L, 216L, 217L, 218L, 219L, 220L, 221L, 222L, 223L,
224L, 225L, 226L, 227L, 228L, 229L, 230L, 231L, 232L, 233L, 234L,
235L, 236L, 237L, 238L, 239L, 240L, 241L, 242L, 243L, 244L, 245L,
246L, 247L, 248L, 249L, 250L, 251L, 252L, 253L, 254L, 255L, 256L,
257L, 258L, 259L, 260L, 261L, 262L, 263L, 264L, 265L, 266L, 0L,
1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L, 11L, 12L, 13L, 14L,
15L, 16L, 17L, 18L, 19L, 20L, 21L, 22L, 23L, 24L, 25L, 26L, 27L,
28L, 29L, 30L, 31L, 32L, 33L, 34L, 35L, 36L, 37L, 38L, 39L, 40L,
41L, 42L, 43L, 44L, 45L, 46L, 47L, 48L, 49L, 50L, 51L, 52L, 53L,
54L, 55L, 56L, 57L, 58L, 59L, 60L, 61L, 62L, 63L, 64L, 65L, 66L,
67L, 68L, 69L, 70L, 71L, 72L, 73L, 74L, 75L, 76L, 77L, 78L, 79L,
80L, 81L, 82L, 83L, 84L, 85L, 86L, 87L, 88L, 89L, 90L, 91L, 92L,
93L, 94L, 95L, 96L, 97L, 98L, 99L, 100L, 101L, 102L, 103L, 104L,
105L, 106L, 107L, 108L, 109L, 110L, 111L, 112L, 113L, 114L, 115L,
116L, 117L, 118L, 119L, 120L, 121L, 122L, 123L, 124L, 125L, 126L,
127L, 128L, 129L, 130L, 131L, 132L, 133L, 134L, 135L, 136L, 137L,
138L, 139L, 140L, 141L, 142L, 143L, 144L, 145L, 146L, 147L, 148L,
149L, 150L, 151L, 152L, 153L, 154L, 155L, 156L, 157L, 158L, 159L,
160L, 161L, 162L, 163L, 164L, 165L, 166L, 167L, 168L, 169L, 170L,
171L, 172L, 173L, 174L, 175L, 176L, 177L, 178L, 179L, 180L, 181L,
182L, 183L, 184L, 185L, 186L, 187L, 188L, 189L, 190L, 191L, 192L,
193L, 194L, 195L, 196L, 197L, 198L, 199L, 200L, 201L, 202L, 203L,
204L, 205L, 206L, 207L, 208L, 209L, 210L, 211L, 212L, 213L, 214L,
215L, 216L, 217L, 218L, 219L, 220L, 221L, 222L, 223L, 224L, 225L,
226L, 227L, 228L, 229L, 230L, 231L, 232L, 233L, 234L, 235L, 236L,
237L, 238L, 239L, 240L, 241L, 242L, 243L, 244L, 245L, 246L, 247L,
248L, 249L, 250L, 251L, 252L, 253L, 254L, 255L, 256L, 257L, 258L,
259L, 260L, 261L, 262L, 263L, 264L, 265L, 266L, 0L, 1L, 2L, 3L,
4L, 5L, 6L, 7L, 8L, 9L, 10L, 11L, 12L, 13L, 14L, 15L, 16L, 17L,
18L, 19L, 20L, 21L, 22L, 23L, 24L, 25L, 26L, 27L, 28L, 29L, 30L,
31L, 32L, 33L, 34L, 35L, 36L, 37L, 38L, 39L, 40L, 41L, 42L, 43L,
44L, 45L, 46L, 47L, 48L, 49L, 50L, 51L, 52L, 53L, 54L, 55L, 56L,
57L, 58L, 59L, 60L, 61L, 62L, 63L, 64L, 65L, 66L, 67L, 68L, 69L,
70L, 71L, 72L, 73L, 74L, 75L, 76L, 77L, 78L, 79L, 80L, 81L, 82L,
83L, 84L, 85L, 86L, 87L, 88L, 89L, 90L, 91L, 92L, 93L, 94L, 95L,
96L, 97L, 98L, 99L, 100L, 101L, 102L, 103L, 104L, 105L, 106L,
107L, 108L, 109L, 110L, 111L, 112L, 113L, 114L, 115L, 116L, 117L,
118L, 119L, 120L, 121L, 122L, 123L, 124L, 125L, 126L, 127L, 128L,
129L, 130L, 131L, 132L, 133L, 134L, 135L, 136L, 137L, 138L, 139L,
140L, 141L, 142L, 143L, 144L, 145L, 146L, 147L, 148L, 149L, 150L,
151L, 152L, 153L, 154L, 155L, 156L, 157L, 158L, 159L, 160L, 161L,
162L, 163L, 164L, 165L, 166L, 167L, 168L, 169L, 170L, 171L, 172L,
173L, 174L, 175L, 176L, 177L, 178L, 179L, 180L, 181L, 182L, 183L,
184L, 185L, 186L, 187L, 188L, 189L, 190L, 191L, 192L, 193L, 194L,
195L, 196L, 197L, 198L, 199L, 200L, 201L, 202L, 203L, 204L, 205L,
206L, 207L, 208L, 209L, 210L, 211L, 212L, 213L, 214L, 215L, 216L,
217L, 218L, 219L, 220L, 221L, 222L, 223L, 224L, 225L, 226L, 227L,
228L, 229L, 230L, 231L, 232L, 233L, 234L, 235L, 236L, 237L, 238L,
239L, 240L, 241L, 242L, 243L, 244L, 245L, 246L, 247L, 248L, 249L,
250L, 251L, 252L, 253L, 254L, 255L, 256L, 257L, 258L, 259L, 260L,
261L, 262L, 263L, 264L, 265L, 266L, 0L, 1L, 2L, 3L, 4L, 5L, 6L,
7L, 8L, 9L, 10L, 11L, 12L, 13L, 14L, 15L, 16L, 17L, 18L, 19L,
20L, 21L, 22L, 23L, 24L, 25L, 26L, 27L, 28L, 29L, 30L, 31L, 32L,
33L, 34L, 35L, 36L, 37L, 38L, 39L, 40L, 41L, 42L, 43L, 44L, 45L,
46L, 47L, 48L, 49L, 50L, 51L, 52L, 53L, 54L, 55L, 56L, 57L, 58L,
59L, 60L, 61L, 62L, 63L, 64L, 65L, 66L, 67L, 68L, 69L, 70L, 71L,
72L, 73L, 74L, 75L, 76L, 77L, 78L, 79L, 80L, 81L, 82L, 83L, 84L,
85L, 86L, 87L, 88L, 89L, 90L, 91L, 92L, 93L, 94L, 95L, 96L, 97L,
98L, 99L, 100L, 101L, 102L, 103L, 104L, 105L, 106L, 107L, 108L,
109L, 110L, 111L, 112L, 113L, 114L, 115L, 116L, 117L, 118L, 119L,
120L, 121L, 122L, 123L, 124L, 125L, 126L, 127L, 128L, 129L, 130L,
131L, 132L, 133L, 134L, 135L, 136L, 137L, 138L, 139L, 140L, 141L,
142L, 143L, 144L, 145L, 146L, 147L, 148L, 149L, 150L, 151L, 152L,
153L, 154L, 155L, 156L, 157L, 158L, 159L, 160L, 161L, 162L, 163L,
164L, 165L, 166L, 167L, 168L, 169L, 170L, 171L, 172L, 173L, 174L,
175L, 176L, 177L, 178L, 179L, 180L, 181L, 182L, 183L, 184L, 185L,
186L, 187L, 188L, 189L, 190L, 191L, 192L, 193L, 194L, 195L, 196L,
197L, 198L, 199L, 200L, 201L, 202L, 203L, 204L, 205L, 206L, 207L,
208L, 209L, 210L, 211L, 212L, 213L, 214L, 215L, 216L, 217L, 218L,
219L, 220L, 221L, 222L, 223L, 224L, 225L, 226L, 227L, 228L, 229L,
230L, 231L, 232L, 233L, 234L, 235L, 236L, 237L, 238L, 239L, 240L,
241L, 242L, 243L, 244L, 245L, 246L, 247L, 248L, 249L, 250L, 251L,
252L, 253L, 254L, 255L, 256L, 257L, 258L, 259L, 260L, 261L, 262L,
263L, 264L, 265L, 266L, 0L, 1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L,
10L, 11L, 12L, 13L, 14L, 15L, 16L, 17L, 18L, 19L, 20L, 21L, 22L,
23L, 24L, 25L, 26L, 27L, 28L, 29L, 30L, 31L, 32L, 33L, 34L, 35L,
36L, 37L, 38L, 39L, 40L, 41L, 42L, 43L, 44L, 45L, 46L, 47L, 48L,
49L, 50L, 51L, 52L, 53L, 54L, 55L, 56L, 57L, 58L, 59L, 60L, 61L,
62L, 63L, 64L, 65L, 66L, 67L, 68L, 69L, 70L, 71L, 72L, 73L, 74L,
75L, 76L, 77L, 78L, 79L, 80L, 81L, 82L, 83L, 84L, 85L, 86L, 87L,
88L, 89L, 90L, 91L, 92L, 93L, 94L, 95L, 96L, 97L, 98L, 99L, 100L,
101L, 102L, 103L, 104L, 105L, 106L, 107L, 108L, 109L, 110L, 111L,
112L, 113L, 114L, 115L, 116L, 117L, 118L, 119L, 120L, 121L, 122L,
123L, 124L, 125L, 126L, 127L, 128L, 129L, 130L, 131L, 132L, 133L,
134L, 135L, 136L, 137L, 138L, 139L, 140L, 141L, 142L, 143L, 144L,
145L, 146L, 147L, 148L, 149L, 150L, 151L, 152L, 153L, 154L, 155L,
156L, 157L, 158L, 159L, 160L, 161L, 162L, 163L, 164L, 165L, 166L,
167L, 168L, 169L, 170L, 171L, 172L, 173L, 174L, 175L, 176L, 177L,
178L, 179L, 180L, 181L, 182L, 183L, 184L, 185L, 186L, 187L, 188L,
189L, 190L, 191L, 192L, 193L, 194L, 195L, 196L, 197L, 198L, 199L,
200L, 201L, 202L, 203L, 204L, 205L, 206L, 207L, 208L, 209L, 210L,
211L, 212L, 213L, 214L, 215L, 216L, 217L, 218L, 219L, 220L, 221L,
222L, 223L, 224L, 225L, 226L, 227L, 228L, 229L, 230L, 231L, 232L,
233L, 234L, 235L, 236L, 237L, 238L, 239L, 240L, 241L, 242L, 243L,
244L, 245L, 246L, 247L, 248L, 249L, 250L, 251L, 252L, 253L, 254L,
255L, 256L, 257L, 258L, 259L, 260L, 261L, 262L, 263L, 264L, 265L,
266L), I = c(-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -0.8,
-0.8, -0.8, -0.8, -0.8, -0.8, -0.8, -0.8, -0.8, -0.8, -0.8, -0.8,
-0.8, -0.8, -0.8, -0.8, -0.8, -0.8, -0.8, -0.8, -0.8, -0.8, -0.8,
-0.8, -0.8, -0.8, -0.8, -0.8, -0.8, -0.8, -0.8, -0.8, -0.8, -0.8,
-0.8, -0.8, -0.8, -0.8, -0.8, -0.8, -0.8, -0.8, -0.8, -0.8, -0.8,
-0.8, -0.8, -0.8, -0.8, -0.8, -0.8, -0.8, -0.8, -0.8, -0.8, -0.8,
-0.8, -0.8, -0.8, -0.8, -0.8, -0.8, -0.8, -0.8, -0.8, -0.8, -0.8,
-0.8, -0.8, -0.8, -0.8, -0.8, -0.8, -0.8, -0.8, -0.8, -0.8, -0.8,
-0.8, -0.8, -0.8, -0.8, -0.8, -0.8, -0.8, -0.8, -0.8, -0.8, -0.8,
-0.8, -0.8, -0.8, -0.8, -0.8, -0.8, -0.8, -0.8, -0.8, -0.8, -0.8,
-0.8, -0.8, -0.8, -0.8, -0.8, -0.8, -0.8, -0.8, -0.8, -0.8, -0.8,
-0.8, -0.8, -0.8, -0.8, -0.8, -0.8, -0.8, -0.8, -0.8, -0.8, -0.8,
-0.8, -0.8, -0.8, -0.8, -0.8, -0.8, -0.8, -0.8, -0.8, -0.8, -0.8,
-0.8, -0.8, -0.8, -0.8, -0.8, -0.8, -0.8, -0.8, -0.8, -0.8, -0.8,
-0.8, -0.8, -0.8, -0.8, -0.8, -0.8, -0.8, -0.8, -0.8, -0.8, -0.8,
-0.8, -0.8, -0.8, -0.8, -0.8, -0.8, -0.8, -0.8, -0.8, -0.8, -0.8,
-0.8, -0.8, -0.8, -0.8, -0.8, -0.8, -0.8, -0.8, -0.8, -0.8, -0.8,
-0.8, -0.8, -0.8, -0.8, -0.8, -0.8, -0.8, -0.8, -0.8, -0.8, -0.8,
-0.8, -0.8, -0.8, -0.8, -0.8, -0.8, -0.8, -0.8, -0.8, -0.8, -0.8,
-0.8, -0.8, -0.8, -0.8, -0.8, -0.8, -0.8, -0.8, -0.8, -0.8, -0.8,
-0.8, -0.8, -0.8, -0.8, -0.8, -0.8, -0.8, -0.8, -0.8, -0.8, -0.8,
-0.8, -0.8, -0.8, -0.8, -0.8, -0.8, -0.8, -0.8, -0.8, -0.8, -0.8,
-0.8, -0.8, -0.8, -0.8, -0.8, -0.8, -0.8, -0.8, -0.8, -0.8, -0.8,
-0.8, -0.8, -0.8, -0.8, -0.8, -0.8, -0.8, -0.8, -0.8, -0.8, -0.8,
-0.8, -0.8, -0.8, -0.8, -0.8, -0.8, -0.8, -0.8, -0.8, -0.8, -0.8,
-0.8, -0.8, -0.6, -0.6, -0.6, -0.6, -0.6, -0.6, -0.6, -0.6, -0.6,
-0.6, -0.6, -0.6, -0.6, -0.6, -0.6, -0.6, -0.6, -0.6, -0.6, -0.6,
-0.6, -0.6, -0.6, -0.6, -0.6, -0.6, -0.6, -0.6, -0.6, -0.6, -0.6,
-0.6, -0.6, -0.6, -0.6, -0.6, -0.6, -0.6, -0.6, -0.6, -0.6, -0.6,
-0.6, -0.6, -0.6, -0.6, -0.6, -0.6, -0.6, -0.6, -0.6, -0.6, -0.6,
-0.6, -0.6, -0.6, -0.6, -0.6, -0.6, -0.6, -0.6, -0.6, -0.6, -0.6,
-0.6, -0.6, -0.6, -0.6, -0.6, -0.6, -0.6, -0.6, -0.6, -0.6, -0.6,
-0.6, -0.6, -0.6, -0.6, -0.6, -0.6, -0.6, -0.6, -0.6, -0.6, -0.6,
-0.6, -0.6, -0.6, -0.6, -0.6, -0.6, -0.6, -0.6, -0.6, -0.6, -0.6,
-0.6, -0.6, -0.6, -0.6, -0.6, -0.6, -0.6, -0.6, -0.6, -0.6, -0.6,
-0.6, -0.6, -0.6, -0.6, -0.6, -0.6, -0.6, -0.6, -0.6, -0.6, -0.6,
-0.6, -0.6, -0.6, -0.6, -0.6, -0.6, -0.6, -0.6, -0.6, -0.6, -0.6,
-0.6, -0.6, -0.6, -0.6, -0.6, -0.6, -0.6, -0.6, -0.6, -0.6, -0.6,
-0.6, -0.6, -0.6, -0.6, -0.6, -0.6, -0.6, -0.6, -0.6, -0.6, -0.6,
-0.6, -0.6, -0.6, -0.6, -0.6, -0.6, -0.6, -0.6, -0.6, -0.6, -0.6,
-0.6, -0.6, -0.6, -0.6, -0.6, -0.6, -0.6, -0.6, -0.6, -0.6, -0.6,
-0.6, -0.6, -0.6, -0.6, -0.6, -0.6, -0.6, -0.6, -0.6, -0.6, -0.6,
-0.6, -0.6, -0.6, -0.6, -0.6, -0.6, -0.6, -0.6, -0.6, -0.6, -0.6,
-0.6, -0.6, -0.6, -0.6, -0.6, -0.6, -0.6, -0.6, -0.6, -0.6, -0.6,
-0.6, -0.6, -0.6, -0.6, -0.6, -0.6, -0.6, -0.6, -0.6, -0.6, -0.6,
-0.6, -0.6, -0.6, -0.6, -0.6, -0.6, -0.6, -0.6, -0.6, -0.6, -0.6,
-0.6, -0.6, -0.6, -0.6, -0.6, -0.6, -0.6, -0.6, -0.6, -0.6, -0.6,
-0.6, -0.6, -0.6, -0.6, -0.6, -0.6, -0.6, -0.6, -0.6, -0.6, -0.6,
-0.6, -0.6, -0.6, -0.6, -0.6, -0.6, -0.6, -0.6, -0.6, -0.6, -0.6,
-0.6, -0.6, -0.6, -0.6, -0.6, -0.4, -0.4, -0.4, -0.4, -0.4, -0.4,
-0.4, -0.4, -0.4, -0.4, -0.4, -0.4, -0.4, -0.4, -0.4, -0.4, -0.4,
-0.4, -0.4, -0.4, -0.4, -0.4, -0.4, -0.4, -0.4, -0.4, -0.4, -0.4,
-0.4, -0.4, -0.4, -0.4, -0.4, -0.4, -0.4, -0.4, -0.4, -0.4, -0.4,
-0.4, -0.4, -0.4, -0.4, -0.4, -0.4, -0.4, -0.4, -0.4, -0.4, -0.4,
-0.4, -0.4, -0.4, -0.4, -0.4, -0.4, -0.4, -0.4, -0.4, -0.4, -0.4,
-0.4, -0.4, -0.4, -0.4, -0.4, -0.4, -0.4, -0.4, -0.4, -0.4, -0.4,
-0.4, -0.4, -0.4, -0.4, -0.4, -0.4, -0.4, -0.4, -0.4, -0.4, -0.4,
-0.4, -0.4, -0.4, -0.4, -0.4, -0.4, -0.4, -0.4, -0.4, -0.4, -0.4,
-0.4, -0.4, -0.4, -0.4, -0.4, -0.4, -0.4, -0.4, -0.4, -0.4, -0.4,
-0.4, -0.4, -0.4, -0.4, -0.4, -0.4, -0.4, -0.4, -0.4, -0.4, -0.4,
-0.4, -0.4, -0.4, -0.4, -0.4, -0.4, -0.4, -0.4, -0.4, -0.4, -0.4,
-0.4, -0.4, -0.4, -0.4, -0.4, -0.4, -0.4, -0.4, -0.4, -0.4, -0.4,
-0.4, -0.4, -0.4, -0.4, -0.4, -0.4, -0.4, -0.4, -0.4, -0.4, -0.4,
-0.4, -0.4, -0.4, -0.4, -0.4, -0.4, -0.4, -0.4, -0.4, -0.4, -0.4,
-0.4, -0.4, -0.4, -0.4, -0.4, -0.4, -0.4, -0.4, -0.4, -0.4, -0.4,
-0.4, -0.4, -0.4, -0.4, -0.4, -0.4, -0.4, -0.4, -0.4, -0.4, -0.4,
-0.4, -0.4, -0.4, -0.4, -0.4, -0.4, -0.4, -0.4, -0.4, -0.4, -0.4,
-0.4, -0.4, -0.4, -0.4, -0.4, -0.4, -0.4, -0.4, -0.4, -0.4, -0.4,
-0.4, -0.4, -0.4, -0.4, -0.4, -0.4, -0.4, -0.4, -0.4, -0.4, -0.4,
-0.4, -0.4, -0.4, -0.4, -0.4, -0.4, -0.4, -0.4, -0.4, -0.4, -0.4,
-0.4, -0.4, -0.4, -0.4, -0.4, -0.4, -0.4, -0.4, -0.4, -0.4, -0.4,
-0.4, -0.4, -0.4, -0.4, -0.4, -0.4, -0.4, -0.4, -0.4, -0.4, -0.4,
-0.4, -0.4, -0.4, -0.4, -0.4, -0.4, -0.4, -0.4, -0.4, -0.4, -0.4,
-0.4, -0.4, -0.4, -0.4, -0.4, -0.4, -0.4, -0.4, -0.2, -0.2, -0.2,
-0.2, -0.2, -0.2, -0.2, -0.2, -0.2, -0.2, -0.2, -0.2, -0.2, -0.2,
-0.2, -0.2, -0.2, -0.2, -0.2, -0.2, -0.2, -0.2, -0.2, -0.2, -0.2,
-0.2, -0.2, -0.2, -0.2, -0.2, -0.2, -0.2, -0.2, -0.2, -0.2, -0.2,
-0.2, -0.2, -0.2, -0.2, -0.2, -0.2, -0.2, -0.2, -0.2, -0.2, -0.2,
-0.2, -0.2, -0.2, -0.2, -0.2, -0.2, -0.2, -0.2, -0.2, -0.2, -0.2,
-0.2, -0.2, -0.2, -0.2, -0.2, -0.2, -0.2, -0.2, -0.2, -0.2, -0.2,
-0.2, -0.2, -0.2, -0.2, -0.2, -0.2, -0.2, -0.2, -0.2, -0.2, -0.2,
-0.2, -0.2, -0.2, -0.2, -0.2, -0.2, -0.2, -0.2, -0.2, -0.2, -0.2,
-0.2, -0.2, -0.2, -0.2, -0.2, -0.2, -0.2, -0.2, -0.2, -0.2, -0.2,
-0.2, -0.2, -0.2, -0.2, -0.2, -0.2, -0.2, -0.2, -0.2, -0.2, -0.2,
-0.2, -0.2, -0.2, -0.2, -0.2, -0.2, -0.2, -0.2, -0.2, -0.2, -0.2,
-0.2, -0.2, -0.2, -0.2, -0.2, -0.2, -0.2, -0.2, -0.2, -0.2, -0.2,
-0.2, -0.2, -0.2, -0.2, -0.2, -0.2, -0.2, -0.2, -0.2, -0.2, -0.2,
-0.2, -0.2, -0.2, -0.2, -0.2, -0.2, -0.2, -0.2, -0.2, -0.2, -0.2,
-0.2, -0.2, -0.2, -0.2, -0.2, -0.2, -0.2, -0.2, -0.2, -0.2, -0.2,
-0.2, -0.2, -0.2, -0.2, -0.2, -0.2, -0.2, -0.2, -0.2, -0.2, -0.2,
-0.2, -0.2, -0.2, -0.2, -0.2, -0.2, -0.2, -0.2, -0.2, -0.2, -0.2,
-0.2, -0.2, -0.2, -0.2, -0.2, -0.2, -0.2, -0.2, -0.2, -0.2, -0.2,
-0.2, -0.2, -0.2, -0.2, -0.2, -0.2, -0.2, -0.2, -0.2, -0.2, -0.2,
-0.2, -0.2, -0.2, -0.2, -0.2, -0.2, -0.2, -0.2, -0.2, -0.2, -0.2,
-0.2, -0.2, -0.2, -0.2, -0.2, -0.2, -0.2, -0.2, -0.2, -0.2, -0.2,
-0.2, -0.2, -0.2, -0.2, -0.2, -0.2, -0.2, -0.2, -0.2, -0.2, -0.2,
-0.2, -0.2, -0.2, -0.2, -0.2, -0.2, -0.2, -0.2, -0.2, -0.2, -0.2,
-0.2, -0.2, -0.2, -0.2, -0.2, -0.2, -0.2, -0.2, -0.2, -0.2, -0.2,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0), err = c(0, 3.61018582251127e-07,
7.22037034162071e-07, 1.08305535573283e-06, 1.44407354696341e-06,
1.80509160796483e-06, 2.16610953851504e-06, 2.52712733872507e-06,
2.88814500859491e-06, 3.24916254823560e-06, 3.61017995742507e-06,
3.97119723638539e-06, 4.33221438500553e-06, 4.69323140317446e-06,
5.05424829111423e-06, 5.41526504871381e-06, 5.77628167586219e-06,
6.13729817278141e-06, 6.49831453936045e-06, 6.8593307755993e-06,
7.22034688149797e-06, 7.58136285705646e-06, 7.94237870238579e-06,
8.30339441726391e-06, 8.66441000180185e-06, 9.02542545611063e-06,
9.3864407799682e-06, 9.74745597348559e-06, 1.01084710367738e-05,
1.04694859697219e-05, 1.08305007722187e-05, 1.11915154444864e-05,
1.15525299864139e-05, 1.19135443980012e-05, 1.22745586792483e-05,
1.26355728301553e-05, 1.29965868507220e-05, 1.33576007409486e-05,
1.3718614500835e-05, 1.40796281303812e-05, 1.44406416296983e-05,
1.48016549985641e-05, 1.51626682372008e-05, 1.55236813453863e-05,
1.58846943233426e-05, 1.62457071708477e-05, 1.66067198881237e-05,
1.69677324750594e-05, 1.73287449316550e-05, 1.76897572579104e-05,
1.80507694538257e-05, 1.84117815194007e-05, 1.87727934546356e-05,
1.91338052595302e-05, 1.94948169341957e-05, 1.98558284784101e-05,
2.02168398923952e-05, 2.05778511759291e-05, 2.09388623292339e-05,
2.12998733521985e-05, 2.16608842447119e-05, 2.20218950069961e-05,
2.23829056389402e-05, 2.27439161405441e-05, 2.31049265118077e-05,
2.34659367528423e-05, 2.38269468634256e-05, 2.41879568436687e-05,
2.45489666936827e-05, 2.49099764132454e-05, 2.52709860025790e-05,
2.56319954614614e-05, 2.59930047901147e-05, 2.63540139884277e-05,
2.67150230564006e-05, 2.70760319940333e-05, 2.74370408013258e-05,
2.77980494782781e-05, 2.81590580248903e-05, 2.85200664412733e-05,
2.88810747272050e-05, 2.92420828827966e-05, 2.96030909081590e-05,
2.99640988031813e-05, 3.03251065677523e-05, 3.06861142020942e-05,
3.10471217060959e-05, 3.14081290797574e-05, 3.17691363230788e-05,
3.21301434361709e-05, 3.24911504188119e-05, 3.28521572711127e-05,
3.32131639931843e-05, 3.35741705848047e-05, 3.3935177046196e-05,
3.42961833772470e-05, 3.46571895778469e-05, 3.50181956482176e-05,
3.53792015882481e-05, 3.57402073979385e-05, 3.61012130773997e-05,
3.64622186264096e-05, 3.68232240450794e-05, 3.71842293335201e-05,
3.75452344915095e-05, 3.79062395192697e-05, 3.82672444166898e-05,
3.86282491837697e-05, 3.89892538205094e-05, 3.9350258326909e-05,
3.97112627029683e-05, 4.00722669486875e-05, 4.04332710640665e-05,
4.07942750492163e-05, 4.11552789039149e-05, 4.15162826283844e-05,
4.18772862225136e-05, 4.22382896863027e-05, 4.25992930197516e-05,
4.29602962228604e-05, 4.33212992956289e-05, 4.36823022380572e-05,
4.40433050501454e-05, 4.44043077320044e-05, 4.47653102835233e-05,
4.51263127045909e-05, 4.54873149954294e-05, 4.58483171559276e-05,
4.62093191860857e-05, 4.65703210859036e-05, 4.69313228553814e-05,
4.72923244945189e-05, 4.76533260034273e-05, 4.80143273818845e-05,
4.83753286301125e-05, 4.87363297480004e-05, 4.9097330735548e-05,
4.94583315927555e-05, 4.98193323196228e-05, 5.01803329161499e-05,
5.05413333823368e-05, 5.09023337181835e-05, 5.12633339238011e-05,
5.16243339990785e-05, 5.19853339439047e-05, 5.23463337585017e-05,
5.27073334427586e-05, 5.30683329966752e-05, 5.34293324202517e-05,
5.37903317135990e-05, 5.41513308764952e-05, 5.45123299091621e-05,
5.48733288113779e-05, 5.52343275833644e-05, 5.55953262250108e-05,
5.5956324736317e-05, 5.63173231172831e-05, 5.6678321367909e-05,
5.70393194883057e-05, 5.74003174782511e-05, 5.77613153379675e-05,
5.81223130672326e-05, 5.84833106662686e-05, 5.88443081349643e-05,
5.92053054733199e-05, 5.95663026813353e-05, 5.99272997591216e-05,
6.02882967064566e-05, 6.06492935235625e-05, 6.10102902102172e-05,
6.13712867666427e-05, 6.1732283192728e-05, 6.20932794884732e-05,
6.24542756538782e-05, 6.2815271688943e-05, 6.31762675937786e-05,
6.3537263368163e-05, 6.38982590123183e-05, 6.42592545261333e-05,
6.46202499096082e-05, 6.4981245162743e-05, 6.53422402855375e-05,
6.57032352779918e-05, 6.6064230140217e-05, 6.6425224871991e-05,
6.67862194735358e-05, 6.71472139447404e-05, 6.75082082856049e-05,
6.78692024961292e-05, 6.82301965763132e-05, 6.85911905261571e-05,
6.89521843457719e-05, 6.93131780350464e-05, 6.96741715938698e-05,
7.0035165022464e-05, 7.0396158320718e-05, 7.07571514886318e-05,
7.11181445263165e-05, 7.14791374335499e-05, 7.18401302105542e-05,
7.22011228571073e-05, 7.25621153734313e-05, 7.2923107759415e-05,
7.32841000150586e-05, 7.3645092140362e-05, 7.40060841354362e-05,
7.43670760000592e-05, 7.4728067734453e-05, 7.50890593385067e-05,
7.54500508122202e-05, 7.58110421555935e-05, 7.61720333686267e-05,
7.65330244513196e-05, 7.68940154037834e-05, 7.7255006225796e-05,
7.76159969175794e-05, 7.79769874790226e-05, 7.83379779101256e-05,
7.86989682108885e-05, 7.90599583814222e-05, 7.94209484215047e-05,
7.9781938331358e-05, 8.01429281108712e-05, 8.05039177599332e-05,
8.0864907278877e-05, 8.12258966673696e-05, 8.1586885925522e-05,
8.19478750534453e-05, 8.23088640509173e-05, 8.26698529181602e-05,
8.30308416550629e-05, 8.33918302616254e-05, 8.37528187378478e-05,
8.4113807083841e-05, 8.4474795299383e-05, 8.48357833846958e-05,
8.51967713396684e-05, 8.55577591643009e-05, 8.59187468585931e-05,
8.62797344225452e-05, 8.66407218562681e-05, 8.70017091595399e-05,
8.73626963325824e-05, 8.77236833752848e-05, 8.8084670287647e-05,
8.844565706978e-05, 8.88066437214619e-05, 8.91676302428035e-05,
8.9528616633916e-05, 8.98896028946883e-05, 9.02505890251204e-05,
9.06115750252123e-05, 9.09725608950751e-05, 9.13335466344867e-05,
9.1694532243669e-05, 9.20555177224003e-05, 9.24165030709023e-05,
9.27774882891752e-05, 9.31384733769969e-05, 9.34994583344784e-05,
9.38604431617307e-05, 9.42214278586428e-05, 9.45824124252148e-05,
9.49433968614466e-05, 9.53043811673382e-05, 9.56653653428896e-05,
9.60263493882119e-05, 0, 3.86244742300867e-06, 7.72487992750648e-06,
1.15872975136044e-05, 1.54497001813025e-05, 1.93120879306008e-05,
2.31744607617212e-05, 2.70368186745529e-05, 3.08991616693177e-05,
3.47614897459048e-05, 3.86238029045360e-05, 4.24861011451005e-05,
4.63483844678203e-05, 5.02106528725843e-05, 5.40729063596146e-05,
5.79351449288001e-05, 6.1797368580363e-05, 6.56595773143032e-05,
6.95217711306206e-05, 7.33839500295375e-05, 7.72461140108316e-05,
8.1108263074836e-05, 8.497039722144e-05, 8.88325164507542e-05,
9.26946207627788e-05, 9.65567101577358e-05, 0.000100418784635514,
0.000104280844196225, 0.000108142888839979, 0.000112004918566777,
0.000115866933376618, 0.000119728933269725, 0.000123590918245986,
0.000127452888305624, 0.000131314843448527, 0.000135176783674917,
0.000139038708984685, 0.000142900619377939, 0.000146762514854792,
0.000150624395415355, 0.000154486261059517, 0.000158348111787499,
0.000162209947599301, 0.000166071768494924, 0.000169933574474368,
0.000173795365537965, 0.000177657141685494, 0.000181518902917066,
0.000185380649232902, 0.000189242380632892, 0.000193104097117147,
0.000196965798685778, 0.000200827485338673, 0.000204689157076166,
0.000208550813898034, 0.000212412455804500, 0.000216274082795564,
0.000220135694871226, 0.000223997292031708, 0.000227858874277009,
0.000231720441607020, 0.000235581994022072, 0.000239443531521943,
0.000243305054106968, 0.000247166561777035, 0.000251028054532143,
0.000254889532372515, 0.000258750995298040, 0.000262612443308941,
0.000266473876405215, 0.000270335294586865, 0.000274196697854001,
0.000278058086206734, 0.000281919459644953, 0.000285780818168879,
0.000289642161778514, 0.000293503490473968, 0.000297364804255129,
0.000301226103122221, 0.000305087387075242, 0.000308948656114305,
0.000312809910239298, 0.000316671149450554, 0.000320532373747850,
0.000324393583131410, 0.000328254777601233, 0.000332115957157431,
0.000335977121800002, 0.000339838271529058, 0.0003436994063446,
0.000347560526246737, 0.000351421631235471, 0.000355282721310912,
0.00035914379647306, 0.000363004856722138, 0.000366865902057922,
0.000370726932480636, 0.00037458794799039, 0.000378448948587184,
0.000382309934271019, 0.000386170905042005, 0.000390031860900142,
0.000393892801845652, 0.000397753727878425, 0.000401614638998571,
0.00040547553520609, 0.000409336416501205, 0.000413197282883804,
0.000417058134354109, 0.000420918970911899, 0.000424779792557506,
0.00042864059929093, 0.000432501391112172, 0.000436362168021343,
0.000440222930018441, 0.000444083677103468, 0.000447944409276646,
0.000451805126537863, 0.000455665828887342, 0.000459526516325082,
0.000463387188851083, 0.000467247846465457, 0.000471108489168204,
0.000474969116959434, 0.000478829729839148, 0.000482690327807567,
0.00048655091086458, 0.0004904114790103, 0.000494272032244725,
0.000498132570567966, 0.000501993093980135, 0.000505853602481232,
0.000509714096071257, 0.00051357457475032, 0.000517435038518643,
0.000521295487376006, 0.000525155921322518, 0.000529016340358401,
0.000532876744483657, 0.000536737133698284, 0.000540597508002283,
0.000544457867395876, 0.000548318211878951, 0.000552178541451731,
0.000556038856114105, 0.000559899155866295, 0.0005637594407083,
0.000567619710640122, 0.000571479965661759, 0.000575340205773434,
0.000579200430975146, 0.000583060641267008, 0.000586920836648908,
0.000590781017121067, 0.000594641182683486, 0.000598501333336166,
0.000602361469079216, 0.000606221589912748, 0.000610081695836762,
0.000613941786851258, 0.000617801862956346, 0.00062166192415225,
0.000625521970438747, 0.000629382001815948, 0.000633242018284075,
0.000637102019843128, 0.000640962006493107, 0.000644821978234011,
0.000648681935066064, 0.000652541876989154, 0.000656401804003504,
0.000660261716109112, 0.000664121613305868, 0.000667981495594105,
0.000671841362973713, 0.000675701215444802, 0.000679561053007371,
0.000683420875661533, 0.000687280683407288, 0.000691140476244856,
0.000695000254174127, 0.000698860017195213, 0.000702719765308113,
0.000706579498512938, 0.0007104392168098, 0.000714298920198697,
0.000718158608679631, 0.000722018282252823, 0.000725877940918163,
0.00072973758467576, 0.000733597213525727, 0.000737456827468064,
0.00074131642650288, 0.000745176010630177, 0.000749035579850066,
0.000752895134162435, 0.000756754673567617, 0.000760614198065501,
0.000764473707656199, 0.000768333202339710, 0.000772192682116035,
0.000776052146985395, 0.000779911596947791, 0.000783771032003333,
0.00078763045215191, 0.000791489857393746, 0.000795349247728727,
0.000799208623157077, 0.000803067983678796, 0.000806927329293994,
0.00081078666000256, 0.000814645975804829, 0.000818505276700576,
0.000822364562689915, 0.000826223833773065, 0.000830083089949918,
0.000833942331220694, 0.000837801557585283, 0.000841660769043795,
0.000845519965596342, 0.000849379147242924, 0.000853238313983651,
0.000857097465818524, 0.000860956602747653, 0.00086481572477104,
0.000868674831888794, 0.000872533924100916, 0.000876393001407516,
0.000880252063808706, 0.000884111111304375, 0.000887970143894634,
0.000891829161579705, 0.000895688164359476, 0.00089954715223406,
0.000903406125203454, 0.000907265083267772, 0.000911124026427124,
0.00091498295468151, 0.000918841868030928, 0.000922700766475493,
0.000926559650015313, 0.000930418518650389, 0.000934277372380832,
0.000938136211206642, 0.000941995035127818, 0.000945853844144584,
0.000949712638256828, 0.00095357141746466, 0.000957430181768193,
0.000961288931167537, 0.00096514766566258, 0.000969006385253435,
0.000972865089940211, 0.000976723779723021, 0.000980582454601753,
0.000984441114576629, 0.000988299759647537, 0.000992158389814701,
0.00099601700507812, 0.000999875605437794, 0.00100373419089383,
0.00100759276144635, 0.00101145131709524, 0.00101530985784071,
0.00101916838368277, 0.00102302689462153, 0.00102688539065687,
0, 4.75740635170752e-05, 9.51458637425961e-05, 0.000142715400784366,
0.000190282674749853, 0.000237847685746861, 0.000285410433883082,
0.000332970919265985, 0.000380529142003483, 0.000428085102202935,
0.000475638799972145, 0.000523190235418802, 0.000570739408650378,
0.000618286319774564, 0.00066583096889894, 0.000713373356131197,
0.000760913481578918, 0.000808451345349681, 0.00085598694755118,
0.000903520288290771, 0.000951051367676259, 0.000998580185815223,
0.00104610674281513, 0.00109363103878357, 0.00114115307382812,
0.00118867284805635, 0.00123619036157585, 0.00128370561449420,
0.00133121860691876, 0.00137872933895733, 0.00142623781071727,
0.00147374402230616, 0.00152124797383146, 0.00156874966540077,
0.00161624909712166, 0.00166374626910160, 0.00171124118144794,
0.00175873383426839, 0.00180622422767029, 0.00185371236176124,
0.00190119823664869, 0.00194868185244002, 0.00199616320924290,
0.00204364230716469, 0.00209111914631288, 0.00213859372679481,
0.00218606604871807, 0.00223353611219013, 0.00228100391731834,
0.00232846946421017, 0.0023759327529731, 0.00242339378371437,
0.00247085255654167, 0.00251830907156236, 0.00256576332888370,
0.00261321532861314, 0.00266066507085816, 0.00270811255572623,
0.00275555778332459, 0.00280300075376061, 0.00285044146714175,
0.00289787992357549, 0.00294531612316895, 0.00299275006602973,
0.00304018175226506, 0.00308761118198231, 0.00313503835528894,
0.00318246327229221, 0.00322988593309936, 0.00327730633781798,
0.00332472448655519, 0.00337214037941835, 0.00341955401651484,
0.00346696539795188, 0.00351437452383685, 0.00356178139427721,
0.00360918600937998, 0.00365658836925253, 0.00370398847400233,
0.00375138632373651, 0.00379878191856231, 0.0038461752585871,
0.00389356634391813, 0.00394095517466264, 0.00398834175092788,
0.00403572607282121, 0.00408310814044976, 0.00413048795392079,
0.00417786551334154, 0.00422524081881936, 0.00427261387046141,
0.0043199846683748, 0.00436735321266679, 0.00441471950344474,
0.00446208354081579, 0.00450944532488706, 0.00455680485576582,
0.0046041621335593, 0.00465151715837453, 0.00469886993031887,
0.00474622044949946, 0.00479356871602343, 0.00484091472999792,
0.00488825849153007, 0.00493560000072724, 0.00498293925769633,
0.00503027626254471, 0.0050776110153794, 0.00512494351630743,
0.00517227376543616, 0.00521960176287262, 0.00526692750872393,
0.00531425100309713, 0.00536157224609946, 0.00540889123783794,
0.00545620797841972, 0.00550352246795183, 0.0055508347065415,
0.00559814469429565, 0.00564545243132142, 0.00569275791772594,
0.00574006115361625, 0.00578736213909947, 0.00583466087428253,
0.00588195735927255, 0.00592925159417657, 0.00597654357910171,
0.00602383331415501, 0.00607112079944339, 0.00611840603507385,
0.00616568902115366, 0.00621296975778962, 0.00626024824508875,
0.00630752448315819, 0.00635479847210485, 0.00640207021203576,
0.00644933970305794, 0.00649660694527832, 0.00654387193880401,
0.00659113468374184, 0.00663839518019882, 0.00668565342828187,
0.00673290942809812, 0.00678016317975438, 0.00682741468335768,
0.00687466393901492, 0.00692191094683314, 0.00696915570691914,
0.00701639821938005, 0.00706363848432257, 0.00711087650185371,
0.00715811227208041, 0.00720534579510956, 0.0072525770710481,
0.00729980610000303, 0.00734703288208094, 0.00739425741738908,
0.00744147970603415, 0.00748869974812294, 0.0075359175437626,
0.0075831330930598, 0.00763034639612137, 0.00767755745305443,
0.00772476626396557, 0.0077719728289617, 0.00781917714814973,
0.00786637922163658, 0.00791357904952883, 0.00796077663193362,
0.00800797196895753, 0.00805516506070758, 0.00810235590729036,
0.00814954450881289, 0.00819673086538186, 0.00824391497710408,
0.00829109684408647, 0.00833827646643559, 0.00838545384425848,
0.00843262897766173, 0.00847980186675223, 0.0085269725116367,
0.00857414091242181, 0.0086213070692146, 0.00866847098212153,
0.00871563265124953, 0.00876279207670527, 0.00880994925859546,
0.0088571041970269, 0.00890425689210639, 0.00895140734394051,
0.00899855555263596, 0.00904570151829964, 0.00909284524103815,
0.00913998672095817, 0.0091871259581664, 0.00923426295276963,
0.00928139770487446, 0.00932853021458757, 0.00937566048201577,
0.00942278850726552, 0.00946991429044364, 0.0095170378316568,
0.0095641591310115, 0.00961127818861462, 0.00965839500457266,
0.0097055095789923, 0.00975262191198023, 0.00979973200364304,
0.0098468398540873, 0.0098939454634197, 0.00994104883174685,
0.0099881499591754, 0.0100352488458119, 0.010082345491763, 0.0101294398971352,
0.0101765320620353, 0.0102236219865696, 0.0102707096708449, 0.0103177951149678,
0.0103648783190446, 0.0104119592831823, 0.0104590380074870, 0.0105061144920656,
0.0105531887370245, 0.0106002607424703, 0.0106473305085095, 0.0106943980352487,
0.0107414633227944, 0.0107885263712530, 0.0108355871807313, 0.0108826457513356,
0.0109297020831725, 0.0109767561763484, 0.0110238080309699, 0.0110708576471436,
0.0111179050249758, 0.0111649501645730, 0.0112119930660417, 0.0112590337294886,
0.0113060721550199, 0.0113531083427421, 0.0114001422927618, 0.0114471740051852,
0.0114942034801191, 0.0115412307176698, 0.0115882557179436, 0.0116352784810472,
0.0116822990070867, 0.0117293172961688, 0.0117763333483998, 0.0118233471638861,
0.0118703587427342, 0.0119173680850505, 0.0119643751909414, 0.0120113800605132,
0.0120583826938724, 0.0121053830911252, 0.0121523812523783, 0.0121993771777377,
0.0122463708673101, 0.0122933623212017, 0.0123403515395188, 0.0123873385223680,
0.0124343232698554, 0.0124813057820874, 0.0125282860591704, 0.0125752641012108,
0, 0.000690108785304844, 0.00137974132047414, 0.00206889793417231,
0.00275757895483686, 0.0034457847106788, 0.00413351552968255,
0.00482077173960616, 0.0055075536679815, 0.00619386164211455,
0.00687969598908522, 0.00756505703574772, 0.0082499451087309,
0.00893436053443797, 0.00961830363904692, 0.0103017747485107,
0.0109847741885574, 0.0116673022846900, 0.0123493593621875, 0.0130309457461035,
0.0137120617612682, 0.0143927077322870, 0.0150728839835415, 0.0157525908391893,
0.0164318286231647, 0.0171105976591781, 0.0177888982707165, 0.0184667307810439,
0.0191440955132008, 0.0198209927900054, 0.0204974229340523, 0.0211733862677143,
0.0218488831131411, 0.0225239137922605, 0.0231984786267778, 0.0238725779381767,
0.0245462120477185, 0.0252193812764432, 0.0258920859451692, 0.0265643263744935,
0.0272361028847915, 0.0279074157962181, 0.0285782654287069, 0.0292486521019706,
0.0299185761355015, 0.0305880378485714, 0.0312570375602318, 0.0319255755893136,
0.0325936522544285, 0.0332612678739673, 0.0339284227661020, 0.0345951172487844,
0.0352613516397472, 0.0359271262565037, 0.0365924414163482, 0.0372572974363559,
0.0379216946333831, 0.0385856333240678, 0.0392491138248292, 0.0399121364518681,
0.0405747015211673, 0.0412368093484912, 0.0418984602493867, 0.0425596545391826,
0.0432203925329905, 0.043880674545704, 0.0445405008919998, 0.0451998718863371,
0.0458587878429586, 0.0465172490758896, 0.0471752558989389, 0.0478328086256989,
0.0484899075695454, 0.0491465530436378, 0.0498027453609198, 0.0504584848341187,
0.0511137717757464, 0.0517686064980988, 0.0524229893132563, 0.0530769205330841,
0.0537304004692322, 0.0543834294331352, 0.0550360077360132, 0.0556881356888714,
0.0563398136025001, 0.0569910417874754, 0.057641820554159, 0.0582921502126985,
0.0589420310730272, 0.0595914634448649, 0.0602404476377173, 0.0608889839608766,
0.0615370727234218, 0.0621847142342182, 0.0628319088019184, 0.0634786567349616,
0.0641249583415743, 0.0647708139297702, 0.0654162238073508, 0.0660611882819048,
0.0667057076608085, 0.0673497822512267, 0.0679934123601116, 0.0686365982942039,
0.0692793403600325, 0.0699216388639147, 0.0705634941119566, 0.0712049064100531,
0.0718458760638875, 0.0724864033789328, 0.0731264886604506, 0.0737661322134924,
0.0744053343428988, 0.0750440953533, 0.0756824155491163, 0.0763202952345576,
0.076957734713624, 0.0775947342901058, 0.0782312942675837, 0.0788674149494287,
0.0795030966388026, 0.0801383396386581, 0.0807731442517385, 0.0814075107805786,
0.082041439527504, 0.0826749307946318, 0.0833079848838708, 0.0839406020969212,
0.0845727827352752, 0.0852045271002168, 0.085835835492822, 0.0864667082139593,
0.0870971455642893, 0.0877271478442653, 0.088356715354133, 0.0889858483939313,
0.0896145472634917, 0.0902428122624389, 0.0908706436901908, 0.0914980418459588,
0.0921250070287475, 0.0927515395373555, 0.093377639670375, 0.0940033077261924,
0.0946285440029877, 0.0952533487987355, 0.0958777224112046, 0.0965016651379584,
0.097125177276355, 0.0977482591235471, 0.0983709109764825, 0.0989931331319042,
0.0996149258863498, 0.100236289536153, 0.100857224377443, 0.101477730706143,
0.102097808817975, 0.102717459008454, 0.103336681572893, 0.1039554768064,
0.104573845003880, 0.105191786460035, 0.105809301469362, 0.106426390326156,
0.107043053324508, 0.107659290758308, 0.108275102921241, 0.108890490106790,
0.109505452608236, 0.110119990718657, 0.110734104730929, 0.111347794937726,
0.111961061631520, 0.112573905104581, 0.113186325648977, 0.113798323556575,
0.114409899119041, 0.115021052627838, 0.115631784374229, 0.116242094649277,
0.116851983743842, 0.117461451948585, 0.118070499553965, 0.118679126850243,
0.119287334127476, 0.119895121675524, 0.120502489784045, 0.121109438742499,
0.121715968840144, 0.122322080366041, 0.122927773609048, 0.123533048857827,
0.12413790640084, 0.124742346526348, 0.125346369522416, 0.125949975676907,
0.126553165277488, 0.127155938611627, 0.127758295966592, 0.128360237629455,
0.128961763887088, 0.129562875026166, 0.130163571333166, 0.130763853094367,
0.131363720595851, 0.131963174123502, 0.132562213963008, 0.133160840399857,
0.133759053719344, 0.134356854206563, 0.134954242146414, 0.135551217823599,
0.136147781522625, 0.136743933527801, 0.137339674123242, 0.137935003592863,
0.138529922220388, 0.139124430289341, 0.139718528083052, 0.140312215884657,
0.140905493977094, 0.141498362643108, 0.142090822165246, 0.142682872825864,
0.143274514907119, 0.143865748690976, 0.144456574459205, 0.145046992493380,
0.145637003074883, 0.146226606484901, 0.146815803004425, 0.147404592914255,
0.147992976494995, 0.148580954027058, 0.149168525790660, 0.149755692065825,
0.150342453132386, 0.15092880926998, 0.151514760758052, 0.152100307875854,
0.152685450902446, 0.153270190116695, 0.153854525797275, 0.154438458222669,
0.155021987671165, 0.155605114420863, 0.156187838749667, 0.156770160935293,
0.157352081255263, 0.157933599986907, 0.158514717407366, 0.159095433793588,
0.159675749422330, 0.160255664570159, 0.160835179513449, 0.161414294528385,
0.161993009890962, 0.162571325876984, 0.163149242762062, 0.163726760821621,
0.164303880330893, 0.164880601564922, 0.165456924798561, 0.166032850306472,
0.166608378363132, 0.167183509242823, 0.167758243219641, 0, 0.0124479218713540,
0.0247408929837927, 0.0368808421522570, 0.0488696741819499, 0.0607092701672085,
0.0724014877866542, 0.0839481615946701, 0.0953511033092499, 0.106612102096263,
0.117732924850182, 0.128715316471315, 0.139561000139587, 0.150271677584916,
0.160849029354215, 0.171294715075085, 0.181610373716209, 0.191797623844516,
0.201858063879142, 0.211793272342226, 0.221604808106585, 0.231294210640312,
0.240863000248319, 0.250312678310882, 0.259644727519213, 0.268860612108099,
0.277961778085647, 0.286949653460168, 0.295825648464238, 0.304591155775966,
0.313247550737516, 0.321796191570896, 0.330238419591076, 0.338575559416441,
0.346808919176629, 0.354939790717784, 0.362969449805248, 0.370899156323738,
0.378730154475023, 0.386463672973146, 0.394100925237214, 0.401643109581787,
0.409091409404899, 0.416446993373739, 0.423711015608016, 0.43088461586105,
0.437968919698597, 0.444965038675461, 0.451874070509899, 0.458697099255855,
0.465435195473056, 0.472089416394983, 0.478660806094759, 0.485150395648966,
0.491559203299425, 0.497888234612963, 0.504138482639188, 0.510310928066307,
0.516406539374993, 0.522426272990351, 0.528371073431979, 0.534241873462168,
0.540039594232259, 0.545765145427172, 0.551419425408141, 0.557003321353667,
0.562517709398726, 0.567963454772232, 0.573341411932797, 0.578652424702800,
0.583897326400783, 0.589076939972208, 0.594192078118572, 0.599243543424928,
0.604232128485815, 0.609158616029616, 0.614023779041371, 0.618828380884065,
0.623573175418398, 0.628258907121071, 0.6328863112016, 0.637456113717667,
0.641969031689046, 0.646425773210106, 0.650827037560911, 0.655173515316942,
0.659465888457451, 0.663704830472463, 0.667891006468456, 0.672025073272711,
0.676107679536375, 0.680139465836238, 0.684121064775238, 0.688053101081722,
0.691936191707468, 0.695770945924485, 0.699557965420613, 0.703297844393928,
0.706991169645975, 0.710638520673838, 0.71424046976107, 0.717797582067479,
0.72131041571781, 0.724779521889315, 0.728205444898233, 0.7315887222852,
0.734929884899584, 0.738229456982785, 0.741487956250485, 0.744705893973883,
0.747883775059913, 0.751022098130468, 0.754121355600634, 0.757182033755951,
0.760204612828718, 0.763189567073338, 0.76613736484073, 0.769048468651822,
0.771923335270113, 0.77476241577335, 0.777566155624296, 0.78033499474063,
0.783069367563969, 0.785769703128036, 0.788436425125975, 0.791069951976831,
0.793670696891202, 0.796239067936071, 0.798775468098837, 0.801280295350543,
0.803753942708318, 0.806196798297046, 0.808609245410262, 0.810991662570295,
0.813344423587655, 0.815667897619688, 0.8179624492285, 0.820228438438157,
0.82246622079117, 0.824676147404288, 0.826858565023584, 0.829013816078864,
0.831142238737396, 0.833244166956964, 0.835319930538277, 0.837369855176705,
0.839394262513393, 0.841393470185717, 0.843367791877132, 0.845317537366383,
0.847243012576115, 0.849144519620871, 0.851022356854496, 0.85287681891695,
0.854708196780536, 0.85651677779556, 0.858302845735411, 0.86006668084109,
0.86180855986518, 0.863528756115268, 0.865227539496831, 0.866905176555585,
0.868561930519303, 0.87019806133912, 0.871813825730321, 0.873409477212618,
0.874985266149929, 0.876541439789663, 0.87807824230151, 0.87959591481576,
0.881094695461125, 0.882574819402114, 0.884036518875927, 0.88548002322889,
0.886905558952445, 0.88831334971869, 0.889703616415465, 0.891076577181018,
0.892432447438229, 0.89377143992841, 0.895093764744688, 0.896399629364964,
0.897689238684473, 0.898962795047927, 0.90022049828127, 0.901462545723028,
0.90268913225527, 0.90390045033419, 0.905096690020302, 0.906278039008262,
0.907444682656318, 0.90859680401539, 0.909734583857798, 0.910858200705622,
0.91196783085871, 0.913063648422347, 0.914145825334566, 0.915214531393131,
0.916269934282175, 0.917312199598514, 0.918341490877626, 0.919357969619313,
0.920361795313039, 0.921353125462957, 0.92233211561262, 0.923298919369388,
0.924253688428526, 0.92519657259701, 0.926127719817033, 0.92704727618921,
0.927955385995508, 0.928852191721888, 0.929737834080652, 0.930612452032528,
0.931476182808472, 0.932329161931199, 0.933171523236449, 0.934003398893983,
0.934824919428326, 0.93563621373924, 0.93643740912196, 0.93722863128715,
0.938010004380646, 0.93878165100292, 0.93954369222833, 0.940296247624102,
0.941039435269104, 0.941773371772365, 0.942498172291375, 0.943213950550152,
0.943920818857087, 0.944618888122563, 0.945308267876362, 0.945989066284846,
0.946661390167931, 0.947325345015848, 0.94798103500569, 0.94862856301777,
0.949268030651743, 0.94989953824257, 0.950523184876245, 0.95113906840535,
0.9517472854644, 0.95234793148502, 0.952941100710904, 0.953526886212606,
0.95410537990215, 0.954676672547444, 0.955240853786523, 0.955798012141617,
0.956348235033036, 0.956891608792892, 0.957428218678638, 0.95795814888645,
0.958481482564439, 0.958998301825691, 0.959508687761158, 0.960012720452376,
0.960510478984033, 0.961002041456376, 0.96148748499747, 0.96196688577529,
0.962440319009684, 0.962907858984165, 0.963369579057571, 0.963825551675577,
0.964275848382059, 0, 0.56997496704571, 0.815078471032661, 0.920479113411862,
0.965804028124382, 0.985294876067283, 0.993676428596237, 0.997280705998708,
0.998830635507482, 0.99949714399557, 0.999783759330123, 0.99990701109881,
0.999960012444701, 0.999982804350215, 0.999992605440135, 0.99999682015415,
0.999998632586684, 0.999999411978044, 0.999999747135839, 0.999999891262081,
0.999999953239973, 0.999999979892018, 0.999999991353064, 0.999999996281601,
0.999999998400995, 0.999999999312388, 0.99999999970431, 0.999999999872846,
0.99999999994532, 0.999999999976486, 0.999999999989889, 0.999999999995652,
0.99999999999813, 0.999999999999196, 0.999999999999654, 0.999999999999851,
0.999999999999936, 0.999999999999972, 0.999999999999988, 0.999999999999995,
0.999999999999998, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1)), .Names = c("K", "I", "err"), class = "data.frame")

James Howison

unread,
Nov 29, 2010, 9:30:06 PM11/29/10
to ggplot2
I think you want to use subset to choose what date (lines) to display, then map specific colours to values of I. But you want to retain the scale as though the full set of values was there.

Hmmm, I'm seeing the same thing as you. At first I thought, use a subset then specify scale_colour_hue(breaks=ordered(d.p$I)) (ie say that you want the original breaks. That didn't work.

Then I thought:

dataSub <- subset(data, I > -0.5) # leave only -0.4, -0.2 and 0
dataSub$I <- ordered(dataSub$I) # make it an ordered factor
levels(dataSub$I) <- ordered(data$I) # but with all the original levels.

then

ggplot(dataSub, aes(x=K, y=err, group=I, colour=I)) + geom_line() + scale_colour_hue()

but that also didn't work, doesn't seem that ggplot respects the additional 'phantom' levels. Perhaps you'll have to map the colors and values manually using scale_colour_manual, not sure how you find out the values that scale_colour_hue picked though.

--J

> --
> You received this message because you are subscribed to the ggplot2 mailing list.
> Please provide a reproducible example: http://gist.github.com/270442
>
> To post: email ggp...@googlegroups.com
> To unsubscribe: email ggplot2+u...@googlegroups.com
> More options: http://groups.google.com/group/ggplot2

James McCreight

unread,
Nov 29, 2010, 9:49:03 PM11/29/10
to James Howison, ggplot2
I've done this as James suggests, using scale_colour_manual, in other situations.

I would be extremely interested in getting at the colors scale_color_hue is selecting because it does produce very distinct choices... though when color blindness is considered, some of the color Brewer scales make equal sense and can be set by hand quite easily. at least that's how i've justified abandoning the hue scale to myself.
--
-
******************************************************************************
James McCreight                                  mccreigh at colorado.edu
NASA Postdoctoral Fellow
cell: (831) 261-5149

Zack Weinberg

unread,
Nov 29, 2010, 11:39:42 PM11/29/10
to ggplot2
All of the "sequential" and "diverging" Brewer palettes include white
as one of the gradient stops. When used for line plots, this means
several of the palette entries have insufficient contrast with
ggplot's default light grey background, which is a shame, because
otherwise I really like the Brewer color schemes.

My current kludge is

scale_colour_manual(values=colorRampPalette(c("#3B4FB8", "#B71B1A"))(6))

for the base plot, and

scale_colour_manual(values=colorRampPalette(c("#3B4FB8", "#B71B1A"))(6)[1:3])

for the one with some lines removed.

James McCreight

unread,
Nov 30, 2010, 12:27:06 AM11/30/10
to Zack Weinberg, ggplot2
I didnt think this was going to work, but it appears to

ggplot() + 
geom_line(data=d.p[which(d.p$I==-1),],aes(x=K, y=err, group=I, colour=ordered(I))) + 
geom_line(data=d.p[which(d.p$I==-.8),],aes(x=K, y=err, group=I, colour=ordered(I))) + geom_line(data=d.p[which(d.p$I==-.6),],aes(x=K, y=err, group=I, colour=ordered(I))) + geom_line(data=d.p[which(d.p$I==-.4),],aes(x=K, y=err, group=I, colour=ordered(I))) + geom_line(data=d.p[which(d.p$I==-.2),],aes(x=K, y=err, group=I, colour=ordered(I)))+ geom_line(data=d.p[which(d.p$I==0),],aes(x=K, y=err, group=I, colour=ordered(I))) + scale_colour_hue(breaks=c(-1,-.8,-.6,-.4, -.2, 0))

I took out a single line (throw a comment in front of your choices) and it preserves the desired color scheme! Given your data frame, you probably wont mind the typing. ;) It's a cludge too, at least syntactically. The first, clean approach is desirable.

I'd already provided a second kludge, cause I do see your problem with the brewer scales you mentioned, you have a gradient so the use of qualitative scales is out. You could leave out low-contrast colours via e.g.

scale_color_manual(values = c(brewer.pal(8, 'Spectral')[c(8,7,6,3,2,1)]))

or you could rearrange qualitative palettes to give you the desired look. of course this becomes dumb for larger sets of colors or if it needs to be automated.

It'd still be nice to get color_scale_hue values to be able to set them by hand at other times.

James

James McCreight

unread,
Nov 30, 2010, 12:31:27 AM11/30/10
to Zack Weinberg, ggplot2
ah, i retract that solution. as you take out more colors, the pallette starts changing. it was hardly noticable when removing just one color. sorry to speak too soon.

James McCreight

unread,
Nov 30, 2010, 12:43:23 AM11/30/10
to Zack Weinberg, ggplot2
ok, it gets uglier, but it works
In each aes, after colour, add "alpha=0" if you want the line "gone"

e.g.
geom_line(data=d.p[which(d.p$I==-1),],aes(x=K, y=err, group=I, colour=ordered(I),alpha=0)) 

then you'll get an alpha legend you dont want, so

+scale_alpha(legend=FALSE)

at the end of the ggplot() command.

still not attractive.

baptiste auguie

unread,
Nov 30, 2010, 1:42:43 AM11/30/10
to ggplot2
On Tue, Nov 30, 2010 at 3:30 AM, James Howison
<ja...@freelancepropaganda.com> wrote:
> I think you want to use subset to choose what date (lines) to display, then map specific colours to values of I.  But you want to retain the scale as though the full set of values was there.
>
> Hmmm, I'm seeing the same thing as you.  At first I thought, use a subset then specify scale_colour_hue(breaks=ordered(d.p$I)) (ie say that you want the original breaks.  That didn't work.
>
> Then I thought:
>
> dataSub <- subset(data, I > -0.5) # leave only -0.4, -0.2 and 0
> dataSub$I <- ordered(dataSub$I) # make it an ordered factor
> levels(dataSub$I) <- ordered(data$I) # but with all the original levels.
>
> then
>
> ggplot(dataSub, aes(x=K, y=err, group=I, colour=I)) + geom_line() + scale_colour_hue()
>
> but that also didn't work, doesn't seem that ggplot respects the additional 'phantom' levels. Perhaps you'll have to map the colors and values manually using scale_colour_manual, not sure how you find out the values that scale_colour_hue picked though.
>

You could use the function in scale_hue that selects the colors. A
standalone version is in the new scales package,

https://github.com/hadley/scales/raw/master/R/pal-hue.r

(for some reason I can't source() this url so I copy it here)

hue_pal <- function(h = c(0, 360) + 15, c = 100, l = 65, h.start = 0,
direction = 1) {

function(n) {
if ((diff(h) %% 360) < 1) {
h[2] <- h[2] - 360 / n
}

rotate <- function(x) (x + h.start) %% 360 * direction
hues <- rotate(seq(h[1], h[2], length = n))

hcl(hues, c, l)
}
}

hue_pal()(5)
[1] "#F8766D" "#A3A500" "#00BF7D" "#00B0F6" "#E76BF3"

library(gridExtra)
grid.colorstrip(hue_pal()(5)[c(1, 3, 5)])

HTH,

baptiste

Hadley Wickham

unread,
Dec 1, 2010, 8:32:47 AM12/1/10
to Zack Weinberg, ggplot2
Breaks control what appears on the legend. Limits control the range of
the underlying scale when you dont want to use the range of the data,
as in this case.

Hadley

> --
> You received this message because you are subscribed to the ggplot2 mailing list.
> Please provide a reproducible example: http://gist.github.com/270442
>
> To post: email ggp...@googlegroups.com
> To unsubscribe: email

--
Assistant Professor / Dobelman Family Junior Chair
Department of Statistics / Rice University
http://had.co.nz/

Zack Weinberg

unread,
Dec 1, 2010, 1:23:33 PM12/1/10
to Hadley Wickham, ggplot2
With the original data set,

ggplot(d.p, aes(x=K, y=err, group=I, colour=ordered(I))) + geom_line() +

scale_colour_hue(limits=c(-.4, 0))

produces a plot with two lines (for -.4 and 0) and a legend with three
entries (for -.4, -.2, and 0); the .-2 legend box has no line drawn
through it. This doesn't seem like it can possibly be what anyone
wants.

zw

Hadley Wickham

unread,
Dec 1, 2010, 3:28:44 PM12/1/10
to Zack Weinberg, ggplot2
On Wed, Dec 1, 2010 at 6:23 PM, Zack Weinberg <za...@panix.com> wrote:
> With the original data set,
>
> ggplot(d.p, aes(x=K, y=err, group=I, colour=ordered(I))) +  geom_line() +
>  scale_colour_hue(limits=c(-.4, 0))
>
> produces a plot with two lines (for -.4 and 0) and a legend with three
> entries (for -.4, -.2, and 0); the .-2 legend box has no line drawn
> through it.  This doesn't seem like it can possibly be what anyone
> wants.

The limit for the discrete scale are the values you want to show. You
probably want

ggplot(d.p, aes(x=K, y=err, group=I, colour=ordered(I))) + geom_line() +

scale_colour_hue(limits = c(-1, -0.8, -0.6, -0.4, -0.2, 0))

last_plot() %+% subset(d.p, I < -0.5)

Hadley

Reply all
Reply to author
Forward
0 new messages