How To Install Plotly In R
Plotly for R
Plotly is an R package for creating interactive web-based graphs via plotly's JavaScript graphing library, plotly.js
.
The plotly R package serializes ggplot2 figures into Plotly's universal graph JSON. plotly::ggplotly
will crawl the ggplot2 figure, extract and translate all of the attributes of the ggplot2 figure into JSON (the colors, the axes, the chart type, etc), and draw the graph with plotly.js.
Furthermore, you have the option of manipulating the Plotly object with the style
function.
Installation
Plotly is now on CRAN!
install.packages ( "plotly" )
Or install the latest development version (on GitHub) via devtools:
devtools :: install_github ( "ropensci/plotly" )
RStudio users should download the latest RStudio release for compatibility with htmlwidgets.
Initialization
By default, Plotly for R runs locally in your web browser or in the R Studio viewer.
library ( plotly ) set.seed ( 100 ) d <- diamonds [ sample ( nrow ( diamonds ), 1000 ), ] p <- ggplot ( data = d , aes ( x = carat , y = price )) + geom_point ( aes ( text = paste ( "Clarity:" , clarity )), size = 4 ) + geom_smooth ( aes ( colour = cut , fill = cut )) + facet_wrap ( ~ cut ) ggplotly ( p )
Simply printing the Plotly object will render the chart locally in your web browser or in the R Studio viewer.
Plotly graphs are interactive. Click on legend entries to toggle traces, click-and-drag on the chart to zoom, double-click to autoscale, shift-and-drag to pan.
Cutomizing the Layout
Since the ggplotly()
function returns a plotly object, we can manipulate that object in the same way that we would manipulate any other plotly object. A simple and useful application of this is to specify interaction modes, like plotly.js' layout.dragmode
for specifying the mode of click+drag events.
## Loading required package: ggplot2
## ## Attaching package: 'plotly'
## The following object is masked from 'package:ggplot2': ## ## last_plot
## The following object is masked from 'package:stats': ## ## filter
## The following object is masked from 'package:graphics': ## ## layout
p <- ggplot ( fortify ( forecast :: gold ), aes ( x , y )) + geom_line ()
## Registered S3 method overwritten by 'quantmod': ## method from ## as.zoo.data.frame zoo
p <- ggplotly ( p ) p <- p %>% layout ( dragmode = "pan" ) p
Modifying Layers
As mentioned previously, ggplotly()
translates each ggplot2 layer into one or more plotly.js traces. In this translation, it is forced to make a number of assumptions about trace attribute values that may or may not be appropriate for the use case. The style()
function is useful in this scenario, as it provides a way to modify trace attribute values in a plotly object. Furthermore, you can use the plotly_build()
function.
Interactively View the JSON Object
Before using the style()
or plotly_build
functions, you may want to inspect the actual traces in a given plotly object using the plotly_json() function
library ( plotly ) p <- ggplot ( fortify ( forecast :: gold ), aes ( x , y )) + geom_line () plotly_json ( p )
## { ## "data": [ ## { ## "x": [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, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, 370, 371, 372, 373, 374, 375, 376, 377, 378, 379, 380, 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411, 412, 413, 414, 415, 416, 417, 418, 419, 420, 421, 422, 423, 424, 425, 426, 427, 428, 429, 430, 431, 432, 433, 434, 435, 436, 437, 438, 439, 440, 441, 442, 443, 444, 445, 446, 447, 448, 449, 450, 451, 452, 453, 454, 455, 456, 457, 458, 459, 460, 461, 462, 463, 464, 465, 466, 467, 468, 469, 470, 471, 472, 473, 474, 475, 476, 477, 478, 479, 480, 481, 482, 483, 484, 485, 486, 487, 488, 489, 490, 491, 492, 493, 494, 495, 496, 497, 498, 499, 500, 501, 502, 503, 504, 505, 506, 507, 508, 509, 510, 511, 512, 513, 514, 515, 516, 517, 518, 519, 520, 521, 522, 523, 524, 525, 526, 527, 528, 529, 530, 531, 532, 533, 534, 535, 536, 537, 538, 539, 540, 541, 542, 543, 544, 545, 546, 547, 548, 549, 550, 551, 552, 553, 554, 555, 556, 557, 558, 559, 560, 561, 562, 563, 564, 565, 566, 567, 568, 569, 570, 571, 572, 573, 574, 575, 576, 577, 578, 579, 580, 581, 582, 583, 584, 585, 586, 587, 588, 589, 590, 591, 592, 593, 594, 595, 596, 597, 598, 599, 600, 601, 602, 603, 604, 605, 606, 607, 608, 609, 610, 611, 612, 613, 614, 615, 616, 617, 618, 619, 620, 621, 622, 623, 624, 625, 626, 627, 628, 629, 630, 631, 632, 633, 634, 635, 636, 637, 638, 639, 640, 641, 642, 643, 644, 645, 646, 647, 648, 649, 650, 651, 652, 653, 654, 655, 656, 657, 658, 659, 660, 661, 662, 663, 664, 665, 666, 667, 668, 669, 670, 671, 672, 673, 674, 675, 676, 677, 678, 679, 680, 681, 682, 683, 684, 685, 686, 687, 688, 689, 690, 691, 692, 693, 694, 695, 696, 697, 698, 699, 700, 701, 702, 703, 704, 705, 706, 707, 708, 709, 710, 711, 712, 713, 714, 715, 716, 717, 718, 719, 720, 721, 722, 723, 724, 725, 726, 727, 728, 729, 730, 731, 732, 733, 734, 735, 736, 737, 738, 739, 740, 741, 742, 743, 744, 745, 746, 747, 748, 749, 750, 751, 752, 753, 754, 755, 756, 757, 758, 759, 760, 761, 762, 763, 764, 765, 766, 767, 768, 769, 770, 771, 772, 773, 774, 775, 776, 777, 778, 779, 780, 781, 782, 783, 784, 785, 786, 787, 788, 789, 790, 791, 792, 793, 794, 795, 796, 797, 798, 799, 800, 801, 802, 803, 804, 805, 806, 807, 808, 809, 810, 811, 812, 813, 814, 815, 816, 817, 818, 819, 820, 821, 822, 823, 824, 825, 826, 827, 828, 829, 830, 831, 832, 833, 834, 835, 836, 837, 838, 839, 840, 841, 842, 843, 844, 845, 846, 847, 848, 849, 850, 851, 852, 853, 854, 855, 856, 857, 858, 859, 860, 861, 862, 863, 864, 865, 866, 867, 868, 869, 870, 871, 872, 873, 874, 875, 876, 877, 878, 879, 880, 881, 882, 883, 884, 885, 886, 887, 888, 889, 890, 891, 892, 893, 894, 895, 896, 897, 898, 899, 900, 901, 902, 903, 904, 905, 906, 907, 908, 909, 910, 911, 912, 913, 914, 915, 916, 917, 918, 919, 920, 921, 922, 923, 924, 925, 926, 927, 928, 929, 930, 931, 932, 933, 934, 935, 936, 937, 938, 939, 940, 941, 942, 943, 944, 945, 946, 947, 948, 949, 950, 951, 952, 953, 954, 955, 956, 957, 958, 959, 960, 961, 962, 963, 964, 965, 966, 967, 968, 969, 970, 971, 972, 973, 974, 975, 976, 977, 978, 979, 980, 981, 982, 983, 984, 985, 986, 987, 988, 989, 990, 991, 992, 993, 994, 995, 996, 997, 998, 999, 1000, 1001, 1002, 1003, 1004, 1005, 1006, 1007, 1008, 1009, 1010, 1011, 1012, 1013, 1014, 1015, 1016, 1017, 1018, 1019, 1020, 1021, 1022, 1023, 1024, 1025, 1026, 1027, 1028, 1029, 1030, 1031, 1032, 1033, 1034, 1035, 1036, 1037, 1038, 1039, 1040, 1041, 1042, 1043, 1044, 1045, 1046, 1047, 1048, 1049, 1050, 1051, 1052, 1053, 1054, 1055, 1056, 1057, 1058, 1059, 1060, 1061, 1062, 1063, 1064, 1065, 1066, 1067, 1068, 1069, 1070, 1071, 1072, 1073, 1074, 1075, 1076, 1077, 1078, 1079, 1080, 1081, 1082, 1083, 1084, 1085, 1086, 1087, 1088, 1089, 1090, 1091, 1092, 1093, 1094, 1095, 1096, 1097, 1098, 1099, 1100, 1101, 1102, 1103, 1104, 1105, 1106, 1107, 1108], ## "y": [306.25, 299.5, 303.45, 296.75, 304.4, 298.35, 304, 304, 301.25, 302.5, 302.45, 305.8, 306.9, 307, 306.85, 302.15, 301.9, 299.25, 298.6, 303.5, 303, 304.9, 304.8, 301.25, 301.75, 303.45, 302.5, 300.6, 300, 303.45, 302.8, 303.4, 304.9, 304.95, 302.9, 302.85, 302, 298.8, 290, 285, 290.75, 290.5, 288.1, 288.3, 288.85, 286.7, 289.3, 289, 290.25, 288.75, 290.1, 290.25, 289.9, 293.7, 307.25, 333.25, 312.5, 320.75, 315.9, 316, 329.9, 328.75, 329.8, 324.65, 317, 321.1, 317, null, null, 323.1, 323.3, 329, 331.25, 330.3, 331.5, 327, 325.5, 327.7, 328.1, 326, 322.6, 322.4, 322.5, 323, 324.65, 315.6, 314.25, 313.7, null, 311.25, 313.35, 314.5, 313.55, 316.75, 324.75, 322.85, 320.4, 319.8, 323.65, 316.5, 317.4, 316.4, 316.35, null, 313.9, 311.2, 315, 313.15, 316.85, 316.25, 314.75, 314.9, 315, 310.75, 313.25, 313.75, 314.1, 315.75, 317.25, 321.65, 325.2, 322, 315.25, 314.1, 315.9, 316.5, 316.25, 316.5, 313.35, 310.85, 310.4, 310.7, 310.9, 312.2, 314.8, 314.7, 313.8, 315.05, 317.15, 316.8, 321.7, 322.25, 319, 317.4, 322.75, 318.5, 319.4, 317.6, 323, 323.25, 328.1, 326.75, 319.65, 323, 321.4, 320.65, 322.9, 322.4, 326.6, 328.5, 326.2, 328.9, 335.4, 339.25, 335.5, 335.75, 337.6, 333.6, null, 335.25, 339.3, 338.4, 335.75, 335.45, 332.7, 325, 326, 318.75, 320.2, 320, 322, 318, 321.75, 318.85, 318.7, 315.5, 315.9, 319.2, 328.1, 328.4, 328.7, 330.4, 328.95, 326.5, 323.15, 324.75, 324.35, 330.55, 326.25, 326.1, 326.95, 325.55, 325.8, 326.6, 326.85, 325.9, 324.6, 326.25, 326.5, 325.9, 326.9, 325.95, 325.65, 326.5, 326.55, 326.8, 325.75, 324.65, 325.6, 324.55, 324.75, 323.6, 322.1, 323.25, 322.7, 324.5, 325, 324.55, 323.75, 324.1, 325.05, 325.75, 326, 330.5, 331.5, 330.45, 326.75, 327.4, 323.95, 322.5, 324.5, 322.5, 322.5, 320.15, 316.1, 316.8, 316.05, 317.9, 318.25, 321.9, 321.1, 323.4, 323.55, 325.75, 324.85, null, null, 324.8, 326.15, 327, null, 327.1, 326, 327.8, 328.9, 330.9, 333.9, 339.45, 340.75, 338.8, 345.3, 359.6, 357.25, 353.25, 356.5, 352.75, 349.5, 355.25, 361.75, 353.8, 354.4, 355.4, 354, 347.35, 338.5, 335.95, 337.1, 337.9, 340.5, 337.2, 338.35, 335.4, 329.5, 333, 332.4, 343.7, 339.25, 339, 343.35, 351.4, 345.1, 337.85, 338.25, 339.45, 337.9, 342.2, 343, 342, 341.8, 341.65, 344.5, 349.8, 347.6, 348.2, 350.8, 349.25, 350.6, 351.35, 352.4, 352.9, 344.9, 345.5, null, null, 333.7, 335.5, 336.6, 335.6, 336.5, 340.65, 338.65, 338.15, 340.25, 343.2, 340.25, 340.75, 339.3, 341, 342.45, 344.15, 347.25, 346, 344.3, 344.4, 342.35, 344.75, 345.6, 341.6, null, 341.55, 342.15, 344.6, 344.25, 344.9, 343.8, 342.75, 342.5, 342.75, 342.05, 340.3, 338.6, 339.4, 340.85, null, 341.15, 341.6, 342.75, 343.35, 343, 341.85, 341.4, 341.5, 341.5, 341.85, 347.55, 347.5, 347.95, 347.4, 346.5, 337.3, 338.5, 338.7, 338.9, 340.5, 340.75, 343.25, 343.8, 343.55, 345.5, 345.65, 344, 343.5, 343.8, 344.45, 346.5, 350.35, 347.5, 347.65, 346.2, 345.85, 348.35, 346.9, 347.1, 353, 353.5, 351.75, 348.5, 349, 350.8, 353.3, 351.35, 375.75, 360.5, 358.75, 358.5, 360.85, 360.85, 361.85, 394.5, 386.1, 391.25, 384, 386.4, 377.25, 372.5, 379, 381.75, 384.65, null, 397.3, 377.8, 384, 386, 392, 395.5, 407.2, 404, 418.25, 419, 412.5, 414.5, 407, 418.75, 416, 413.55, 413.6, 415.7, 423, 442.75, 435.15, 434, 432.25, 434, 429.45, 421.2, 425.5, 425.5, 436.9, 436.5, 442, 439.4, 435.8, 428.15, 431.4, 431.25, 426.25, 426, 420, 420, 426.8, 426.6, 425.4, 413, 409.6, 409.55, 407.75, 404, 401.5, 400.3, 408.5, 410.25, 405, 408.3, 409.9, 407.4, 407.45, 406.85, 409, 393.25, 388, 391.5, 387, 389.5, 380.4, 380.75, 384, 382.3, 390, 399.6, 394.3, 385.25, 391.2, 388.6, 390.5, 389.2, 387.25, 388.75, 389.7, 394.6, 393.7, 393.4, 392.5, 394.15, 395.35, 392.75, 391, null, null, 391.4, 389.4, 390.9, null, 402.4, 399, 401.7, 399.5, 401.6, 402.25, 409.9, 408.6, 414.4, 415, 414.5, 421.25, 417.4, 408.5, 410.6, 403.55, 403.35, 408.7, 416.5, 411, 407.3, 406.45, 402, 401.75, 402.6, 402.7, 402.95, 404.4, 402.9, 402, 395.55, 397.2, 396.85, 392.25, 392.6, 397.5, 403, 401.95, 406.7, 403.1, 408.7, 404.4, 403.7, 407.65, 411.45, 406.5, 404.85, 405, 406.85, 408, 409.25, 404.65, 406, 406.4, 405.05, 405, 406.6, 410.3, 415, 411.3, 415.9, 421.8, 419, 418.5, 420.25, 418.65, 420.55, 419.8, 423.2, 421.5, 423.3, 436.5, 440.25, 445.5, 441, null, null, 454.3, 446.8, 453, 462.6, 476.6, 455.75, 451.75, 454.5, 452.15, null, 464.5, 456.75, 457.4, 456.7, 454.75, 460.25, 459.5, 460, 466.7, 476.5, 471.35, 479.95, 468.6, 473.6, null, 459.65, 447.9, 453.35, 451.75, 443.4, 449.3, 453.35, 450.25, 454.7, 454.4, 452.05, 456.65, 456.4, 460.8, 450.35, 452.75, 448.25, 451.1, 452.25, 443.6, 438.1, 443, 439, 441.4, 446, 447.1, 449.5, 447.4, 443, 443.1, 444.8, 442.15, 445.3, 444.25, 443.7, 447.15, 448.25, 452.9, 452.5, 449.65, 452.5, 454.45, 454.75, 454, 453.1, 454.2, 459.5, 457.2, 464.2, 473.25, 476, 469.85, 468.85, 464, 459.5, 463.2, 461, 462, 457.4, 454.8, 454.9, 457.65, 457.4, 454.1, 455.8, 458.5, 457.4, 458.25, 455.9, null, 453.1, 456.55, 462.15, 464.4, 463.35, 462.75, 458, 461, 460.9, 456.6, 458.35, 458.5, 458.8, 461.35, 458.85, 463.15, 461.05, 463.85, 461, 460.9, 458.9, 459.15, 454.1, 455, 455.15, 456.85, 458.55, 458.25, 461.75, 461.85, 459.65, 459.45, 461.75, 464.25, 479.5, 481.6, 466.65, 469.8, 472.65, 474.85, 473.45, 479.65, 474.05, 468, 469.95, 470.1, 467, 459.7, 458.6, 463.5, 458.75, 461.3, 463, 464.2, 461.75, 463.55, 464.2, 465.8, 466.25, 468.25, 476.95, 478.75, 477.65, 477.8, 493.9, 486.9, 490, 488.95, 485.75, 480.9, 483, 485.3, 484.5, 495, 502.75, 593.7, 487.05, 487.75, 484.55, 481, 481.6, 483.25, 483.75, null, null, 489.55, 486.9, 486.5, null, 484.1, 477.3, 481.6, 483.95, 479.5, 485.3, 482.05, 481.4, 480.9, 484.8, 475.85, 476.75, 477.75, 476.5, 477.85, 471.4, 471.4, 469.4, 468, 465.25, 454.65, 455.15, 447.1, 437.6, 444.15, 443.05, 439.25, 443.8, 440.2, 440.3, 443.6, 444.25, 444.4, 446.25, 443.45, 445.1, 443.95, 438, 433.95, 432.65, 423.75, 429.15, 431.55, 429.15, 430.75, 436, 435.7, 436.1, 437.25, 444.1, 441.9, 442.25, 447.15, 445.35, 442.8, 446.5, 449.4, 450, 453.9, 451.5, 453.1, 454.7, 454, 458, null, null, 456, 450.8, 446.25, 448.6, 450.15, 450.2, 448.5, 447, 453.85, 457.55, 456.55, 458, 454, 453.15, 449.75, 448.25, 449.1, 452.15, 449.75, null, 444.3, 441.95, 445.35, 445.95, 443.6, 447.1, 449.35, 448.65, 451.05, 453.4, 453.15, 452.7, 456.65, 459.5, 460.25, 458.6, 458.6, 453, 452.5, null, 454, 457, 454.6, 464.85, 464.1, 463.4, 458.75, 455, 457.1, 450.5, 450.8, 450.3, 452.65, 449.8, 453.9, 451.7, 449.8, 447.6, 447, 442, 443.85, 434.9, 436.85, 436.5, 437.15, 437.4, 438.1, 439.15, 438.9, 439.65, 434.5, 436.2, 439.05, 438.1, 437.65, 437.25, 445, 443.2, 443.2, 442.2, 430.15, 431.7, 428.75, 432.7, 436.4, 432.9, 431.25, 433.4, 431.45, 431.85, 428.25, 426.95, 429, 428.4, 431.15, 432, 429, 430.2, 432.4, 429.7, 432.7, 432.1, 434.8, 433.75, null, 429.4, 426.35, 430.3, 430.3, 427, 427.65, 427, 428, 428.9, 418, 420.8, 421.9, 421.5, 417.3, 409, 410.4, 401.6, 399.6, 399.3, 389.05, 397, 397.65, 398.6, 396.15, 394.2, 397.35, 397.25, 403, 404.25, 406.25, 408, 404.7, 408.6, 406.5, 411.15, 413.05, 410.8, 411.4, 410.55, 406.3, 406.6, 407.5, 407.15, 407.3, 412.3, 411, 412.5, 422.9, 419.5, 422, 421.85, 419.5, 422.25, 420.75, 420.65, 422.8, 422.6, 423.3, 419.75, 416.6, 416.1, 417.95, 419.85, 422.6, 421.4, 422.1, 421.3, 425.5, 423.8, 430.4, 429, 425.35, 423.3, 422.2, 421, 420.05, 419.6, 421.4, 412.6, 413.65, 413.2, 413.85, 415.6, 417.55, null, null, 413.65, 413.1, 410.15, null, 413.6, 410.5, 408, 408.45, 404.45, 405.5, 403.5, 404.85, 403.5, 401.75, 402.1, 402.85, 402.3, 404.5, 407.75, 407.8, 404.75, 406, 402.25, 394.3, 394.85, 392, 392.7, 390.85, 390.25, 391.45, 390.4, 394.1, 393.8, 386.7, 385.65, 381.7, 384.25, 378.95, 382.15, 382.75, 386, 389, 389.25, 390.75, 386.75, 386.1, 384.1, 384.1, 388.4, 386.3, 393.1, 392.5, 397, 393.1, 394.3, 394.45, 391, 389.25, 395.3, 394.1, 393.4, 396, null, null, 391.25, 383.3, 384, 382.3], ## "text": ["x: 1<br />y: 306.25", "x: 2<br />y: 299.50", "x: 3<br />y: 303.45", "x: 4<br />y: 296.75", "x: 5<br />y: 304.40", "x: 6<br />y: 298.35", "x: 7<br />y: 304.00", "x: 8<br />y: 304.00", "x: 9<br />y: 301.25", "x: 10<br />y: 302.50", "x: 11<br />y: 302.45", "x: 12<br />y: 305.80", "x: 13<br />y: 306.90", "x: 14<br />y: 307.00", "x: 15<br />y: 306.85", "x: 16<br />y: 302.15", "x: 17<br />y: 301.90", "x: 18<br />y: 299.25", "x: 19<br />y: 298.60", "x: 20<br />y: 303.50", "x: 21<br />y: 303.00", "x: 22<br />y: 304.90", "x: 23<br />y: 304.80", "x: 24<br />y: 301.25", "x: 25<br />y: 301.75", "x: 26<br />y: 303.45", "x: 27<br />y: 302.50", "x: 28<br />y: 300.60", "x: 29<br />y: 300.00", "x: 30<br />y: 303.45", "x: 31<br />y: 302.80", "x: 32<br />y: 303.40", "x: 33<br />y: 304.90", "x: 34<br />y: 304.95", "x: 35<br />y: 302.90", "x: 36<br />y: 302.85", "x: 37<br />y: 302.00", "x: 38<br />y: 298.80", "x: 39<br />y: 290.00", "x: 40<br />y: 285.00", "x: 41<br />y: 290.75", "x: 42<br />y: 290.50", "x: 43<br />y: 288.10", "x: 44<br />y: 288.30", "x: 45<br />y: 288.85", "x: 46<br />y: 286.70", "x: 47<br />y: 289.30", "x: 48<br />y: 289.00", "x: 49<br />y: 290.25", "x: 50<br />y: 288.75", "x: 51<br />y: 290.10", "x: 52<br />y: 290.25", "x: 53<br />y: 289.90", "x: 54<br />y: 293.70", "x: 55<br />y: 307.25", "x: 56<br />y: 333.25", "x: 57<br />y: 312.50", "x: 58<br />y: 320.75", "x: 59<br />y: 315.90", "x: 60<br />y: 316.00", "x: 61<br />y: 329.90", "x: 62<br />y: 328.75", "x: 63<br />y: 329.80", "x: 64<br />y: 324.65", "x: 65<br />y: 317.00", "x: 66<br />y: 321.10", "x: 67<br />y: 317.00", "x: 68<br />y: NA", "x: 69<br />y: NA", "x: 70<br />y: 323.10", "x: 71<br />y: 323.30", "x: 72<br />y: 329.00", "x: 73<br />y: 331.25", "x: 74<br />y: 330.30", "x: 75<br />y: 331.50", "x: 76<br />y: 327.00", "x: 77<br />y: 325.50", "x: 78<br />y: 327.70", "x: 79<br />y: 328.10", "x: 80<br />y: 326.00", "x: 81<br />y: 322.60", "x: 82<br />y: 322.40", "x: 83<br />y: 322.50", "x: 84<br />y: 323.00", "x: 85<br />y: 324.65", "x: 86<br />y: 315.60", "x: 87<br />y: 314.25", "x: 88<br />y: 313.70", "x: 89<br />y: NA", "x: 90<br />y: 311.25", "x: 91<br />y: 313.35", "x: 92<br />y: 314.50", "x: 93<br />y: 313.55", "x: 94<br />y: 316.75", "x: 95<br />y: 324.75", "x: 96<br />y: 322.85", "x: 97<br />y: 320.40", "x: 98<br />y: 319.80", "x: 99<br />y: 323.65", "x: 100<br />y: 316.50", "x: 101<br />y: 317.40", "x: 102<br />y: 316.40", "x: 103<br />y: 316.35", "x: 104<br />y: NA", "x: 105<br />y: 313.90", "x: 106<br />y: 311.20", "x: 107<br />y: 315.00", "x: 108<br />y: 313.15", "x: 109<br />y: 316.85", "x: 110<br />y: 316.25", "x: 111<br />y: 314.75", "x: 112<br />y: 314.90", "x: 113<br />y: 315.00", "x: 114<br />y: 310.75", "x: 115<br />y: 313.25", "x: 116<br />y: 313.75", "x: 117<br />y: 314.10", "x: 118<br />y: 315.75", "x: 119<br />y: 317.25", "x: 120<br />y: 321.65", "x: 121<br />y: 325.20", "x: 122<br />y: 322.00", "x: 123<br />y: 315.25", "x: 124<br />y: 314.10", "x: 125<br />y: 315.90", "x: 126<br />y: 316.50", "x: 127<br />y: 316.25", "x: 128<br />y: 316.50", "x: 129<br />y: 313.35", "x: 130<br />y: 310.85", "x: 131<br />y: 310.40", "x: 132<br />y: 310.70", "x: 133<br />y: 310.90", "x: 134<br />y: 312.20", "x: 135<br />y: 314.80", "x: 136<br />y: 314.70", "x: 137<br />y: 313.80", "x: 138<br />y: 315.05", "x: 139<br />y: 317.15", "x: 140<br />y: 316.80", "x: 141<br />y: 321.70", "x: 142<br />y: 322.25", "x: 143<br />y: 319.00", "x: 144<br />y: 317.40", "x: 145<br />y: 322.75", "x: 146<br />y: 318.50", "x: 147<br />y: 319.40", "x: 148<br />y: 317.60", "x: 149<br />y: 323.00", "x: 150<br />y: 323.25", "x: 151<br />y: 328.10", "x: 152<br />y: 326.75", "x: 153<br />y: 319.65", "x: 154<br />y: 323.00", "x: 155<br />y: 321.40", "x: 156<br />y: 320.65", "x: 157<br />y: 322.90", "x: 158<br />y: 322.40", "x: 159<br />y: 326.60", "x: 160<br />y: 328.50", "x: 161<br />y: 326.20", "x: 162<br />y: 328.90", "x: 163<br />y: 335.40", "x: 164<br />y: 339.25", "x: 165<br />y: 335.50", "x: 166<br />y: 335.75", "x: 167<br />y: 337.60", "x: 168<br />y: 333.60", "x: 169<br />y: NA", "x: 170<br />y: 335.25", "x: 171<br />y: 339.30", "x: 172<br />y: 338.40", "x: 173<br />y: 335.75", "x: 174<br />y: 335.45", "x: 175<br />y: 332.70", "x: 176<br />y: 325.00", "x: 177<br />y: 326.00", "x: 178<br />y: 318.75", "x: 179<br />y: 320.20", "x: 180<br />y: 320.00", "x: 181<br />y: 322.00", "x: 182<br />y: 318.00", "x: 183<br />y: 321.75", "x: 184<br />y: 318.85", "x: 185<br />y: 318.70", "x: 186<br />y: 315.50", "x: 187<br />y: 315.90", "x: 188<br />y: 319.20", "x: 189<br />y: 328.10", "x: 190<br />y: 328.40", "x: 191<br />y: 328.70", "x: 192<br />y: 330.40", "x: 193<br />y: 328.95", "x: 194<br />y: 326.50", "x: 195<br />y: 323.15", "x: 196<br />y: 324.75", "x: 197<br />y: 324.35", "x: 198<br />y: 330.55", "x: 199<br />y: 326.25", "x: 200<br />y: 326.10", "x: 201<br />y: 326.95", "x: 202<br />y: 325.55", "x: 203<br />y: 325.80", "x: 204<br />y: 326.60", "x: 205<br />y: 326.85", "x: 206<br />y: 325.90", "x: 207<br />y: 324.60", "x: 208<br />y: 326.25", "x: 209<br />y: 326.50", "x: 210<br />y: 325.90", "x: 211<br />y: 326.90", "x: 212<br />y: 325.95", "x: 213<br />y: 325.65", "x: 214<br />y: 326.50", "x: 215<br />y: 326.55", "x: 216<br />y: 326.80", "x: 217<br />y: 325.75", "x: 218<br />y: 324.65", "x: 219<br />y: 325.60", "x: 220<br />y: 324.55", "x: 221<br />y: 324.75", "x: 222<br />y: 323.60", "x: 223<br />y: 322.10", "x: 224<br />y: 323.25", "x: 225<br />y: 322.70", "x: 226<br />y: 324.50", "x: 227<br />y: 325.00", "x: 228<br />y: 324.55", "x: 229<br />y: 323.75", "x: 230<br />y: 324.10", "x: 231<br />y: 325.05", "x: 232<br />y: 325.75", "x: 233<br />y: 326.00", "x: 234<br />y: 330.50", "x: 235<br />y: 331.50", "x: 236<br />y: 330.45", "x: 237<br />y: 326.75", "x: 238<br />y: 327.40", "x: 239<br />y: 323.95", "x: 240<br />y: 322.50", "x: 241<br />y: 324.50", "x: 242<br />y: 322.50", "x: 243<br />y: 322.50", "x: 244<br />y: 320.15", "x: 245<br />y: 316.10", "x: 246<br />y: 316.80", "x: 247<br />y: 316.05", "x: 248<br />y: 317.90", "x: 249<br />y: 318.25", "x: 250<br />y: 321.90", "x: 251<br />y: 321.10", "x: 252<br />y: 323.40", "x: 253<br />y: 323.55", "x: 254<br />y: 325.75", "x: 255<br />y: 324.85", "x: 256<br />y: NA", "x: 257<br />y: NA", "x: 258<br />y: 324.80", "x: 259<br />y: 326.15", "x: 260<br />y: 327.00", "x: 261<br />y: NA", "x: 262<br />y: 327.10", "x: 263<br />y: 326.00", "x: 264<br />y: 327.80", "x: 265<br />y: 328.90", "x: 266<br />y: 330.90", "x: 267<br />y: 333.90", "x: 268<br />y: 339.45", "x: 269<br />y: 340.75", "x: 270<br />y: 338.80", "x: 271<br />y: 345.30", "x: 272<br />y: 359.60", "x: 273<br />y: 357.25", "x: 274<br />y: 353.25", "x: 275<br />y: 356.50", "x: 276<br />y: 352.75", "x: 277<br />y: 349.50", "x: 278<br />y: 355.25", "x: 279<br />y: 361.75", "x: 280<br />y: 353.80", "x: 281<br />y: 354.40", "x: 282<br />y: 355.40", "x: 283<br />y: 354.00", "x: 284<br />y: 347.35", "x: 285<br />y: 338.50", "x: 286<br />y: 335.95", "x: 287<br />y: 337.10", "x: 288<br />y: 337.90", "x: 289<br />y: 340.50", "x: 290<br />y: 337.20", "x: 291<br />y: 338.35", "x: 292<br />y: 335.40", "x: 293<br />y: 329.50", "x: 294<br />y: 333.00", "x: 295<br />y: 332.40", "x: 296<br />y: 343.70", "x: 297<br />y: 339.25", "x: 298<br />y: 339.00", "x: 299<br />y: 343.35", "x: 300<br />y: 351.40", "x: 301<br />y: 345.10", "x: 302<br />y: 337.85", "x: 303<br />y: 338.25", "x: 304<br />y: 339.45", "x: 305<br />y: 337.90", "x: 306<br />y: 342.20", "x: 307<br />y: 343.00", "x: 308<br />y: 342.00", "x: 309<br />y: 341.80", "x: 310<br />y: 341.65", "x: 311<br />y: 344.50", "x: 312<br />y: 349.80", "x: 313<br />y: 347.60", "x: 314<br />y: 348.20", "x: 315<br />y: 350.80", "x: 316<br />y: 349.25", "x: 317<br />y: 350.60", "x: 318<br />y: 351.35", "x: 319<br />y: 352.40", "x: 320<br />y: 352.90", "x: 321<br />y: 344.90", "x: 322<br />y: 345.50", "x: 323<br />y: NA", "x: 324<br />y: NA", "x: 325<br />y: 333.70", "x: 326<br />y: 335.50", "x: 327<br />y: 336.60", "x: 328<br />y: 335.60", "x: 329<br />y: 336.50", "x: 330<br />y: 340.65", "x: 331<br />y: 338.65", "x: 332<br />y: 338.15", "x: 333<br />y: 340.25", "x: 334<br />y: 343.20", "x: 335<br />y: 340.25", "x: 336<br />y: 340.75", "x: 337<br />y: 339.30", "x: 338<br />y: 341.00", "x: 339<br />y: 342.45", "x: 340<br />y: 344.15", "x: 341<br />y: 347.25", "x: 342<br />y: 346.00", "x: 343<br />y: 344.30", "x: 344<br />y: 344.40", "x: 345<br />y: 342.35", "x: 346<br />y: 344.75", "x: 347<br />y: 345.60", "x: 348<br />y: 341.60", "x: 349<br />y: NA", "x: 350<br />y: 341.55", "x: 351<br />y: 342.15", "x: 352<br />y: 344.60", "x: 353<br />y: 344.25", "x: 354<br />y: 344.90", "x: 355<br />y: 343.80", "x: 356<br />y: 342.75", "x: 357<br />y: 342.50", "x: 358<br />y: 342.75", "x: 359<br />y: 342.05", "x: 360<br />y: 340.30", "x: 361<br />y: 338.60", "x: 362<br />y: 339.40", "x: 363<br />y: 340.85", "x: 364<br />y: NA", "x: 365<br />y: 341.15", "x: 366<br />y: 341.60", "x: 367<br />y: 342.75", "x: 368<br />y: 343.35", "x: 369<br />y: 343.00", "x: 370<br />y: 341.85", "x: 371<br />y: 341.40", "x: 372<br />y: 341.50", "x: 373<br />y: 341.50", "x: 374<br />y: 341.85", "x: 375<br />y: 347.55", "x: 376<br />y: 347.50", "x: 377<br />y: 347.95", "x: 378<br />y: 347.40", "x: 379<br />y: 346.50", "x: 380<br />y: 337.30", "x: 381<br />y: 338.50", "x: 382<br />y: 338.70", "x: 383<br />y: 338.90", "x: 384<br />y: 340.50", "x: 385<br />y: 340.75", "x: 386<br />y: 343.25", "x: 387<br />y: 343.80", "x: 388<br />y: 343.55", "x: 389<br />y: 345.50", "x: 390<br />y: 345.65", "x: 391<br />y: 344.00", "x: 392<br />y: 343.50", "x: 393<br />y: 343.80", "x: 394<br />y: 344.45", "x: 395<br />y: 346.50", "x: 396<br />y: 350.35", "x: 397<br />y: 347.50", "x: 398<br />y: 347.65", "x: 399<br />y: 346.20", "x: 400<br />y: 345.85", "x: 401<br />y: 348.35", "x: 402<br />y: 346.90", "x: 403<br />y: 347.10", "x: 404<br />y: 353.00", "x: 405<br />y: 353.50", "x: 406<br />y: 351.75", "x: 407<br />y: 348.50", "x: 408<br />y: 349.00", "x: 409<br />y: 350.80", "x: 410<br />y: 353.30", "x: 411<br />y: 351.35", "x: 412<br />y: 375.75", "x: 413<br />y: 360.50", "x: 414<br />y: 358.75", "x: 415<br />y: 358.50", "x: 416<br />y: 360.85", "x: 417<br />y: 360.85", "x: 418<br />y: 361.85", "x: 419<br />y: 394.50", "x: 420<br />y: 386.10", "x: 421<br />y: 391.25", "x: 422<br />y: 384.00", "x: 423<br />y: 386.40", "x: 424<br />y: 377.25", "x: 425<br />y: 372.50", "x: 426<br />y: 379.00", "x: 427<br />y: 381.75", "x: 428<br />y: 384.65", "x: 429<br />y: NA", "x: 430<br />y: 397.30", "x: 431<br />y: 377.80", "x: 432<br />y: 384.00", "x: 433<br />y: 386.00", "x: 434<br />y: 392.00", "x: 435<br />y: 395.50", "x: 436<br />y: 407.20", "x: 437<br />y: 404.00", "x: 438<br />y: 418.25", "x: 439<br />y: 419.00", "x: 440<br />y: 412.50", "x: 441<br />y: 414.50", "x: 442<br />y: 407.00", "x: 443<br />y: 418.75", "x: 444<br />y: 416.00", "x: 445<br />y: 413.55", "x: 446<br />y: 413.60", "x: 447<br />y: 415.70", "x: 448<br />y: 423.00", "x: 449<br />y: 442.75", "x: 450<br />y: 435.15", "x: 451<br />y: 434.00", "x: 452<br />y: 432.25", "x: 453<br />y: 434.00", "x: 454<br />y: 429.45", "x: 455<br />y: 421.20", "x: 456<br />y: 425.50", "x: 457<br />y: 425.50", "x: 458<br />y: 436.90", "x: 459<br />y: 436.50", "x: 460<br />y: 442.00", "x: 461<br />y: 439.40", "x: 462<br />y: 435.80", "x: 463<br />y: 428.15", "x: 464<br />y: 431.40", "x: 465<br />y: 431.25", "x: 466<br />y: 426.25", "x: 467<br />y: 426.00", "x: 468<br />y: 420.00", "x: 469<br />y: 420.00", "x: 470<br />y: 426.80", "x: 471<br />y: 426.60", "x: 472<br />y: 425.40", "x: 473<br />y: 413.00", "x: 474<br />y: 409.60", "x: 475<br />y: 409.55", "x: 476<br />y: 407.75", "x: 477<br />y: 404.00", "x: 478<br />y: 401.50", "x: 479<br />y: 400.30", "x: 480<br />y: 408.50", "x: 481<br />y: 410.25", "x: 482<br />y: 405.00", "x: 483<br />y: 408.30", "x: 484<br />y: 409.90", "x: 485<br />y: 407.40", "x: 486<br />y: 407.45", "x: 487<br />y: 406.85", "x: 488<br />y: 409.00", "x: 489<br />y: 393.25", "x: 490<br />y: 388.00", "x: 491<br />y: 391.50", "x: 492<br />y: 387.00", "x: 493<br />y: 389.50", "x: 494<br />y: 380.40", "x: 495<br />y: 380.75", "x: 496<br />y: 384.00", "x: 497<br />y: 382.30", "x: 498<br />y: 390.00", "x: 499<br />y: 399.60", "x: 500<br />y: 394.30", "x: 501<br />y: 385.25", "x: 502<br />y: 391.20", "x: 503<br />y: 388.60", "x: 504<br />y: 390.50", "x: 505<br />y: 389.20", "x: 506<br />y: 387.25", "x: 507<br />y: 388.75", "x: 508<br />y: 389.70", "x: 509<br />y: 394.60", "x: 510<br />y: 393.70", "x: 511<br />y: 393.40", "x: 512<br />y: 392.50", "x: 513<br />y: 394.15", "x: 514<br />y: 395.35", "x: 515<br />y: 392.75", "x: 516<br />y: 391.00", "x: 517<br />y: NA", "x: 518<br />y: NA", "x: 519<br />y: 391.40", "x: 520<br />y: 389.40", "x: 521<br />y: 390.90", "x: 522<br />y: NA", "x: 523<br />y: 402.40", "x: 524<br />y: 399.00", "x: 525<br />y: 401.70", "x: 526<br />y: 399.50", "x: 527<br />y: 401.60", "x: 528<br />y: 402.25", "x: 529<br />y: 409.90", "x: 530<br />y: 408.60", "x: 531<br />y: 414.40", "x: 532<br />y: 415.00", "x: 533<br />y: 414.50", "x: 534<br />y: 421.25", "x: 535<br />y: 417.40", "x: 536<br />y: 408.50", "x: 537<br />y: 410.60", "x: 538<br />y: 403.55", "x: 539<br />y: 403.35", "x: 540<br />y: 408.70", "x: 541<br />y: 416.50", "x: 542<br />y: 411.00", "x: 543<br />y: 407.30", "x: 544<br />y: 406.45", "x: 545<br />y: 402.00", "x: 546<br />y: 401.75", "x: 547<br />y: 402.60", "x: 548<br />y: 402.70", "x: 549<br />y: 402.95", "x: 550<br />y: 404.40", "x: 551<br />y: 402.90", "x: 552<br />y: 402.00", "x: 553<br />y: 395.55", "x: 554<br />y: 397.20", "x: 555<br />y: 396.85", "x: 556<br />y: 392.25", "x: 557<br />y: 392.60", "x: 558<br />y: 397.50", "x: 559<br />y: 403.00", "x: 560<br />y: 401.95", "x: 561<br />y: 406.70", "x: 562<br />y: 403.10", "x: 563<br />y: 408.70", "x: 564<br />y: 404.40", "x: 565<br />y: 403.70", "x: 566<br />y: 407.65", "x: 567<br />y: 411.45", "x: 568<br />y: 406.50", "x: 569<br />y: 404.85", "x: 570<br />y: 405.00", "x: 571<br />y: 406.85", "x: 572<br />y: 408.00", "x: 573<br />y: 409.25", "x: 574<br />y: 404.65", "x: 575<br />y: 406.00", "x: 576<br />y: 406.40", "x: 577<br />y: 405.05", "x: 578<br />y: 405.00", "x: 579<br />y: 406.60", "x: 580<br />y: 410.30", "x: 581<br />y: 415.00", "x: 582<br />y: 411.30", "x: 583<br />y: 415.90", "x: 584<br />y: 421.80", "x: 585<br />y: 419.00", "x: 586<br />y: 418.50", "x: 587<br />y: 420.25", "x: 588<br />y: 418.65", "x: 589<br />y: 420.55", "x: 590<br />y: 419.80", "x: 591<br />y: 423.20", "x: 592<br />y: 421.50", "x: 593<br />y: 423.30", "x: 594<br />y: 436.50", "x: 595<br />y: 440.25", "x: 596<br />y: 445.50", "x: 597<br />y: 441.00", "x: 598<br />y: NA", "x: 599<br />y: NA", "x: 600<br />y: 454.30", "x: 601<br />y: 446.80", "x: 602<br />y: 453.00", "x: 603<br />y: 462.60", "x: 604<br />y: 476.60", "x: 605<br />y: 455.75", "x: 606<br />y: 451.75", "x: 607<br />y: 454.50", "x: 608<br />y: 452.15", "x: 609<br />y: NA", "x: 610<br />y: 464.50", "x: 611<br />y: 456.75", "x: 612<br />y: 457.40", "x: 613<br />y: 456.70", "x: 614<br />y: 454.75", "x: 615<br />y: 460.25", "x: 616<br />y: 459.50", "x: 617<br />y: 460.00", "x: 618<br />y: 466.70", "x: 619<br />y: 476.50", "x: 620<br />y: 471.35", "x: 621<br />y: 479.95", "x: 622<br />y: 468.60", "x: 623<br />y: 473.60", "x: 624<br />y: NA", "x: 625<br />y: 459.65", "x: 626<br />y: 447.90", "x: 627<br />y: 453.35", "x: 628<br />y: 451.75", "x: 629<br />y: 443.40", "x: 630<br />y: 449.30", "x: 631<br />y: 453.35", "x: 632<br />y: 450.25", "x: 633<br />y: 454.70", "x: 634<br />y: 454.40", "x: 635<br />y: 452.05", "x: 636<br />y: 456.65", "x: 637<br />y: 456.40", "x: 638<br />y: 460.80", "x: 639<br />y: 450.35", "x: 640<br />y: 452.75", "x: 641<br />y: 448.25", "x: 642<br />y: 451.10", "x: 643<br />y: 452.25", "x: 644<br />y: 443.60", "x: 645<br />y: 438.10", "x: 646<br />y: 443.00", "x: 647<br />y: 439.00", "x: 648<br />y: 441.40", "x: 649<br />y: 446.00", "x: 650<br />y: 447.10", "x: 651<br />y: 449.50", "x: 652<br />y: 447.40", "x: 653<br />y: 443.00", "x: 654<br />y: 443.10", "x: 655<br />y: 444.80", "x: 656<br />y: 442.15", "x: 657<br />y: 445.30", "x: 658<br />y: 444.25", "x: 659<br />y: 443.70", "x: 660<br />y: 447.15", "x: 661<br />y: 448.25", "x: 662<br />y: 452.90", "x: 663<br />y: 452.50", "x: 664<br />y: 449.65", "x: 665<br />y: 452.50", "x: 666<br />y: 454.45", "x: 667<br />y: 454.75", "x: 668<br />y: 454.00", "x: 669<br />y: 453.10", "x: 670<br />y: 454.20", "x: 671<br />y: 459.50", "x: 672<br />y: 457.20", "x: 673<br />y: 464.20", "x: 674<br />y: 473.25", "x: 675<br />y: 476.00", "x: 676<br />y: 469.85", "x: 677<br />y: 468.85", "x: 678<br />y: 464.00", "x: 679<br />y: 459.50", "x: 680<br />y: 463.20", "x: 681<br />y: 461.00", "x: 682<br />y: 462.00", "x: 683<br />y: 457.40", "x: 684<br />y: 454.80", "x: 685<br />y: 454.90", "x: 686<br />y: 457.65", "x: 687<br />y: 457.40", "x: 688<br />y: 454.10", "x: 689<br />y: 455.80", "x: 690<br />y: 458.50", "x: 691<br />y: 457.40", "x: 692<br />y: 458.25", "x: 693<br />y: 455.90", "x: 694<br />y: NA", "x: 695<br />y: 453.10", "x: 696<br />y: 456.55", "x: 697<br />y: 462.15", "x: 698<br />y: 464.40", "x: 699<br />y: 463.35", "x: 700<br />y: 462.75", "x: 701<br />y: 458.00", "x: 702<br />y: 461.00", "x: 703<br />y: 460.90", "x: 704<br />y: 456.60", "x: 705<br />y: 458.35", "x: 706<br />y: 458.50", "x: 707<br />y: 458.80", "x: 708<br />y: 461.35", "x: 709<br />y: 458.85", "x: 710<br />y: 463.15", "x: 711<br />y: 461.05", "x: 712<br />y: 463.85", "x: 713<br />y: 461.00", "x: 714<br />y: 460.90", "x: 715<br />y: 458.90", "x: 716<br />y: 459.15", "x: 717<br />y: 454.10", "x: 718<br />y: 455.00", "x: 719<br />y: 455.15", "x: 720<br />y: 456.85", "x: 721<br />y: 458.55", "x: 722<br />y: 458.25", "x: 723<br />y: 461.75", "x: 724<br />y: 461.85", "x: 725<br />y: 459.65", "x: 726<br />y: 459.45", "x: 727<br />y: 461.75", "x: 728<br />y: 464.25", "x: 729<br />y: 479.50", "x: 730<br />y: 481.60", "x: 731<br />y: 466.65", "x: 732<br />y: 469.80", "x: 733<br />y: 472.65", "x: 734<br />y: 474.85", "x: 735<br />y: 473.45", "x: 736<br />y: 479.65", "x: 737<br />y: 474.05", "x: 738<br />y: 468.00", "x: 739<br />y: 469.95", "x: 740<br />y: 470.10", "x: 741<br />y: 467.00", "x: 742<br />y: 459.70", "x: 743<br />y: 458.60", "x: 744<br />y: 463.50", "x: 745<br />y: 458.75", "x: 746<br />y: 461.30", "x: 747<br />y: 463.00", "x: 748<br />y: 464.20", "x: 749<br />y: 461.75", "x: 750<br />y: 463.55", "x: 751<br />y: 464.20", "x: 752<br />y: 465.80", "x: 753<br />y: 466.25", "x: 754<br />y: 468.25", "x: 755<br />y: 476.95", "x: 756<br />y: 478.75", "x: 757<br />y: 477.65", "x: 758<br />y: 477.80", "x: 759<br />y: 493.90", "x: 760<br />y: 486.90", "x: 761<br />y: 490.00", "x: 762<br />y: 488.95", "x: 763<br />y: 485.75", "x: 764<br />y: 480.90", "x: 765<br />y: 483.00", "x: 766<br />y: 485.30", "x: 767<br />y: 484.50", "x: 768<br />y: 495.00", "x: 769<br />y: 502.75", "x: 770<br />y: 593.70", "x: 771<br />y: 487.05", "x: 772<br />y: 487.75", "x: 773<br />y: 484.55", "x: 774<br />y: 481.00", "x: 775<br />y: 481.60", "x: 776<br />y: 483.25", "x: 777<br />y: 483.75", "x: 778<br />y: NA", "x: 779<br />y: NA", "x: 780<br />y: 489.55", "x: 781<br />y: 486.90", "x: 782<br />y: 486.50", "x: 783<br />y: NA", "x: 784<br />y: 484.10", "x: 785<br />y: 477.30", "x: 786<br />y: 481.60", "x: 787<br />y: 483.95", "x: 788<br />y: 479.50", "x: 789<br />y: 485.30", "x: 790<br />y: 482.05", "x: 791<br />y: 481.40", "x: 792<br />y: 480.90", "x: 793<br />y: 484.80", "x: 794<br />y: 475.85", "x: 795<br />y: 476.75", "x: 796<br />y: 477.75", "x: 797<br />y: 476.50", "x: 798<br />y: 477.85", "x: 799<br />y: 471.40", "x: 800<br />y: 471.40", "x: 801<br />y: 469.40", "x: 802<br />y: 468.00", "x: 803<br />y: 465.25", "x: 804<br />y: 454.65", "x: 805<br />y: 455.15", "x: 806<br />y: 447.10", "x: 807<br />y: 437.60", "x: 808<br />y: 444.15", "x: 809<br />y: 443.05", "x: 810<br />y: 439.25", "x: 811<br />y: 443.80", "x: 812<br />y: 440.20", "x: 813<br />y: 440.30", "x: 814<br />y: 443.60", "x: 815<br />y: 444.25", "x: 816<br />y: 444.40", "x: 817<br />y: 446.25", "x: 818<br />y: 443.45", "x: 819<br />y: 445.10", "x: 820<br />y: 443.95", "x: 821<br />y: 438.00", "x: 822<br />y: 433.95", "x: 823<br />y: 432.65", "x: 824<br />y: 423.75", "x: 825<br />y: 429.15", "x: 826<br />y: 431.55", "x: 827<br />y: 429.15", "x: 828<br />y: 430.75", "x: 829<br />y: 436.00", "x: 830<br />y: 435.70", "x: 831<br />y: 436.10", "x: 832<br />y: 437.25", "x: 833<br />y: 444.10", "x: 834<br />y: 441.90", "x: 835<br />y: 442.25", "x: 836<br />y: 447.15", "x: 837<br />y: 445.35", "x: 838<br />y: 442.80", "x: 839<br />y: 446.50", "x: 840<br />y: 449.40", "x: 841<br />y: 450.00", "x: 842<br />y: 453.90", "x: 843<br />y: 451.50", "x: 844<br />y: 453.10", "x: 845<br />y: 454.70", "x: 846<br />y: 454.00", "x: 847<br />y: 458.00", "x: 848<br />y: NA", "x: 849<br />y: NA", "x: 850<br />y: 456.00", "x: 851<br />y: 450.80", "x: 852<br />y: 446.25", "x: 853<br />y: 448.60", "x: 854<br />y: 450.15", "x: 855<br />y: 450.20", "x: 856<br />y: 448.50", "x: 857<br />y: 447.00", "x: 858<br />y: 453.85", "x: 859<br />y: 457.55", "x: 860<br />y: 456.55", "x: 861<br />y: 458.00", "x: 862<br />y: 454.00", "x: 863<br />y: 453.15", "x: 864<br />y: 449.75", "x: 865<br />y: 448.25", "x: 866<br />y: 449.10", "x: 867<br />y: 452.15", "x: 868<br />y: 449.75", "x: 869<br />y: NA", "x: 870<br />y: 444.30", "x: 871<br />y: 441.95", "x: 872<br />y: 445.35", "x: 873<br />y: 445.95", "x: 874<br />y: 443.60", "x: 875<br />y: 447.10", "x: 876<br />y: 449.35", "x: 877<br />y: 448.65", "x: 878<br />y: 451.05", "x: 879<br />y: 453.40", "x: 880<br />y: 453.15", "x: 881<br />y: 452.70", "x: 882<br />y: 456.65", "x: 883<br />y: 459.50", "x: 884<br />y: 460.25", "x: 885<br />y: 458.60", "x: 886<br />y: 458.60", "x: 887<br />y: 453.00", "x: 888<br />y: 452.50", "x: 889<br />y: NA", "x: 890<br />y: 454.00", "x: 891<br />y: 457.00", "x: 892<br />y: 454.60", "x: 893<br />y: 464.85", "x: 894<br />y: 464.10", "x: 895<br />y: 463.40", "x: 896<br />y: 458.75", "x: 897<br />y: 455.00", "x: 898<br />y: 457.10", "x: 899<br />y: 450.50", "x: 900<br />y: 450.80", "x: 901<br />y: 450.30", "x: 902<br />y: 452.65", "x: 903<br />y: 449.80", "x: 904<br />y: 453.90", "x: 905<br />y: 451.70", "x: 906<br />y: 449.80", "x: 907<br />y: 447.60", "x: 908<br />y: 447.00", "x: 909<br />y: 442.00", "x: 910<br />y: 443.85", "x: 911<br />y: 434.90", "x: 912<br />y: 436.85", "x: 913<br />y: 436.50", "x: 914<br />y: 437.15", "x: 915<br />y: 437.40", "x: 916<br />y: 438.10", "x: 917<br />y: 439.15", "x: 918<br />y: 438.90", "x: 919<br />y: 439.65", "x: 920<br />y: 434.50", "x: 921<br />y: 436.20", "x: 922<br />y: 439.05", "x: 923<br />y: 438.10", "x: 924<br />y: 437.65", "x: 925<br />y: 437.25", "x: 926<br />y: 445.00", "x: 927<br />y: 443.20", "x: 928<br />y: 443.20", "x: 929<br />y: 442.20", "x: 930<br />y: 430.15", "x: 931<br />y: 431.70", "x: 932<br />y: 428.75", "x: 933<br />y: 432.70", "x: 934<br />y: 436.40", "x: 935<br />y: 432.90", "x: 936<br />y: 431.25", "x: 937<br />y: 433.40", "x: 938<br />y: 431.45", "x: 939<br />y: 431.85", "x: 940<br />y: 428.25", "x: 941<br />y: 426.95", "x: 942<br />y: 429.00", "x: 943<br />y: 428.40", "x: 944<br />y: 431.15", "x: 945<br />y: 432.00", "x: 946<br />y: 429.00", "x: 947<br />y: 430.20", "x: 948<br />y: 432.40", "x: 949<br />y: 429.70", "x: 950<br />y: 432.70", "x: 951<br />y: 432.10", "x: 952<br />y: 434.80", "x: 953<br />y: 433.75", "x: 954<br />y: NA", "x: 955<br />y: 429.40", "x: 956<br />y: 426.35", "x: 957<br />y: 430.30", "x: 958<br />y: 430.30", "x: 959<br />y: 427.00", "x: 960<br />y: 427.65", "x: 961<br />y: 427.00", "x: 962<br />y: 428.00", "x: 963<br />y: 428.90", "x: 964<br />y: 418.00", "x: 965<br />y: 420.80", "x: 966<br />y: 421.90", "x: 967<br />y: 421.50", "x: 968<br />y: 417.30", "x: 969<br />y: 409.00", "x: 970<br />y: 410.40", "x: 971<br />y: 401.60", "x: 972<br />y: 399.60", "x: 973<br />y: 399.30", "x: 974<br />y: 389.05", "x: 975<br />y: 397.00", "x: 976<br />y: 397.65", "x: 977<br />y: 398.60", "x: 978<br />y: 396.15", "x: 979<br />y: 394.20", "x: 980<br />y: 397.35", "x: 981<br />y: 397.25", "x: 982<br />y: 403.00", "x: 983<br />y: 404.25", "x: 984<br />y: 406.25", "x: 985<br />y: 408.00", "x: 986<br />y: 404.70", "x: 987<br />y: 408.60", "x: 988<br />y: 406.50", "x: 989<br />y: 411.15", "x: 990<br />y: 413.05", "x: 991<br />y: 410.80", "x: 992<br />y: 411.40", "x: 993<br />y: 410.55", "x: 994<br />y: 406.30", "x: 995<br />y: 406.60", "x: 996<br />y: 407.50", "x: 997<br />y: 407.15", "x: 998<br />y: 407.30", "x: 999<br />y: 412.30", "x: 1000<br />y: 411.00", "x: 1001<br />y: 412.50", "x: 1002<br />y: 422.90", "x: 1003<br />y: 419.50", "x: 1004<br />y: 422.00", "x: 1005<br />y: 421.85", "x: 1006<br />y: 419.50", "x: 1007<br />y: 422.25", "x: 1008<br />y: 420.75", "x: 1009<br />y: 420.65", "x: 1010<br />y: 422.80", "x: 1011<br />y: 422.60", "x: 1012<br />y: 423.30", "x: 1013<br />y: 419.75", "x: 1014<br />y: 416.60", "x: 1015<br />y: 416.10", "x: 1016<br />y: 417.95", "x: 1017<br />y: 419.85", "x: 1018<br />y: 422.60", "x: 1019<br />y: 421.40", "x: 1020<br />y: 422.10", "x: 1021<br />y: 421.30", "x: 1022<br />y: 425.50", "x: 1023<br />y: 423.80", "x: 1024<br />y: 430.40", "x: 1025<br />y: 429.00", "x: 1026<br />y: 425.35", "x: 1027<br />y: 423.30", "x: 1028<br />y: 422.20", "x: 1029<br />y: 421.00", "x: 1030<br />y: 420.05", "x: 1031<br />y: 419.60", "x: 1032<br />y: 421.40", "x: 1033<br />y: 412.60", "x: 1034<br />y: 413.65", "x: 1035<br />y: 413.20", "x: 1036<br />y: 413.85", "x: 1037<br />y: 415.60", "x: 1038<br />y: 417.55", "x: 1039<br />y: NA", "x: 1040<br />y: NA", "x: 1041<br />y: 413.65", "x: 1042<br />y: 413.10", "x: 1043<br />y: 410.15", "x: 1044<br />y: NA", "x: 1045<br />y: 413.60", "x: 1046<br />y: 410.50", "x: 1047<br />y: 408.00", "x: 1048<br />y: 408.45", "x: 1049<br />y: 404.45", "x: 1050<br />y: 405.50", "x: 1051<br />y: 403.50", "x: 1052<br />y: 404.85", "x: 1053<br />y: 403.50", "x: 1054<br />y: 401.75", "x: 1055<br />y: 402.10", "x: 1056<br />y: 402.85", "x: 1057<br />y: 402.30", "x: 1058<br />y: 404.50", "x: 1059<br />y: 407.75", "x: 1060<br />y: 407.80", "x: 1061<br />y: 404.75", "x: 1062<br />y: 406.00", "x: 1063<br />y: 402.25", "x: 1064<br />y: 394.30", "x: 1065<br />y: 394.85", "x: 1066<br />y: 392.00", "x: 1067<br />y: 392.70", "x: 1068<br />y: 390.85", "x: 1069<br />y: 390.25", "x: 1070<br />y: 391.45", "x: 1071<br />y: 390.40", "x: 1072<br />y: 394.10", "x: 1073<br />y: 393.80", "x: 1074<br />y: 386.70", "x: 1075<br />y: 385.65", "x: 1076<br />y: 381.70", "x: 1077<br />y: 384.25", "x: 1078<br />y: 378.95", "x: 1079<br />y: 382.15", "x: 1080<br />y: 382.75", "x: 1081<br />y: 386.00", "x: 1082<br />y: 389.00", "x: 1083<br />y: 389.25", "x: 1084<br />y: 390.75", "x: 1085<br />y: 386.75", "x: 1086<br />y: 386.10", "x: 1087<br />y: 384.10", "x: 1088<br />y: 384.10", "x: 1089<br />y: 388.40", "x: 1090<br />y: 386.30", "x: 1091<br />y: 393.10", "x: 1092<br />y: 392.50", "x: 1093<br />y: 397.00", "x: 1094<br />y: 393.10", "x: 1095<br />y: 394.30", "x: 1096<br />y: 394.45", "x: 1097<br />y: 391.00", "x: 1098<br />y: 389.25", "x: 1099<br />y: 395.30", "x: 1100<br />y: 394.10", "x: 1101<br />y: 393.40", "x: 1102<br />y: 396.00", "x: 1103<br />y: NA", "x: 1104<br />y: NA", "x: 1105<br />y: 391.25", "x: 1106<br />y: 383.30", "x: 1107<br />y: 384.00", "x: 1108<br />y: 382.30"], ## "type": "scatter", ## "mode": "lines", ## "line": { ## "width": 1.88976377952756, ## "color": "rgba(0,0,0,1)", ## "dash": "solid" ## }, ## "hoveron": "points", ## "showlegend": false, ## "xaxis": "x", ## "yaxis": "y", ## "hoverinfo": "text", ## "frame": null ## } ## ], ## "layout": { ## "margin": { ## "t": 26.2283105022831, ## "r": 7.30593607305936, ## "b": 40.1826484018265, ## "l": 43.1050228310502 ## }, ## "plot_bgcolor": "rgba(235,235,235,1)", ## "paper_bgcolor": "rgba(255,255,255,1)", ## "font": { ## "color": "rgba(0,0,0,1)", ## "family": "", ## "size": 14.6118721461187 ## }, ## "xaxis": { ## "domain": [0, 1], ## "automargin": true, ## "type": "linear", ## "autorange": false, ## "range": [-54.35, 1163.35], ## "tickmode": "array", ## "ticktext": ["0", "300", "600", "900"], ## "tickvals": [7.105427357601e-15, 300, 600, 900], ## "categoryorder": "array", ## "categoryarray": ["0", "300", "600", "900"], ## "nticks": null, ## "ticks": "outside", ## "tickcolor": "rgba(51,51,51,1)", ## "ticklen": 3.65296803652968, ## "tickwidth": 0.66417600664176, ## "showticklabels": true, ## "tickfont": { ## "color": "rgba(77,77,77,1)", ## "family": "", ## "size": 11.689497716895 ## }, ## "tickangle": -0, ## "showline": false, ## "linecolor": null, ## "linewidth": 0, ## "showgrid": true, ## "gridcolor": "rgba(255,255,255,1)", ## "gridwidth": 0.66417600664176, ## "zeroline": false, ## "anchor": "y", ## "title": { ## "text": "x", ## "font": { ## "color": "rgba(0,0,0,1)", ## "family": "", ## "size": 14.6118721461187 ## } ## }, ## "hoverformat": ".2f" ## }, ## "yaxis": { ## "domain": [0, 1], ## "automargin": true, ## "type": "linear", ## "autorange": false, ## "range": [269.565, 609.135], ## "tickmode": "array", ## "ticktext": ["300", "400", "500", "600"], ## "tickvals": [300, 400, 500, 600], ## "categoryorder": "array", ## "categoryarray": ["300", "400", "500", "600"], ## "nticks": null, ## "ticks": "outside", ## "tickcolor": "rgba(51,51,51,1)", ## "ticklen": 3.65296803652968, ## "tickwidth": 0.66417600664176, ## "showticklabels": true, ## "tickfont": { ## "color": "rgba(77,77,77,1)", ## "family": "", ## "size": 11.689497716895 ## }, ## "tickangle": -0, ## "showline": false, ## "linecolor": null, ## "linewidth": 0, ## "showgrid": true, ## "gridcolor": "rgba(255,255,255,1)", ## "gridwidth": 0.66417600664176, ## "zeroline": false, ## "anchor": "x", ## "title": { ## "text": "y", ## "font": { ## "color": "rgba(0,0,0,1)", ## "family": "", ## "size": 14.6118721461187 ## } ## }, ## "hoverformat": ".2f" ## }, ## "shapes": [ ## { ## "type": "rect", ## "fillcolor": null, ## "line": { ## "color": null, ## "width": 0, ## "linetype": [] ## }, ## "yref": "paper", ## "xref": "paper", ## "x0": 0, ## "x1": 1, ## "y0": 0, ## "y1": 1 ## } ## ], ## "showlegend": false, ## "legend": { ## "bgcolor": "rgba(255,255,255,1)", ## "bordercolor": "transparent", ## "borderwidth": 1.88976377952756, ## "font": { ## "color": "rgba(0,0,0,1)", ## "family": "", ## "size": 11.689497716895 ## } ## }, ## "hovermode": "closest", ## "barmode": "relative" ## }, ## "config": { ## "doubleClick": "reset", ## "modeBarButtonsToAdd": ["hoverclosest", "hovercompare"], ## "showSendToCloud": false ## }, ## "source": "A", ## "attrs": { ## "3c7018506e55": { ## "x": {}, ## "y": {}, ## "type": "scatter" ## } ## }, ## "cur_data": "3c7018506e55", ## "visdat": { ## "3c7018506e55": ["function (y) ", "x"] ## }, ## "highlight": { ## "on": "plotly_click", ## "persistent": false, ## "dynamic": false, ## "selectize": false, ## "opacityDim": 0.2, ## "selected": { ## "opacity": 1 ## }, ## "debounce": 0 ## }, ## "shinyEvents": ["plotly_hover", "plotly_click", "plotly_selected", "plotly_relayout", "plotly_brushed", "plotly_brushing", "plotly_clickannotation", "plotly_doubleclick", "plotly_deselect", "plotly_afterplot", "plotly_sunburstclick"], ## "base_url": "https://plot.ly" ## }
Modify with Style
Generally speaking, the style()
function is designed modify attribute values of trace(s) within a plotly object, which is primarily useful for customizing defaults produced via ggplotly()
library ( plotly ) p <- ggplot ( fortify ( forecast :: gold ), aes ( x , y )) + geom_line () p <- p %>% style ( line = list ( color = 'gold' ), hoverinfo = "y" , traces = 1 ) ggplotly ( p )
Modify with Build
library ( plotly ) df <- data.frame ( x = c ( 1 , 2 , 3 , 4 ), y = c ( 1 , 5 , 3 , 5 ), group = c ( 'A' , 'A' , 'B' , 'B' )) p <- ggplot ( data = df , aes ( x = x , y = y , colour = group )) + geom_point () ggplotly ( p )
Here is the ggplot2 figure described as a plotly object
df <- data.frame ( x = c ( 1 , 2 , 3 , 4 ), y = c ( 1 , 5 , 3 , 5 ), group = c ( 'A' , 'A' , 'B' , 'B' )) p <- ggplot ( data = df , aes ( x = x , y = y , colour = group )) + geom_point () p <- ggplotly ( p ) fig <- plotly_build ( p ) str ( fig )
## List of 8 ## $ x :List of 10 ## ..$ data :List of 2 ## .. ..$ :List of 14 ## .. .. ..$ x : num [1:2] 1 2 ## .. .. .. ..- attr(*, "apiSrc")= logi TRUE ## .. .. ..$ y : num [1:2] 1 5 ## .. .. .. ..- attr(*, "apiSrc")= logi TRUE ## .. .. ..$ text : chr [1:2] "x: 1<br />y: 1" "x: 2<br />y: 5" ## .. .. .. ..- attr(*, "apiSrc")= logi TRUE ## .. .. ..$ type : chr "scatter" ## .. .. ..$ mode : chr "markers" ## .. .. ..$ marker :List of 6 ## .. .. .. ..$ autocolorscale: logi FALSE ## .. .. .. ..$ color : chr "rgba(248,118,109,1)" ## .. .. .. ..$ opacity : num 1 ## .. .. .. ..$ size : num 5.67 ## .. .. .. ..$ symbol : chr "circle" ## .. .. .. ..$ line :List of 2 ## .. .. .. .. ..$ width: num 1.89 ## .. .. .. .. ..$ color: chr "rgba(248,118,109,1)" ## .. .. ..$ hoveron : chr "points" ## .. .. ..$ name : chr "A" ## .. .. ..$ legendgroup: chr "A" ## .. .. ..$ showlegend : logi TRUE ## .. .. ..$ xaxis : chr "x" ## .. .. ..$ yaxis : chr "y" ## .. .. ..$ hoverinfo : chr "text" ## .. .. ..$ frame : chr NA ## .. ..$ :List of 14 ## .. .. ..$ x : num [1:2] 3 4 ## .. .. .. ..- attr(*, "apiSrc")= logi TRUE ## .. .. ..$ y : num [1:2] 3 5 ## .. .. .. ..- attr(*, "apiSrc")= logi TRUE ## .. .. ..$ text : chr [1:2] "x: 3<br />y: 3" "x: 4<br />y: 5" ## .. .. .. ..- attr(*, "apiSrc")= logi TRUE ## .. .. ..$ type : chr "scatter" ## .. .. ..$ mode : chr "markers" ## .. .. ..$ marker :List of 6 ## .. .. .. ..$ autocolorscale: logi FALSE ## .. .. .. ..$ color : chr "rgba(0,191,196,1)" ## .. .. .. ..$ opacity : num 1 ## .. .. .. ..$ size : num 5.67 ## .. .. .. ..$ symbol : chr "circle" ## .. .. .. ..$ line :List of 2 ## .. .. .. .. ..$ width: num 1.89 ## .. .. .. .. ..$ color: chr "rgba(0,191,196,1)" ## .. .. ..$ hoveron : chr "points" ## .. .. ..$ name : chr "B" ## .. .. ..$ legendgroup: chr "B" ## .. .. ..$ showlegend : logi TRUE ## .. .. ..$ xaxis : chr "x" ## .. .. ..$ yaxis : chr "y" ## .. .. ..$ hoverinfo : chr "text" ## .. .. ..$ frame : chr NA ## ..$ layout :List of 11 ## .. ..$ margin :List of 4 ## .. .. ..$ t: num 26.2 ## .. .. ..$ r: num 7.31 ## .. .. ..$ b: num 40.2 ## .. .. ..$ l: num 31.4 ## .. ..$ plot_bgcolor : chr "rgba(235,235,235,1)" ## .. ..$ paper_bgcolor: chr "rgba(255,255,255,1)" ## .. ..$ font :List of 3 ## .. .. ..$ color : chr "rgba(0,0,0,1)" ## .. .. ..$ family: chr "" ## .. .. ..$ size : num 14.6 ## .. ..$ xaxis :List of 28 ## .. .. ..$ domain : num [1:2] 0 1 ## .. .. ..$ automargin : logi TRUE ## .. .. ..$ type : chr "linear" ## .. .. ..$ autorange : logi FALSE ## .. .. ..$ range : num [1:2] 0.85 4.15 ## .. .. ..$ tickmode : chr "array" ## .. .. ..$ ticktext : chr [1:4] "1" "2" "3" "4" ## .. .. ..$ tickvals : num [1:4] 1 2 3 4 ## .. .. ..$ categoryorder : chr "array" ## .. .. ..$ categoryarray : chr [1:4] "1" "2" "3" "4" ## .. .. ..$ nticks : logi NA ## .. .. ..$ ticks : chr "outside" ## .. .. ..$ tickcolor : chr "rgba(51,51,51,1)" ## .. .. ..$ ticklen : num 3.65 ## .. .. ..$ tickwidth : num 0.664 ## .. .. ..$ showticklabels: logi TRUE ## .. .. ..$ tickfont :List of 3 ## .. .. .. ..$ color : chr "rgba(77,77,77,1)" ## .. .. .. ..$ family: chr "" ## .. .. .. ..$ size : num 11.7 ## .. .. ..$ tickangle : num 0 ## .. .. ..$ showline : logi FALSE ## .. .. ..$ linecolor : logi NA ## .. .. ..$ linewidth : num 0 ## .. .. ..$ showgrid : logi TRUE ## .. .. ..$ gridcolor : chr "rgba(255,255,255,1)" ## .. .. ..$ gridwidth : num 0.664 ## .. .. ..$ zeroline : logi FALSE ## .. .. ..$ anchor : chr "y" ## .. .. ..$ title :List of 2 ## .. .. .. ..$ text: chr "x" ## .. .. .. ..$ font:List of 3 ## .. .. .. .. ..$ color : chr "rgba(0,0,0,1)" ## .. .. .. .. ..$ family: chr "" ## .. .. .. .. ..$ size : num 14.6 ## .. .. ..$ hoverformat : chr ".2f" ## .. ..$ yaxis :List of 28 ## .. .. ..$ domain : num [1:2] 0 1 ## .. .. ..$ automargin : logi TRUE ## .. .. ..$ type : chr "linear" ## .. .. ..$ autorange : logi FALSE ## .. .. ..$ range : num [1:2] 0.8 5.2 ## .. .. ..$ tickmode : chr "array" ## .. .. ..$ ticktext : chr [1:5] "1" "2" "3" "4" ... ## .. .. ..$ tickvals : num [1:5] 1 2 3 4 5 ## .. .. ..$ categoryorder : chr "array" ## .. .. ..$ categoryarray : chr [1:5] "1" "2" "3" "4" ... ## .. .. ..$ nticks : logi NA ## .. .. ..$ ticks : chr "outside" ## .. .. ..$ tickcolor : chr "rgba(51,51,51,1)" ## .. .. ..$ ticklen : num 3.65 ## .. .. ..$ tickwidth : num 0.664 ## .. .. ..$ showticklabels: logi TRUE ## .. .. ..$ tickfont :List of 3 ## .. .. .. ..$ color : chr "rgba(77,77,77,1)" ## .. .. .. ..$ family: chr "" ## .. .. .. ..$ size : num 11.7 ## .. .. ..$ tickangle : num 0 ## .. .. ..$ showline : logi FALSE ## .. .. ..$ linecolor : logi NA ## .. .. ..$ linewidth : num 0 ## .. .. ..$ showgrid : logi TRUE ## .. .. ..$ gridcolor : chr "rgba(255,255,255,1)" ## .. .. ..$ gridwidth : num 0.664 ## .. .. ..$ zeroline : logi FALSE ## .. .. ..$ anchor : chr "x" ## .. .. ..$ title :List of 2 ## .. .. .. ..$ text: chr "y" ## .. .. .. ..$ font:List of 3 ## .. .. .. .. ..$ color : chr "rgba(0,0,0,1)" ## .. .. .. .. ..$ family: chr "" ## .. .. .. .. ..$ size : num 14.6 ## .. .. ..$ hoverformat : chr ".2f" ## .. ..$ shapes :List of 1 ## .. .. ..$ :List of 9 ## .. .. .. ..$ type : chr "rect" ## .. .. .. ..$ fillcolor: logi NA ## .. .. .. ..$ line :List of 3 ## .. .. .. .. ..$ color : logi NA ## .. .. .. .. ..$ width : num 0 ## .. .. .. .. ..$ linetype: chr(0) ## .. .. .. ..$ yref : chr "paper" ## .. .. .. ..$ xref : chr "paper" ## .. .. .. ..$ x0 : num 0 ## .. .. .. ..$ x1 : num 1 ## .. .. .. ..$ y0 : num 0 ## .. .. .. ..$ y1 : num 1 ## .. ..$ showlegend : logi TRUE ## .. ..$ legend :List of 5 ## .. .. ..$ bgcolor : chr "rgba(255,255,255,1)" ## .. .. ..$ bordercolor: chr "transparent" ## .. .. ..$ borderwidth: num 1.89 ## .. .. ..$ font :List of 3 ## .. .. .. ..$ color : chr "rgba(0,0,0,1)" ## .. .. .. ..$ family: chr "" ## .. .. .. ..$ size : num 11.7 ## .. .. ..$ title :List of 2 ## .. .. .. ..$ text: chr "group" ## .. .. .. ..$ font:List of 3 ## .. .. .. .. ..$ color : chr "rgba(0,0,0,1)" ## .. .. .. .. ..$ family: chr "" ## .. .. .. .. ..$ size : num 14.6 ## .. ..$ hovermode : chr "closest" ## .. ..$ barmode : chr "relative" ## ..$ config :List of 3 ## .. ..$ doubleClick : chr "reset" ## .. ..$ modeBarButtonsToAdd: chr [1:2] "hoverclosest" "hovercompare" ## .. ..$ showSendToCloud : logi FALSE ## ..$ source : chr "A" ## ..$ attrs :List of 1 ## .. ..$ 3c7056970d65:List of 4 ## .. .. ..$ x :Class 'formula' language ~~x ## .. .. .. .. ..- attr(*, ".Environment")=<environment: 0x55946717a2c0> ## .. .. ..$ y :Class 'formula' language ~~y ## .. .. .. .. ..- attr(*, ".Environment")=<environment: 0x55946717a2c0> ## .. .. ..$ colour:Class 'formula' language ~~group ## .. .. .. .. ..- attr(*, ".Environment")=<environment: 0x55946717a2c0> ## .. .. ..$ type : chr "scatter" ## .. .. ..- attr(*, "class")= chr "plotly_eval" ## ..$ cur_data : chr "3c7056970d65" ## ..$ visdat :List of 1 ## .. ..$ 3c7056970d65:function (y) ## ..$ highlight :List of 7 ## .. ..$ on : chr "plotly_click" ## .. ..$ persistent: logi FALSE ## .. ..$ dynamic : logi FALSE ## .. ..$ selectize : logi FALSE ## .. ..$ opacityDim: num 0.2 ## .. ..$ selected :List of 1 ## .. .. ..$ opacity: num 1 ## .. ..$ debounce : num 0 ## ..$ shinyEvents: chr [1:11] "plotly_hover" "plotly_click" "plotly_selected" "plotly_relayout" ... ## ..$ base_url : chr "https://plot.ly" ## ..- attr(*, "TOJSON_FUNC")=function (x, ...) ## $ width : NULL ## $ height : NULL ## $ sizingPolicy :List of 6 ## ..$ defaultWidth : chr "100%" ## ..$ defaultHeight: num 400 ## ..$ padding : num 0 ## ..$ viewer :List of 6 ## .. ..$ defaultWidth : NULL ## .. ..$ defaultHeight: NULL ## .. ..$ padding : NULL ## .. ..$ fill : logi TRUE ## .. ..$ suppress : logi FALSE ## .. ..$ paneHeight : NULL ## ..$ browser :List of 5 ## .. ..$ defaultWidth : NULL ## .. ..$ defaultHeight: NULL ## .. ..$ padding : NULL ## .. ..$ fill : logi TRUE ## .. ..$ external : logi FALSE ## ..$ knitr :List of 3 ## .. ..$ defaultWidth : NULL ## .. ..$ defaultHeight: NULL ## .. ..$ figure : logi TRUE ## $ dependencies :List of 5 ## ..$ :List of 10 ## .. ..$ name : chr "typedarray" ## .. ..$ version : chr "0.1" ## .. ..$ src :List of 1 ## .. .. ..$ file: chr "htmlwidgets/lib/typedarray" ## .. ..$ meta : NULL ## .. ..$ script : chr "typedarray.min.js" ## .. ..$ stylesheet: NULL ## .. ..$ head : NULL ## .. ..$ attachment: NULL ## .. ..$ package : chr "plotly" ## .. ..$ all_files : logi FALSE ## .. ..- attr(*, "class")= chr "html_dependency" ## ..$ :List of 10 ## .. ..$ name : chr "jquery" ## .. ..$ version : chr "3.5.1" ## .. ..$ src :List of 1 ## .. .. ..$ file: chr "lib/jquery" ## .. ..$ meta : NULL ## .. ..$ script : chr "jquery.min.js" ## .. ..$ stylesheet: NULL ## .. ..$ head : NULL ## .. ..$ attachment: NULL ## .. ..$ package : chr "crosstalk" ## .. ..$ all_files : logi TRUE ## .. ..- attr(*, "class")= chr "html_dependency" ## ..$ :List of 10 ## .. ..$ name : chr "crosstalk" ## .. ..$ version : chr "1.1.1" ## .. ..$ src :List of 1 ## .. .. ..$ file: chr "www" ## .. ..$ meta : NULL ## .. ..$ script : chr "js/crosstalk.min.js" ## .. ..$ stylesheet: chr "css/crosstalk.css" ## .. ..$ head : NULL ## .. ..$ attachment: NULL ## .. ..$ package : chr "crosstalk" ## .. ..$ all_files : logi TRUE ## .. ..- attr(*, "class")= chr "html_dependency" ## ..$ :List of 10 ## .. ..$ name : chr "plotly-htmlwidgets-css" ## .. ..$ version : chr "2.5.1" ## .. ..$ src :List of 1 ## .. .. ..$ file: chr "htmlwidgets/lib/plotlyjs" ## .. ..$ meta : NULL ## .. ..$ script : NULL ## .. ..$ stylesheet: chr "plotly-htmlwidgets.css" ## .. ..$ head : NULL ## .. ..$ attachment: NULL ## .. ..$ package : chr "plotly" ## .. ..$ all_files : logi FALSE ## .. ..- attr(*, "class")= chr "html_dependency" ## ..$ :List of 10 ## .. ..$ name : chr "plotly-main" ## .. ..$ version : chr "2.5.1" ## .. ..$ src :List of 1 ## .. .. ..$ file: chr "htmlwidgets/lib/plotlyjs" ## .. ..$ meta : NULL ## .. ..$ script : chr "plotly-latest.min.js" ## .. ..$ stylesheet: NULL ## .. ..$ head : NULL ## .. ..$ attachment: NULL ## .. ..$ package : chr "plotly" ## .. ..$ all_files : logi FALSE ## .. ..- attr(*, "class")= chr "html_dependency" ## $ elementId : NULL ## $ preRenderHook:function (p, registerFrames = TRUE) ## $ jsHooks : list() ## - attr(*, "class")= chr [1:2] "plotly" "htmlwidget" ## - attr(*, "package")= chr "plotly"
This declarative description of the graph is very human readable. Every attribute of the chart, the colors, the data, the text, is described in a key-value pair in this object. View all of the possible graph attributes.
Attributes of plotly figures are grouped into two categories: data
and layout
. data
describes attributes that pertain to the plot's series, or "traces". These properties include things like the x
and y
data, the color
and name
of the trace, which axis the trace is bound to. data
is an unnamed list.
Take a look:
library ( plotly ) names ( fig $ x $ data [[ 1 ]])
## [1] "x" "y" "text" "type" "mode" ## [6] "marker" "hoveron" "name" "legendgroup" "showlegend" ## [11] "xaxis" "yaxis" "hoverinfo" "frame"
# this trace is a "scatter" type fig $ x $ data [[ 1 ]] $ type
its name, as it appears in the legend, is "A"
## List of 14 ## $ x : num [1:2] 1 2 ## ..- attr(*, "apiSrc")= logi TRUE ## $ y : num [1:2] 1 5 ## ..- attr(*, "apiSrc")= logi TRUE ## $ text : chr [1:2] "x: 1<br />y: 1" "x: 2<br />y: 5" ## ..- attr(*, "apiSrc")= logi TRUE ## $ type : chr "scatter" ## $ mode : chr "markers" ## $ marker :List of 6 ## ..$ autocolorscale: logi FALSE ## ..$ color : chr "rgba(248,118,109,1)" ## ..$ opacity : num 1 ## ..$ size : num 5.67 ## ..$ symbol : chr "circle" ## ..$ line :List of 2 ## .. ..$ width: num 1.89 ## .. ..$ color: chr "rgba(248,118,109,1)" ## $ hoveron : chr "points" ## $ name : chr "A" ## $ legendgroup: chr "A" ## $ showlegend : logi TRUE ## $ xaxis : chr "x" ## $ yaxis : chr "y" ## $ hoverinfo : chr "text" ## $ frame : chr NA
layout
describes attributes that pertain to the rest of the plot, like axis properties, annotations, legends, and titles.
## [1] "margin" "plot_bgcolor" "paper_bgcolor" "font" ## [5] "xaxis" "yaxis" "shapes" "showlegend" ## [9] "legend" "hovermode" "barmode"
str ( fig $ x $ layout $ plot_bgcolor ) # the background color of the plot is "rgb(229,229,229)"
Each of these properties was extracted and translated from the original ggplot2 figure. View all of the possible attributes.
You can edit or add these attributes and then send the figure to Plotly. Let's add custom hover text (text
), change the legend names (name
) add a title (layout$title
)
fig $ x $ data [[ 1 ]] $ name <- 'Group A' fig $ x $ data [[ 1 ]] $ text <- c ( 'St Urbain' , 'Gaspe' ) fig $ x $ data [[ 1 ]] $ type <- 'scatter' fig $ x $ data [[ 1 ]] $ mode <- 'lines' fig $ x $ data [[ 2 ]] $ name <- 'Group B' fig $ x $ data [[ 2 ]] $ text <- c ( 'Laurier' , 'Fairmount' ) fig $ x $ data [[ 2 ]] $ type <- 'scatter' fig $ x $ data [[ 2 ]] $ mode <- 'lines' fig $ x $ layout $ title <- 'Updated title'
Now, display this figure:
## A marker object has been specified, but markers is not in the mode ## Adding markers to the mode... ## A marker object has been specified, but markers is not in the mode ## Adding markers to the mode...
Resources
- ggplot2 examples
- Plotly's native R DSL
- Plotly's declarative graph description reference
-
plotly
R package on GitHub
What About Dash?
Dash for R is an open-source framework for building analytical applications, with no Javascript required, and it is tightly integrated with the Plotly graphing library.
Learn about how to install Dash for R at https://dashr.plot.ly/installation.
Everywhere in this page that you see fig
, you can display the same figure in a Dash for R application by passing it to the figure
argument of the Graph
component from the built-in dashCoreComponents
package like this:
library ( plotly ) fig <- plot_ly () # fig <- fig %>% add_trace( ... ) # fig <- fig %>% layout( ... ) library ( dash ) library ( dashCoreComponents ) library ( dashHtmlComponents ) app <- Dash $ new () app $ layout ( htmlDiv ( list ( dccGraph ( figure = fig ) ) ) ) app $ run_server ( debug = TRUE , dev_tools_hot_reload = FALSE )
How To Install Plotly In R
Source: https://plotly.com/ggplot2/getting-started/
Posted by: nelsonwhostravion.blogspot.com
0 Response to "How To Install Plotly In R"
Post a Comment