[R] scatter plot coloring problem

PIKAL Petr petr@p|k@| @end|ng |rom prechez@@cz
Fri Jul 20 14:16:04 CEST 2018


Hi

Values in conv_df are almost same for each Error level

> aggregate(conv_df$Intercept, list(conv_df$Error), mean)
         Group.1         x
1 High CML error -3.226313
2  Low CML error -3.226536
3  Med CML error -3.226422
> aggregate(conv_df$Slope, list(conv_df$Error), mean)
         Group.1        x
1 High CML error 8.325558
2  Low CML error 8.324242
3  Med CML error 8.324721
> boxplot(split(conv_df$Slope, conv_df$Error))
> boxplot(split(conv_df$Intercept, conv_df$Error))
>

so points in ggplot are overplotted and only colour for last plotted level is visible.

Cheers
Petr

> On 07/20/2018 02:01 PM, Micha Silver wrote:
> >
> >
> > On 07/20/2018 01:28 PM, Bert Gunter wrote:
> >> Nothing attached. The mail server strips most attachments for security.
>
> Here is a (slightly shorter) repex.
> The fourth plot shows the problem. The first three are as expected.
>
> library(ggplot2)
>
> strat_df <- structure(list(Slope = c(1.15639473681994, 0.972278300619073,
>                                       1.14313365332712,
> 1.14399372216612, 1.22529134790727, 2.14326711679831,
>                                       0.54859156211142,
> 1.17046713623601, 1.17453878322687, 3.31323770780669,
>                                       0.966673750291528,
> 0.746319725592914, 1.02480114419885, 1.0229752524756,
>                                       1.00132723720128,
> 1.15639473681994, 0.972278300619073, 1.14313365332712,
>                                       1.14399372216612,
> 1.22529134790727, 2.14326711679831, 0.54859156211142,
>                                       1.17046713623601,
> 1.17453878322687, 3.31323770780669, 0.966673750291528,
>                                       0.746319725592914,
> 1.02480114419885, 1.0229752524756, 1.00132723720128,
>                                       1.15639473681994,
> 0.972278300619073, 1.14313365332712, 1.14399372216612,
>                                       1.22529134790727,
> 2.14326711679831, 0.54859156211142, 1.17046713623601,
>                                       1.17453878322687,
> 3.31323770780669, 0.966673750291528, 0.746319725592914,
>                                       1.02480114419885, 1.0229752524756,
> 1.00132723720128, 1.00564012971235,
>                                       0.781822304249351,
> 0.793232303666035, 0.798538338102623, 1.20657643535607,
>                                       2.16318241002351,
> 1.42268702026443, 0.812412401599228, 0.817089629984966,
>                                       3.27413789688355,
> 0.840735716836696, 0.629583577106973, 0.710708013029288,
>                                       0.714002133616219,
> 0.985501434987176, 1.03494070727933, 0.956962513783496,
>                                       0.793549829222589,
> 0.798851646709461, 1.20660885706037, 2.18674952848921,
>                                       1.5634217520085, 0.81273050967827,
> 0.817407079251797, 3.27417031858785,
>                                       0.877344267863596,
> 0.848664941338144, 0.710978765510023, 0.714268901361411,
>                                       0.985533856691474,
> 1.03983096388345, 0.985084623809766, 0.794138608594684,
>                                       0.79943259180892,
> 1.20665856218731, 2.21336885559571, 1.72189603514386,
>                                       0.813327118056704,
> 0.818002445250057, 3.27422002371479, 0.877473770321168,
>                                       0.848389484199237,
> 0.711483989718558, 0.714766443910276, 0.985583561818414
> ), Intercept = c(-1.0892464119326, 0.246565490954958, -1.1639008288321,
>                   -1.17146025612969, -1.93566050996642,
> -3.96706179209372, 3.9202695728101,
>                   -1.04771345550341, -1.07809518302298,
> -19.7820283549024, 0.36822137463493,
>                   2.207658818211, -0.016876438597312,
> -0.00842619567899302, 0.0306144651329568,
>                   -1.0892464119326, 0.246565490954958, -1.1639008288321,
> -1.17146025612969,
>                   -1.93566050996642, -3.96706179209372, 3.9202695728101,
> -1.04771345550341,
>                   -1.07809518302298, -19.7820283549024,
> 0.36822137463493, 2.207658818211,
>                   -0.016876438597312, -0.00842619567899302,
> 0.0306144651329568,
>                   -1.0892464119326, 0.246565490954958, -1.1639008288321,
> -1.17146025612969,
>                   -1.93566050996642, -3.96706179209372, 3.9202695728101,
> -1.04771345550341,
>                   -1.07809518302298, -19.7820283549024,
> 0.36822137463493, 2.207658818211,
>                   -0.016876438597312, -0.00842619567899302,
> 0.0306144651329568,
>                   -1.42588814587741, -0.0938807577163176,
> -0.760427987439108, -0.802681471353857,
>                   -4.38731629113287, -4.72258266663199,
> 1.08443985346667, -0.679055757307681,
>                   -0.713928732007598, -22.2121480319997,
> -0.187477151457156, 1.28512191810652,
>                   0.0386762170827232, 0.00928219285158222,
> -2.45430083552569, -1.5052623193495,
>                   -0.571094020563348, -0.760898951384971,
> -0.80312079180565, -4.38543778472072,
>                   -4.74043340113669, 0.976337655364814,
> -0.679498378418568, -0.714366826235178,
>                   -22.2102695255875, -0.264069816907669,
> 0.823783304969757, 0.0386132206604378,
>                   0.00924930329540931, -2.45242232911355,
> -1.5204762452006, -0.664489263100851,
>                   -0.761704010560802, -0.803866601426402,
> -4.38177522849324, -4.78366916314869,
>                   0.714779631860822, -0.68026224065537,
> -0.715122068793879, -22.20660696936,
>                   -0.262931522643713, 0.827039881514761,
> 0.0385397097353969, 0.00923344703169212,
>                   -2.44875977288606), Struct = c("Bias only", "Bias
> only", "Bias only",
>                                                  "Bias only", "Bias
> only", "Lognormal error dist.", "Lognormal error dist.",
>                                                  "Lognormal error
> dist.", "Lognormal error dist.", "Lognormal error dist.",
>                                                  "FFT-based struct.",
> "FFT-based struct.", "FFT-based struct.",
>                                                  "FFT-based struct.",
> "FFT-based struct.", "Bias only", "Bias only",
>                                                  "Bias only", "Bias
> only", "Bias only", "Lognormal error dist.",
>                                                  "Lognormal error
> dist.", "Lognormal error dist.", "Lognormal error dist.",
>                                                  "Lognormal error
> dist.", "FFT-based struct.", "FFT-based struct.",
>                                                  "FFT-based struct.",
> "FFT-based struct.", "FFT-based struct.",
>                                                  "Bias only", "Bias
> only", "Bias only", "Bias only", "Bias only",
>                                                  "Lognormal error
> dist.", "Lognormal error dist.", "Lognormal error dist.",
>                                                  "Lognormal error
> dist.", "Lognormal error dist.", "FFT-based struct.",
>                                                  "FFT-based struct.",
> "FFT-based struct.", "FFT-based struct.",
>                                                  "FFT-based struct.",
> "Bias only", "Bias only", "Bias only", "Bias only",
>                                                  "Bias only", "Lognormal
> error dist.", "Lognormal error dist.",
>                                                  "Lognormal error
> dist.", "Lognormal error dist.", "Lognormal error dist.",
>                                                  "FFT-based struct.",
> "FFT-based struct.", "FFT-based struct.",
>                                                  "FFT-based struct.",
> "FFT-based struct.", "Bias only", "Bias only",
>                                                  "Bias only", "Bias
> only", "Bias only", "Lognormal error dist.",
>                                                  "Lognormal error
> dist.", "Lognormal error dist.", "Lognormal error dist.",
>                                                  "Lognormal error
> dist.", "FFT-based struct.", "FFT-based struct.",
>                                                  "FFT-based struct.",
> "FFT-based struct.", "FFT-based struct.",
>                                                  "Bias only", "Bias
> only", "Bias only", "Bias only", "Bias only",
>                                                  "Lognormal error
> dist.", "Lognormal error dist.", "Lognormal error dist.",
>                                                  "Lognormal error
> dist.", "Lognormal error dist.", "FFT-based struct.",
>                                                  "FFT-based struct.",
> "FFT-based struct.", "FFT-based struct.",
>                                                  "FFT-based struct."),
> Error = c("Low CML error", "Low CML error",
> "Low CML error", "Low CML error", "Low CML error", "Low CML error",
> "Low CML error", "Low CML error", "Low CML error", "Low CML error",
> "Low CML error", "Low CML error", "Low CML error", "Low CML error",
> "Low CML error", "Med CML error", "Med CML error", "Med CML error",
> "Med CML error", "Med CML error", "Med CML error", "Med CML error",
> "Med CML error", "Med CML error", "Med CML error", "Med CML error",
> "Med CML error", "Med CML error", "Med CML error", "Med CML error",
> "High CML error", "High CML error", "High CML error", "High CML error",
> "High CML error", "High CML error", "High CML error", "High CML error",
> "High CML error", "High CML error", "High CML error", "High CML error",
> "High CML error", "High CML error", "High CML error", "Low CML error",
> "Low CML error", "Low CML error", "Low CML error", "Low CML error",
> "Low CML error", "Low CML error", "Low CML error", "Low CML error",
> "Low CML error", "Low CML error", "Low CML error", "Low CML error",
> "Low CML error", "Low CML error", "Med CML error", "Med CML error",
> "Med CML error", "Med CML error", "Med CML error", "Med CML error",
> "Med CML error", "Med CML error", "Med CML error", "Med CML error",
> "Med CML error", "Med CML error", "Med CML error", "Med CML error",
> "Med CML error", "High CML error", "High CML error", "High CML error",
> "High CML error", "High CML error", "High CML error", "High CML error",
> "High CML error", "High CML error", "High CML error", "High CML error",
> "High CML error", "High CML error", "High CML error", "High CML error"
>                                                  )), .Names = c("Slope",
> "Intercept", "Struct", "Error"), row.names = c(2L,
> 7L, 8L, 9L, 10L, 12L, 17L, 18L, 19L, 20L, 22L, 27L, 28L, 29L,
> 30L, 32L, 37L, 38L, 39L, 40L, 42L, 47L, 48L, 49L, 50L, 52L, 57L,
> 58L, 59L, 60L, 62L, 67L, 68L, 69L, 70L, 72L, 77L, 78L, 79L, 80L,
> 82L, 87L, 88L, 89L, 90L, 92L, 97L, 98L, 99L, 100L, 102L, 107L,
> 108L, 109L, 110L, 112L, 117L, 118L, 119L, 120L, 122L, 127L, 128L,
> 129L, 130L, 132L, 137L, 138L, 139L, 140L, 142L, 147L, 148L, 149L,
> 150L, 152L, 157L, 158L, 159L, 160L, 162L, 167L, 168L, 169L, 170L,
> 172L, 177L, 178L, 179L, 180L), class = "data.frame")
> conv_df <- structure(list(Slope = c(1.04807118675076, 0.998948448847309,
>                                      0.999431048648743,
> 1.06271129629311, 1.07572617384751, 2.22760090861169,
>                                      0.932482182264868,
> 1.02936746325801, 2.52988042582817, 2.95633562179131,
>                                      18.8227507300988,
> 0.974588681842621, 108.07393074932, 0.870832606501646,
>                                      1.00567956715787, 1.04807118675076,
> 0.998948448847309, 0.999431048648743,
>                                      1.06271129629311, 1.07572617384751,
> 2.22760090861169, 0.932482182264868,
>                                      1.02936746325801, 2.52988042582817,
> 2.95633562179131, 18.8227507300988,
>                                      0.974588681842621, 108.07393074932,
> 0.870832606501646, 1.00567956715787,
>                                      1.04807118675076,
> 0.998948448847309, 0.999431048648743, 1.06271129629311,
>                                      1.07572617384751, 2.22760090861169,
> 0.932482182264868, 1.02936746325801,
>                                      2.52988042582817, 2.95633562179131,
> 18.8227507300988, 0.974588681842621,
>                                      108.07393074932, 0.870832606501646,
> 1.00567956715787, 0.938306957617447,
>                                      0.696202687574185,
> 0.698287792550519, 1.01157976748338, 1.07216134522869,
>                                      2.11775044458303,
> 0.658564756192898, 0.718936009019651, 2.46328731519796,
>                                      2.94817482855984, 13.4010203977042,
> 0.758075017209242, 75.8087725102359,
>                                      0.825432059460383,
> 1.00237002354864, 0.93840246618556, 0.696484580425202,
>                                      0.698549805163105,
> 1.01161728893021, 1.07215296972693, 2.11785160868381,
>                                      0.658846969311393,
> 0.719217656820784, 2.46333881438479, 2.94816645305808,
>                                      13.4028764261544,
> 0.758261665458076, 75.8196908351967, 0.82547163245355,
>                                      1.00236164804689,
> 0.938596807939808, 0.697064148960971, 0.699062697365857,
>                                      1.01169996923602, 1.07214387920809,
> 2.11805571501552, 0.659427992302351,
>                                      0.719759915668507,
> 2.46344926105519, 2.94815736253924, 13.4060642247861,
>                                      0.758655662542348,
> 75.8383487496718, 0.825555603203494, 1.00235255752804
> ), Intercept = c(-0.017716276271862, 0.000961091319158938,
> -0.000703510322277703,
>                   -0.00845866525088005, -0.0966678762281092,
> -0.389386368120609,
>                   0.068730059320282, 0.0367676804603267,
> -0.0134454494180847, -2.61898714802878,
>                   -7.30136425060206, -0.21274280699377,
> -43.1291289782452, -0.125688969456484,
>                   -0.307472718728007, -0.017716276271862,
> 0.000961091319158938,
>                   -0.000703510322277703, -0.00845866525088005,
> -0.0966678762281092,
>                   -0.389386368120609, 0.068730059320282,
> 0.0367676804603267, -0.0134454494180847,
>                   -2.61898714802878, -7.30136425060206,
> -0.21274280699377, -43.1291289782452,
>                   -0.125688969456484, -0.307472718728007,
> -0.017716276271862, 0.000961091319158938,
>                   -0.000703510322277703, -0.00845866525088005,
> -0.0966678762281092,
>                   -0.389386368120609, 0.068730059320282,
> 0.0367676804603267, -0.0134454494180847,
>                   -2.61898714802878, -7.30136425060206,
> -0.21274280699377, -43.1291289782452,
>                   -0.125688969456484, -0.307472718728007,
> -0.0859314660447012,
>                   0.0135310033957625, -3.43619764283222e-05,
> -0.0523622551444108,
>                   -0.475294485394066, -0.460272581935994,
> 0.0625183970346825, 0.0262518388075903,
>                   -0.0839509467307793, -2.95707142967006,
> -5.52875677718304, -0.152998423411686,
>                   -32.1368671911073, -0.164063261306885,
> -0.685459757083477, -0.0858163634696177,
>                   0.01352935620949, 9.46328483051025e-05,
> -0.052203322505647, -0.47489015022079,
>                   -0.460135002763724, 0.0626429365104076,
> 0.02640499766902, -0.0838075052075929,
>                   -2.95666709449679, -5.52852300483326,
> -0.153159000797531, -32.135862357057,
>                   -0.163909219046001, -0.685055421910201,
> -0.0856060516008676,
>                   0.0135479894875152, 0.000302270025863519,
> -0.0519314642867551,
>                   -0.474126407682765, -0.45988984866136,
> 0.0628609678242435, 0.026651390571036,
>                   -0.0835647473472818, -2.95590335195876,
> -5.52851009407545, -0.153425312176928,
>                   -32.1365449540903, -0.163646588624356,
> -0.684291679372176), Struct = c("Bias only",
> "Bias only", "Bias only", "Bias only", "Bias only", "Lognormal error dist.",
> "Lognormal error dist.", "Lognormal error dist.", "Lognormal error dist.",
> "Lognormal error dist.", "FFT-based struct.", "FFT-based struct.",
> "FFT-based struct.", "FFT-based struct.", "FFT-based struct.",
> "Bias only", "Bias only", "Bias only", "Bias only", "Bias only",
> "Lognormal error dist.", "Lognormal error dist.", "Lognormal error dist.",
> "Lognormal error dist.", "Lognormal error dist.", "FFT-based struct.",
> "FFT-based struct.", "FFT-based struct.", "FFT-based struct.",
> "FFT-based struct.", "Bias only", "Bias only", "Bias only", "Bias only",
> "Bias only", "Lognormal error dist.", "Lognormal error dist.",
> "Lognormal error dist.", "Lognormal error dist.", "Lognormal error dist.",
> "FFT-based struct.", "FFT-based struct.", "FFT-based struct.",
> "FFT-based struct.", "FFT-based struct.", "Bias only", "Bias only",
> "Bias only", "Bias only", "Bias only", "Lognormal error dist.",
> "Lognormal error dist.", "Lognormal error dist.", "Lognormal error dist.",
> "Lognormal error dist.", "FFT-based struct.", "FFT-based struct.",
> "FFT-based struct.", "FFT-based struct.", "FFT-based struct.",
> "Bias only", "Bias only", "Bias only", "Bias only", "Bias only",
> "Lognormal error dist.", "Lognormal error dist.", "Lognormal error dist.",
> "Lognormal error dist.", "Lognormal error dist.", "FFT-based struct.",
> "FFT-based struct.", "FFT-based struct.", "FFT-based struct.",
> "FFT-based struct.", "Bias only", "Bias only", "Bias only", "Bias only",
> "Bias only", "Lognormal error dist.", "Lognormal error dist.",
> "Lognormal error dist.", "Lognormal error dist.", "Lognormal error dist.",
> "FFT-based struct.", "FFT-based struct.", "FFT-based struct.",
> "FFT-based struct.", "FFT-based struct."), Error = c("Low CML error",
> "Low CML error", "Low CML error", "Low CML error", "Low CML error",
> "Low CML error", "Low CML error", "Low CML error", "Low CML error",
> "Low CML error", "Low CML error", "Low CML error", "Low CML error",
> "Low CML error", "Low CML error", "Med CML error", "Med CML error",
> "Med CML error", "Med CML error", "Med CML error", "Med CML error",
> "Med CML error", "Med CML error", "Med CML error", "Med CML error",
> "Med CML error", "Med CML error", "Med CML error", "Med CML error",
> "Med CML error", "High CML error", "High CML error", "High CML error",
> "High CML error", "High CML error", "High CML error", "High CML error",
> "High CML error", "High CML error", "High CML error", "High CML error",
> "High CML error", "High CML error", "High CML error", "High CML error",
> "Low CML error", "Low CML error", "Low CML error", "Low CML error",
> "Low CML error", "Low CML error", "Low CML error", "Low CML error",
> "Low CML error", "Low CML error", "Low CML error", "Low CML error",
> "Low CML error", "Low CML error", "Low CML error", "Med CML error",
> "Med CML error", "Med CML error", "Med CML error", "Med CML error",
> "Med CML error", "Med CML error", "Med CML error", "Med CML error",
> "Med CML error", "Med CML error", "Med CML error", "Med CML error",
> "Med CML error", "Med CML error", "High CML error", "High CML error",
> "High CML error", "High CML error", "High CML error", "High CML error",
> "High CML error", "High CML error", "High CML error", "High CML error",
> "High CML error", "High CML error", "High CML error", "High CML error",
> "High CML error")), .Names = c("Slope", "Intercept", "Struct",
> "Error"), row.names = c(1L, 3L, 4L, 5L, 6L, 11L, 13L, 14L, 15L,
> 16L, 21L, 23L, 24L, 25L, 26L, 31L, 33L, 34L, 35L, 36L, 41L, 43L,
> 44L, 45L, 46L, 51L, 53L, 54L, 55L, 56L, 61L, 63L, 64L, 65L, 66L,
> 71L, 73L, 74L, 75L, 76L, 81L, 83L, 84L, 85L, 86L, 91L, 93L, 94L,
> 95L, 96L, 101L, 103L, 104L, 105L, 106L, 111L, 113L, 114L, 115L,
> 116L, 121L, 123L, 124L, 125L, 126L, 131L, 133L, 134L, 135L, 136L,
> 141L, 143L, 144L, 145L, 146L, 151L, 153L, 154L, 155L, 156L, 161L,
> 163L, 164L, 165L, 166L, 171L, 173L, 174L, 175L, 176L), class = "data.frame")
>
>
> pl.strat.1 <- ggplot(strat_df, mapping=aes(x=Intercept, y=Slope)) +
>    geom_point(aes(color=Struct),size=4) +
>    scale_y_continuous(limits=c(0.3, 3.0)) +
>    scale_x_continuous(limits=c(-7, 7))
>
> pl.strat.2 <- ggplot(strat_df, mapping=aes(x=Intercept, y=Slope)) +
>    geom_point(aes(color=Error), size=4) +
>    scale_y_continuous(limits=c(0.3, 3.0)) +
>    scale_x_continuous(limits=c(-7, 7))
>
> pl.conv.1 <- ggplot(conv_df, mapping=aes(x=Intercept, y=Slope)) +
>    geom_point(aes(color=Struct), size=4) +
>    scale_y_continuous(limits=c(0.3, 3.0)) +
>    scale_x_continuous(limits=c(-7, 7))
>
> pl.conv.2 <- ggplot(conv_df, mapping=aes(x=Intercept, y=Slope)) +
>    geom_point(aes(color=Error), size=4) +
>    scale_y_continuous(limits=c(0.3, 3.0)) +
>    scale_x_continuous(limits=c(-7, 7))
>
> print(pl.strat.1)
> print(pl.strat.2)
> print(pl.conv.1)
> print(pl.conv.2)
>
>
> >
> >
>
> --
> Micha Silver
> Ben Gurion Univ.
> Sde Boker, Remote Sensing Lab
> cell: +972-523-665918
>
> ______________________________________________
> R-help using r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
Osobní údaje: Informace o zpracování a ochraně osobních údajů obchodních partnerů PRECHEZA a.s. jsou zveřejněny na: https://www.precheza.cz/zasady-ochrany-osobnich-udaju/ | Information about processing and protection of business partner’s personal data are available on website: https://www.precheza.cz/en/personal-data-protection-principles/
Důvěrnost: Tento e-mail a jakékoliv k němu připojené dokumenty jsou důvěrné a podléhají tomuto právně závaznému prohláąení o vyloučení odpovědnosti: https://www.precheza.cz/01-dovetek/ | This email and any documents attached to it may be confidential and are subject to the legally binding disclaimer: https://www.precheza.cz/en/01-disclaimer/



More information about the R-help mailing list