sharednero.blogg.se

Maptiler leaflet shiny png
Maptiler leaflet shiny png







maptiler leaflet shiny png

The width and height values passed to png() specify the pixel dimensions of the saved image. The following server function would send the appropriate image, depending on the value of input$n: server <- function ( input, output, session ) Suppose the images are in the subdirectory images/, and are named image1.jpeg, image2.jpeg, and so on. If your Shiny app has pre-rendered images saved in a subdirectory, you can send them using renderImage().

maptiler leaflet shiny png

Sending pre-rendered images with renderImage() For browsers that support the data URI scheme, the src and contentType from the returned list are put together to create a special URL that embeds the data, so the result would be similar to something like this: įor browsers that don’t support the data URI scheme, Shiny sends a URL that points to the file.

maptiler leaflet shiny png

Note that the src="." is shorthand for a longer URL. The effect is similar to having an image tag with the following:

#Maptiler leaflet shiny png code#

If the following code works from the console, then it should work in renderPlot(): png () # Your plotting code here dev.off () # This would go in the server function output $ myPlot DOM element on the web page. In other words, any plot-generating code that would normally go between png() and dev.off() can be used in renderPlot(). RenderPlot() is useful for any time where R generates an image using its normal graphical device system. This is demonstrated in the image output demo application. But when you need finer control over the process, you might need to use the renderImage() function instead. When you want to have R generate a plot and send it to the client browser, the renderPlot() function will in most cases do the job.









Maptiler leaflet shiny png