50818

Have names on the spheres built by rgl package plot3d

Question:

Is there a way to have the names shown when use plot3d(rgl) in R to build a 3d graph, cause it's hard to locate which entry the sphere belongs to when I have many spheres to plot on the same coordinate. For example, I have the data:

x y z A 0.1 -0.5 3.2 B -1.1 1.2 0.8 C 2.0 2.1 0.6 ...... plot3d(data,type="s",radius=0.025)

But, I want to have the name A, B, C shown on the graph as it's easier to observe. Or to have the name shown only when I put the mouse onto one specific sphere. I have tried to use different colors, but when I have like 20 spheres, it seems it will run out of colors or colors are too close to distinguish.

Answer1:

There is a function text3d() in library rgl that can be used to plot texts inside plot. This example shows how to plot row names as texts.

plot3d(data,type="s",radius=0.025) text3d(data$x,data$y,data$z,text=rownames(data))

Answer2:

You can also combine the use of text3d with identify3d() to identify points you want to label interactively with your mouse

Recommend

  • Stable Django-Haystack + elasticsearch setup
  • Plotly - Create Pie Chart with continuous color scale
  • Can't get JSON data from Rails API
  • Zend\\ServiceManager\\ServiceManager::get was unable to fetch or create an instance for getAlbum
  • What is the “center” of a Three.js object?
  • How to remove special characters in file names?
  • PHP Explode from first number (integer)
  • How to setCenter mapview with location in google maps sdk for iOS
  • Spring Web Security locks Neo4j embedded database
  • Parsing tokens with PLY
  • What going wrong in using PropertiesConfiguration?
  • Getting coordinates of a component in java
  • Left fixed columns with table colspan
  • LyX — Title, Abstract, Keywords Missing When Using Elsevier Class in View
  • NSMutableArray instance used in a block
  • XOR with Neural Networks (Matlab)
  • Couchbase: Connection refused
  • Cannot find “Grammar.txt” in python-sphinx
  • pymongo replication secondary readreference not work
  • Does CSS support inheritance [duplicate]
  • Suqueries in select clause with JPA
  • Calculating ratio of reciprocated ties for each node in igraph
  • How to create CGPath from a SKSpriteNode in SWIFT
  • Eclipse MTJ doesn't see Java ME SDK 3.0 devices
  • C# fibonacci function returning errors
  • How to detect interior vertices in groups of 2d polygons? (E.g. ZIP Codes to determine a territory)
  • During installation of Django, why do I keep getting ImportError: No module named django?
  • How to get current document uri in XSLT?
  • Generate random number from custom distribution
  • Convert Type Decimal to Hex (string) in .NET 3.5
  • What is the purpose of TaskExecutor in spring?
  • JBoss External Properties Files in Classpath
  • How to revert to previous XCode version?
  • Mysterious problem with floating point in LISP - time axis generation
  • If I include Java 8 in my Android app does that affect which devices it will work on?
  • how to add data labels for bar graph in matlab
  • embed rChart in Markdown
  • How to get NHibernate ISession to cache entity not retrieved by primary key
  • How can I use `wmic` in a Windows PE script?
  • Unable to use reactive element in my shiny app