Ggplotly legend with colour AND shape

Hi all,

Has there been a solution to mapping both colour and shape to the legend in ggplotly? I have made up the following data set: df=structure(list(x = c(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13,
14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29,
30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45,
46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61,
62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77,
78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93,
94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107,
108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120,
121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133,
134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146,
147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159,
160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172,
173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185,
186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198,
199, 200, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47,
48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63,
64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79,
80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95,
96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108,
109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121,
122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134,
135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147,
148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160,
161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173,
174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186,
187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199,
200, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17,
18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33,
34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49,
50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65,
66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81,
82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97,
98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110,
111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123,
124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136,
137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149,
150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162,
163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175,
176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188,
189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 1,
2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19,
20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35,
36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51,
52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67,
68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83,
84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99,
100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112,
113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125,
126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138,
139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151,
152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164,
165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177,
178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190,
191, 192, 193, 194, 195, 196, 197, 198, 199, 200), variable = structure(c(1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L,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 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L,
4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L,
4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L,
4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L,
4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L,
4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L,
4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L,
4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L,
4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L), class = “factor”, .Label = c(“y1”,
“y2”, “y3”, “y4”)), value = c(153.14, 156.28, 159.42, 162.56,
165.7, 168.84, 171.98, 175.12, 178.26, 181.4, 184.54, 187.68,
190.82, 193.96, 197.1, 200.24, 203.38, 206.52, 209.66, 212.8,
215.94, 219.08, 222.22, 225.36, 228.5, 231.64, 234.78, 237.92,
241.06, 244.2, 247.34, 250.48, 253.62, 256.76, 259.9, 263.04,
266.18, 269.32, 272.46, 275.6, 278.74, 281.88, 285.02, 288.16,
291.3, 294.44, 297.58, 300.72, 303.86, 307, 310.14, 313.28, 316.42,
319.56, 322.7, 325.84, 328.98, 332.12, 335.26, 338.4, 341.54,
344.68, 347.82, 350.96, 354.1, 357.24, 360.38, 363.52, 366.66,
369.8, 372.94, 376.08, 379.22, 382.36, 385.5, 388.64, 391.78,
394.92, 398.06, 401.2, 404.34, 407.48, 410.62, 413.76, 416.9,
420.04, 423.18, 426.32, 429.46, 432.6, 435.74, 438.88, 442.02,
445.16, 448.3, 451.44, 454.58, 457.72, 460.86, 464, 467.14, 470.28,
473.42, 476.56, 479.7, 482.84, 485.98, 489.12, 492.26, 495.4,
498.54, 501.68, 504.82, 507.96, 511.1, 514.24, 517.38, 520.52,
523.66, 526.8, 529.94, 533.08, 536.22, 539.36, 542.5, 545.64,
548.78, 551.92, 555.06, 558.2, 561.34, 564.48, 567.62, 570.76,
573.9, 577.04, 580.18, 583.32, 586.46, 589.6, 592.74, 595.88,
599.02, 602.16, 605.3, 608.44, 611.58, 614.72, 617.86, 621, 624.14,
627.28, 630.42, 633.56, 636.7, 639.84, 642.98, 646.12, 649.26,
652.4, 655.54, 658.68, 661.82, 664.96, 668.1, 671.24, 674.38,
677.52, 680.66, 683.8, 686.94, 690.08, 693.22, 696.36, 699.5,
702.64, 705.78, 708.92, 712.06, 715.2, 718.34, 721.48, 724.62,
727.76, 730.9, 734.04, 737.18, 740.32, 743.46, 746.6, 749.74,
752.88, 756.02, 759.16, 762.3, 765.44, 768.58, 771.72, 774.86,
778, 222.18, 224.36, 226.54, 228.72, 230.9, 233.08, 235.26, 237.44,
239.62, 241.8, 243.98, 246.16, 248.34, 250.52, 252.7, 254.88,
257.06, 259.24, 261.42, 263.6, 265.78, 267.96, 270.14, 272.32,
274.5, 276.68, 278.86, 281.04, 283.22, 285.4, 287.58, 289.76,
291.94, 294.12, 296.3, 298.48, 300.66, 302.84, 305.02, 307.2,
309.38, 311.56, 313.74, 315.92, 318.1, 320.28, 322.46, 324.64,
326.82, 329, 331.18, 333.36, 335.54, 337.72, 339.9, 342.08, 344.26,
346.44, 348.62, 350.8, 352.98, 355.16, 357.34, 359.52, 361.7,
363.88, 366.06, 368.24, 370.42, 372.6, 374.78, 376.96, 379.14,
381.32, 383.5, 385.68, 387.86, 390.04, 392.22, 394.4, 396.58,
398.76, 400.94, 403.12, 405.3, 407.48, 409.66, 411.84, 414.02,
416.2, 418.38, 420.56, 422.74, 424.92, 427.1, 429.28, 431.46,
433.64, 435.82, 438, 440.18, 442.36, 444.54, 446.72, 448.9, 451.08,
453.26, 455.44, 457.62, 459.8, 461.98, 464.16, 466.34, 468.52,
470.7, 472.88, 475.06, 477.24, 479.42, 481.6, 483.78, 485.96,
488.14, 490.32, 492.5, 494.68, 496.86, 499.04, 501.22, 503.4,
505.58, 507.76, 509.94, 512.12, 514.3, 516.48, 518.66, 520.84,
523.02, 525.2, 527.38, 529.56, 531.74, 533.92, 536.1, 538.28,
540.46, 542.64, 544.82, 547, 549.18, 551.36, 553.54, 555.72,
557.9, 560.08, 562.26, 564.44, 566.62, 568.8, 570.98, 573.16,
575.34, 577.52, 579.7, 581.88, 584.06, 586.24, 588.42, 590.6,
592.78, 594.96, 597.14, 599.32, 601.5, 603.68, 605.86, 608.04,
610.22, 612.4, 614.58, 616.76, 618.94, 621.12, 623.3, 625.48,
627.66, 629.84, 632.02, 634.2, 636.38, 638.56, 640.74, 642.92,
645.1, 647.28, 649.46, 651.64, 653.82, 656, 173.15, 176.3, 179.45,
182.6, 185.75, 188.9, 192.05, 195.2, 198.35, 201.5, 204.65, 207.8,
210.95, 214.1, 217.25, 220.4, 223.55, 226.7, 229.85, 233, 236.15,
239.3, 242.45, 245.6, 248.75, 251.9, 255.05, 258.2, 261.35, 264.5,
267.65, 270.8, 273.95, 277.1, 280.25, 283.4, 286.55, 289.7, 292.85,
296, 299.15, 302.3, 305.45, 308.6, 311.75, 314.9, 318.05, 321.2,
324.35, 327.5, 330.65, 333.8, 336.95, 340.1, 343.25, 346.4, 349.55,
352.7, 355.85, 359, 362.15, 365.3, 368.45, 371.6, 374.75, 377.9,
381.05, 384.2, 387.35, 390.5, 393.65, 396.8, 399.95, 403.1, 406.25,
409.4, 412.55, 415.7, 418.85, 422, 425.15, 428.3, 431.45, 434.6,
437.75, 440.9, 444.05, 447.2, 450.35, 453.5, 456.65, 459.8, 462.95,
466.1, 469.25, 472.4, 475.55, 478.7, 481.85, 485, 488.15, 491.3,
494.45, 497.6, 500.75, 503.9, 507.05, 510.2, 513.35, 516.5, 519.65,
522.8, 525.95, 529.1, 532.25, 535.4, 538.55, 541.7, 544.85, 548,
551.15, 554.3, 557.45, 560.6, 563.75, 566.9, 570.05, 573.2, 576.35,
579.5, 582.65, 585.8, 588.95, 592.1, 595.25, 598.4, 601.55, 604.7,
607.85, 611, 614.15, 617.3, 620.45, 623.6, 626.75, 629.9, 633.05,
636.2, 639.35, 642.5, 645.65, 648.8, 651.95, 655.1, 658.25, 661.4,
664.55, 667.7, 670.85, 674, 677.15, 680.3, 683.45, 686.6, 689.75,
692.9, 696.05, 699.2, 702.35, 705.5, 708.65, 711.8, 714.95, 718.1,
721.25, 724.4, 727.55, 730.7, 733.85, 737, 740.15, 743.3, 746.45,
749.6, 752.75, 755.9, 759.05, 762.2, 765.35, 768.5, 771.65, 774.8,
777.95, 781.1, 784.25, 787.4, 790.55, 793.7, 796.85, 800, 220.01,
222.02, 224.03, 226.04, 228.05, 230.06, 232.07, 234.08, 236.09,
238.1, 240.11, 242.12, 244.13, 246.14, 248.15, 250.16, 252.17,
254.18, 256.19, 258.2, 260.21, 262.22, 264.23, 266.24, 268.25,
270.26, 272.27, 274.28, 276.29, 278.3, 280.31, 282.32, 284.33,
286.34, 288.35, 290.36, 292.37, 294.38, 296.39, 298.4, 300.41,
302.42, 304.43, 306.44, 308.45, 310.46, 312.47, 314.48, 316.49,
318.5, 320.51, 322.52, 324.53, 326.54, 328.55, 330.56, 332.57,
334.58, 336.59, 338.6, 340.61, 342.62, 344.63, 346.64, 348.65,
350.66, 352.67, 354.68, 356.69, 358.7, 360.71, 362.72, 364.73,
366.74, 368.75, 370.76, 372.77, 374.78, 376.79, 378.8, 380.81,
382.82, 384.83, 386.84, 388.85, 390.86, 392.87, 394.88, 396.89,
398.9, 400.91, 402.92, 404.93, 406.94, 408.95, 410.96, 412.97,
414.98, 416.99, 419, 421.01, 423.02, 425.03, 427.04, 429.05,
431.06, 433.07, 435.08, 437.09, 439.1, 441.11, 443.12, 445.13,
447.14, 449.15, 451.16, 453.17, 455.18, 457.19, 459.2, 461.21,
463.22, 465.23, 467.24, 469.25, 471.26, 473.27, 475.28, 477.29,
479.3, 481.31, 483.32, 485.33, 487.34, 489.35, 491.36, 493.37,
495.38, 497.39, 499.4, 501.41, 503.42, 505.43, 507.44, 509.45,
511.46, 513.47, 515.48, 517.49, 519.5, 521.51, 523.52, 525.53,
527.54, 529.55, 531.56, 533.57, 535.58, 537.59, 539.6, 541.61,
543.62, 545.63, 547.64, 549.65, 551.66, 553.67, 555.68, 557.69,
559.7, 561.71, 563.72, 565.73, 567.74, 569.75, 571.76, 573.77,
575.78, 577.79, 579.8, 581.81, 583.82, 585.83, 587.84, 589.85,
591.86, 593.87, 595.88, 597.89, 599.9, 601.91, 603.92, 605.93,
607.94, 609.95, 611.96, 613.97, 615.98, 617.99, 620), Cat = structure(c(1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1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L, 2L, 2L, 2L, 2L, 2L,
2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L,
2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L,
2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L,
2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L,
2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L,
2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L,
2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L,
2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L,
2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L), .Label = c(“0”,
“1”), class = “factor”)), .Names = c(“x”, “variable”, “value”,
“Cat”), row.names = c(NA, -800L), class = c(“tbl_dt”, “tbl”,
“data.table”, “data.frame”), .internal.selfref = <pointer: 0x101827d78>)

my ggplot output looks like this:
ggplot(data = df2,aes(x,value,col=variable,shape=Cat))+geom_line()+geom_point()

whereas the ggplotly output looks like this:
ggplotly(ggplot(data = df2,aes(x,value,col=variable,shape=Cat))+geom_line()+geom_point())

Obviously the shape panel in the legend is lost and is now merged with the colour legend. Now, in the case of 4 colours and 2 shapes, this isn’t entirely a bad solution but in a real world data set I’ve got 7 colours and 3 shapes = 21 different curves, where I would like to interact with the colours and shapes separately.

Any ideas on how to get closer to the ggplot version would be greatly appreciated.

Thanks,
Miha