Я сделал пузырьковую диаграмму, где цвет - это категориальные данные (3 серии), а 3 оси - числовые данные, а также размер пузырьков.
VAR4 является переменной размера этого графика.Одна из моих серий (Model3) имеет только одну точку (где VAR4 = 0), вторая (Model2) имеет одинаковое значение во всех точках переменной размера (VAR4 = 0), а последняя (Model1) имеет разныезначения для VAR4 (от 0 до 1,0).
Это моя команда:
plot_ly(dfPlotTemp, x=~VAR1, y=~VAR2, z=~VAR3,
type='scatter3d', sizes = c(6,12) , mode='markers',
size=~VAR4, color=~Model,
marker = list(symbol = 'circle', sizemode = 'diameter')) %>%
layout(title = 'Final solutions')
Я прикрепил изображение, чтобы лучше объяснить, что происходит.
Что я хотел бы видеть: одна фиолетовая точка (модель3), несколько оранжевых точек (модель2) с таким же размером пурпурной,и некоторая зеленая точка (Model1) с различными размерами, где меньшие зеленые пузырьки имеют тот же размер, что и оранжевые пузырьки (поскольку минимальное значение для VAR4 равно 0, и это значение всех точек в Model 2 и Model3).
Глядя на картинку, размер пузырьков для Model2 (оранжевый) и Model3 (фиолетовый) кажется одинаковым.Тем не менее, Model1 имеет меньшие пузырьковые точки, чем Model2 и Model3, и эта ситуация не может произойти, так как Model2 и Model3 VAR4 = 0, а Model1 VAR4 имеет значения от 0 до 1.0 (я проверял).
Я сделал несколькопоиск в Интернете, и я обнаружил, что эта проблема возникает, когда вы не определяете sizemode = diameter
, но я сделал, и он все еще не работает (https://github.com/ropensci/plotly/issues/1133). Я уже пытался удалить / изменить sizes
параметр и использовать sizeref
, но ни тот, ни другой не сработали.
В соответствии с запросом ниже приводится результат dput (dfPlotTemp). Этот набор данных был перезаписан из файла CSV, и "Cenario" был преобразован какфактор, потому что, несмотря на то, что он состоит из чисел, он не является числовой переменной.
structure(list(Cenario = 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, 1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L, 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), .Label = "2327", class = "factor"),
Model = c("Model2", "Model2", "Model2", "Model2", "Model2",
"Model2", "Model2", "Model2", "Model2", "Model2", "Model2",
"Model2", "Model2", "Model2", "Model2", "Model2", "Model2",
"Model2", "Model2", "Model2", "Model2", "Model2", "Model2",
"Model2", "Model2", "Model2", "Model2", "Model2", "Model2",
"Model2", "Model2", "Model2", "Model2", "Model2", "Model2",
"Model2", "Model2", "Model2", "Model2", "Model2", "Model2",
"Model2", "Model2", "Model2", "Model2", "Model2", "Model2",
"Model2", "Model2", "Model2", "Model2", "Model2", "Model2",
"Model2", "Model2", "Model2", "Model2", "Model2", "Model2",
"Model2", "Model2", "Model2", "Model2", "Model2", "Model2",
"Model2", "Model2", "Model2", "Model2", "Model2", "Model2",
"Model2", "Model2", "Model2", "Model2", "Model2", "Model2",
"Model2", "Model2", "Model2", "Model2", "Model2", "Model2",
"Model2", "Model2", "Model2", "Model2", "Model2", "Model2",
"Model2", "Model2", "Model2", "Model2", "Model2", "Model2",
"Model2", "Model2", "Model2", "Model2", "Model2", "Model2",
"Model2", "Model2", "Model2", "Model2", "Model2", "Model2",
"Model2", "Model2", "Model2", "Model2", "Model2", "Model2",
"Model2", "Model2", "Model2", "Model2", "Model2", "Model2",
"Model2", "Model2", "Model2", "Model2", "Model2", "Model2",
"Model2", "Model2", "Model2", "Model2", "Model2", "Model2",
"Model2", "Model2", "Model2", "Model2", "Model2", "Model2",
"Model2", "Model2", "Model2", "Model2", "Model2", "Model2",
"Model2", "Model2", "Model2", "Model2", "Model2", "Model2",
"Model2", "Model2", "Model2", "Model2", "Model2", "Model2",
"Model2", "Model2", "Model2", "Model2", "Model2", "Model2",
"Model2", "Model2", "Model2", "Model2", "Model2", "Model2",
"Model2", "Model2", "Model2", "Model2", "Model2", "Model2",
"Model2", "Model2", "Model2", "Model2", "Model2", "Model2",
"Model2", "Model2", "Model2", "Model2", "Model2", "Model2",
"Model2", "Model2", "Model2", "Model2", "Model2", "Model2",
"Model2", "Model2", "Model2", "Model2", "Model1", "Model1",
"Model1", "Model1", "Model1", "Model1", "Model1", "Model1",
"Model1", "Model1", "Model1", "Model1", "Model1", "Model1",
"Model1", "Model1", "Model1", "Model1", "Model1", "Model1",
"Model1", "Model1", "Model1", "Model1", "Model1", "Model1",
"Model1", "Model1", "Model1", "Model1", "Model1", "Model1",
"Model1", "Model1", "Model1", "Model1", "Model1", "Model1",
"Model1", "Model1", "Model1", "Model1", "Model1", "Model1",
"Model1", "Model1", "Model1", "Model1", "Model1", "Model1",
"Model1", "Model1", "Model1", "Model1", "Model1", "Model1",
"Model1", "Model1", "Model1", "Model1", "Model1", "Model1",
"Model1", "Model1", "Model1", "Model1", "Model1", "Model1",
"Model1", "Model1", "Model1", "Model1", "Model1", "Model1",
"Model1", "Model1", "Model1", "Model1", "Model1", "Model1",
"Model1", "Model1", "Model1", "Model1", "Model1", "Model1",
"Model1", "Model1", "Model1", "Model1", "Model1", "Model1",
"Model1", "Model1", "Model1", "Model1", "Model1", "Model1",
"Model1", "Model1", "Model1", "Model1", "Model1", "Model1",
"Model1", "Model1", "Model1", "Model1", "Model1", "Model1",
"Model1", "Model1", "Model1", "Model1", "Model1", "Model1",
"Model1", "Model1", "Model1", "Model1", "Model1", "Model1",
"Model1", "Model1", "Model1", "Model1", "Model1", "Model1",
"Model1", "Model1", "Model1", "Model1", "Model1", "Model1",
"Model1", "Model1", "Model1", "Model1", "Model1", "Model1",
"Model1", "Model1", "Model1", "Model1", "Model1", "Model1",
"Model1", "Model1", "Model1", "Model1", "Model1", "Model1",
"Model1", "Model1", "Model1", "Model1", "Model1", "Model1",
"Model1", "Model1", "Model1", "Model1", "Model1", "Model1",
"Model1", "Model1", "Model1", "Model1", "Model1", "Model1",
"Model1", "Model1", "Model1", "Model1", "Model3"), VAR1 = c(2.9252,
2.9252, 0, 1.992, 0, 0, 0, 0, 0.9582, 1.421, 0, 1.421, 0,
1.7302, 0, 0.1509, 0, 0, 3.4013, 1.992, 1.992, 0.0067, 0,
0.1072, 0, 1.2911, 1.992, 0, 1.5388, 3.7707, 3.7707, 0, 1.2911,
0, 0, 3.5704, 0, 0, 0, 0, 0, 0.9582, 3.4025, 0, 2.9252, 3.4002,
0, 0.0668, 0, 1.992, 0, 1.992, 2.9252, 0, 2.9252, 0, 0, 2.9037,
1.992, 0, 0, 3.777, 3.2819, 1.5374, 1.3731, 0, 2.7602, 1.992,
0, 2.9037, 0.954, 0.5146, 0, 1.992, 2.3874, 2.6814, 2.3825,
0, 0, 2.6814, 0, 2.9252, 2.9252, 2.9252, 0, 1.992, 1.992,
2.452, 2.9252, 0, 1.992, 0, 0, 0, 0, 1.2344, 0, 0, 1.2911,
0, 0, 1.2911, 0, 0.9582, 0, 0, 0, 0.3579, 0, 0, 0.6779, 0.1509,
1.827, 2.7602, 0, 0, 0, 1.992, 1.2911, 1.2911, 0.1509, 0,
1.992, 3.4002, 0, 2.7755, 2.6814, 0, 1.6551, 1.992, 0, 0,
2.9037, 2.9252, 0, 2.9252, 2.1804, 1.992, 0, 1.8789, 1.101,
0, 0, 3.7793, 2.7816, 2.9252, 2.9252, 0, 2.9252, 2.8739,
0, 1.2911, 0, 0, 1.992, 0, 0, 0, 0, 2.8375, 1.9669, 1.4506,
2.572, 0.6051, 1.992, 2.9252, 0.5146, 0, 2.9252, 2.9252,
1.992, 1.8646, 3.1557, 0, 1.992, 0, 1.992, 0, 2.9037, 2.9252,
0, 1.992, 1.992, 0.8455, 0, 0.8455, 0, 0.8455, 2.8375, 0.8455,
0.8455, 0.521, 0, 0, 0, 0, 1.29, 0, 0, 1.99, 2.46, 0, 2.9,
0, 0, 2.61, 3.08, 1.45, 0.846, 2.73, 0, 3.7, 2.22, 3.77,
0, 0, 0, 0, 0.846, 2.17, 3.23, 0, 0.846, 0.846, 1.21, 2.76,
0, 0.151, 3.1, 0, 0, 0, 0.12, 0.12, 0, 0, 0, 1.29, 0, 0,
0.2, 0.846, 2.93, 3.4, 0, 2.93, 2.3, 2.68, 3.03, 0, 0.151,
0, 2.33, 3.62, 0, 2.74, 0, 3.4, 0, 0, 0.151, 0, 1.29, 0,
0, 0, 0, 2.68, 3.05, 2.68, 3.62, 0, 0, 3.07, 0, 3.57, 0,
0, 2.93, 1.99, 0, 2.78, 1.11, 2.78, 0, 3.65, 3.32, 2.3, 3.28,
0, 0.846, 0, 0, 0.151, 1.52, 1.7, 0.316, 2.76, 2.68, 0, 2.68,
0, 0, 0, 1.21, 3.53, 2.04, 1.82, 2.12, 0, 2.97, 2.03, 0,
0, 2.68, 0.312, 2.93, 0, 2.96, 3.78, 1.97, 0, 0, 0, 0, 2.17,
1.91, 3.23, 0, 2.68, 3.31, 1.37, 2.68, 3.16, 0, 0, 0, 2.67,
2.34, 1.21, 0.958, 2.68, 0, 2.68, 2.68, 0, 0, 0, 0.546, 1.36,
1.39, 3.48, 0, 3.33, 0, 2.93, 0, 1.99, 2.93, 0, 3.7, 0, 1.99,
3.7, 1.99, 1.29, 0, 0, 0, 0), VAR2 = c(25.002, 9.003, 26.003,
3.002, 32.004, 2.002, 40.002, 13.002, 0.001, 7.003, 9.002,
8.003, 10.002, 8.001, 38.003, 8.001, 19.003, 9.002, 26.002,
12.002, 22.002, 33.003, 21.003, 8.001, 31.002, 8.001, 23.002,
32.003, 19.003, 12.002, 16.003, 36.003, 8.001, 1.002, 11.002,
24.002, 27.003, 42.004, 38.003, 0.001, 13.002, 0.001, 0.001,
15.002, 12.002, 3.003, 26.002, 8.002, 0.001, 12.002, 24.002,
3.002, 12.002, 24.002, 25.002, 27.002, 30.003, 25.002, 12.002,
15.002, 29.002, 28.002, 19.002, 108.003, 12.003, 14.002,
8.002, 7.003, 13.003, 15.002, 8.003, 14.002, 17.002, 3.002,
34.002, 22.002, 23.002, 26.002, 23.002, 25.003, 15.002, 11.003,
6.002, 2.002, 5.002, 12.002, 6.003, 18.003, 12.002, 15.002,
3.002, 17.002, 13.002, 11.002, 12.002, 8.001, 15.002, 21.003,
8.001, 8.001, 15.002, 8.001, 15.002, 0.001, 0.001, 27.002,
11.002, 8.001, 30.002, 9.002, 29.003, 9.002, 23.002, 22.002,
27.002, 34.003, 6.002, 3.002, 8.001, 11.003, 8.001, 13.003,
12.002, 11.002, 18.003, 12.002, 22.002, 26.003, 26.002, 12.002,
15.002, 13.003, 25.002, 4.003, 32.004, 21.002, 3.002, 12.002,
25.002, 33.003, 36.003, 35.003, 37.003, 31.003, 24.002, 22.002,
12.003, 27.002, 15.003, 10.004, 19.003, 11.003, 15.002, 13.003,
3.002, 8.002, 0.001, 8.002, 0.001, 12.002, 25.004, 39.004,
34.004, 38.004, 3.002, 19.003, 5.002, 22.003, 2.002, 12.002,
6.003, 31.003, 31.002, 40.002, 3.002, 15.002, 12.002, 20.003,
25.002, 12.002, 30.003, 12.002, 16.003, 10.002, 14.002, 10.002,
14.002, 10.003, 12.002, 15.002, 14.002, 51.003, 1.002, 0.001,
8.002, 12, 8, 10, 29, 23, 41, 34, 25, 33, 23, 33, 41, 24,
17, 13, 39, 14, 13, 12, 2, 11, 0.001, 14, 10, 4, 3, 28, 24,
15, 11, 8, 35, 12, 40, 28, 30, 23, 13, 3, 23, 40, 16, 8,
30, 26, 10, 6, 12, 2, 6, 4, 35, 30, 22, 47, 8, 9, 24, 14,
18, 14, 15, 11, 12, 15, 8, 21, 8, 7, 8, 0.001, 27, 18, 20,
12, 22, 17, 21, 8, 16, 24, 36, 50, 4, 5, 24, 12, 4, 3, 17,
2, 2, 23, 22, 34, 10, 14, 10, 8, 8, 8, 11, 8, 1, 14, 5, 27,
28, 31, 36, 37, 55, 48, 52, 14, 6, 10, 42, 23, 20, 30, 25,
35, 22, 21, 29, 47, 30, 16, 14, 4, 9, 3, 14, 4, 0.001, 1,
20, 24, 32, 0.001, 31, 28, 10, 29, 0.001, 14, 35, 5, 4, 0.001,
9, 13, 8, 29, 28, 23, 31, 34, 34, 25, 15, 3, 12, 13, 3, 15,
3, 2, 3, 3, 2, 1, 26, 21), VAR3 = c(12L, 13L, 14L, 15L, 13L,
16L, 13L, 14L, 14L, 15L, 14L, 13L, 16L, 14L, 12L, 15L, 14L,
17L, 13L, 15L, 14L, 19L, 15L, 16L, 12L, 12L, 16L, 16L, 18L,
15L, 14L, 15L, 12L, 13L, 12L, 16L, 17L, 16L, 12L, 17L, 13L,
15L, 14L, 13L, 13L, 15L, 12L, 13L, 14L, 13L, 14L, 16L, 13L,
15L, 12L, 14L, 13L, 13L, 16L, 14L, 17L, 16L, 17L, 16L, 13L,
12L, 13L, 18L, 15L, 14L, 18L, 14L, 14L, 17L, 13L, 14L, 14L,
12L, 15L, 13L, 13L, 13L, 14L, 15L, 15L, 16L, 17L, 14L, 14L,
16L, 20L, 14L, 17L, 20L, 18L, 17L, 15L, 13L, 12L, 14L, 12L,
12L, 12L, 15L, 17L, 12L, 13L, 15L, 11L, 14L, 11L, 13L, 16L,
13L, 13L, 12L, 13L, 16L, 14L, 12L, 16L, 12L, 18L, 15L, 14L,
15L, 15L, 12L, 12L, 18L, 14L, 15L, 13L, 14L, 13L, 13L, 18L,
16L, 13L, 15L, 17L, 18L, 15L, 21L, 12L, 14L, 16L, 12L, 15L,
12L, 12L, 12L, 13L, 14L, 17L, 12L, 13L, 12L, 13L, 16L, 17L,
16L, 16L, 18L, 20L, 13L, 14L, 13L, 14L, 13L, 17L, 12L, 12L,
12L, 18L, 15L, 15L, 14L, 13L, 13L, 14L, 15L, 14L, 16L, 12L,
15L, 12L, 14L, 19L, 16L, 18L, 20L, 14L, 15L, 13L, 13L, 13L,
15L, 12L, 15L, 14L, 17L, 13L, 17L, 18L, 17L, 16L, 14L, 15L,
16L, 17L, 15L, 18L, 19L, 15L, 13L, 16L, 14L, 14L, 16L, 15L,
17L, 16L, 17L, 12L, 12L, 12L, 15L, 13L, 16L, 15L, 18L, 13L,
16L, 16L, 12L, 14L, 12L, 14L, 17L, 16L, 17L, 13L, 15L, 14L,
14L, 23L, 13L, 14L, 21L, 14L, 12L, 16L, 17L, 17L, 18L, 13L,
13L, 15L, 13L, 18L, 12L, 13L, 13L, 12L, 13L, 12L, 17L, 16L,
18L, 13L, 13L, 12L, 14L, 13L, 13L, 16L, 18L, 13L, 16L, 13L,
14L, 16L, 16L, 14L, 16L, 16L, 12L, 13L, 12L, 16L, 13L, 12L,
17L, 16L, 15L, 19L, 13L, 17L, 12L, 16L, 19L, 17L, 15L, 14L,
15L, 15L, 17L, 14L, 14L, 12L, 13L, 15L, 12L, 13L, 13L, 13L,
12L, 15L, 17L, 14L, 17L, 13L, 14L, 14L, 15L, 14L, 14L, 12L,
12L, 15L, 13L, 15L, 13L, 13L, 16L, 13L, 12L, 13L, 12L, 15L,
12L, 13L, 13L, 15L, 16L, 13L, 12L, 12L, 16L, 20L, 14L, 18L,
14L, 16L, 12L, 13L, 17L, 13L, 15L, 17L, 14L, 19L, 18L, 22L,
12L, 14L, 15L, 12L, 14L), VAR4 = c(0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0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