2017-02-10 3 views
0

Ich versuche, ein 3D-Scatterplot mit der R-Schnittstelle zu plotten. Mein plotly Anruf ist:plotly 3D-Streudiagramm in R z-Achse und Isomorphis

p.sagittale<-plot_ly(data=filter(temp,tipo=='Caucasici'), x = ~coordX.Sagg , y = ~ coordY.Sagg, z = ~coordZ.Sagg,text = ~punti) %>% 
add_markers(color=~cluster) %>% 
layout(title = paste('Caucasici','Dente',i,'Sagittale'), xaxis = myaxis.list, yaxis = myaxis.list, zaxis=myaxis.list) 

wo der myaxis.list definiert ist als vor:

myaxis.list<- list(
    zeroline = TRUE, 
    showline = TRUE, 
    mirror = "ticks", 
    gridcolor = toRGB("gray50"), 
    gridwidth = 2, 
    zerolinecolor = toRGB("blue"), 
    zerolinewidth = 4, 
    linecolor = toRGB("black"), 
    linewidth = 6, 
    autotick = FALSE, 
    ticks = "outside", 
    tick0 = 0, 
    dtick = 0.25 
) 

Ich habe zwei Fragen: 1. ich eine Warnung erhalten:

" Warnmeldung: 'Layout'-Objekte haben diese Attribute nicht: ' zaxis 'Gültige Attribute sind:' font ',' title ',' titlefont ', ' Autosize ',' Breite ',' Höhe ',' ma rgin ',' paper_bgcolor ', ' plot_bgcolor ',' separators ',' hidesources ',' smith ',' showlegend ', ' dragmode ',' hovermode ',' xaxis ',' yaxis ',' szene ',' geo ',' legende ', ' annotationen ',' formen ',' bilder ',' update menus ',' ternary ',' mapbox ', ' radialaxis ',' angularaxis ',' richtung ',' orientierung ',' barmode ', ' bargap ',' mapType '".

Also meine erste Frage ist: Wie wird die Z-Achse Ästhetik?

  1. Ich hätte gerne einen isomorphen Graphen: gleicher Abstand zwischen den Ticks, gleiche Skalierung auf der x-, y-, z-Achse. Wie kann ich das bekommen?

Vielen Dank im Voraus für Ihre Unterstützung

+1

können Sie einen Datensatz zu Ihrem Beitrag enthalten? – MLavoie

+1

Ja, ein dput-Bild ist hier https://www.dropbox.com/sh/7ct3xpfwwwj555gh/AAAJc7u3aIxIBoN4dtvjKqora?dl=0 –

Antwort

1

Sie müßten Ihre Achsen in einem scene wickeln.

layout(scene = list(xaxis = myaxis.list, 
        yaxis = myaxis.list, 
        zaxis = myaxis.list), 
     ) 

und gibt den Bereich (d.h. obere und untere Grenze) Ihre Achsen über range.

myaxis.list<- list( 
    autorange = FALSE, 
    range = c(-5, 5) 
    [...] 
) 

Der vollständige Code für die Grafik unten

myaxis.list<- list( 
    zeroline = TRUE, 
    showline = TRUE, 
    mirror = "ticks", 
    gridcolor = toRGB("gray50"), 
    gridwidth = 2, 
    zerolinecolor = toRGB("blue"), 
    zerolinewidth = 4, 
    linecolor = toRGB("black"), 
    linewidth = 6, 
    autotick = FALSE, 
    ticks = "outside", 
    tick0 = 0, 
    dtick = 0.25, 
    autorange = FALSE, 
    range = c(-5, 5) 
) 
p.sagittale<-plot_ly(data=filter(temp,tipo=='Caucasici'), x = ~coordX.Sagg , y = ~ coordY.Sagg, z = ~coordZ.Sagg,text = ~punti) %>% 
add_markers(color=~cluster) %>% 
layout(title = paste('Caucasici','Dente',"i",'Sagittale'), scene=list(xaxis = myaxis.list, yaxis = myaxis.list, zaxis=myaxis.list)) 

enter image description here