ChatGPT-4:
------ Query: ----------------------------------
Thank you. The `value` in the code example is 2874. The plot shows a large
number at the center and a smaller value computed as a delta relative to the
`reference` of 4800. But the large value is given as 2870, and the smaller value
is given as -1930 i.e. both values are rounded. Can I control the precision of
these two numbers?
------ Response: -------------------------------
In Plotly, you can control the precision of the numbers by specifying the
`valueformat` and `delta.valueformat` parameters. These parameters accept a
string in the format that is used by the C `printf` function. For example,
`%.2f` specifies a number with two digits after the decimal point. Here is an
example:
```R
plotly::plot_ly(
domain = list(x = c(0, 1), y = c(0, 1)),
value = 2874,
title = list(text = "Generic"),
type = "indicator",
mode = "gauge+number+delta",
number = list(valueformat = "%.2f"),
delta = list(reference = 4800, valueformat = "%.2f"),
gauge = list(
axis = list(range = list(NULL, 5000),
tickfont = list(size = 20, family = "Arial")),
bar = list(color = "blue"),
steps = list(
list(range = c(0, 4800), color = "white"),
list(range = c(4800, 6000), color = "red")),
threshold = list(
line = list(color = "black", width = 6),
thickness = 0.75,
value = 4800)))
```
In this example, both the main number and the delta value will be displayed with
two decimal places. You can adjust these strings to display the numbers with the
precision you prefer.
-------------------------------------------------
Here you go. I have no idea how it does this, and have a discussion on elements
of "Sein und Zeit" and book 19 of the Odyssey, and tutor me in Italian
conversation, and draft Mermaid mind-maps - but here we are.
:-)
> On Jul 22, 2023, at 10:50, Thomas Subia <tgs77m at yahoo.com> wrote:
>
> \In this example, the value was 2324, the gauge displays 2320.
> I'm not sure why this occurs. Changing the statement to 56, results in
the gauge reading 60. I'm not sure what needs to be changed in the script or
the environment to stop rounding.
> On Jul 22, 2023, at 10:43, Boris Steipe <boris.steipe at utoronto.ca>
wrote:
>
> What do you mean "Rounded"?
> What do you expect, what do you get instead?
>
> ?
>
>
>
>
>
>> On Jul 22, 2023, at 10:40, Thomas Subia via R-help <r-help at
r-project.org> wrote:
>>
>> Colleagues,
>> Thanks for the update.
>> My colleagues at work have run this script but the resulting graph
output for value is rounded. How can one turn this annoying feature off?
>> I've googled this but to no avail.
>>
>>
>>
>>
>> [[alternative HTML version deleted]]
>>
>> ______________________________________________
>> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide
http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>
> ______________________________________________
> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.