Data cursor showing color value
Show older comments
Is there a way to get the data cursor to list the X,Y,Z coordinates and the value from the colorbar in a 3d scatter plot with the dots colored by a 4th column vector?
the default data cursor gives only X,Y,Z.
thanks Greg
Accepted Answer
More Answers (1)
Gregory McFadden
on 27 Sep 2016
1 vote
1 Comment
Michael Abboud
on 27 Sep 2016
If you are using a version of MATLAB such as R2014a or earlier, then graphics generally work a bit differently from newer releases. You can refer to the following link for more information about the graphics changes in MATLAB R2014b:
-
If your version of MATLAB is pre-R2014b, try replacing the terms such as “event_obj.Target.XData” with the following:
>> get( get(event_obj, 'Target'), 'XData')
And then replace the specific line:
>> value = event_obj.Target.CData(idx(1));
With the following:
>> CData = get( get(event_obj, 'Target'), 'CData');
>> value = CData(idx(1));
Also note that I am using an example from the "scatter3" documentation page to test my solution. Perhaps see if you can get it working with the 3rd example, "Vary Marker Color", and then generalize to your own code. You can find the "scatter3" documentation page below:
Categories
Find more on Scatter Plots in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!