Re: [R] plotly
Hi, ke, 2023-07-26 kello 02:04 +, Thomas Subia via R-help kirjoitti: > Question 1:How can I save the plotly graph with a specific graph > size?Using ggsave, one can define the height, width and unit of > measure, is there something similar in plotly?Since I am creating the > same gauge plot but with different data, I'd like all the resulting > graphs to have the same size. I've googled this but to no avail, Maybe this: plotly_IMAGE See ?plotly_IMAGE for details, especially 'height' and 'width' should be of interest for you. > Question 2:How can I adjust the tick marks of the gauge? Ideally the > tick marks should be set at seq(0,9600,1200) Try this (notice 'tickvals' in gauge/axis: --- snip --- plot_ly( domain = list(x = c(0, .5), y = c(0,0.5)), value = 319, title = list(text = "Example\n4,800 Target",font=t), type = "indicator", mode = "gauge+number+delta", number = list(valueformat = "%.2f",font=t5), delta = list(reference = 4800, valueformat = "%.2f",font=t3), gauge = list( axis = list(range = list(NULL, 9600), tickformat = "%d", tickvals = seq(0,9600,1200), tickfont = list(size = 12, face="bold",family = "Arial")), bar = list(color = "black"), steps = list( list(range = seq(0, 4800,1200), color = 'AAFF00'), list(range = seq(4800, 9600,1200), color = 'ffb2b2')), threshold = list( line = list(color = "black", width = 8), thickness = 0.75, value = 4800))) --- snip --- HTH, Kimmo __ R-help@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.
Re: [R] plotly
Colleagues, Here is my reproducible code. library(plotly) t <- list( family = "Arial", size = 12, color = "black", face="bold") t3 <- list( family = "Arial", size = 12, color = "black", face="bold") t5 <- list( family = "Arial", size = 12, color = "black", face="bold") plot_ly( domain = list(x = c(0, .5), y = c(0,0.5)), value = 319, title = list(text = "Example\n4,800 Target",font=t), type = "indicator", mode = "gauge+number+delta", number = list(valueformat = "%.2f",font=t5), delta = list(reference = 4800, valueformat = "%.2f",font=t3), gauge = list( axis = list(range = list(NULL, 9600), tickfont = list(size = 12, face="bold",family = "Arial")), bar = list(color = "black"), steps = list( list(range = c(0, 4800), color = 'AAFF00'), list(range = c(4800, 9600), color = 'ffb2b2')), threshold = list( line = list(color = "black", width = 8), thickness = 0.75, value = 4800))) Question 1:How can I save the plotly graph with a specific graph size?Using ggsave, one can define the height, width and unit of measure, is there something similar in plotly?Since I am creating the same gauge plot but with different data, I'd like all the resulting graphs to have the same size. I've googled this but to no avail, Question 2:How can I adjust the tick marks of the gauge? Ideally the tick marks should be set at seq(0,9600,1200) Thanks everyone! Thomas Subia On Saturday, July 22, 2023 at 08:10:52 AM PDT, Boris Steipe wrote: 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. :-) > > \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 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 >> 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@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, reproducibl
Re: [R] plotly
Many thanks for this! This is an elegant solution! After looking at my script, I still do not understand is how the rounding occurs. After reading the plotly documentation, unless I am missing something, this wasn't covered. On Saturday, July 22, 2023 at 08:10:52 AM PDT, Boris Steipe wrote: 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. :-) > > \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 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 >> 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@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@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. [[alternative HTML version deleted]] __ R-help@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.
Re: [R] plotly
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 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 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 >> 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@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@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@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.
Re: [R] plotly
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 > 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@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@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.
Re: [R] plotly
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@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.
Re: [R] plotly question
I was just replying to say which bit do you consider the indicator. But I see Boris has provided a Chat GPT solution. Running it hopefully shows you how to change colours on various parts. On Fri, 21 Jul 2023, 22:43 Jeff Newmiller, wrote: > plotly is _not_ associated with posit. I think you are unlikely to find > expertise with plotly in their forums. You might find help at > stackoverflow.com. > > On July 21, 2023 1:40:49 PM PDT, Bert Gunter > wrote: > >As you apparently haven't received any responses yet, I'll try to > >suggest something useful. However, I have absolutely zero experience > >with plotly, so this is just from general principles and reading the > >plot_ly Help file, which says for the "..." arguments: > > > >"Arguments (i.e., attributes) passed along to the trace type. See > >schema() for a list of acceptable attributes for a given trace type > >(by going to traces -> type -> attributes). Note that attributes > >provided at this level may override other arguments (e.g. plot_ly(x = > >1:10, y = 1:10, color = I("red"), marker = list(color = "blue")))." > > > >So I would **guess** that you needs to go to ?schema to see if the > >further attributes of your "gauge" type that you wish to change are > >there. > > > >Alternatively, plotly is a package from posit.co, formerly RStudio; > >they have an extensive support site and community here: > >https://posit.co/support/ > >So you may have success there. > > > >Finally, I assume you have tried web searching appropriate search > >queries, but if not, you should do so. It is sometimes surprising how > >much you can find that way. > > > >... and, again, apologies if my ignorance means my suggestions are > useless. > > > >Cheers, > >Bert > > > > > >On Fri, Jul 21, 2023 at 6:19 AM Thomas Subia via R-help > > wrote: > >> > >> Colleagues > >> > >> Here is my reproducible code > >> > >> plot_ly( > >> domain = list(x = c(0, 1), y = c(0, 1)), > >> value = 2874, > >> title = list(text = "Generic"), > >> type = "indicator", > >> mode = "gauge+number+delta", > >> delta = list(reference = 4800), > >> gauge = list( > >> axis =list(range = list(NULL, 5000)), > >> 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))) > >> > >> How can I change the indicator color from green to some other color? > >> > >> How can I change the typeface and font size of the speedometer tick > mark font size? > >> > >> Thomas Subia > >> > >> [[alternative HTML version deleted]] > >> > >> __ > >> R-help@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@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. > > -- > Sent from my phone. Please excuse my brevity. > > __ > R-help@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. > [[alternative HTML version deleted]] __ R-help@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.
Re: [R] plotly question
Since it is 2023, I asked that question to ChatGPT-4 and got the following response. - The `plotly` library in R uses the `gauge` argument inside the `plot_ly` function to specify the properties of the gauge plot. You can change the indicator color of the arc (also known as the bar) by setting the `bar` property inside `gauge`, and the `font` property for modifying the typeface and font size of the tick marks on the arc. Below is an example that modifies your code to change the indicator color of the arc to blue and sets the font to Arial with a size of 20: ```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", delta = list(reference = 4800), 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))) ``` Please note that the colors are specified by strings that can either be a CSS-acceptable color name or a hexadecimal color code. You can adjust the `tickfont` size and family properties according to your preferences. --- That seems to do what was requested - the bar is blue now, and changing "Arial" to "Times" in the code indeed has the expected effect. Nice. Boris > On Jul 21, 2023, at 17:43, Jeff Newmiller wrote: > > plotly is _not_ associated with posit. I think you are unlikely to find > expertise with plotly in their forums. You might find help at > stackoverflow.com. > > On July 21, 2023 1:40:49 PM PDT, Bert Gunter wrote: >> As you apparently haven't received any responses yet, I'll try to >> suggest something useful. However, I have absolutely zero experience >> with plotly, so this is just from general principles and reading the >> plot_ly Help file, which says for the "..." arguments: >> >> "Arguments (i.e., attributes) passed along to the trace type. See >> schema() for a list of acceptable attributes for a given trace type >> (by going to traces -> type -> attributes). Note that attributes >> provided at this level may override other arguments (e.g. plot_ly(x = >> 1:10, y = 1:10, color = I("red"), marker = list(color = "blue")))." >> >> So I would **guess** that you needs to go to ?schema to see if the >> further attributes of your "gauge" type that you wish to change are >> there. >> >> Alternatively, plotly is a package from posit.co, formerly RStudio; >> they have an extensive support site and community here: >> https://posit.co/support/ >> So you may have success there. >> >> Finally, I assume you have tried web searching appropriate search >> queries, but if not, you should do so. It is sometimes surprising how >> much you can find that way. >> >> ... and, again, apologies if my ignorance means my suggestions are useless. >> >> Cheers, >> Bert >> >> >> On Fri, Jul 21, 2023 at 6:19 AM Thomas Subia via R-help >> wrote: >>> >>> Colleagues >>> >>> Here is my reproducible code >>> >>> plot_ly( >>> domain = list(x = c(0, 1), y = c(0, 1)), >>> value = 2874, >>> title = list(text = "Generic"), >>> type = "indicator", >>> mode = "gauge+number+delta", >>> delta = list(reference = 4800), >>> gauge = list( >>>axis =list(range = list(NULL, 5000)), >>>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))) >>> >>> How can I change the indicator color from green to some other color? >>> >>> How can I change the typeface and font size of the speedometer tick mark >>> font size? >>> >>> Thomas Subia >>> >>>[[alternative HTML version deleted]] >>> >>> __ >>> R-help@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://w
Re: [R] plotly question
plotly is _not_ associated with posit. I think you are unlikely to find expertise with plotly in their forums. You might find help at stackoverflow.com. On July 21, 2023 1:40:49 PM PDT, Bert Gunter wrote: >As you apparently haven't received any responses yet, I'll try to >suggest something useful. However, I have absolutely zero experience >with plotly, so this is just from general principles and reading the >plot_ly Help file, which says for the "..." arguments: > >"Arguments (i.e., attributes) passed along to the trace type. See >schema() for a list of acceptable attributes for a given trace type >(by going to traces -> type -> attributes). Note that attributes >provided at this level may override other arguments (e.g. plot_ly(x = >1:10, y = 1:10, color = I("red"), marker = list(color = "blue")))." > >So I would **guess** that you needs to go to ?schema to see if the >further attributes of your "gauge" type that you wish to change are >there. > >Alternatively, plotly is a package from posit.co, formerly RStudio; >they have an extensive support site and community here: >https://posit.co/support/ >So you may have success there. > >Finally, I assume you have tried web searching appropriate search >queries, but if not, you should do so. It is sometimes surprising how >much you can find that way. > >... and, again, apologies if my ignorance means my suggestions are useless. > >Cheers, >Bert > > >On Fri, Jul 21, 2023 at 6:19 AM Thomas Subia via R-help > wrote: >> >> Colleagues >> >> Here is my reproducible code >> >> plot_ly( >> domain = list(x = c(0, 1), y = c(0, 1)), >> value = 2874, >> title = list(text = "Generic"), >> type = "indicator", >> mode = "gauge+number+delta", >> delta = list(reference = 4800), >> gauge = list( >> axis =list(range = list(NULL, 5000)), >> 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))) >> >> How can I change the indicator color from green to some other color? >> >> How can I change the typeface and font size of the speedometer tick mark >> font size? >> >> Thomas Subia >> >> [[alternative HTML version deleted]] >> >> __ >> R-help@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@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. -- Sent from my phone. Please excuse my brevity. __ R-help@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.
Re: [R] plotly question
As you apparently haven't received any responses yet, I'll try to suggest something useful. However, I have absolutely zero experience with plotly, so this is just from general principles and reading the plot_ly Help file, which says for the "..." arguments: "Arguments (i.e., attributes) passed along to the trace type. See schema() for a list of acceptable attributes for a given trace type (by going to traces -> type -> attributes). Note that attributes provided at this level may override other arguments (e.g. plot_ly(x = 1:10, y = 1:10, color = I("red"), marker = list(color = "blue")))." So I would **guess** that you needs to go to ?schema to see if the further attributes of your "gauge" type that you wish to change are there. Alternatively, plotly is a package from posit.co, formerly RStudio; they have an extensive support site and community here: https://posit.co/support/ So you may have success there. Finally, I assume you have tried web searching appropriate search queries, but if not, you should do so. It is sometimes surprising how much you can find that way. ... and, again, apologies if my ignorance means my suggestions are useless. Cheers, Bert On Fri, Jul 21, 2023 at 6:19 AM Thomas Subia via R-help wrote: > > Colleagues > > Here is my reproducible code > > plot_ly( > domain = list(x = c(0, 1), y = c(0, 1)), > value = 2874, > title = list(text = "Generic"), > type = "indicator", > mode = "gauge+number+delta", > delta = list(reference = 4800), > gauge = list( > axis =list(range = list(NULL, 5000)), > 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))) > > How can I change the indicator color from green to some other color? > > How can I change the typeface and font size of the speedometer tick mark font > size? > > Thomas Subia > > [[alternative HTML version deleted]] > > __ > R-help@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@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] plotly question
Colleagues Here is my reproducible code plot_ly( domain = list(x = c(0, 1), y = c(0, 1)), value = 2874, title = list(text = "Generic"), type = "indicator", mode = "gauge+number+delta", delta = list(reference = 4800), gauge = list( axis =list(range = list(NULL, 5000)), 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))) How can I change the indicator color from green to some other color? How can I change the typeface and font size of the speedometer tick mark font size? Thomas Subia [[alternative HTML version deleted]] __ R-help@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.
Re: [R] Plotly
Bert Ok I'll give that a shot too. Jeff -Original Message- From: Bert Gunter Sent: Monday, November 8, 2021 1:16 PM To: reichm...@sbcglobal.net Cc: R-help Subject: Re: [R] Plotly As Plotly for R is a product of private company, your query is off topic here (though you may get a response if you are lucky). They have their own Help forum to which you should post instead: https://community.plotly.com/c/graphing-libraries/r/9 Bert Gunter "The trouble with having an open mind is that people keep coming along and sticking things into it." -- Opus (aka Berkeley Breathed in his "Bloom County" comic strip ) On Mon, Nov 8, 2021 at 10:25 AM Jeff Reichman wrote: > > R Help Forum > > > > Anyone know if there are Plotly issues ones need to be aware of. For > example I quite often receive the following error "Error in > dirname(to) : path too long." I find there is no one fix. Is there > some sort of Windows /Plotly naming restrictions??? > > > > # create a line chart displaying launches by agency type, with > highlighting > > shared_launches %>% > > plot_ly(x = ~launch_year, y = ~n, color = ~agency_type) %>% > > add_lines() %>% > > highlight() > > > > Jeff > > > [[alternative HTML version deleted]] > > __ > R-help@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@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.
Re: [R] Plotly
I don't know any details of Plotly, but Windows does have a directory depth limit that can be very frustrating. I think there is a registry setting that can help alleviate, but it breaks some things so it is highly dependent on how you use your computer as to whether you can take advantage of that setting. On November 8, 2021 11:15:59 AM PST, Bert Gunter wrote: >As Plotly for R is a product of private company, your query is off >topic here (though you may get a response if you are lucky). They have >their own Help forum to which you should post instead: > >https://community.plotly.com/c/graphing-libraries/r/9 > > >Bert Gunter > >"The trouble with having an open mind is that people keep coming along >and sticking things into it." >-- Opus (aka Berkeley Breathed in his "Bloom County" comic strip ) > >On Mon, Nov 8, 2021 at 10:25 AM Jeff Reichman wrote: >> >> R Help Forum >> >> >> >> Anyone know if there are Plotly issues ones need to be aware of. For example >> I quite often receive the following error "Error in dirname(to) : path too >> long." I find there is no one fix. Is there some sort of Windows /Plotly >> naming restrictions??? >> >> >> >> # create a line chart displaying launches by agency type, with highlighting >> >> shared_launches %>% >> >> plot_ly(x = ~launch_year, y = ~n, color = ~agency_type) %>% >> >> add_lines() %>% >> >> highlight() >> >> >> >> Jeff >> >> >> [[alternative HTML version deleted]] >> >> __ >> R-help@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@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. -- Sent from my phone. Please excuse my brevity. __ R-help@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.
Re: [R] Plotly
As Plotly for R is a product of private company, your query is off topic here (though you may get a response if you are lucky). They have their own Help forum to which you should post instead: https://community.plotly.com/c/graphing-libraries/r/9 Bert Gunter "The trouble with having an open mind is that people keep coming along and sticking things into it." -- Opus (aka Berkeley Breathed in his "Bloom County" comic strip ) On Mon, Nov 8, 2021 at 10:25 AM Jeff Reichman wrote: > > R Help Forum > > > > Anyone know if there are Plotly issues ones need to be aware of. For example > I quite often receive the following error "Error in dirname(to) : path too > long." I find there is no one fix. Is there some sort of Windows /Plotly > naming restrictions??? > > > > # create a line chart displaying launches by agency type, with highlighting > > shared_launches %>% > > plot_ly(x = ~launch_year, y = ~n, color = ~agency_type) %>% > > add_lines() %>% > > highlight() > > > > Jeff > > > [[alternative HTML version deleted]] > > __ > R-help@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@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] Plotly
R Help Forum Anyone know if there are Plotly issues ones need to be aware of. For example I quite often receive the following error "Error in dirname(to) : path too long." I find there is no one fix. Is there some sort of Windows /Plotly naming restrictions??? # create a line chart displaying launches by agency type, with highlighting shared_launches %>% plot_ly(x = ~launch_year, y = ~n, color = ~agency_type) %>% add_lines() %>% highlight() Jeff [[alternative HTML version deleted]] __ R-help@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] plotly: ability to drag points on x axis only and prevent change of y axis value
Hello, wonder if you could provide input on the following: please see toy example below, wanted to see if there is a way to have restrictions on how the points are dragged on the plot. More specifically I would like the points draggable horizontally ONLY and have their y axis value remain fixed, ie the movement vertically would be restricted and no change allowed to that direction for each point? much appreciate any input you may have, library(plotly) library(purrr) # creates a list of 32 circle shapes (one for each row/car) circles <- map2( mtcars$mpg, mtcars$wt, ~list( type = "circle", # anchor circles at (mpg, wt) xanchor = .x, yanchor = .y, # give each circle a 2 pixel diameter x0 = -5, x1 = 5, y0 = -5, y1 = 5, xsizemode = "pixel", ysizemode = "pixel", # other visual properties fillcolor = "blue", line = list(color = "transparent") ) ) plot_ly() %>% layout(shapes = circles) %>% config(edits = list(shapePosition = TRUE)) appreciate the help, thanks, Andras __ R-help@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] plotly example that highlights a line
Hi All: In searching online, I have found examples of using plotly with ggplot2 graphics, say using geom_line, where there are multiple lines and by selecting the "factor" in the legend makes the particular line disappear or reappear (see https://plot.ly/ggplot2/). I am wondering if anyone's an example or knows how to set it up, so that instead if I click on the factor in the legend it highlights the line, and hen unhighlights if i select again Thanks for any help. -Roy ** "The contents of this message do not reflect any position of the U.S. Government or NOAA." ** Roy Mendelssohn Supervisory Operations Research Analyst NOAA/NMFS Environmental Research Division Southwest Fisheries Science Center ***Note new street address*** 110 McAllister Way Santa Cruz, CA 95060 Phone: (831)-420-3666 Fax: (831) 420-3980 e-mail: roy.mendelss...@noaa.gov www: http://www.pfeg.noaa.gov/ "Old age and treachery will overcome youth and skill." "From those who have been given much, much will be expected" "the arc of the moral universe is long, but it bends toward justice" -MLK Jr. __ R-help@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.
Re: [R] plotly
Hey Shane, Sorry you're having trouble. The quick start is here and walks through installation: https://plot.ly/r/. A note. If you're on Windows, you'll need Rtools to install devtools: http://cran.rstudio.com/bin/windows/Rtools/. As Sarah noted, Plotly isn't on CRAN. If you're having trouble, please let us know and we're happy to try and help, or open an issue on GitHub: https://github.com/ropensci/plotly/issues. M On Mon, Jul 21, 2014 at 4:05 AM, Sarah Goslee sarah.gos...@gmail.com wrote: Hi, On Monday, July 21, 2014, Shane Carey careys...@gmail.com wrote: Hey, What version of R is required to use the plotly library? I have R version 3.0.1 and it will not allow me to install the devtools package or the ploty package. I have googled and searched to see what version of R I should be running but could not find anything. It's always a good idea to upgrade to the current release of R before asking questions like that (3.1.1). But in general, packages on CRAN clearly state what version of R is needed, as in http://cran.r-project.org/web/packages/devtools/index.html devtools: Tools to make developing R code easier Collection of package development tools Version:1.5Depends:R (⥠3.0.2) For packages not on CRAN, like plotly, you may need to download the package and check the DESCRIPTION file. Sarah -- Sarah Goslee http://www.stringpage.com http://www.sarahgoslee.com http://www.functionaldiversity.org [[alternative HTML version deleted]] __ R-help@r-project.org mailing list 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. [[alternative HTML version deleted]] __ R-help@r-project.org mailing list 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] plotly
Hey, What version of R is required to use the plotly library? I have R version 3.0.1 and it will not allow me to install the devtools package or the ploty package. I have googled and searched to see what version of R I should be running but could not find anything. Thanks -- Shane [[alternative HTML version deleted]] __ R-help@r-project.org mailing list 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.
Re: [R] plotly
Hi, On Monday, July 21, 2014, Shane Carey careys...@gmail.com wrote: Hey, What version of R is required to use the plotly library? I have R version 3.0.1 and it will not allow me to install the devtools package or the ploty package. I have googled and searched to see what version of R I should be running but could not find anything. It's always a good idea to upgrade to the current release of R before asking questions like that (3.1.1). But in general, packages on CRAN clearly state what version of R is needed, as in http://cran.r-project.org/web/packages/devtools/index.html devtools: Tools to make developing R code easier Collection of package development tools Version:1.5Depends:R (⥠3.0.2) For packages not on CRAN, like plotly, you may need to download the package and check the DESCRIPTION file. Sarah -- Sarah Goslee http://www.stringpage.com http://www.sarahgoslee.com http://www.functionaldiversity.org [[alternative HTML version deleted]] __ R-help@r-project.org mailing list 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] Plotly and rOpenSci: R and ggplot2 interactive, online, collaborative plotting
Hello R help, My name is Matt, and I'm a co-founder at Plotly http://plot.ly, an online graphing and analytics project. We're building an R library http://plot.ly/r as part of the rOpenScihttp://ropensci.orgproject. You can use it to make interactive, web-based R and ggplot2 plots. The plots are shareable, embeddable, and drawn with D3 (a JS graphing library). You can also make R and ggplot2 plots into collaborative, web-based plots. The project is still definitely in beta, so we'd appreciate hearing your suggestions and issues. Here is how the ggplot2 sharing works: ropensci.org/blog/2014/04/17/plotly/ Another fun aspect of it is that you can collaboratively plot in R, Python, MATLAB, and from our web app. That means you could work from R with a team working from Excel and work on the same plots and data. And your data and plots always stay together in your files. Here's how that looks in an IPython Notebook: http://nbviewer.ipython.org/gist/msund/61cdbd5b22c103fffb84 We'd love to hear your thoughts, feedback, and suggestions. Our goal is to be a GitHub for sharing and collaborating on data and plots. We're on GitHubhttp://github.com/ropensci/plotly, and eager to hear from you. Thanks so much for any and all help and advice. All the best, Matt [[alternative HTML version deleted]] __ R-help@r-project.org mailing list 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] Plotly Beta: Online Plotting with R
Hi R Users, My name is Matt, and I'm a part of Plotly http://plot.ly. We recently released an R plotting library http://plot.ly/api/r for making publication-quality graphs online. We wanted to let the folks on this list know. A basic summary: - Make publication-quality, online plots with a GUI and R. - Fits, error bars, stats, and functions. - Embed interactive graphs in an iframe (Washington Post examplehttp://washingtonpost.com/blogs/wonkblog/wp/2013/06/14/do-low-taxes-on-the-rich-leave-the-middle-class-with-lower-wages/ ). - Collaborative, so you can edit with others, comment on your graphs, and save revision history. - Free for public use, and you own your data (like GitHub). If you're interested, here are a few examples you can check out of: multiple axes scales with old faithful datahttp://blog.plot.ly/post/69647810381/multiple-axes-scales-with-old-faithful-data, an IPython http://nbviewer.ipython.org/gist/fonnesbeck/8495259 that has an Rmagic example, and a posthttp://www.r-bloggers.com/plotly-beta-collaborative-plotting-with-r/on r-bloggers. We'd love your feedback, advice, and thoughts. As a new project, expert insights go a long way for us, so please let us know what you think. Happy plotting, Matt [[alternative HTML version deleted]] __ R-help@r-project.org mailing list 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.