FIT/SCALE normal distribution curve on barplot besed on specific parameters

My thesis study case concern the characteristic fire size.
1st step: create an histogram
RandomF_his <- hist(log(RandomF$area_ha),breaks =seq(from= 0,to=12, by=0.7),
main ="FWIL Burned Areas",xlab="Burned Area LOG HA",ylab= "Frequency")
RandomF_info <- hist(log(RandomF$area_ha),breaks =seq(from=0,to=12, by=0.7),
main ="FWIL Burned Areas",xlab="Burned Area LOG HA",ylab= "Frequency")
RandomF_info

RandomF_info
RandomF_counts <- RandomF_info $counts
RandomF_counts

2nd Step
Scale histogam bins to a bar plot

Barplot

The number of counts per each bin and the sum of them
counts <- RandomF_counts
counts_sum <- 14613
find the exponential value of bin midpoints
ksi <- RandomF_his$mids
bin.mid.exp <- exp(ksi)
scale the burned area for each bin: multiply each bin count by the exponential value of the bin midpoint
tba <- bin.mid.exp*counts
create a data frame for the barplot
Total_dec <- data.frame(ksi, tba)

Create the barplot
(bp <- barplot(Total_dec$tba, names.arg=Total_dec$ksi,
space = c(0, diff(Total_dec$ksi)),
col="lightblue", xlab="bins", ylab="area"))

I have to fit the normal curve distribution based on mu, sigma

I have a matlab code but i should convert it into R

first find the bins :

[global_height,global_bin]=hist(log(data(:,1)),20);
statsall.bins=global_bin;
statsall.heights=global_height;
%this will make statsall.bins=global_bin;
global_height_exp=global_height.*exp(global_bin)/sum(years);

HOW TO INTERPRET WITH THIS IN RSTUDIO
%make a line that follows the normal distribution in the histogram

% total standard model
% this here is the normal distribution function that the values need to be fit to
lin=inline('beta(3)/((2*3.14159.*beta(2).^2)^(1/2)).*exp(-(x-beta(1)).^2/(2.*beta(2).^2))','beta','x');
% this is for finding the starting values for the fitting
beta=[mean(global_bin),2,10^6];
% this is the actual fitting
betaend=nlinfit (global_bin,global_height_exp,lin,beta);
% now we plot it.
figure
hold on
bar(global_bin/2.3026,global_height_exp,'FaceColor',[.7 .7 .7]);
xlabel('log_10 Fire size class [ha]')
ylabel('Total contribution to annual burned area [ha/year ]')

meanval=betaend(1);
plot(global_bin,lin(betaend,global_bin),'k')
% this one check how well the fit has worked
c=corrcoef(lin(betaend,global_bin),global_height_exp);
ccs=c(1,2);
CFS CURVE.pdf (187.7 KB)

I'll take a whack if you can provide some representative data to complete your reprex (see the FAQ).

library(readxl)
library(ggplot2)
library(dplyr)
library(Hmisc)


setwd("C:/Users/user/Desktop/Thesis/RSt")
getwd()

RandomF <- read_excel("C:/Users/user/Desktop/Thesis/RSt/RandomF.xls")

Total CFS

RandomF_his <- hist(log(RandomF$area_ha),breaks =seq(from= 0,to=12, by=0.7),
main ="FWIL Burned Areas",xlab="Burned Area LOG HA",ylab= "Frequency")

RandomF_info <- hist(log(RandomF$area_ha),breaks =seq(from=0,to=12, by=0.7),
main ="FWIL Burned Areas",xlab="Burned Area LOG HA",ylab= "Frequency")

RandomF_info

RandomF_counts <- RandomF_info $counts

RandomF_counts

Barplot

counts <- RandomF_counts
counts_sum <- sum(counts)
sum_area <- sum(RandomF$area_ha) #5499822

ksi <- RandomF_his$mids
bin.mid.exp <- exp(ksi)
tba <- bin.mid.exp*counts

Total_dec <- data.frame(ksi, tba) # Apply data.frame function

###Barplot
bp <- barplot(Total_dec$tba, names.arg=Total_dec$ksi,
space = c(0, diff(Total_dec$ksi)),
ylim = c(0, 1500000),
col="lightblue", xlab="Loge(Ha)", ylab="Burned Area")

mu and sigma are requires, the script below may not be suytable, this is only a trial

mu <- Hmisc::wtd.mean(Total_dec$ksi, Total_dec$tba)
sigma <- sqrt(Hmisc::wtd.var(Total_dec$ksi, weights = Total_dec$tba))
c(mu, sigma)# 8.350394 1.688838

func <- function(a) {
(min(Total_dec$ksi) - bp[1,1]) + # the offset, happens to be 0 here since
# the first datapoint is exactly 0.5
a * diff(range(bp[,1])) / diff(range(Total_dec$ksi))
}

mu2 <- func(mu)
sigma2 <- sigma
c(mu2, sigma2)

##must define upper and lower limit, pretty usnsure how to enable in the curve script

lower upper limit

ll <- 17.14-(21.39)
ul <- 17.14+(2
1.39)

curve(dnorm(x, mean=17.14, sd=1.39) * sum(Total_dec$tba),
col = "red", lwd = 3, add=T)

DATASET

THEORY BEHIND SCRIPT

Many thanks for replying to my post

Sorry to be unclear. Can you run

dput(RandomF)

and cut-and-paste the output here? That should provide everything needed.

When I run dput(RandomF) I have the following output but for me is unclear what these values means
I was waiting to see sth in a table format

dput(RandomF)
structure(list(Date = structure(c(1621382400, 1621382400, 1621382400,
1621382400, 1621382400, 1621382400, 1621382400, 1621382400, 1621382400,
1621382400, 1621382400, 1621382400, 1156204800, 1156204800, 1156204800,
1156204800, 1156204800, 1156204800, 1156204800, 1156204800, 1156204800,
1156204800, 1156204800, 1156204800, 1314144000, 1314144000, 1314144000,
1314144000, 1314144000, 1314144000, 1314144000, 1314144000, 1314144000,
1314144000, 1314144000, 1314144000, 1314144000, 1314144000, 1314144000,
1314144000, 1314144000, 1314144000, 1314144000, 1314144000, 1314144000,
1314144000, 1314144000, 1314144000, 1183075200, 1183075200, 1183075200,
1183075200, 1183075200, 1183075200, 1183075200, 1183075200, 1183075200,
1183075200, 1183075200, 1183075200, 1183075200, 1183075200, 1250899200,
1250899200, 1250899200, 1250899200, 1250899200, 1250899200, 1250899200,
1250899200, 1250899200, 1250899200, 1250899200, 1250899200, 1250899200,
1250899200, 1250899200, 1250899200, 1250899200, 1250899200, 1250899200,
1250899200, 1250899200, 1532304000, 1532304000, 1532304000, 1532304000,
1532304000, 1532304000, 1532304000, 1532304000, 1532304000, 1532304000,
1532304000, 1532304000, 1532304000, 1532304000, 1187913600, 1187913600,
1187913600, 1187913600, 1187913600, 1187913600, 1187913600, 1187913600,
1187913600, 1187913600, 1187913600, 1187913600, 1187913600, 1187913600,
1187913600, 1187913600, 1187913600, 1187913600, 1187913600, 1187913600,
1187913600, 1187913600, 1187913600, 1187913600, 1469404800, 1377648000,
1377648000, 1377648000, 1377648000, 1377648000, 1377648000, 1377648000,
1377648000, 1377648000, 1377648000, 1377648000, 1377648000, 1377648000,
1344384000, 1344384000, 1344384000, 1344384000, 1344384000, 1344384000,
1344384000, 1344384000, 1344384000, 1344384000, 1344384000, 1344384000,
1156118400, 1156118400, 1156118400, 1156118400, 1156118400, 1156118400,
1156118400, 1156118400, 1156118400, 1156118400, 1156118400, 1156118400,
1156118400, 1156118400, 1156118400, 1156118400, 1156118400, 1156118400,
1156118400, 1156118400, 1156118400, 1156118400, 1156118400, 1156118400,
1156118400, 1156118400, 1156118400, 1156118400, 1156118400, 1156118400,
1156118400, 1156118400, 1156118400, 1156118400, 1156118400, 1156118400,
1156118400, 1156118400, 1156118400, 1156118400, 1156118400, 1156118400,
1156118400, 1156118400, 1156118400, 1156118400, 1156118400, 1156118400,
1156118400, 1156118400, 1156118400, 1156118400, 1156118400, 1156118400,
1156118400, 1156118400, 1156118400, 1156118400, 1156118400, 1156118400,
1156118400, 1156118400, 1156118400, 1156118400, 1156118400, 1156118400,
1156118400, 1156118400, 1156118400, 1156118400, 1156118400, 1156118400,
1156118400, 1156118400, 1156118400, 1156118400, 1156118400, 1156118400,
1156118400, 1156118400, 1156118400, 1156118400, 1156118400, 1156118400,
1628121600, 1628121600, 1628121600, 1628121600, 1182988800, 1182988800,
1182988800, 1182988800, 1182988800, 1182988800, 1182988800, 1182988800,
1182988800, 1182988800, 1182988800, 1182988800, 1182988800, 1182988800,
1182988800, 1374883200, 1374883200, 1374883200, 1374883200, 1374883200,
1374883200, 1374883200, 1374883200, 1374883200, 1374883200, 1374883200,
1374883200, 1374883200, 1374883200, 1437091200, 1437091200, 1437091200,
1437091200, 1437091200, 1437091200, 1437091200, 1437091200, 1437091200,
1437091200, 1437091200, 1437091200, 1473465600, 1473465600, 1473465600,
1473465600, 1473465600, 1473465600, 1473465600, 1473465600, 1473465600,
1473465600, 1473465600, 1473465600, 1473465600, 1473465600, 1473465600,
1473465600, 1473465600, 1473465600, 1473465600, 1473465600, 1473465600,
1473465600, 1473465600, 1473465600, 1473465600, 1473465600, 1345852800,
1345852800, 1345852800, 1345852800, 1345852800, 1345852800, 1345852800,
1345852800, 1345852800, 1345852800, 1345852800, 1345852800, 1345852800,
1345852800, 1345852800, 1345852800, 1345852800, 1345852800, 1345852800,
1345852800, 1345852800, 1345852800, 1345852800, 1595376000, 1595376000,
1595376000, 1595376000, 1595376000, 1595376000, 1595376000, 1595376000,
1595376000, 1595376000, 1339804800, 1339804800, 1339804800, 1339804800,
1339804800, 1339804800, 1339804800, 1339804800, 1339804800, 1339804800,
1339804800, 1339804800, 1250899200, 1250899200, 1250899200, 1250899200,
1250899200, 1250899200, 1250899200, 1250899200, 1250899200, 1250899200,
1250899200, 1250899200, 1250899200, 1501804800, 1501804800, 1501804800,
1501804800, 1501804800, 1501804800, 1501804800, 1501804800, 1501804800,
1501804800, 1501804800, 1628121600, 1628121600, 1628121600, 1628121600,
1628121600, 1628121600, 1628121600, 1628121600, 1628121600, 1628121600,
1628121600, 1628121600, 1565568000, 1565568000, 1565568000, 1565568000,
1565568000, 1565568000, 1565568000, 1565568000, 1565568000, 1565568000,
1565568000, 1311897600, 1311897600, 1311897600, 1311897600, 1311897600,
1311897600, 1311897600, 1311897600, 1311897600, 1311897600, 1311897600,
1311897600, 1311897600, 1311897600, 1311897600, 1185408000, 1185408000,
1185408000, 1185408000, 1185408000, 1185408000, 1185408000, 1185408000,
1185408000, 1185408000, 1185408000, 1185408000, 1185408000, 1502582400,
1502582400, 1502582400, 1502582400, 1502582400, 1502582400, 1502582400,
1502582400, 1502582400, 1502582400, 1502582400, 1502582400, 1502582400,
1.188e+09, 1.188e+09, 1.188e+09, 1.188e+09, 1.188e+09, 1.188e+09,
1.188e+09, 1.188e+09, 1.188e+09, 1.188e+09, 1.188e+09, 1.188e+09,
1.188e+09, 1.188e+09, 1.188e+09, 1.188e+09, 1.188e+09, 1.188e+09,
1.188e+09, 1.188e+09, 1.188e+09, 1.188e+09, 1469836800, 1469836800,
1469836800, 1469836800, 1469836800, 1469836800, 1469836800, 1469836800,
1469836800, 1469836800, 1469836800, 1469836800, 1403740800, 1403740800,
1403740800, 1403740800, 1403740800, 1403740800, 1403740800, 1403740800,
1403740800, 1403740800, 1403740800, 1403740800, 1185321600, 1185321600,
1185321600, 1185321600, 1185321600, 1185321600, 1185321600, 1185321600,
1185321600, 1185321600, 1185321600, 1185321600, 1185321600, 1185321600,
1185321600, 1185321600, 1185321600, 1185321600, 1185321600, 1185321600,
1185321600, 1185321600, 1185321600, 1185321600, 1185321600, 1185321600,
1185321600, 1185321600, 1185321600, 1185321600, 1185321600, 1185321600,
1185321600, 1185321600, 1185321600, 1185321600, 1185321600, 1185321600,
1185321600, 1185321600, 1185321600, 1185321600, 1185321600, 1185321600,
1185321600, 1185321600, 1185321600, 1185321600, 1185321600, 1185321600,
1185321600, 1185321600, 1185321600, 1185321600, 1185321600, 1185321600,
1185321600, 1185321600, 1185321600, 1185321600, 1185321600, 1185321600,
1185321600, 1185321600, 1185321600, 1185321600, 1185321600, 1185321600,
1185321600, 1185321600, 1185321600, 1185321600, 1185321600, 1185321600,
1185321600, 1185321600, 1185321600, 1185321600, 1185321600, 1185321600,
1185321600, 1185321600, 1185321600, 1185321600, 1218672000, 1218672000,
1218672000, 1218672000, 1218672000, 1218672000, 1218672000, 1218672000,
1218672000, 1218672000, 1218672000, 1314230400, 1314230400, 1314230400,
1314230400, 1314230400, 1314230400, 1314230400, 1314230400, 1314230400,
1314230400, 1314230400, 1498867200, 1498867200, 1498867200, 1498867200,
1498867200, 1498867200, 1498867200, 1498867200, 1498867200, 1498867200,
1.188e+09, 1.188e+09, 1.188e+09, 1.188e+09, 1.188e+09, 1.188e+09,
1.188e+09, 1.188e+09, 1.188e+09, 1.188e+09, 1.188e+09, 1.188e+09,
1314057600, 1314057600, 1314057600, 1314057600, 1314057600, 1314057600,
1314057600, 1314057600, 1314057600, 1314057600, 1314057600, 1314057600,
1314057600, 1185062400, 1185062400, 1185062400, 1185062400, 1185062400,
1185062400, 1185062400, 1185062400, 1185062400, 1185062400, 1185062400,
1250467200, 1250467200, 1250467200, 1250467200, 1250467200, 1250467200,
1250467200, 1250467200, 1250467200, 1250467200, 1250467200, 1250467200,
1250467200, 1250467200, 1250467200, 1185321600, 1185321600, 1185321600,
1185321600, 1185321600, 1185321600, 1185321600, 1185321600, 1185321600,
1185321600, 1185321600, 1185321600, 1185321600, 1185321600, 1185321600,
1185321600, 1185321600, 1185321600, 1185321600, 1185321600, 1185321600,
1185321600, 1185321600, 1185321600, 1185321600, 1185321600, 1185321600,
1185321600, 1185321600, 1598054400, 1598054400, 1374883200, 1374883200,
1374883200, 1374883200, 1374883200, 1374883200, 1374883200, 1374883200,
1374883200, 1374883200, 1374883200, 1314316800, 1314316800, 1314316800,
1314316800, 1314316800, 1314316800, 1314316800, 1314316800, 1314316800,
1314316800, 1314316800, 1314316800, 1.188e+09, 1.188e+09, 1.188e+09,
1.188e+09, 1.188e+09, 1.188e+09, 1.188e+09, 1.188e+09, 1.188e+09,
1.188e+09, 1.188e+09, 1.188e+09, 1.188e+09, 1.188e+09, 1.188e+09,
1.188e+09, 1466208000, 1466208000, 1466208000, 1466208000, 1466208000,
1466208000, 1466208000, 1466208000, 1466208000, 1466208000, 1185321600,
1185321600, 1185321600, 1185321600, 1185321600, 1185321600, 1185321600,
1185321600, 1185321600, 1185321600, 1185321600, 1314316800, 1314316800,
1314316800, 1314316800, 1314316800, 1314316800, 1314316800, 1314316800,
1.188e+09, 1.188e+09, 1.188e+09, 1.188e+09, 1.188e+09, 1.188e+09,
1.188e+09, 1.188e+09, 1.188e+09, 1.188e+09, 1.188e+09, 1.188e+09,
1.188e+09, 1.188e+09, 1.188e+09, 1.188e+09, 1.188e+09, 1.188e+09,
1.188e+09, 1.188e+09, 1.188e+09, 1.188e+09, 1.188e+09, 1.188e+09,
1.188e+09, 1.188e+09, 1.188e+09, 1.188e+09, 1.188e+09, 1.188e+09,
1.188e+09, 1.188e+09, 1.188e+09, 1.188e+09, 1.188e+09, 1009843200,
1009843200, 1009843200, 1009843200, 1009843200, 1009843200, 1009843200,
1009843200, 1009843200, 1009843200, 1009843200, 1009843200, 1009843200,
1184803200, 1184803200, 1184803200, 1184803200, 1184803200, 1184803200,
1184803200, 1184803200, 1184803200, 1184803200, 1184803200, 1184803200,
1184803200, 1184803200, 1184803200, 1184803200, 1184803200, 1503705600,
1503705600, 1503705600, 1503705600, 1503705600, 1503705600, 1503705600,
1503705600, 1469404800, 1469404800, 1469404800, 1469404800, 1469404800,
1469404800, 1469404800, 1469404800, 1469404800, 1469404800, 1469404800,
1185321600, 1185321600, 1185321600, 1185321600, 1185321600, 1185321600,
1185321600, 1185321600, 1185321600, 1185321600, 1185321600, 1185321600,
1185321600, 1187913600, 1187913600, 1187913600, 1187913600, 1187913600,
1187913600, 1187913600, 1187913600, 1187913600, 1187913600, 1187913600,
1250726400, 1250726400, 1250726400, 1250726400, 1250726400, 1250726400,
1250726400, 1250726400, 1250726400, 1250726400, 1250726400, 1505174400,
1505174400, 1505174400, 1505174400, 1505174400, 1505174400, 1505174400,
1505174400, 1505174400, 1505174400, 1505174400, 1314316800, 1314316800,
1314316800, 1314316800, 1314316800, 1314316800, 1314316800, 1314316800,
1469836800, 1469836800, 1314144000, 1314144000, 978307200, 978307200,
978307200, 978307200, 978307200, 978307200, 978307200, 978307200,
978307200, 978307200, 978307200, 1183075200, 1183075200, 1183075200,
1183075200, 1183075200, 1183075200, 1183075200, 1183075200, 1183075200,
1183075200, 1183075200, 1403827200, 1403827200, 1403827200, 1403827200,
1403827200, 1403827200, 1403827200, 1403827200, 1403827200, 1403827200,
1404432000, 1404432000, 1404432000, 1404432000, 1404432000, 1404432000,
1404432000, 1404432000, 1404432000, 1404432000, 1281830400, 1281830400,
1281830400, 1281830400, 1281830400, 1281830400, 1281830400, 1281830400,
1281830400, 1281830400, 1281830400, 1185408000, 1185408000, 1185408000,
1185408000, 1185408000, 1185408000, 1185408000, 1185408000, 1185408000,
1185408000, 1185408000, 1185408000, 1185408000, 1188259200, 1188259200,
1188259200, 1188259200, 1188259200, 1188259200, 1188259200, 1188259200,
1188259200, 1188259200, 1188259200, 1188259200, 1188259200, 1532304000,
1532304000, 1532304000, 1532304000, 1532304000, 1532304000, 1188172800,
1188172800, 1188172800, 1188172800, 1188172800, 1188172800, 1188172800,
1188172800, 1188172800, 1188172800, 1188172800, 1343606400, 1343606400,
1343606400, 1343606400, 1343606400, 1343606400, 1343606400, 1343606400,
1343606400, 1343606400, 1343606400, 1182988800, 1182988800, 1182988800,
1182988800), tzone = "UTC", class = c("POSIXct", "POSIXt")),
area_ha = c(7005, 7005, 7005, 7005, 7005, 7005, 7005, 7005,
7005, 7005, 7005, 7005, 6837, 6837, 6837, 6837, 6837, 6837,
6837, 6837, 6837, 6837, 6837, 6837, 6245, 6245, 6245, 6245,
6245, 6245, 6245, 6245, 6245, 6245, 6245, 6245, 6245, 6245,
6245, 6245, 6245, 6245, 6245, 6245, 6245, 6245, 6245, 6245,
5829, 5829, 5829, 5829, 5829, 5829, 5829, 5829, 5829, 5829,
5829, 5829, 5829, 5829, 5815, 5815, 5815, 5815, 5815, 5815,
5815, 5815, 5815, 5815, 5815, 5815, 5815, 5815, 5815, 5815,
5815, 5815, 5815, 5815, 5815, 5568, 5568, 5568, 5568, 5568,
5568, 5568, 5568, 5568, 5568, 5568, 5568, 5568, 5568, 5434,
5434, 5434, 5434, 5434, 5434, 5434, 5434, 5434, 5434, 5434,
5434, 5434, 5434, 5434, 5434, 5434, 5434, 5434, 5434, 5434,
5434, 5434, 5434, 5242, 4986, 4986, 4986, 4986, 4986, 4986,
4986, 4986, 4986, 4986, 4986, 4986, 4986, 4833, 4833, 4833,
4833, 4833, 4833, 4833, 4833, 4833, 4833, 4833, 4833, 4813,
4813, 4813, 4813, 4813, 4813, 4813, 4813, 4813, 4813, 4813,
4813, 4813, 4813, 4813, 4813, 4813, 4813, 4813, 4813, 4813,
4813, 4813, 4813, 4813, 4813, 4813, 4813, 4813, 4813, 4813,
4813, 4813, 4813, 4813, 4813, 4813, 4813, 4813, 4813, 4813,
4813, 4813, 4813, 4813, 4813, 4813, 4813, 4813, 4813, 4813,
4813, 4813, 4813, 4813, 4813, 4813, 4813, 4813, 4813, 4813,
4813, 4813, 4813, 4813, 4813, 4813, 4813, 4813, 4813, 4813,
4813, 4813, 4813, 4813, 4813, 4813, 4813, 4813, 4813, 4813,
4813, 4813, 4813, 4688, 4688, 4688, 4688, 4386, 4386, 4386,
4386, 4386, 4386, 4386, 4386, 4386, 4386, 4386, 4386, 4386,
4386, 4386, 4227, 4227, 4227, 4227, 4227, 4227, 4227, 4227,
4227, 4227, 4227, 4227, 4227, 4227, 4093, 4093, 4093, 4093,
4093, 4093, 4093, 4093, 4093, 4093, 4093, 4093, 4079, 4079,
4079, 4079, 4079, 4079, 4079, 4079, 4079, 4079, 4079, 4079,
3896, 3896, 3896, 3896, 3896, 3896, 3896, 3896, 3896, 3896,
3896, 3896, 3896, 3896, 3724, 3724, 3724, 3724, 3724, 3724,
3724, 3724, 3724, 3724, 3724, 3724, 3724, 3724, 3724, 3724,
3724, 3724, 3724, 3724, 3724, 3724, 3724, 3549, 3549, 3549,
3549, 3549, 3549, 3549, 3549, 3549, 3549, 3310, 3310, 3310,
3310, 3310, 3310, 3310, 3310, 3310, 3310, 3310, 3310, 3073,
3073, 3073, 3073, 3073, 3073, 3073, 3073, 3073, 3073, 3073,
3073, 3073, 2963, 2963, 2963, 2963, 2963, 2963, 2963, 2963,
2963, 2963, 2963, 2962, 2962, 2962, 2962, 2962, 2962, 2962,
2962, 2962, 2962, 2962, 2962, 2889, 2889, 2889, 2889, 2889,
2889, 2889, 2889, 2889, 2889, 2889, 2859, 2859, 2859, 2859,
2859, 2859, 2859, 2859, 2859, 2859, 2859, 2859, 2859, 2859,
2859, 2851, 2851, 2851, 2851, 2851, 2851, 2851, 2851, 2851,
2851, 2851, 2851, 2851, 2839, 2839, 2839, 2839, 2839, 2839,
2839, 2839, 2839, 2839, 2839, 2839, 2839, 2701, 2701, 2701,
2701, 2701, 2701, 2701, 2701, 2701, 2701, 2701, 2701, 2701,
2701, 2701, 2701, 2701, 2701, 2701, 2701, 2701, 2701, 2604,
2604, 2604, 2604, 2604, 2604, 2604, 2604, 2604, 2604, 2604,
2604, 2583, 2583, 2583, 2583, 2583, 2583, 2583, 2583, 2583,
2583, 2583, 2583, 2578, 2578, 2578, 2578, 2578, 2578, 2578,
2578, 2578, 2578, 2578, 2578, 2578, 2578, 2578, 2578, 2578,
2578, 2478, 2478, 2478, 2478, 2478, 2478, 2478, 2478, 2478,
2478, 2478, 2478, 2478, 2478, 2478, 2478, 2478, 2478, 2478,
2478, 2478, 2478, 2478, 2478, 2478, 2478, 2478, 2478, 2478,
2478, 2478, 2478, 2478, 2478, 2478, 2478, 2478, 2478, 2478,
2478, 2478, 2478, 2478, 2478, 2478, 2478, 2478, 2478, 2478,
2478, 2478, 2478, 2478, 2478, 2478, 2478, 2478, 2478, 2478,
2478, 2478, 2478, 2478, 2478, 2478, 2478, 2431, 2431, 2431,
2431, 2431, 2431, 2431, 2431, 2431, 2431, 2431, 2369, 2369,
2369, 2369, 2369, 2369, 2369, 2369, 2369, 2369, 2369, 2341,
2341, 2341, 2341, 2341, 2341, 2341, 2341, 2341, 2341, 2209,
2209, 2209, 2209, 2209, 2209, 2209, 2209, 2209, 2209, 2209,
2209, 2074, 2074, 2074, 2074, 2074, 2074, 2074, 2074, 2074,
2074, 2074, 2074, 2074, 2025, 2025, 2025, 2025, 2025, 2025,
2025, 2025, 2025, 2025, 2025, 1925, 1925, 1925, 1925, 1925,
1925, 1925, 1925, 1925, 1925, 1925, 1925, 1925, 1925, 1925,
1923, 1923, 1923, 1923, 1923, 1923, 1923, 1923, 1923, 1923,
1923, 1923, 1923, 1923, 1923, 1923, 1923, 1923, 1923, 1923,
1923, 1923, 1923, 1923, 1923, 1923, 1923, 1923, 1923, 1894,
1894, 1881, 1881, 1881, 1881, 1881, 1881, 1881, 1881, 1881,
1881, 1881, 1808, 1808, 1808, 1808, 1808, 1808, 1808, 1808,
1808, 1808, 1808, 1808, 1794, 1794, 1794, 1794, 1794, 1794,
1794, 1794, 1794, 1794, 1794, 1794, 1794, 1794, 1794, 1794,
1772, 1772, 1772, 1772, 1772, 1772, 1772, 1772, 1772, 1772,
1768, 1768, 1768, 1768, 1768, 1768, 1768, 1768, 1768, 1768,
1768, 1761, 1761, 1761, 1761, 1761, 1761, 1761, 1761, 1680,
1680, 1680, 1680, 1680, 1680, 1680, 1680, 1680, 1680, 1680,
1680, 1680, 1680, 1680, 1680, 1680, 1680, 1680, 1680, 1671,
1671, 1671, 1671, 1671, 1671, 1671, 1671, 1671, 1671, 1671,
1671, 1671, 1671, 1671, 1625, 1625, 1625, 1625, 1625, 1625,
1625, 1625, 1625, 1625, 1625, 1625, 1625, 1612, 1612, 1612,
1612, 1612, 1612, 1612, 1612, 1612, 1612, 1612, 1612, 1612,
1612, 1612, 1612, 1612, 1592, 1592, 1592, 1592, 1592, 1592,
1592, 1592, 1515, 1515, 1515, 1515, 1515, 1515, 1515, 1515,
1515, 1515, 1515, 1504, 1504, 1504, 1504, 1504, 1504, 1504,
1504, 1504, 1504, 1504, 1504, 1504, 1495, 1495, 1495, 1495,
1495, 1495, 1495, 1495, 1495, 1495, 1495, 1489, 1489, 1489,
1489, 1489, 1489, 1489, 1489, 1489, 1489, 1489, 1483, 1483,
1483, 1483, 1483, 1483, 1483, 1483, 1483, 1483, 1483, 1477,
1477, 1477, 1477, 1477, 1477, 1477, 1477, 1474, 1474, 1471,
1471, 1447, 1447, 1447, 1447, 1447, 1447, 1447, 1447, 1447,
1447, 1447, 1443, 1443, 1443, 1443, 1443, 1443, 1443, 1443,
1443, 1443, 1443, 1435, 1435, 1435, 1435, 1435, 1435, 1435,
1435, 1435, 1435, 1431, 1431, 1431, 1431, 1431, 1431, 1431,
1431, 1431, 1431, 1417, 1417, 1417, 1417, 1417, 1417, 1417,
1417, 1417, 1417, 1417, 1403, 1403, 1403, 1403, 1403, 1403,
1403, 1403, 1403, 1403, 1403, 1403, 1403, 1373, 1373, 1373,
1373, 1373, 1373, 1373, 1373, 1373, 1373, 1373, 1373, 1373,
1362, 1362, 1362, 1362, 1362, 1362, 1352, 1352, 1352, 1352,
1352, 1352, 1352, 1352, 1352, 1352, 1352, 1337, 1337, 1337,
1337, 1337, 1337, 1337, 1337, 1337, 1337, 1337, 1335, 1335,
1335, 1335)), row.names = c(NA, -1000L), class = c("tbl_df",
"tbl", "data.frame"))

This dataset contain 1000 of 14000 records and only the date and the area because of the limitation on uploading data

This is great. Don't need all the data, just enough to work the problem. The output is just an odd way of showing a data frame. Assigning it to d comes out looking like this

> head(d)
        Date area_ha
1 2021-05-19    7005
2 2021-05-19    7005
3 2021-05-19    7005
4 2021-05-19    7005
5 2021-05-19    7005
6 2021-05-19    7005

Starting now on the main event. ... [later]

Had some difficulty interpreting their methodology.

library(ggplot2)
#> Warning: package 'ggplot2' was built under R version 4.3.1
RandomF <- structure(list(
  Date = structure(c(
    1621382400, 1621382400, 1621382400,
    1621382400, 1621382400, 1621382400, 1621382400, 1621382400, 1621382400,
    1621382400, 1621382400, 1621382400, 1156204800, 1156204800, 1156204800,
    1156204800, 1156204800, 1156204800, 1156204800, 1156204800, 1156204800,
    1156204800, 1156204800, 1156204800, 1314144000, 1314144000, 1314144000,
    1314144000, 1314144000, 1314144000, 1314144000, 1314144000, 1314144000,
    1314144000, 1314144000, 1314144000, 1314144000, 1314144000, 1314144000,
    1314144000, 1314144000, 1314144000, 1314144000, 1314144000, 1314144000,
    1314144000, 1314144000, 1314144000, 1183075200, 1183075200, 1183075200,
    1183075200, 1183075200, 1183075200, 1183075200, 1183075200, 1183075200,
    1183075200, 1183075200, 1183075200, 1183075200, 1183075200, 1250899200,
    1250899200, 1250899200, 1250899200, 1250899200, 1250899200, 1250899200,
    1250899200, 1250899200, 1250899200, 1250899200, 1250899200, 1250899200,
    1250899200, 1250899200, 1250899200, 1250899200, 1250899200, 1250899200,
    1250899200, 1250899200, 1532304000, 1532304000, 1532304000, 1532304000,
    1532304000, 1532304000, 1532304000, 1532304000, 1532304000, 1532304000,
    1532304000, 1532304000, 1532304000, 1532304000, 1187913600, 1187913600,
    1187913600, 1187913600, 1187913600, 1187913600, 1187913600, 1187913600,
    1187913600, 1187913600, 1187913600, 1187913600, 1187913600, 1187913600,
    1187913600, 1187913600, 1187913600, 1187913600, 1187913600, 1187913600,
    1187913600, 1187913600, 1187913600, 1187913600, 1469404800, 1377648000,
    1377648000, 1377648000, 1377648000, 1377648000, 1377648000, 1377648000,
    1377648000, 1377648000, 1377648000, 1377648000, 1377648000, 1377648000,
    1344384000, 1344384000, 1344384000, 1344384000, 1344384000, 1344384000,
    1344384000, 1344384000, 1344384000, 1344384000, 1344384000, 1344384000,
    1156118400, 1156118400, 1156118400, 1156118400, 1156118400, 1156118400,
    1156118400, 1156118400, 1156118400, 1156118400, 1156118400, 1156118400,
    1156118400, 1156118400, 1156118400, 1156118400, 1156118400, 1156118400,
    1156118400, 1156118400, 1156118400, 1156118400, 1156118400, 1156118400,
    1156118400, 1156118400, 1156118400, 1156118400, 1156118400, 1156118400,
    1156118400, 1156118400, 1156118400, 1156118400, 1156118400, 1156118400,
    1156118400, 1156118400, 1156118400, 1156118400, 1156118400, 1156118400,
    1156118400, 1156118400, 1156118400, 1156118400, 1156118400, 1156118400,
    1156118400, 1156118400, 1156118400, 1156118400, 1156118400, 1156118400,
    1156118400, 1156118400, 1156118400, 1156118400, 1156118400, 1156118400,
    1156118400, 1156118400, 1156118400, 1156118400, 1156118400, 1156118400,
    1156118400, 1156118400, 1156118400, 1156118400, 1156118400, 1156118400,
    1156118400, 1156118400, 1156118400, 1156118400, 1156118400, 1156118400,
    1156118400, 1156118400, 1156118400, 1156118400, 1156118400, 1156118400,
    1628121600, 1628121600, 1628121600, 1628121600, 1182988800, 1182988800,
    1182988800, 1182988800, 1182988800, 1182988800, 1182988800, 1182988800,
    1182988800, 1182988800, 1182988800, 1182988800, 1182988800, 1182988800,
    1182988800, 1374883200, 1374883200, 1374883200, 1374883200, 1374883200,
    1374883200, 1374883200, 1374883200, 1374883200, 1374883200, 1374883200,
    1374883200, 1374883200, 1374883200, 1437091200, 1437091200, 1437091200,
    1437091200, 1437091200, 1437091200, 1437091200, 1437091200, 1437091200,
    1437091200, 1437091200, 1437091200, 1473465600, 1473465600, 1473465600,
    1473465600, 1473465600, 1473465600, 1473465600, 1473465600, 1473465600,
    1473465600, 1473465600, 1473465600, 1473465600, 1473465600, 1473465600,
    1473465600, 1473465600, 1473465600, 1473465600, 1473465600, 1473465600,
    1473465600, 1473465600, 1473465600, 1473465600, 1473465600, 1345852800,
    1345852800, 1345852800, 1345852800, 1345852800, 1345852800, 1345852800,
    1345852800, 1345852800, 1345852800, 1345852800, 1345852800, 1345852800,
    1345852800, 1345852800, 1345852800, 1345852800, 1345852800, 1345852800,
    1345852800, 1345852800, 1345852800, 1345852800, 1595376000, 1595376000,
    1595376000, 1595376000, 1595376000, 1595376000, 1595376000, 1595376000,
    1595376000, 1595376000, 1339804800, 1339804800, 1339804800, 1339804800,
    1339804800, 1339804800, 1339804800, 1339804800, 1339804800, 1339804800,
    1339804800, 1339804800, 1250899200, 1250899200, 1250899200, 1250899200,
    1250899200, 1250899200, 1250899200, 1250899200, 1250899200, 1250899200,
    1250899200, 1250899200, 1250899200, 1501804800, 1501804800, 1501804800,
    1501804800, 1501804800, 1501804800, 1501804800, 1501804800, 1501804800,
    1501804800, 1501804800, 1628121600, 1628121600, 1628121600, 1628121600,
    1628121600, 1628121600, 1628121600, 1628121600, 1628121600, 1628121600,
    1628121600, 1628121600, 1565568000, 1565568000, 1565568000, 1565568000,
    1565568000, 1565568000, 1565568000, 1565568000, 1565568000, 1565568000,
    1565568000, 1311897600, 1311897600, 1311897600, 1311897600, 1311897600,
    1311897600, 1311897600, 1311897600, 1311897600, 1311897600, 1311897600,
    1311897600, 1311897600, 1311897600, 1311897600, 1185408000, 1185408000,
    1185408000, 1185408000, 1185408000, 1185408000, 1185408000, 1185408000,
    1185408000, 1185408000, 1185408000, 1185408000, 1185408000, 1502582400,
    1502582400, 1502582400, 1502582400, 1502582400, 1502582400, 1502582400,
    1502582400, 1502582400, 1502582400, 1502582400, 1502582400, 1502582400,
    1.188e+09, 1.188e+09, 1.188e+09, 1.188e+09, 1.188e+09, 1.188e+09,
    1.188e+09, 1.188e+09, 1.188e+09, 1.188e+09, 1.188e+09, 1.188e+09,
    1.188e+09, 1.188e+09, 1.188e+09, 1.188e+09, 1.188e+09, 1.188e+09,
    1.188e+09, 1.188e+09, 1.188e+09, 1.188e+09, 1469836800, 1469836800,
    1469836800, 1469836800, 1469836800, 1469836800, 1469836800, 1469836800,
    1469836800, 1469836800, 1469836800, 1469836800, 1403740800, 1403740800,
    1403740800, 1403740800, 1403740800, 1403740800, 1403740800, 1403740800,
    1403740800, 1403740800, 1403740800, 1403740800, 1185321600, 1185321600,
    1185321600, 1185321600, 1185321600, 1185321600, 1185321600, 1185321600,
    1185321600, 1185321600, 1185321600, 1185321600, 1185321600, 1185321600,
    1185321600, 1185321600, 1185321600, 1185321600, 1185321600, 1185321600,
    1185321600, 1185321600, 1185321600, 1185321600, 1185321600, 1185321600,
    1185321600, 1185321600, 1185321600, 1185321600, 1185321600, 1185321600,
    1185321600, 1185321600, 1185321600, 1185321600, 1185321600, 1185321600,
    1185321600, 1185321600, 1185321600, 1185321600, 1185321600, 1185321600,
    1185321600, 1185321600, 1185321600, 1185321600, 1185321600, 1185321600,
    1185321600, 1185321600, 1185321600, 1185321600, 1185321600, 1185321600,
    1185321600, 1185321600, 1185321600, 1185321600, 1185321600, 1185321600,
    1185321600, 1185321600, 1185321600, 1185321600, 1185321600, 1185321600,
    1185321600, 1185321600, 1185321600, 1185321600, 1185321600, 1185321600,
    1185321600, 1185321600, 1185321600, 1185321600, 1185321600, 1185321600,
    1185321600, 1185321600, 1185321600, 1185321600, 1218672000, 1218672000,
    1218672000, 1218672000, 1218672000, 1218672000, 1218672000, 1218672000,
    1218672000, 1218672000, 1218672000, 1314230400, 1314230400, 1314230400,
    1314230400, 1314230400, 1314230400, 1314230400, 1314230400, 1314230400,
    1314230400, 1314230400, 1498867200, 1498867200, 1498867200, 1498867200,
    1498867200, 1498867200, 1498867200, 1498867200, 1498867200, 1498867200,
    1.188e+09, 1.188e+09, 1.188e+09, 1.188e+09, 1.188e+09, 1.188e+09,
    1.188e+09, 1.188e+09, 1.188e+09, 1.188e+09, 1.188e+09, 1.188e+09,
    1314057600, 1314057600, 1314057600, 1314057600, 1314057600, 1314057600,
    1314057600, 1314057600, 1314057600, 1314057600, 1314057600, 1314057600,
    1314057600, 1185062400, 1185062400, 1185062400, 1185062400, 1185062400,
    1185062400, 1185062400, 1185062400, 1185062400, 1185062400, 1185062400,
    1250467200, 1250467200, 1250467200, 1250467200, 1250467200, 1250467200,
    1250467200, 1250467200, 1250467200, 1250467200, 1250467200, 1250467200,
    1250467200, 1250467200, 1250467200, 1185321600, 1185321600, 1185321600,
    1185321600, 1185321600, 1185321600, 1185321600, 1185321600, 1185321600,
    1185321600, 1185321600, 1185321600, 1185321600, 1185321600, 1185321600,
    1185321600, 1185321600, 1185321600, 1185321600, 1185321600, 1185321600,
    1185321600, 1185321600, 1185321600, 1185321600, 1185321600, 1185321600,
    1185321600, 1185321600, 1598054400, 1598054400, 1374883200, 1374883200,
    1374883200, 1374883200, 1374883200, 1374883200, 1374883200, 1374883200,
    1374883200, 1374883200, 1374883200, 1314316800, 1314316800, 1314316800,
    1314316800, 1314316800, 1314316800, 1314316800, 1314316800, 1314316800,
    1314316800, 1314316800, 1314316800, 1.188e+09, 1.188e+09, 1.188e+09,
    1.188e+09, 1.188e+09, 1.188e+09, 1.188e+09, 1.188e+09, 1.188e+09,
    1.188e+09, 1.188e+09, 1.188e+09, 1.188e+09, 1.188e+09, 1.188e+09,
    1.188e+09, 1466208000, 1466208000, 1466208000, 1466208000, 1466208000,
    1466208000, 1466208000, 1466208000, 1466208000, 1466208000, 1185321600,
    1185321600, 1185321600, 1185321600, 1185321600, 1185321600, 1185321600,
    1185321600, 1185321600, 1185321600, 1185321600, 1314316800, 1314316800,
    1314316800, 1314316800, 1314316800, 1314316800, 1314316800, 1314316800,
    1.188e+09, 1.188e+09, 1.188e+09, 1.188e+09, 1.188e+09, 1.188e+09,
    1.188e+09, 1.188e+09, 1.188e+09, 1.188e+09, 1.188e+09, 1.188e+09,
    1.188e+09, 1.188e+09, 1.188e+09, 1.188e+09, 1.188e+09, 1.188e+09,
    1.188e+09, 1.188e+09, 1.188e+09, 1.188e+09, 1.188e+09, 1.188e+09,
    1.188e+09, 1.188e+09, 1.188e+09, 1.188e+09, 1.188e+09, 1.188e+09,
    1.188e+09, 1.188e+09, 1.188e+09, 1.188e+09, 1.188e+09, 1009843200,
    1009843200, 1009843200, 1009843200, 1009843200, 1009843200, 1009843200,
    1009843200, 1009843200, 1009843200, 1009843200, 1009843200, 1009843200,
    1184803200, 1184803200, 1184803200, 1184803200, 1184803200, 1184803200,
    1184803200, 1184803200, 1184803200, 1184803200, 1184803200, 1184803200,
    1184803200, 1184803200, 1184803200, 1184803200, 1184803200, 1503705600,
    1503705600, 1503705600, 1503705600, 1503705600, 1503705600, 1503705600,
    1503705600, 1469404800, 1469404800, 1469404800, 1469404800, 1469404800,
    1469404800, 1469404800, 1469404800, 1469404800, 1469404800, 1469404800,
    1185321600, 1185321600, 1185321600, 1185321600, 1185321600, 1185321600,
    1185321600, 1185321600, 1185321600, 1185321600, 1185321600, 1185321600,
    1185321600, 1187913600, 1187913600, 1187913600, 1187913600, 1187913600,
    1187913600, 1187913600, 1187913600, 1187913600, 1187913600, 1187913600,
    1250726400, 1250726400, 1250726400, 1250726400, 1250726400, 1250726400,
    1250726400, 1250726400, 1250726400, 1250726400, 1250726400, 1505174400,
    1505174400, 1505174400, 1505174400, 1505174400, 1505174400, 1505174400,
    1505174400, 1505174400, 1505174400, 1505174400, 1314316800, 1314316800,
    1314316800, 1314316800, 1314316800, 1314316800, 1314316800, 1314316800,
    1469836800, 1469836800, 1314144000, 1314144000, 978307200, 978307200,
    978307200, 978307200, 978307200, 978307200, 978307200, 978307200,
    978307200, 978307200, 978307200, 1183075200, 1183075200, 1183075200,
    1183075200, 1183075200, 1183075200, 1183075200, 1183075200, 1183075200,
    1183075200, 1183075200, 1403827200, 1403827200, 1403827200, 1403827200,
    1403827200, 1403827200, 1403827200, 1403827200, 1403827200, 1403827200,
    1404432000, 1404432000, 1404432000, 1404432000, 1404432000, 1404432000,
    1404432000, 1404432000, 1404432000, 1404432000, 1281830400, 1281830400,
    1281830400, 1281830400, 1281830400, 1281830400, 1281830400, 1281830400,
    1281830400, 1281830400, 1281830400, 1185408000, 1185408000, 1185408000,
    1185408000, 1185408000, 1185408000, 1185408000, 1185408000, 1185408000,
    1185408000, 1185408000, 1185408000, 1185408000, 1188259200, 1188259200,
    1188259200, 1188259200, 1188259200, 1188259200, 1188259200, 1188259200,
    1188259200, 1188259200, 1188259200, 1188259200, 1188259200, 1532304000,
    1532304000, 1532304000, 1532304000, 1532304000, 1532304000, 1188172800,
    1188172800, 1188172800, 1188172800, 1188172800, 1188172800, 1188172800,
    1188172800, 1188172800, 1188172800, 1188172800, 1343606400, 1343606400,
    1343606400, 1343606400, 1343606400, 1343606400, 1343606400, 1343606400,
    1343606400, 1343606400, 1343606400, 1182988800, 1182988800, 1182988800,
    1182988800
  ), tzone = "UTC", class = c("POSIXct", "POSIXt")),
  area_ha = c(
    7005, 7005, 7005, 7005, 7005, 7005, 7005, 7005,
    7005, 7005, 7005, 7005, 6837, 6837, 6837, 6837, 6837, 6837,
    6837, 6837, 6837, 6837, 6837, 6837, 6245, 6245, 6245, 6245,
    6245, 6245, 6245, 6245, 6245, 6245, 6245, 6245, 6245, 6245,
    6245, 6245, 6245, 6245, 6245, 6245, 6245, 6245, 6245, 6245,
    5829, 5829, 5829, 5829, 5829, 5829, 5829, 5829, 5829, 5829,
    5829, 5829, 5829, 5829, 5815, 5815, 5815, 5815, 5815, 5815,
    5815, 5815, 5815, 5815, 5815, 5815, 5815, 5815, 5815, 5815,
    5815, 5815, 5815, 5815, 5815, 5568, 5568, 5568, 5568, 5568,
    5568, 5568, 5568, 5568, 5568, 5568, 5568, 5568, 5568, 5434,
    5434, 5434, 5434, 5434, 5434, 5434, 5434, 5434, 5434, 5434,
    5434, 5434, 5434, 5434, 5434, 5434, 5434, 5434, 5434, 5434,
    5434, 5434, 5434, 5242, 4986, 4986, 4986, 4986, 4986, 4986,
    4986, 4986, 4986, 4986, 4986, 4986, 4986, 4833, 4833, 4833,
    4833, 4833, 4833, 4833, 4833, 4833, 4833, 4833, 4833, 4813,
    4813, 4813, 4813, 4813, 4813, 4813, 4813, 4813, 4813, 4813,
    4813, 4813, 4813, 4813, 4813, 4813, 4813, 4813, 4813, 4813,
    4813, 4813, 4813, 4813, 4813, 4813, 4813, 4813, 4813, 4813,
    4813, 4813, 4813, 4813, 4813, 4813, 4813, 4813, 4813, 4813,
    4813, 4813, 4813, 4813, 4813, 4813, 4813, 4813, 4813, 4813,
    4813, 4813, 4813, 4813, 4813, 4813, 4813, 4813, 4813, 4813,
    4813, 4813, 4813, 4813, 4813, 4813, 4813, 4813, 4813, 4813,
    4813, 4813, 4813, 4813, 4813, 4813, 4813, 4813, 4813, 4813,
    4813, 4813, 4813, 4688, 4688, 4688, 4688, 4386, 4386, 4386,
    4386, 4386, 4386, 4386, 4386, 4386, 4386, 4386, 4386, 4386,
    4386, 4386, 4227, 4227, 4227, 4227, 4227, 4227, 4227, 4227,
    4227, 4227, 4227, 4227, 4227, 4227, 4093, 4093, 4093, 4093,
    4093, 4093, 4093, 4093, 4093, 4093, 4093, 4093, 4079, 4079,
    4079, 4079, 4079, 4079, 4079, 4079, 4079, 4079, 4079, 4079,
    3896, 3896, 3896, 3896, 3896, 3896, 3896, 3896, 3896, 3896,
    3896, 3896, 3896, 3896, 3724, 3724, 3724, 3724, 3724, 3724,
    3724, 3724, 3724, 3724, 3724, 3724, 3724, 3724, 3724, 3724,
    3724, 3724, 3724, 3724, 3724, 3724, 3724, 3549, 3549, 3549,
    3549, 3549, 3549, 3549, 3549, 3549, 3549, 3310, 3310, 3310,
    3310, 3310, 3310, 3310, 3310, 3310, 3310, 3310, 3310, 3073,
    3073, 3073, 3073, 3073, 3073, 3073, 3073, 3073, 3073, 3073,
    3073, 3073, 2963, 2963, 2963, 2963, 2963, 2963, 2963, 2963,
    2963, 2963, 2963, 2962, 2962, 2962, 2962, 2962, 2962, 2962,
    2962, 2962, 2962, 2962, 2962, 2889, 2889, 2889, 2889, 2889,
    2889, 2889, 2889, 2889, 2889, 2889, 2859, 2859, 2859, 2859,
    2859, 2859, 2859, 2859, 2859, 2859, 2859, 2859, 2859, 2859,
    2859, 2851, 2851, 2851, 2851, 2851, 2851, 2851, 2851, 2851,
    2851, 2851, 2851, 2851, 2839, 2839, 2839, 2839, 2839, 2839,
    2839, 2839, 2839, 2839, 2839, 2839, 2839, 2701, 2701, 2701,
    2701, 2701, 2701, 2701, 2701, 2701, 2701, 2701, 2701, 2701,
    2701, 2701, 2701, 2701, 2701, 2701, 2701, 2701, 2701, 2604,
    2604, 2604, 2604, 2604, 2604, 2604, 2604, 2604, 2604, 2604,
    2604, 2583, 2583, 2583, 2583, 2583, 2583, 2583, 2583, 2583,
    2583, 2583, 2583, 2578, 2578, 2578, 2578, 2578, 2578, 2578,
    2578, 2578, 2578, 2578, 2578, 2578, 2578, 2578, 2578, 2578,
    2578, 2478, 2478, 2478, 2478, 2478, 2478, 2478, 2478, 2478,
    2478, 2478, 2478, 2478, 2478, 2478, 2478, 2478, 2478, 2478,
    2478, 2478, 2478, 2478, 2478, 2478, 2478, 2478, 2478, 2478,
    2478, 2478, 2478, 2478, 2478, 2478, 2478, 2478, 2478, 2478,
    2478, 2478, 2478, 2478, 2478, 2478, 2478, 2478, 2478, 2478,
    2478, 2478, 2478, 2478, 2478, 2478, 2478, 2478, 2478, 2478,
    2478, 2478, 2478, 2478, 2478, 2478, 2478, 2431, 2431, 2431,
    2431, 2431, 2431, 2431, 2431, 2431, 2431, 2431, 2369, 2369,
    2369, 2369, 2369, 2369, 2369, 2369, 2369, 2369, 2369, 2341,
    2341, 2341, 2341, 2341, 2341, 2341, 2341, 2341, 2341, 2209,
    2209, 2209, 2209, 2209, 2209, 2209, 2209, 2209, 2209, 2209,
    2209, 2074, 2074, 2074, 2074, 2074, 2074, 2074, 2074, 2074,
    2074, 2074, 2074, 2074, 2025, 2025, 2025, 2025, 2025, 2025,
    2025, 2025, 2025, 2025, 2025, 1925, 1925, 1925, 1925, 1925,
    1925, 1925, 1925, 1925, 1925, 1925, 1925, 1925, 1925, 1925,
    1923, 1923, 1923, 1923, 1923, 1923, 1923, 1923, 1923, 1923,
    1923, 1923, 1923, 1923, 1923, 1923, 1923, 1923, 1923, 1923,
    1923, 1923, 1923, 1923, 1923, 1923, 1923, 1923, 1923, 1894,
    1894, 1881, 1881, 1881, 1881, 1881, 1881, 1881, 1881, 1881,
    1881, 1881, 1808, 1808, 1808, 1808, 1808, 1808, 1808, 1808,
    1808, 1808, 1808, 1808, 1794, 1794, 1794, 1794, 1794, 1794,
    1794, 1794, 1794, 1794, 1794, 1794, 1794, 1794, 1794, 1794,
    1772, 1772, 1772, 1772, 1772, 1772, 1772, 1772, 1772, 1772,
    1768, 1768, 1768, 1768, 1768, 1768, 1768, 1768, 1768, 1768,
    1768, 1761, 1761, 1761, 1761, 1761, 1761, 1761, 1761, 1680,
    1680, 1680, 1680, 1680, 1680, 1680, 1680, 1680, 1680, 1680,
    1680, 1680, 1680, 1680, 1680, 1680, 1680, 1680, 1680, 1671,
    1671, 1671, 1671, 1671, 1671, 1671, 1671, 1671, 1671, 1671,
    1671, 1671, 1671, 1671, 1625, 1625, 1625, 1625, 1625, 1625,
    1625, 1625, 1625, 1625, 1625, 1625, 1625, 1612, 1612, 1612,
    1612, 1612, 1612, 1612, 1612, 1612, 1612, 1612, 1612, 1612,
    1612, 1612, 1612, 1612, 1592, 1592, 1592, 1592, 1592, 1592,
    1592, 1592, 1515, 1515, 1515, 1515, 1515, 1515, 1515, 1515,
    1515, 1515, 1515, 1504, 1504, 1504, 1504, 1504, 1504, 1504,
    1504, 1504, 1504, 1504, 1504, 1504, 1495, 1495, 1495, 1495,
    1495, 1495, 1495, 1495, 1495, 1495, 1495, 1489, 1489, 1489,
    1489, 1489, 1489, 1489, 1489, 1489, 1489, 1489, 1483, 1483,
    1483, 1483, 1483, 1483, 1483, 1483, 1483, 1483, 1483, 1477,
    1477, 1477, 1477, 1477, 1477, 1477, 1477, 1474, 1474, 1471,
    1471, 1447, 1447, 1447, 1447, 1447, 1447, 1447, 1447, 1447,
    1447, 1447, 1443, 1443, 1443, 1443, 1443, 1443, 1443, 1443,
    1443, 1443, 1443, 1435, 1435, 1435, 1435, 1435, 1435, 1435,
    1435, 1435, 1435, 1431, 1431, 1431, 1431, 1431, 1431, 1431,
    1431, 1431, 1431, 1417, 1417, 1417, 1417, 1417, 1417, 1417,
    1417, 1417, 1417, 1417, 1403, 1403, 1403, 1403, 1403, 1403,
    1403, 1403, 1403, 1403, 1403, 1403, 1403, 1373, 1373, 1373,
    1373, 1373, 1373, 1373, 1373, 1373, 1373, 1373, 1373, 1373,
    1362, 1362, 1362, 1362, 1362, 1362, 1352, 1352, 1352, 1352,
    1352, 1352, 1352, 1352, 1352, 1352, 1352, 1337, 1337, 1337,
    1337, 1337, 1337, 1337, 1337, 1337, 1337, 1337, 1335, 1335,
    1335, 1335
  )
), row.names = c(NA, -1000L), class = c(
  "tbl_df",
  "tbl", "data.frame"
))

# we don't appear to be doing a time series
# so let's simplify by just focusing on area
# in log base 10
d <- sort(log10(RandomF$area_ha))
# characteristic file size range in powers
# of ten
range(d)
#> [1] 3.125481 3.845408
# 16 is the number of bins reflected
# by hist(d)$breaks |> length()
# or use 20 to compare to results in
# Lehsten, V., de Groot, W. J., Flannigan, M., 
# George, C., Harmand, P., and Balzter, H. (2014), 
# Wildfires in boreal ecoregions: Evaluating the power 
# law assumption and intra-annual and interannual variations,
# J. Geophys. Res. Biogeosci., 119, 14–23, doi:10.1002/2012JG002252.
bins <- cut(d, breaks = 16)
# the mean burn area for each bin
bin_means <- tapply(d, bins, mean)
# number of observations within each bin
bin_counts <- tapply(d, bins, length)
# burn area within each bin
a <- bin_means * bin_counts


midpoint <- function(interval_string) {
  # Remove parentheses and brackets
  interval_string <- gsub("\\(|\\[|\\)|\\]", "", interval_string)
  
  # Split the string into lower and upper bounds
  bounds <- strsplit(interval_string, ",")[[1]]
  
  # Convert the bounds to numeric values
  lower_bound <- as.numeric(bounds[1])
  upper_bound <- as.numeric(bounds[2])
  
  # Calculate and return the midpoint
  return(mean(c(lower_bound, upper_bound)))
}
marks <- sapply(attributes(a)$dimnames[[1]],midpoint)
attributes(marks) <- NULL

attributes(a)$dimnames[[1]] = marks

cfs <- as.numeric(attributes(a[which.max(a)])$names)
cfs
#> [1] 3.69

# data frame with burn area by size
b <- data.frame(
  area = log10(a),
  size = marks)

# Create the base plot
p <- ggplot(b, aes(x = size, y = area))

# Distribution of burn area by fire size
p <- p + geom_col() 

# Add a normal distribution curve layer
p <- p + stat_function(fun = dnorm, args = list(mean = mean(b$size), sd = sd(b$size)), color = "red", size = 1)
#> Warning: Using `size` aesthetic for lines was deprecated in ggplot2 3.4.0.
#> ℹ Please use `linewidth` instead.
#> This warning is displayed once every 8 hours.
#> Call `lifecycle::last_lifecycle_warnings()` to see where this warning was
#> generated.

# Display the plot
p +
  xlab("Fire size in hectares base 10") +
  ylab("Burn area in 100 hectares") +
  theme_minimal()

image

Created on 2023-10-22 with reprex v2.0.2

Just see it!!! Many thanks for this I will try to work with your code

This is a great code

  1. the total burned area for each bin = mean fire size * number of fires in each bin
    but mean fire size = exp(mean fire size)

e.g.

mean fire size =0.35 = exp(0.5) = 1.42

each bin total area = 1.42 * 158 fire events = 224

a <- bin_means * bin_counts ==> a <- exp(bin_means) * bin_counts

That means that bars should have the real area and not the log of the area

b <- data.frame(
area = a,
size = marks)

I did these changes to your code but the curve is attached at x axis as a line.

y axis should be in hectares and not the log values
x axis should be in log values
the area of the histogram is adjusted to the total burned area

e.g. Creating the normal distribution curve in excel"
I found the pdf and multiply each of the points with the sum of the burned area ( e.g 369874 ha)

I had to give more information
I made it more difficult for you

1 Like

I found the paper difficult to interpret. The flat curve is something I found too. Post your code so we can work from a common understanding?

This is my initial code but the curve doesn;t count the upper and lower limit

RandomF_his <- hist(log(RandomF$area_ha),breaks =seq(from= 0,to=12, by=0.7),
main ="FWIL Burned Areas",xlab="Burned Area LOG HA",ylab= "Frequency")

RandomF_info <- hist(log(RandomF$area_ha),breaks =seq(from=0,to=12, by=0.7),
main ="FWIL Burned Areas",xlab="Burned Area LOG HA",ylab= "Frequency")

RandomF_info

RandomF_counts <- RandomF_info $counts

RandomF_counts

Barplot

counts <- RandomF_counts

counts_sum <- sum(counts)
sum_area <- sum(RandomF$area_ha) #5499822

ksi <- RandomF_his$mids
bin.mid.exp <- exp(ksi)
tba <- bin.mid.exp*counts

Total_dec <- data.frame(ksi, tba) # Apply data.frame function

###Barplot
bp <- barplot(Total_dec$tba, names.arg=Total_dec$ksi,
space = c(0, diff(Total_dec$ksi)),
ylim = c(0, 1500000),
col="lightblue", xlab="Loge(Ha)", ylab="Burned Area")

mu + s

mu <- Hmisc::wtd.mean(Total_dec$ksi, Total_dec$tba)
sigma <- sqrt(Hmisc::wtd.var(Total_dec$ksi, weights = Total_dec$tba))
c(mu, sigma)#

func <- function(a) {
(min(Total_dec$ksi) - bp[1,1]) + # the offset, happens to be 0 here since
# the first datapoint is exactly 0.5
a * diff(range(bp[,1])) / diff(range(Total_dec$ksi))
}

mu2 <- func(mu)
sigma2 <- sigma
c(mu2, sigma2)

lower upper limit

ll <- 17.14-(21.39)
ul <- 17.14+(2
1.39)

normal distribution

curve(dnorm(x, mean=mu2, sd=sigma2) * sum(Total_dec$tba),
col = "red", lwd = 3, add=T)

This is what I was hoping to see, and it would also be helpful to have it in the form of a reprex (see the FAQ)

These are commnets by my supervisor because what I have sent up to the moment was incorrect.

For each of the curves you should estimate 3 parameters: CFS (which is a parameter shifting the curve left right),
sigma (which is the spread of the curve)
and another parameter for the total area under the curve, shifting it up and down.

Than you calculate the value of the curve using these parameters for each bar and connect these points with a line. That way there can not be any skewness as the 3 parameter do not allow for any skewness.
You should do is to estimate the parameters sigma and mue for the formula directly instead of using a mean and a standarddeviation.

library(readxl)
#> Warning: package 'readxl' was built under R version 4.2.3
library(ggplot2)
library(dplyr)
#> 
#> Attaching package: 'dplyr'
#> The following objects are masked from 'package:stats':
#> 
#>     filter, lag
#> The following objects are masked from 'package:base':
#> 
#>     intersect, setdiff, setequal, union
setwd("C:/Users/user/Desktop/Thesis/RSt")
getwd()
#> [1] "C:/Users/user/Desktop/Thesis/RSt"

RandomF <- read_excel("C:/Users/user/Desktop/Thesis/RSt/RandomF.xls")
#> New names:
#> • `` -> `...8`



RandomF_his <- hist(log(RandomF$area_ha),breaks =seq(from= 0,to=12, by=0.7),
                    main ="FWIL Burned Areas",xlab="Burned Area LOG HA",ylab= "Frequency")

RandomF_info <- hist(log(RandomF$area_ha),breaks =seq(from=0,to=12, by=0.7),
                     main ="FWIL Burned Areas",xlab="Burned Area LOG HA",ylab= "Frequency")


RandomF_info
#> $breaks
#>  [1]  0.0  0.7  1.4  2.1  2.8  3.5  4.2  4.9  5.6  6.3  7.0  7.7  8.4  9.1  9.8
#> [16] 10.5 11.2 11.9
#> 
#> $counts
#>  [1]    0  166  569  807 2155 2351 2670 2295 1367 1015  609  374  235    0    0
#> [16]    0    0
#> 
#> $density
#>  [1] 0.00000000 0.01622821 0.05562562 0.07889257 0.21067347 0.22983449
#>  [7] 0.26102003 0.22435991 0.13363835 0.09922672 0.05953603 0.03656236
#> [13] 0.02297367 0.00000000 0.00000000 0.00000000 0.00000000
#> 
#> $mids
#>  [1]  0.35  1.05  1.75  2.45  3.15  3.85  4.55  5.25  5.95  6.65  7.35  8.05
#> [13]  8.75  9.45 10.15 10.85 11.55
#> 
#> $xname
#> [1] "log(RandomF$area_ha)"
#> 
#> $equidist
#> [1] TRUE
#> 
#> attr(,"class")
#> [1] "histogram"

RandomF_counts <- RandomF_info $counts

RandomF_counts
#>  [1]    0  166  569  807 2155 2351 2670 2295 1367 1015  609  374  235    0    0
#> [16]    0    0

#Barplot

counts <- RandomF_counts

counts_sum <- sum(counts)
sum_area <- sum(RandomF$area_ha) #5499822

ksi <- RandomF_his$mids
bin.mid.exp <- exp(ksi)
tba <- bin.mid.exp*counts

Total_dec <- data.frame(ksi, tba) # Apply data.frame function

###Barplot
bp <- barplot(Total_dec$tba, names.arg=Total_dec$ksi,
              space = c(0, diff(Total_dec$ksi)),
              ylim = c(0, 1500000),
              col="lightblue", xlab="Loge(Ha)", ylab="Burned Area")
## mu + s

mu <- Hmisc::wtd.mean(Total_dec$ksi, Total_dec$tba)
sigma <- sqrt(Hmisc::wtd.var(Total_dec$ksi, weights = Total_dec$tba))
c(mu, sigma)#
#> [1] 7.232645 1.399378

func <- function(a) {
  (min(Total_dec$ksi) - bp[1,1]) + # the offset, happens to be 0 here since
    # the first datapoint is exactly 0.5
    a * diff(range(bp[,1])) / diff(range(Total_dec$ksi))
}

mu2 <- func(mu)
sigma2 <- sigma
c(mu2, sigma2)
#> [1] 17.414995  1.399378

###lower upper limit dont know if this is the correct way

ll <- 17.14-(21.39)
ul <- 17.14+(21.39)

###normal distribution

curve(dnorm(x, mean=mu2, sd=sigma2) * sum(Total_dec$tba),
      col = "red", lwd = 3, add=T)

Created on 2023-10-23 with reprex v2.0.2

Instead of using dnorn (which is the normal distribution, correct), you need to fit the parameters of the function directly, and it has to be 4 parameters.

something like DataTechNotes: Curve Fitting Example With Nonlinear Least Squares in R

where you use :

fit = nls(y~ax^2+bx, data = df, start(a=0, b=0))
print(fit)

but for y~ax^2+bx you place

('b_3/((2*3.14159.*b_2.^2)^(1/2)).*exp(-(x-b_1).^2/(2.*b_2.^2))'
this is the function for the curve of the normal distribution,

Where b_1 to b_3 are the parameters to be estimated and you need to provide an initial guess. b_1 = area under curve, b_2 = sigma and b_3 becomes the mean value.