Encountering an issue with plot output in Shiny. When using standard ggplots, the output is correct without any extra white margins. However, when utilizing the "ggmap" package (which also produces ggplot-type outputs), white margins suddenly appear.
(Please disregard any Polish words as they are not pertinent) !Example:
Code: ui.R
shinyUI(fluidPage(
fluidRow(class="row2",
tags$head(
tags$style("body {background-color: #94BEE8; height: 600px}")
),
column(
h3("Filters"),
dateInput("date", label=h5("Date"), value = "2014-09-07", min = "2014-09-01", max="2014-09-14"),
sliderInput("hour", label=h5("Hour"), min = 0, max = 23, value = 15, animate= TRUE),
textInput("text1", label=h5("Address I"), value="Piotrkowska 30, Lodz"),
textInput("text2", label=h5("Address II"), value = "Uniwersytecka 5, Lodz"),
numericInput("radius", label=h5("Radius [km]"), value = 1, min = 0.1, max = 100),
sliderInput("zoom", label="", min =1, max = 21, value = 13),
submitButton(text="Enter Data"),
width = 2),
column(5,
div(plotOutput("map", width = "100%")
, style = "height: 300px; background-color: #94BEE8;")
),
column(5,
htmlOutput("table")
))
))
Part of server.R
# Plotting
g <- p+
geom_point(data = data, aes(x = LONGITUDE, y = LATITUDE, size = LICZBA.NUMEROW), col = "yellow")+
geom_point(data= data, aes(x=LONGITUDE, y=LATITUDE, size = (0.625)*LICZBA.NUMEROW), col ="black", alpha = 0.4)+
geom_point(data=address1, aes(x=lon, y=lat), size=15, col = "blue", alpha = 0.35)+
geom_point(data=address2, aes(x=lon, y=lat), size =15, col ="red", alpha=0.35)+
xlab("")+ylab("")+ggtitle("TITLE")+
theme(
legend.position = "bottom",
legend.title=element_text(""),
legend.key = element_rect(colour = "black"),
legend.background = element_rect(fill="#94BEE8"),
plot.background = element_rect(fill = "#94BEE8", colour = 'red')
)+scale_colour_discrete(name="CONNECTION COUNT")
plot(p)
}, width=500, height=500)
Issue 2. Facing difficulty in adding a rectangle or circle with a 2km radius to a ggmap object.
Appreciate any assistance provided.