Black Lives Matter. Please consider donating to Black Girls Code today.

Plotly scatter3d

Hello,

I’m trying to make a scatter and I don’t understand why I don’t have the completeness for some integral points of my text.
Can you help me?
below the code and the screenshots:

pal <- c(“red”, “blue”, “green”)

p <- plot_ly(data,
x=data$number,
y=data$pos,
z=data$log10,
color = ~as.factor(data$code),
colors = pal,
text =~paste(‘test:’,data$assoc_files))


Hey @fr61605

Hmmm interesting. Is assoc_files the same length as x,y,z? A quick check on a basic example seems to work as expected:

mtcars$am[which(mtcars$am == 0)] <- 'Automatic'
mtcars$am[which(mtcars$am == 1)] <- 'Manual'
mtcars$am <- as.factor(mtcars$am)

p <- plot_ly(mtcars, x = ~wt, y = ~hp, z = ~qsec, color = ~am, text = ~paste("am: ", am), colors = c('#BF382A', '#0C4B8E')) %>%
  add_markers() %>%
  layout(scene = list(xaxis = list(title = 'Weight'),
                      yaxis = list(title = 'Gross horsepower'),
                      zaxis = list(title = '1/4 mile time')))

I have no problems with the example but with my data when we exceed 5 colors the text is degraded.
pos number log10 am
55518467 14816 4,309503563 0
55518528 14818 3,50443485 0
55518682 14820 4,769303346 0
55532742 14822 3,077379885 0
55538903 14824 3,202907736 0
55541174 14826 3,129942732 0
55545515 14828 3,209406646 0
55546895 14830 3,063760291 0
55553104 14832 3,06248612 0
55555285 14834 3,048713006 0
55557067 14836 3,168599312 0
55558661 14838 3,060062628 0
55560796 14840 3,197328192 0
55500283 4274 3,093612695 1
55485042 541 4,339970727 1
55487489 545 4,528302062 1
55496176 549 3,586799179 1
55518752 551 3,094170672 1
55538903 553 3,043312072 1
55545515 555 3,1081148 1
55500090 2197 3,110454041 1
55511317 7894 3,04725646 1
55522558 6905 3,161627006 1
55466134 2439 3,174377228 1
55468919 2443 3,19291235 1
55470822 2447 3,422191212 1
55494890 2451 3,21434421 1
55555251 2250 3,610715166 1
55465345 5327 3,473950349 1
55485919 5331 3,759143859 1
55486117 5335 3,856441891 1
55486361 5339 3,749011883 1
55486751 5343 3,738784728 1
55487786 5347 3,687040264 1
55489240 5351 3,487554425 1
55517301 1727 3,82200492 1
55522415 1729 3,223160851 1
55532160 1731 3,644075554 1
55466606 1124 3,317745687 1
55485562 3502 3,00065976 1
55465345 4265 3,247866239 1
55504188 4267 3,205013115 2
55512882 4270 3,184262907 2
55513521 4273 3,538819732 2
55514611 4276 3,288710016 2
55520265 4278 3,163391091 2
55541896 4280 3,120036399 2
55566955 4282 3,284327514 2
55567143 4284 3,247954627 2
55567410 4286 3,256183045 2
55472356 827 3,12865361 2
55487346 1476 5,536307041 2
55487648 1480 3,925724937 2
55489542 1484 5,479686812 2
55494017 1488 3,828457832 2
55494890 1493 3,184563719 2
55496039 1498 3,281053449 2
55498428 1501 3,16397987 2
55498864 1504 3,117635435 2
55500025 1507 3,162988268 2
55502146 1510 3,858810568 2
55505647 1513 3,578713685 2
55538552 1515 3,630886232 2
55498745 1342 3,006742815 2
55507649 1863 3,477302828 2
55511471 1866 3,794351821 2
55513061 1869 3,779287983 2
55515481 1872 3,998898291 2
55516004 1875 3,951006938 2
55516188 1878 4,007075966 2
55516508 1881 3,984091435 2
55522674 2796 3,491478361 2
55523361 2798 3,173014135 2
55523483 2800 3,237867836 4
55523984 2802 3,116501527 5
55524116 2804 3,108610863 6
55524197 2806 3,130750674 7
55524237 2808 3,117363914 8
55525726 2810 3,133050793 9
55525868 2812 3,14706643 10
55526685 2814 3,143688087 11
55527479 2816 3,158303363 12
55527918 2818 3,168164766 13
55529828 2820 4,300403327 14
55532742 2822 3,000545382 15
55536526 2824 3,49198231 16
55537966 2826 3,49033385 17
55538385 2828 3,448203681 18
55538462 2830 3,481146653 19
55538903 2832 3,067729732 20
55540500 2834 3,514751445 21
55541174 2836 4,030546811 2
55542603 2838 3,483068191 2
55545515 2840 3,038222124 2
55546895 2842 4,033812727 2
55552569 2844 3,539974627 2
55553104 2846 4,012553172 2
55553554 2848 3,509596211 2
55553569 2850 3,468463607 2
55553721 2852 3,46478059 2
55554844 2854 3,468605395 2
55555285 2856 4,022667436 2
55555746 2858 3,472685947 2
55556916 2860 3,503748602 2
55558661 2862 4,021740943 2
55561893 2864 3,496707884 2
55562125 2866 3,487383634 2
55566955 2868 3,289875862 2
55567143 2870 3,303993285 2
55567410 2872 3,349039098 2
55569190 2874 3,546314806 2
55570131 2876 3,501339394 2
55481748 3145 3,011545839 2
plot_ly(type = “scatter3d”, x = data$number, y = data$pos,z = data$log10, color=as.factor(data$am),text=~paste(‘Gene:’),colors=colors)


Can you help me understand the cause of the error in the text?