Scale_size_manual line specifying alternate line sizes











up vote
1
down vote

favorite












I am trying to plot multiple years of data and an average on the same plot. I would like the average line (avg) and standard deviations (StdH and StdL) to be in a bolder line type to make the stand out more.



I have gotten to the point where i can plot them with different colours and linetypes but my coding does not seem to be working for scale_size_manual() specifically - even when i have gotten other manual scales to work in the same way. It just doesn't apply or change anything?? I am not sure if my syntax is off slightly?



Any help would be appreciated.



Code:



 p1 <- ggplot(example, aes(x=day, y=value, colour = variable, shape=variable, linetype = variable,
fill = variable))

p1 <- p1 +geom_line()


p1 <- p1 + scale_shape_manual(name= "", values=
c(21,21,21,21,21,21,21,21,21,21),labels = c("2012", "2013", "2014", "2015",
"2016", "2017", "2018", "Avg", "StdH" , "StdL")) +
scale_linetype_manual(name= "", values= c("solid","solid","solid","solid","solid", "solid", "solid",
"solid","dotted", "dotted" ),
labels = c("2012", "2013", "2014", "2015",
"2016", "2017", "2018", "Avg","StdH" , "StdL")) +
scale_color_manual(name= "",values = c("lightpink1", "firebrick2", "red",
"khaki2", "darkgoldenrod2", "darkslategray3", "blue",
"black", "grey80",
"grey80"),labels = c("2012", "2013", "2014", "2015", "2016", "2017", "2018",
"Avg", "StdH" , "StdL"))+
scale_size_manual(name= "",values =
c(0.5,0.5,0.5,0.5,0.5,0.5,0.5,3,1,1),labels = c("2012", "2013", "2014",
"2015", "2016", "2017", "2018", "Avg", "StdH" , "StdL"))


Dummy dataset:



example <- structure(list(day = c(1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L, 
11L, 12L, 13L, 14L, 15L, 16L, 17L, 18L, 19L, 1L, 2L, 3L, 4L,
5L, 6L, 7L, 8L, 9L, 10L, 11L, 12L, 13L, 14L, 15L, 16L, 17L, 18L,
19L, 1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L, 11L, 12L, 13L,
14L, 15L, 16L, 17L, 18L, 19L, 1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L,
9L, 10L, 11L, 12L, 13L, 14L, 15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, 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), .Label = c("2012",
"2013", "2014", "2015", "2016", "2017", "2018", "avg", "stdH",
"stdL"), class = "factor"), value = c(NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 0.813035011534722,
0.819399596857342, 0.828738664539958, 0.834710324143056, 0.844191607359277,
0.856100462892981, 0.861863779878472, 0.869605662396528, 0.878702257322222,
0.887130821185546, 0.899324228029167, 0.905628739333333, 0.914049177410987,
0.923330835359972, 0.930067979710709, 0.942030437145341, 0.948458332459722,
0.958359304605976, 0.969835481069589, 1.10938764625556, 1.12192300698819,
1.13473937973333, 1.14141483861181, 1.15061751442361, 1.16057298275972,
1.17090689060417, 1.18157552140208, 1.19986553628542, 1.21308408352153,
1.2266191703875, 1.23583940773611, 1.2494657257733, 1.25980365776111,
1.27269001772083, 1.28644381114028, 1.30061703170486, 1.31415782964236,
1.32427688976998, 0.830779163004933, 0.838186262363765, 0.859128417646401,
0.862724449693277, 0.871525131398038, 0.889826098448637, 0.891210156322401,
0.895077847238628, 0.895987598688284, 0.895820013531707, 0.911374309052301,
0.91266488286899, 0.910766739630252, 0.909109504993046, 0.913261098626404,
0.922103696808793, 0.927409952689993, 0.92591168405434, 0.941596485085614,
0.929119833825, 0.9444975486125, 0.948266898932639, 0.955056299104167,
0.963458828334955, 0.964581225203472, 0.972657548749817, 1.01873876981718,
1.03278145046042, 1.04546081641516, 1.05473343752431, 1.06352718637708,
1.0742666486442, 1.07891911047222, 1.08363550907302, 1.08906426304934,
1.09677758193194, 1.1046076705066, 1.10911954408125, 0.631248365554861,
0.641042829451008, 0.648293579827778, 0.655045395079167, 0.663208785114583,
0.666893115380125, 0.674189422488873, 0.681509924184028, 0.693503957159028,
0.702561419576389, 0.713188132266667, 0.724857766157639, 0.735444916902778,
0.745390341159028, 0.760225588979861, 0.771742594456944, 0.784025145670139,
0.79432079518125, 0.803671385588194, 0.637260062459986, 0.645136937039611,
0.651507199442887, 0.658422984122477, 0.671206412972822, 0.682619127953343,
0.690362939048611, 0.695130862961699, 0.699617322367361, 0.702218111697496,
0.712515244731707, 0.721580055017483, 0.727369178154969, 0.732949823962448,
0.744934685162613, 0.749011390347201, 0.757563485596087, 0.765955210908965,
0.77178278640612, 0.825138347105843, 0.835031030218735, 0.845112356687166,
0.851229048458991, 0.860701379933881, 0.870098835439713, 0.876865122848723,
0.890273098000025, 0.900076353713788, 0.907712544321304, 0.919625753665275,
0.927349672915107, 0.935227064419413, 0.941583878951304, 0.950802479878907,
0.960066032157983, 0.969141921675458, 0.977218749149916, 0.986713762000125,
1.00662096223506, 1.01846244020306, 1.03015819298715, 1.03619126491636,
1.04504445788237, 1.05466778026015, 1.06229870901887, 1.08183160804982,
1.0954292369126, 1.10626044728563, 1.11886959265124, 1.12621735838914,
1.13634521874989, 1.14334246002261, 1.15169875944251, 1.16252056967026,
1.17279340524912, 1.18256135017598, 1.19211693704488, 0.643655731976628,
0.651599620234415, 0.660066520387178, 0.666266832001628, 0.676358301985388,
0.685529890619276, 0.691431536678579, 0.698714587950224, 0.70472347051498,
0.709164641356977, 0.720381914679308, 0.728481987441075, 0.734108910088932,
0.739825297879997, 0.749906200315302, 0.757611494645704, 0.7654904381018,
0.771876148123849, 0.781310586955371)), row.names = c(1L, 2L,
3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L, 11L, 12L, 13L, 14L, 15L, 16L,
17L, 18L, 19L, 366L, 367L, 368L, 369L, 370L, 371L, 372L, 373L,
374L, 375L, 376L, 377L, 378L, 379L, 380L, 381L, 382L, 383L, 384L,
731L, 732L, 733L, 734L, 735L, 736L, 737L, 738L, 739L, 740L, 741L,
742L, 743L, 744L, 745L, 746L, 747L, 748L, 749L, 1096L, 1097L,
1098L, 1099L, 1100L, 1101L, 1102L, 1103L, 1104L, 1105L, 1106L,
1107L, 1108L, 1109L, 1110L, 1111L, 1112L, 1113L, 1114L, 1461L,
1462L, 1463L, 1464L, 1465L, 1466L, 1467L, 1468L, 1469L, 1470L,
1471L, 1472L, 1473L, 1474L, 1475L, 1476L, 1477L, 1478L, 1479L,
1826L, 1827L, 1828L, 1829L, 1830L, 1831L, 1832L, 1833L, 1834L,
1835L, 1836L, 1837L, 1838L, 1839L, 1840L, 1841L, 1842L, 1843L,
1844L, 2191L, 2192L, 2193L, 2194L, 2195L, 2196L, 2197L, 2198L,
2199L, 2200L, 2201L, 2202L, 2203L, 2204L, 2205L, 2206L, 2207L,
2208L, 2209L, 2556L, 2557L, 2558L, 2559L, 2560L, 2561L, 2562L,
2563L, 2564L, 2565L, 2566L, 2567L, 2568L, 2569L, 2570L, 2571L,
2572L, 2573L, 2574L, 2921L, 2922L, 2923L, 2924L, 2925L, 2926L,
2927L, 2928L, 2929L, 2930L, 2931L, 2932L, 2933L, 2934L, 2935L,
2936L, 2937L, 2938L, 2939L, 3286L, 3287L, 3288L, 3289L, 3290L,
3291L, 3292L, 3293L, 3294L, 3295L, 3296L, 3297L, 3298L, 3299L,
3300L, 3301L, 3302L, 3303L, 3304L), class = "data.frame")









share|improve this question


















  • 2




    In your example ggplot code there isn't any variable that's mapped to the size aesthetic. If you add size=variable inside aes(), does that resolve your issue?
    – eipi10
    Nov 19 at 20:07












  • Well - that was easy! Thank you for picking up on that, totally missed it! Answered!
    – Lmm
    Nov 19 at 20:10






  • 1




    Also, you can shorten your code with, for example, rep(c("solid", "dotted"), c(8,2)) and c(2012:2018, "Avg", "StdH", "StdL").
    – eipi10
    Nov 19 at 20:11










  • Ohhh thanks - I am always looking for ways to become more efficient so useful tip! Cheers.
    – Lmm
    Nov 19 at 20:12






  • 1




    Since you use the second vector three times, you could also assign that to an object and just use the object name in the scale_***_manual calls. For example, x=c(2012:2018, "Avg", "StdH", "StdL") then labels=x.
    – eipi10
    Nov 19 at 20:15















up vote
1
down vote

favorite












I am trying to plot multiple years of data and an average on the same plot. I would like the average line (avg) and standard deviations (StdH and StdL) to be in a bolder line type to make the stand out more.



I have gotten to the point where i can plot them with different colours and linetypes but my coding does not seem to be working for scale_size_manual() specifically - even when i have gotten other manual scales to work in the same way. It just doesn't apply or change anything?? I am not sure if my syntax is off slightly?



Any help would be appreciated.



Code:



 p1 <- ggplot(example, aes(x=day, y=value, colour = variable, shape=variable, linetype = variable,
fill = variable))

p1 <- p1 +geom_line()


p1 <- p1 + scale_shape_manual(name= "", values=
c(21,21,21,21,21,21,21,21,21,21),labels = c("2012", "2013", "2014", "2015",
"2016", "2017", "2018", "Avg", "StdH" , "StdL")) +
scale_linetype_manual(name= "", values= c("solid","solid","solid","solid","solid", "solid", "solid",
"solid","dotted", "dotted" ),
labels = c("2012", "2013", "2014", "2015",
"2016", "2017", "2018", "Avg","StdH" , "StdL")) +
scale_color_manual(name= "",values = c("lightpink1", "firebrick2", "red",
"khaki2", "darkgoldenrod2", "darkslategray3", "blue",
"black", "grey80",
"grey80"),labels = c("2012", "2013", "2014", "2015", "2016", "2017", "2018",
"Avg", "StdH" , "StdL"))+
scale_size_manual(name= "",values =
c(0.5,0.5,0.5,0.5,0.5,0.5,0.5,3,1,1),labels = c("2012", "2013", "2014",
"2015", "2016", "2017", "2018", "Avg", "StdH" , "StdL"))


Dummy dataset:



example <- structure(list(day = c(1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L, 
11L, 12L, 13L, 14L, 15L, 16L, 17L, 18L, 19L, 1L, 2L, 3L, 4L,
5L, 6L, 7L, 8L, 9L, 10L, 11L, 12L, 13L, 14L, 15L, 16L, 17L, 18L,
19L, 1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L, 11L, 12L, 13L,
14L, 15L, 16L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 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), .Label = c("2012",
"2013", "2014", "2015", "2016", "2017", "2018", "avg", "stdH",
"stdL"), class = "factor"), value = c(NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 0.813035011534722,
0.819399596857342, 0.828738664539958, 0.834710324143056, 0.844191607359277,
0.856100462892981, 0.861863779878472, 0.869605662396528, 0.878702257322222,
0.887130821185546, 0.899324228029167, 0.905628739333333, 0.914049177410987,
0.923330835359972, 0.930067979710709, 0.942030437145341, 0.948458332459722,
0.958359304605976, 0.969835481069589, 1.10938764625556, 1.12192300698819,
1.13473937973333, 1.14141483861181, 1.15061751442361, 1.16057298275972,
1.17090689060417, 1.18157552140208, 1.19986553628542, 1.21308408352153,
1.2266191703875, 1.23583940773611, 1.2494657257733, 1.25980365776111,
1.27269001772083, 1.28644381114028, 1.30061703170486, 1.31415782964236,
1.32427688976998, 0.830779163004933, 0.838186262363765, 0.859128417646401,
0.862724449693277, 0.871525131398038, 0.889826098448637, 0.891210156322401,
0.895077847238628, 0.895987598688284, 0.895820013531707, 0.911374309052301,
0.91266488286899, 0.910766739630252, 0.909109504993046, 0.913261098626404,
0.922103696808793, 0.927409952689993, 0.92591168405434, 0.941596485085614,
0.929119833825, 0.9444975486125, 0.948266898932639, 0.955056299104167,
0.963458828334955, 0.964581225203472, 0.972657548749817, 1.01873876981718,
1.03278145046042, 1.04546081641516, 1.05473343752431, 1.06352718637708,
1.0742666486442, 1.07891911047222, 1.08363550907302, 1.08906426304934,
1.09677758193194, 1.1046076705066, 1.10911954408125, 0.631248365554861,
0.641042829451008, 0.648293579827778, 0.655045395079167, 0.663208785114583,
0.666893115380125, 0.674189422488873, 0.681509924184028, 0.693503957159028,
0.702561419576389, 0.713188132266667, 0.724857766157639, 0.735444916902778,
0.745390341159028, 0.760225588979861, 0.771742594456944, 0.784025145670139,
0.79432079518125, 0.803671385588194, 0.637260062459986, 0.645136937039611,
0.651507199442887, 0.658422984122477, 0.671206412972822, 0.682619127953343,
0.690362939048611, 0.695130862961699, 0.699617322367361, 0.702218111697496,
0.712515244731707, 0.721580055017483, 0.727369178154969, 0.732949823962448,
0.744934685162613, 0.749011390347201, 0.757563485596087, 0.765955210908965,
0.77178278640612, 0.825138347105843, 0.835031030218735, 0.845112356687166,
0.851229048458991, 0.860701379933881, 0.870098835439713, 0.876865122848723,
0.890273098000025, 0.900076353713788, 0.907712544321304, 0.919625753665275,
0.927349672915107, 0.935227064419413, 0.941583878951304, 0.950802479878907,
0.960066032157983, 0.969141921675458, 0.977218749149916, 0.986713762000125,
1.00662096223506, 1.01846244020306, 1.03015819298715, 1.03619126491636,
1.04504445788237, 1.05466778026015, 1.06229870901887, 1.08183160804982,
1.0954292369126, 1.10626044728563, 1.11886959265124, 1.12621735838914,
1.13634521874989, 1.14334246002261, 1.15169875944251, 1.16252056967026,
1.17279340524912, 1.18256135017598, 1.19211693704488, 0.643655731976628,
0.651599620234415, 0.660066520387178, 0.666266832001628, 0.676358301985388,
0.685529890619276, 0.691431536678579, 0.698714587950224, 0.70472347051498,
0.709164641356977, 0.720381914679308, 0.728481987441075, 0.734108910088932,
0.739825297879997, 0.749906200315302, 0.757611494645704, 0.7654904381018,
0.771876148123849, 0.781310586955371)), row.names = c(1L, 2L,
3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L, 11L, 12L, 13L, 14L, 15L, 16L,
17L, 18L, 19L, 366L, 367L, 368L, 369L, 370L, 371L, 372L, 373L,
374L, 375L, 376L, 377L, 378L, 379L, 380L, 381L, 382L, 383L, 384L,
731L, 732L, 733L, 734L, 735L, 736L, 737L, 738L, 739L, 740L, 741L,
742L, 743L, 744L, 745L, 746L, 747L, 748L, 749L, 1096L, 1097L,
1098L, 1099L, 1100L, 1101L, 1102L, 1103L, 1104L, 1105L, 1106L,
1107L, 1108L, 1109L, 1110L, 1111L, 1112L, 1113L, 1114L, 1461L,
1462L, 1463L, 1464L, 1465L, 1466L, 1467L, 1468L, 1469L, 1470L,
1471L, 1472L, 1473L, 1474L, 1475L, 1476L, 1477L, 1478L, 1479L,
1826L, 1827L, 1828L, 1829L, 1830L, 1831L, 1832L, 1833L, 1834L,
1835L, 1836L, 1837L, 1838L, 1839L, 1840L, 1841L, 1842L, 1843L,
1844L, 2191L, 2192L, 2193L, 2194L, 2195L, 2196L, 2197L, 2198L,
2199L, 2200L, 2201L, 2202L, 2203L, 2204L, 2205L, 2206L, 2207L,
2208L, 2209L, 2556L, 2557L, 2558L, 2559L, 2560L, 2561L, 2562L,
2563L, 2564L, 2565L, 2566L, 2567L, 2568L, 2569L, 2570L, 2571L,
2572L, 2573L, 2574L, 2921L, 2922L, 2923L, 2924L, 2925L, 2926L,
2927L, 2928L, 2929L, 2930L, 2931L, 2932L, 2933L, 2934L, 2935L,
2936L, 2937L, 2938L, 2939L, 3286L, 3287L, 3288L, 3289L, 3290L,
3291L, 3292L, 3293L, 3294L, 3295L, 3296L, 3297L, 3298L, 3299L,
3300L, 3301L, 3302L, 3303L, 3304L), class = "data.frame")









share|improve this question


















  • 2




    In your example ggplot code there isn't any variable that's mapped to the size aesthetic. If you add size=variable inside aes(), does that resolve your issue?
    – eipi10
    Nov 19 at 20:07












  • Well - that was easy! Thank you for picking up on that, totally missed it! Answered!
    – Lmm
    Nov 19 at 20:10






  • 1




    Also, you can shorten your code with, for example, rep(c("solid", "dotted"), c(8,2)) and c(2012:2018, "Avg", "StdH", "StdL").
    – eipi10
    Nov 19 at 20:11










  • Ohhh thanks - I am always looking for ways to become more efficient so useful tip! Cheers.
    – Lmm
    Nov 19 at 20:12






  • 1




    Since you use the second vector three times, you could also assign that to an object and just use the object name in the scale_***_manual calls. For example, x=c(2012:2018, "Avg", "StdH", "StdL") then labels=x.
    – eipi10
    Nov 19 at 20:15













up vote
1
down vote

favorite









up vote
1
down vote

favorite











I am trying to plot multiple years of data and an average on the same plot. I would like the average line (avg) and standard deviations (StdH and StdL) to be in a bolder line type to make the stand out more.



I have gotten to the point where i can plot them with different colours and linetypes but my coding does not seem to be working for scale_size_manual() specifically - even when i have gotten other manual scales to work in the same way. It just doesn't apply or change anything?? I am not sure if my syntax is off slightly?



Any help would be appreciated.



Code:



 p1 <- ggplot(example, aes(x=day, y=value, colour = variable, shape=variable, linetype = variable,
fill = variable))

p1 <- p1 +geom_line()


p1 <- p1 + scale_shape_manual(name= "", values=
c(21,21,21,21,21,21,21,21,21,21),labels = c("2012", "2013", "2014", "2015",
"2016", "2017", "2018", "Avg", "StdH" , "StdL")) +
scale_linetype_manual(name= "", values= c("solid","solid","solid","solid","solid", "solid", "solid",
"solid","dotted", "dotted" ),
labels = c("2012", "2013", "2014", "2015",
"2016", "2017", "2018", "Avg","StdH" , "StdL")) +
scale_color_manual(name= "",values = c("lightpink1", "firebrick2", "red",
"khaki2", "darkgoldenrod2", "darkslategray3", "blue",
"black", "grey80",
"grey80"),labels = c("2012", "2013", "2014", "2015", "2016", "2017", "2018",
"Avg", "StdH" , "StdL"))+
scale_size_manual(name= "",values =
c(0.5,0.5,0.5,0.5,0.5,0.5,0.5,3,1,1),labels = c("2012", "2013", "2014",
"2015", "2016", "2017", "2018", "Avg", "StdH" , "StdL"))


Dummy dataset:



example <- structure(list(day = c(1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L, 
11L, 12L, 13L, 14L, 15L, 16L, 17L, 18L, 19L, 1L, 2L, 3L, 4L,
5L, 6L, 7L, 8L, 9L, 10L, 11L, 12L, 13L, 14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, 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), .Label = c("2012",
"2013", "2014", "2015", "2016", "2017", "2018", "avg", "stdH",
"stdL"), class = "factor"), value = c(NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 0.813035011534722,
0.819399596857342, 0.828738664539958, 0.834710324143056, 0.844191607359277,
0.856100462892981, 0.861863779878472, 0.869605662396528, 0.878702257322222,
0.887130821185546, 0.899324228029167, 0.905628739333333, 0.914049177410987,
0.923330835359972, 0.930067979710709, 0.942030437145341, 0.948458332459722,
0.958359304605976, 0.969835481069589, 1.10938764625556, 1.12192300698819,
1.13473937973333, 1.14141483861181, 1.15061751442361, 1.16057298275972,
1.17090689060417, 1.18157552140208, 1.19986553628542, 1.21308408352153,
1.2266191703875, 1.23583940773611, 1.2494657257733, 1.25980365776111,
1.27269001772083, 1.28644381114028, 1.30061703170486, 1.31415782964236,
1.32427688976998, 0.830779163004933, 0.838186262363765, 0.859128417646401,
0.862724449693277, 0.871525131398038, 0.889826098448637, 0.891210156322401,
0.895077847238628, 0.895987598688284, 0.895820013531707, 0.911374309052301,
0.91266488286899, 0.910766739630252, 0.909109504993046, 0.913261098626404,
0.922103696808793, 0.927409952689993, 0.92591168405434, 0.941596485085614,
0.929119833825, 0.9444975486125, 0.948266898932639, 0.955056299104167,
0.963458828334955, 0.964581225203472, 0.972657548749817, 1.01873876981718,
1.03278145046042, 1.04546081641516, 1.05473343752431, 1.06352718637708,
1.0742666486442, 1.07891911047222, 1.08363550907302, 1.08906426304934,
1.09677758193194, 1.1046076705066, 1.10911954408125, 0.631248365554861,
0.641042829451008, 0.648293579827778, 0.655045395079167, 0.663208785114583,
0.666893115380125, 0.674189422488873, 0.681509924184028, 0.693503957159028,
0.702561419576389, 0.713188132266667, 0.724857766157639, 0.735444916902778,
0.745390341159028, 0.760225588979861, 0.771742594456944, 0.784025145670139,
0.79432079518125, 0.803671385588194, 0.637260062459986, 0.645136937039611,
0.651507199442887, 0.658422984122477, 0.671206412972822, 0.682619127953343,
0.690362939048611, 0.695130862961699, 0.699617322367361, 0.702218111697496,
0.712515244731707, 0.721580055017483, 0.727369178154969, 0.732949823962448,
0.744934685162613, 0.749011390347201, 0.757563485596087, 0.765955210908965,
0.77178278640612, 0.825138347105843, 0.835031030218735, 0.845112356687166,
0.851229048458991, 0.860701379933881, 0.870098835439713, 0.876865122848723,
0.890273098000025, 0.900076353713788, 0.907712544321304, 0.919625753665275,
0.927349672915107, 0.935227064419413, 0.941583878951304, 0.950802479878907,
0.960066032157983, 0.969141921675458, 0.977218749149916, 0.986713762000125,
1.00662096223506, 1.01846244020306, 1.03015819298715, 1.03619126491636,
1.04504445788237, 1.05466778026015, 1.06229870901887, 1.08183160804982,
1.0954292369126, 1.10626044728563, 1.11886959265124, 1.12621735838914,
1.13634521874989, 1.14334246002261, 1.15169875944251, 1.16252056967026,
1.17279340524912, 1.18256135017598, 1.19211693704488, 0.643655731976628,
0.651599620234415, 0.660066520387178, 0.666266832001628, 0.676358301985388,
0.685529890619276, 0.691431536678579, 0.698714587950224, 0.70472347051498,
0.709164641356977, 0.720381914679308, 0.728481987441075, 0.734108910088932,
0.739825297879997, 0.749906200315302, 0.757611494645704, 0.7654904381018,
0.771876148123849, 0.781310586955371)), row.names = c(1L, 2L,
3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L, 11L, 12L, 13L, 14L, 15L, 16L,
17L, 18L, 19L, 366L, 367L, 368L, 369L, 370L, 371L, 372L, 373L,
374L, 375L, 376L, 377L, 378L, 379L, 380L, 381L, 382L, 383L, 384L,
731L, 732L, 733L, 734L, 735L, 736L, 737L, 738L, 739L, 740L, 741L,
742L, 743L, 744L, 745L, 746L, 747L, 748L, 749L, 1096L, 1097L,
1098L, 1099L, 1100L, 1101L, 1102L, 1103L, 1104L, 1105L, 1106L,
1107L, 1108L, 1109L, 1110L, 1111L, 1112L, 1113L, 1114L, 1461L,
1462L, 1463L, 1464L, 1465L, 1466L, 1467L, 1468L, 1469L, 1470L,
1471L, 1472L, 1473L, 1474L, 1475L, 1476L, 1477L, 1478L, 1479L,
1826L, 1827L, 1828L, 1829L, 1830L, 1831L, 1832L, 1833L, 1834L,
1835L, 1836L, 1837L, 1838L, 1839L, 1840L, 1841L, 1842L, 1843L,
1844L, 2191L, 2192L, 2193L, 2194L, 2195L, 2196L, 2197L, 2198L,
2199L, 2200L, 2201L, 2202L, 2203L, 2204L, 2205L, 2206L, 2207L,
2208L, 2209L, 2556L, 2557L, 2558L, 2559L, 2560L, 2561L, 2562L,
2563L, 2564L, 2565L, 2566L, 2567L, 2568L, 2569L, 2570L, 2571L,
2572L, 2573L, 2574L, 2921L, 2922L, 2923L, 2924L, 2925L, 2926L,
2927L, 2928L, 2929L, 2930L, 2931L, 2932L, 2933L, 2934L, 2935L,
2936L, 2937L, 2938L, 2939L, 3286L, 3287L, 3288L, 3289L, 3290L,
3291L, 3292L, 3293L, 3294L, 3295L, 3296L, 3297L, 3298L, 3299L,
3300L, 3301L, 3302L, 3303L, 3304L), class = "data.frame")









share|improve this question













I am trying to plot multiple years of data and an average on the same plot. I would like the average line (avg) and standard deviations (StdH and StdL) to be in a bolder line type to make the stand out more.



I have gotten to the point where i can plot them with different colours and linetypes but my coding does not seem to be working for scale_size_manual() specifically - even when i have gotten other manual scales to work in the same way. It just doesn't apply or change anything?? I am not sure if my syntax is off slightly?



Any help would be appreciated.



Code:



 p1 <- ggplot(example, aes(x=day, y=value, colour = variable, shape=variable, linetype = variable,
fill = variable))

p1 <- p1 +geom_line()


p1 <- p1 + scale_shape_manual(name= "", values=
c(21,21,21,21,21,21,21,21,21,21),labels = c("2012", "2013", "2014", "2015",
"2016", "2017", "2018", "Avg", "StdH" , "StdL")) +
scale_linetype_manual(name= "", values= c("solid","solid","solid","solid","solid", "solid", "solid",
"solid","dotted", "dotted" ),
labels = c("2012", "2013", "2014", "2015",
"2016", "2017", "2018", "Avg","StdH" , "StdL")) +
scale_color_manual(name= "",values = c("lightpink1", "firebrick2", "red",
"khaki2", "darkgoldenrod2", "darkslategray3", "blue",
"black", "grey80",
"grey80"),labels = c("2012", "2013", "2014", "2015", "2016", "2017", "2018",
"Avg", "StdH" , "StdL"))+
scale_size_manual(name= "",values =
c(0.5,0.5,0.5,0.5,0.5,0.5,0.5,3,1,1),labels = c("2012", "2013", "2014",
"2015", "2016", "2017", "2018", "Avg", "StdH" , "StdL"))


Dummy dataset:



example <- structure(list(day = c(1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L, 
11L, 12L, 13L, 14L, 15L, 16L, 17L, 18L, 19L, 1L, 2L, 3L, 4L,
5L, 6L, 7L, 8L, 9L, 10L, 11L, 12L, 13L, 14L, 15L, 16L, 17L, 18L,
19L, 1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L, 11L, 12L, 13L,
14L, 15L, 16L, 17L, 18L, 19L, 1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L,
9L, 10L, 11L, 12L, 13L, 14L, 15L, 16L, 17L, 18L, 19L, 1L, 2L,
3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L, 11L, 12L, 13L, 14L, 15L, 16L,
17L, 18L, 19L, 1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L, 11L,
12L, 13L, 14L, 15L, 16L, 17L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 10L, 10L, 10L, 10L,
10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L), .Label = c("2012",
"2013", "2014", "2015", "2016", "2017", "2018", "avg", "stdH",
"stdL"), class = "factor"), value = c(NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 0.813035011534722,
0.819399596857342, 0.828738664539958, 0.834710324143056, 0.844191607359277,
0.856100462892981, 0.861863779878472, 0.869605662396528, 0.878702257322222,
0.887130821185546, 0.899324228029167, 0.905628739333333, 0.914049177410987,
0.923330835359972, 0.930067979710709, 0.942030437145341, 0.948458332459722,
0.958359304605976, 0.969835481069589, 1.10938764625556, 1.12192300698819,
1.13473937973333, 1.14141483861181, 1.15061751442361, 1.16057298275972,
1.17090689060417, 1.18157552140208, 1.19986553628542, 1.21308408352153,
1.2266191703875, 1.23583940773611, 1.2494657257733, 1.25980365776111,
1.27269001772083, 1.28644381114028, 1.30061703170486, 1.31415782964236,
1.32427688976998, 0.830779163004933, 0.838186262363765, 0.859128417646401,
0.862724449693277, 0.871525131398038, 0.889826098448637, 0.891210156322401,
0.895077847238628, 0.895987598688284, 0.895820013531707, 0.911374309052301,
0.91266488286899, 0.910766739630252, 0.909109504993046, 0.913261098626404,
0.922103696808793, 0.927409952689993, 0.92591168405434, 0.941596485085614,
0.929119833825, 0.9444975486125, 0.948266898932639, 0.955056299104167,
0.963458828334955, 0.964581225203472, 0.972657548749817, 1.01873876981718,
1.03278145046042, 1.04546081641516, 1.05473343752431, 1.06352718637708,
1.0742666486442, 1.07891911047222, 1.08363550907302, 1.08906426304934,
1.09677758193194, 1.1046076705066, 1.10911954408125, 0.631248365554861,
0.641042829451008, 0.648293579827778, 0.655045395079167, 0.663208785114583,
0.666893115380125, 0.674189422488873, 0.681509924184028, 0.693503957159028,
0.702561419576389, 0.713188132266667, 0.724857766157639, 0.735444916902778,
0.745390341159028, 0.760225588979861, 0.771742594456944, 0.784025145670139,
0.79432079518125, 0.803671385588194, 0.637260062459986, 0.645136937039611,
0.651507199442887, 0.658422984122477, 0.671206412972822, 0.682619127953343,
0.690362939048611, 0.695130862961699, 0.699617322367361, 0.702218111697496,
0.712515244731707, 0.721580055017483, 0.727369178154969, 0.732949823962448,
0.744934685162613, 0.749011390347201, 0.757563485596087, 0.765955210908965,
0.77178278640612, 0.825138347105843, 0.835031030218735, 0.845112356687166,
0.851229048458991, 0.860701379933881, 0.870098835439713, 0.876865122848723,
0.890273098000025, 0.900076353713788, 0.907712544321304, 0.919625753665275,
0.927349672915107, 0.935227064419413, 0.941583878951304, 0.950802479878907,
0.960066032157983, 0.969141921675458, 0.977218749149916, 0.986713762000125,
1.00662096223506, 1.01846244020306, 1.03015819298715, 1.03619126491636,
1.04504445788237, 1.05466778026015, 1.06229870901887, 1.08183160804982,
1.0954292369126, 1.10626044728563, 1.11886959265124, 1.12621735838914,
1.13634521874989, 1.14334246002261, 1.15169875944251, 1.16252056967026,
1.17279340524912, 1.18256135017598, 1.19211693704488, 0.643655731976628,
0.651599620234415, 0.660066520387178, 0.666266832001628, 0.676358301985388,
0.685529890619276, 0.691431536678579, 0.698714587950224, 0.70472347051498,
0.709164641356977, 0.720381914679308, 0.728481987441075, 0.734108910088932,
0.739825297879997, 0.749906200315302, 0.757611494645704, 0.7654904381018,
0.771876148123849, 0.781310586955371)), row.names = c(1L, 2L,
3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L, 11L, 12L, 13L, 14L, 15L, 16L,
17L, 18L, 19L, 366L, 367L, 368L, 369L, 370L, 371L, 372L, 373L,
374L, 375L, 376L, 377L, 378L, 379L, 380L, 381L, 382L, 383L, 384L,
731L, 732L, 733L, 734L, 735L, 736L, 737L, 738L, 739L, 740L, 741L,
742L, 743L, 744L, 745L, 746L, 747L, 748L, 749L, 1096L, 1097L,
1098L, 1099L, 1100L, 1101L, 1102L, 1103L, 1104L, 1105L, 1106L,
1107L, 1108L, 1109L, 1110L, 1111L, 1112L, 1113L, 1114L, 1461L,
1462L, 1463L, 1464L, 1465L, 1466L, 1467L, 1468L, 1469L, 1470L,
1471L, 1472L, 1473L, 1474L, 1475L, 1476L, 1477L, 1478L, 1479L,
1826L, 1827L, 1828L, 1829L, 1830L, 1831L, 1832L, 1833L, 1834L,
1835L, 1836L, 1837L, 1838L, 1839L, 1840L, 1841L, 1842L, 1843L,
1844L, 2191L, 2192L, 2193L, 2194L, 2195L, 2196L, 2197L, 2198L,
2199L, 2200L, 2201L, 2202L, 2203L, 2204L, 2205L, 2206L, 2207L,
2208L, 2209L, 2556L, 2557L, 2558L, 2559L, 2560L, 2561L, 2562L,
2563L, 2564L, 2565L, 2566L, 2567L, 2568L, 2569L, 2570L, 2571L,
2572L, 2573L, 2574L, 2921L, 2922L, 2923L, 2924L, 2925L, 2926L,
2927L, 2928L, 2929L, 2930L, 2931L, 2932L, 2933L, 2934L, 2935L,
2936L, 2937L, 2938L, 2939L, 3286L, 3287L, 3288L, 3289L, 3290L,
3291L, 3292L, 3293L, 3294L, 3295L, 3296L, 3297L, 3298L, 3299L,
3300L, 3301L, 3302L, 3303L, 3304L), class = "data.frame")






r ggplot2 reshape2






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 19 at 20:03









Lmm

639




639








  • 2




    In your example ggplot code there isn't any variable that's mapped to the size aesthetic. If you add size=variable inside aes(), does that resolve your issue?
    – eipi10
    Nov 19 at 20:07












  • Well - that was easy! Thank you for picking up on that, totally missed it! Answered!
    – Lmm
    Nov 19 at 20:10






  • 1




    Also, you can shorten your code with, for example, rep(c("solid", "dotted"), c(8,2)) and c(2012:2018, "Avg", "StdH", "StdL").
    – eipi10
    Nov 19 at 20:11










  • Ohhh thanks - I am always looking for ways to become more efficient so useful tip! Cheers.
    – Lmm
    Nov 19 at 20:12






  • 1




    Since you use the second vector three times, you could also assign that to an object and just use the object name in the scale_***_manual calls. For example, x=c(2012:2018, "Avg", "StdH", "StdL") then labels=x.
    – eipi10
    Nov 19 at 20:15














  • 2




    In your example ggplot code there isn't any variable that's mapped to the size aesthetic. If you add size=variable inside aes(), does that resolve your issue?
    – eipi10
    Nov 19 at 20:07












  • Well - that was easy! Thank you for picking up on that, totally missed it! Answered!
    – Lmm
    Nov 19 at 20:10






  • 1




    Also, you can shorten your code with, for example, rep(c("solid", "dotted"), c(8,2)) and c(2012:2018, "Avg", "StdH", "StdL").
    – eipi10
    Nov 19 at 20:11










  • Ohhh thanks - I am always looking for ways to become more efficient so useful tip! Cheers.
    – Lmm
    Nov 19 at 20:12






  • 1




    Since you use the second vector three times, you could also assign that to an object and just use the object name in the scale_***_manual calls. For example, x=c(2012:2018, "Avg", "StdH", "StdL") then labels=x.
    – eipi10
    Nov 19 at 20:15








2




2




In your example ggplot code there isn't any variable that's mapped to the size aesthetic. If you add size=variable inside aes(), does that resolve your issue?
– eipi10
Nov 19 at 20:07






In your example ggplot code there isn't any variable that's mapped to the size aesthetic. If you add size=variable inside aes(), does that resolve your issue?
– eipi10
Nov 19 at 20:07














Well - that was easy! Thank you for picking up on that, totally missed it! Answered!
– Lmm
Nov 19 at 20:10




Well - that was easy! Thank you for picking up on that, totally missed it! Answered!
– Lmm
Nov 19 at 20:10




1




1




Also, you can shorten your code with, for example, rep(c("solid", "dotted"), c(8,2)) and c(2012:2018, "Avg", "StdH", "StdL").
– eipi10
Nov 19 at 20:11




Also, you can shorten your code with, for example, rep(c("solid", "dotted"), c(8,2)) and c(2012:2018, "Avg", "StdH", "StdL").
– eipi10
Nov 19 at 20:11












Ohhh thanks - I am always looking for ways to become more efficient so useful tip! Cheers.
– Lmm
Nov 19 at 20:12




Ohhh thanks - I am always looking for ways to become more efficient so useful tip! Cheers.
– Lmm
Nov 19 at 20:12




1




1




Since you use the second vector three times, you could also assign that to an object and just use the object name in the scale_***_manual calls. For example, x=c(2012:2018, "Avg", "StdH", "StdL") then labels=x.
– eipi10
Nov 19 at 20:15




Since you use the second vector three times, you could also assign that to an object and just use the object name in the scale_***_manual calls. For example, x=c(2012:2018, "Avg", "StdH", "StdL") then labels=x.
– eipi10
Nov 19 at 20:15

















active

oldest

votes











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53381838%2fscale-size-manual-line-specifying-alternate-line-sizes%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown






























active

oldest

votes













active

oldest

votes









active

oldest

votes






active

oldest

votes
















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.





Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


Please pay close attention to the following guidance:


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53381838%2fscale-size-manual-line-specifying-alternate-line-sizes%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Tonle Sap (See)

I get strange results when I access the Sqlitedatabase with Unity C# via XAMPP

Guatemaltekische Davis-Cup-Mannschaft