Embed What would you like to do? Embed Embed this gist in your website. Share Copy sharable link for this gist. Learn more about clone URLs.
Download ZIP. R Shiny - Download plot demo. This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. Stack Overflow for Teams — Collaborate and share knowledge with a private group.
Create a free Team What is Teams? Collectives on Stack Overflow. Learn more. Shiny: Download Plot Ask Question. Asked 1 year, 10 months ago. Active 1 year, 10 months ago. Viewed times. Improve this question. Yeah, to A. Are you trying to stack the two plots or something? You can access this app by running:. Many Shiny apps come with a ui object that determines the layout of the app. You can see that the functions in the ui object definition return HTML if you run them.
For example, the following code returns the HTML output in the comments below. In R terminology, the output is a list of character strings with a special class that tells Shiny the contents contain HTML.
In a large majority of your Shiny apps, you will probably never think of using anything more complicated. However in some apps, you may want to add custom HTML that is not provided by the usual Shiny functions.
You can do this by passing HTML tags with the tags object. Each function builds a specific HTML tag. If you are familiar with HTML, you will recognize these tags by their names. To create a tag, run an element of tags as a function.
To create a div tag, you can run:. You can call some of the most popular tags with helper functions that wrap the appropriate tags functions. A tag function will use each named argument to add an HTML attribute to the tag.
The argument name becomes the attribute name, and the argument value becomes the attribute value. So for example, if you want to create a div with a class attribute, use:. Each tag function will add unnamed arguments to your tag as HTML children. This addition lets you nest tags inside of each other just as in HTML. For example, you could add the tag above to the ui object of hello :.
NULL gives you a way to build attributes and children that will appear only under certain conditions. The tag function will add each element of the list as a child of the tag. Be sure to double check it. It is a bad idea to pass an input object to HTML :. In the example below, all of these are enabled, and the coordinates are displayed below. Next: learn about how to easily select rows of data with interactive plots.
Coordinated multiple views linked brushing. If you have questions about this article or would like to discuss ideas presented here, please post on RStudio Community.
Our developers monitor these forums and answer questions periodically. See help for more help with all things Shiny. Shiny from. Interactive plots Last Updated: 15 Oct Basics To get the position of the mouse when a plot is clicked, you simply need to use the click option with the plotOutput.
Learn more For more on this topic, see the following resources: Coordinated multiple views linked brushing. The basic parts of a Shiny app. How to get help. App formats and launching apps. Introduction to R Markdown. Introduction to interactive documents.
Setting Output args via Render functions. Generating downloadable reports. Shiny Gadgets. Reactivity - An overview.
0コメント