Leaflet r map saving issue - r

I have used addlogo to my leaflet map which displays my organizations' logo on the bottom right of the map.
This is logo visible in the viewer within R. However when I save the map the logo is not visible in either a png or HTML format. Please view the code below and the attachments.
Any advice would be appreciated.
Best Wishes
MD
I have used webshot to save as HTML but still the same issue
save the file to png
mapshot(m, file = "myfilepath", remove_controls = NULL)
The output should be saved with the logo at the bottom right hand visible.

Instead of using webshot, you should consider to try webshot2. See my detailed answer to the similar case.
The code:
# Webshot and phantomjs have been previously installed.
library(webshot2)

Related

Using street map and street view side by side in a xaringan slide

I came across this example from Google that shows how we can place a street map and a street view in a side-by-side fashion. But I don't know how I can create such a view in a xaringan slide.
I tried copying the code under "All" tab, saved the contents as an html file, and later imported that file in the xaringan slide. But this approach doesn't seem to work. Can somebody point me in the right direction?
(Cross posted from RStudio Community)
I finally figured it out! Here's what we need to do:
Go to this link to open the Street View Side-By-Side example
Go to All tab and click on the Copy code sample to clipboard menu
Open any text editor (e.g., notepad++), paste the code sample and save the file with .html extension
Go to this link and follow the instructions given under Get the API key section to get an API key
Replace the text YOUR_API_KEY on line 7 of the code sample with the API key obtained from Google through Step 4
src="https://maps.googleapis.com/maps/api/js?key=YOUR_API_KEY&callback=initialize&libraries=&v=weekly"
In the definition of the initialize() function, replace fenway with the desired location name and change the associated lat & lng
Add the following code to xaringan's source Rmd file to create a slide showing the satellite view and street view in a side-by-side fashion
# Adjust width & height to suit your needs
htmltools::tags$iframe(
src = "path/to/street-view-side-by-side.html",
width = 800,
height = 450
)

Controlling the size of the HTML file when saving file

can someone help me to resize an HTML file produce with plotly in Jupyter?
This is the code I am using to save to an HTML file:
fig.write_html("D:\jupyter\image.html")
It works but now I want to control for the size. Here (https://plotly.com/python/interactive-html-export/) is suggested how to do it but I cannot get my head around to how specifically write the code to not get a big image
If you type fig.write_html? inside a cell you can read all the documentation, which is a little more explicit than the document you posted. In short
fig.write_html("output.html",
include_plotlyjs="cdn")
Should produce a file ~3MB smaller than the one you are getting now as this option point to the plotly.js online instead of include it on the output.

Figure changes when loading pdf to inkscape

I use heatmap.2 in R to draw a figure and save it as PDF format. When I opened the PDF files, it looked good.
PDF Figure
But when I loaded the PDF file into Inkscape. It seemed that the color key is not as bright as what I saw in PDF files.
PNG file exported from Inkscape. Please focus on the colorkey.
Can someone help me on this?
Thanks.
This has probably got something to do with the used colorspace, try changing the colorspace in the pdf-output device with the colormodel option.

R Shiny: Allow download of a plot image through browser with file name

I have a shiny app that renders a plot using ggplot2. In fact, the browser's download image button works too (right click). And, when I download the image it does and displays when I open the file.
Only problem is that the file name to which it downloads is simply called 'untitled'. I want to make the file download to a name. But, I don't want to use the 'download image/plot' button. All examples I see show this option. Want to use built-in browser capability.
Any ideas?
If you don't want to use a button, you could use ggsave inside the function that creates the plot: http://docs.ggplot2.org/0.9.2.1/ggsave.html

exported image from Highcharts has a blank square on up-left corner

I have been working on exporting Highchart to JPEG image. I have downloaded the asp.net code for exporting.
Everything works fine, just the image exported has a blank square on the up-left corn. (sorry, I don't have enough reputation to post an image)
However, the exact same code, but I change the export url to "http://export.highcharts.com/", then export to image, it looks fine.
So I am assuming nothing is wrong with my code? unless I have missed some configurations? Can anybody help thanks.

Resources