Usage Arguments Author(s) Examples
1 | PlotMetadata(dataframe)
|
dataframe |
= TDat_LMF or EcoSitePlots |
Rachel Burke, ecologist/analyst @ Jornada
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | # To plot number of plots per year nationally:
PlotMetadata(dataframe = TDat_LMF)
# TDat_LMF is returned object from Combine_AIM_LMF()
# To plot number of plots per year in the your ecological site(s):
PlotMetadata(dataframe = EcoSitePlots)
# EcoSitePlots is returned object from Combine_AIM_LMF() and SubsetEcologicalSite()
## The function is currently defined as
function (dataframe)
{
Plots <- c("Plots")
#Create color palettes
Year_Palette <- scales::seq_gradient_pal("grey85", "grey18", "Lab")(seq(0,1,length.out= length(unique(dataframe$Year))))
Plots_Simple <- dataframe
dplyr::select(PrimaryKey , Year)
dplyr::mutate(PlotsPerYear = Plots)
dplyr::arrange(Year)
PlotsPerYear <- ggplot(Plots_Simple , aes(Plots, text = stat(count))) +
geom_bar(stat = "count" , position = position_stack(reverse = TRUE) ,
aes(fill = Year) , width = .2 , ) +
scale_fill_manual(values = Year_Palette) +
ggtitle("Plots Per Year") +
coord_flip() + theme(axis.text.y = element_blank())
PlotsPerYear<- plotly::ggplotly(PlotsPerYear , tooltip = "text")
return(PlotsPerYear)
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.