Learn R Programming

r4pde (version 0.1.0)

plot_AFSD: Plot ASFD

Description

This function creates a tile plot of the foci (cluster) identified by the AFSD function. It colors each cell in a foci and labels the centroid of each cluster with the foci ID. The 'ggplot2' package is used for the plot, and will be automatically installed if not already present.

Usage

plot_AFSD(df)

Value

A ggplot object with the scatter plot of foci (clusters).

Arguments

df

A dataframe containing at least three columns: 'x', 'y', and 'cluster_id'. 'x' and 'y' are spatial coordinates and 'cluster_id' is the cluster identifier to which each cell belongs.

See Also

Other Spatial analysis: AFSD(), BPL(), count_subareas(), count_subareas_random(), fit_gradients(), join_count(), oruns_test(), oruns_test_boustrophedon(), oruns_test_byrowcol()

Examples

Run this code
df <- data.frame(x = sample(1:100, 500, replace = TRUE),
                 y = sample(1:100, 500, replace = TRUE),
                 i = sample(0:1, 500, replace = TRUE, prob = c(0.7, 0.3)))

# Perform the AFSD
result <- AFSD(df)
# Plot the foci
plot_AFSD(result[[3]])

Run the code above in your browser using DataLab