- Create a data tip and right-click on it. Edit content and style.
- You'll see a popover that has "DataTipRows". Click that and then click the field you want to adjust. Format is set to AUTO.
- Type in the precision you want into that field using MATLAB's standard nomenclature, so for 5 spaces and 3 decimal points as a float: %5.3f
- This will affect the datatips globally on a plot. If you set the decimal precision then the requisite number of zeros should appear.
Increasing datatip display precision (MATLAB 2019a)
376 views (last 30 days)
Help! I want to increase the datatip display precision. How do I do this? Is it possible to do this automatically for all datatips?
If that is not possible, is there a way to at least make the datatip display the same level of precision (show the same number of digits after the decimal point)? In my case (photo attached), the datatip is not showing zeros. I want these datatips to show 0,25220 and 0,80351.
Thank you in advance.
Peter O on 4 Jul 2021
Quick and dirty way (works in 2021, I think should still work in 2019):
There's also a programmatic way, which is the backdoor to that and just involves a few function calls. Let me know if you need that and I can dig it up. I've used it in the past to add things like a third row to display an index or identifier of a data point (helpful for image processing and pareto plot point identification)
More Answers (2)
Mike on 29 Sep 2021
Peter O's approach can be implemented programatically by modifying the DataTipTemplate.
p = plot(x,y);
p.DataTipTemplate.DataTipRows(1).Format = '%g'; % x
p.DataTipTemplate.DataTipRows(2).Format = '%g'; % y