![]() Now we can plot the map and it will show labels with multiple lines text. I think this is better than the paste function. labels ", mapdata$conm,Īlternatively, you may also use the sprintf() function from Base R which returns a character vector containing a formatted combination of text and variable values. You have to force it to recognize HTML tags using the HTML() function. ![]() You need to install a new package called package:htmltools. So how to show multiple lines as label? We find the solution in the Leaflet manual. You can even just remove the comment from the 2nd example and it will correctly infer the subsetting of df from the line above. According to this post, the reason is that the developers do not add additional security check on popups. It seems the underline engines for label and popup are different. Popup = ~paste(conm, "Building:", BUILDING,Īs shown above, the label does not show multiple lines properly. The function plot() or lines() can be used to create a line plot. Let’s first load the data we will use to draw the map. Here, well describe how to create line plots in R. So this post is a record for future reference. Then one student asked how to show multi-line text label as he found the syntax for label and popup is different. ![]() Students are asked to show a single-line text label and a milti-line text popup for markers on a map. One of the assignments is to draw a geographic map for data visualization purpose using the package:leaflet. I have been teaching the Forecasting and Forensic Analytics course using R programming at Singapore Management University.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |