clustering_stockshares_plot: Plot stock shares of clusters

View source: R/FleetSegmentation.R

clustering_stockshares_plotR Documentation

Plot stock shares of clusters

Description

This is function creates an overview barplot of the average shares of stocks on the catch of each clusters vessels.

Usage

clustering_stockshares_plot(
  data,
  clustering,
  min_share = 5,
  label_wrap = 6,
  display_cluster_size = F,
  subset = NULL
)

Arguments

data

The original, untransformed data that was used for the clustering.

clustering

The result of the clustering procedure, stored as a data frame.

min_share

The minimum average percentage share a stock has to have to be labelled in the plot. Defaults to 5%.

label_wrap

Indicates the number of characters per line before a line break in the stock labels. Defaults to 6.

display_cluster_size

Indicates, whether the number of vessels in each cluster should be displayed in the plot. Defaults to FALSE.

subset

Display only a subset of clusters in plot. Can be a single number or a vector of numbers.

Examples

library(tidyverse)
data <- example_catchdata
stockdata <- assign_stocks(data=data)
catchdata <- catchdata_transformation(data = stockdata)
clustering <- segmentation_clustering(catchdata = catchdata,n_cluster = 6)
clustering_stockshares_plot(data = stockdata,clustering = clustering)
clustering_stockshares_plot(data = stockdata,clustering = clustering,
min_share=10,label_wrap=10, display_cluster_size=TRUE)

ESulanke/FleetSegmentation documentation built on March 27, 2023, 10:13 p.m.