Files
HappyDad/Plots/NS41 Plots Script.R
2024-05-15 20:02:16 -06:00

54 lines
2.2 KiB
R

# NS41 Plots
# Michael D Cayton
# August 23, 2023
# Last update 08-23-2023
library(lubridate)
library(tidyverse)
A <- read_table("ns41nT2019A.txt",
col_names = FALSE)
B <- read_table("ns41nT2019B.txt",
col_names = FALSE)
C <- read_table("ns41nT2019C.txt",
col_names = FALSE)
D <- read_table("ns41nT2019D.txt",
col_names = FALSE)
View(B)
A <- A %>% rename(Date=X1, Electron_Temperature=X2, Electron_Density=X3)
B <- B %>% rename(Date=X1, Electron_Temperature=X2, Electron_Density=X3)
C <- C %>% rename(Date=X1, Electron_Temperature=X2, Electron_Density=X3)
D <- D %>% rename(Date=X1, Electron_Temperature=X2, Electron_Density=X3)
A["Date"] <- lapply(A["Date"], function(x) as.Date(x ,origin="2019-01-01"))
B["Date"] <- lapply(B["Date"], function(x) as.Date(x ,origin="2019-01-01"))
C["Date"] <- lapply(C["Date"], function(x) as.Date(x ,origin="2019-01-01"))
D["Date"] <- lapply(D["Date"], function(x) as.Date(x ,origin="2019-01-01"))
ggplot() +
geom_line(data=A, aes(x=Date, y=Electron_Temperature, colour="A")) +
geom_line(data=B, aes(x=Date, y=Electron_Temperature, colour="B")) +
geom_line(data=C, aes(x=Date, y=Electron_Temperature, colour="C")) +
geom_line(data=D, aes(x=Date, y=Electron_Temperature, colour="D")) +
scale_color_manual(name="Group", values=c("A"="red", "B"="green", "C"="blue", "D"="purple")) +
scale_x_date(date_labels = "%m-%d-%y") +
theme_bw() +
guides() +
ggtitle("Electron Temperature at 4 Magnetic-equator Crossings during 20 Oct 2019 through 15 Feb 2020") +
ylab("Electron temperature: MeV")
ggplot() +
geom_line(data=A, aes(x=Date, y=Electron_Density, colour="A")) +
geom_line(data=B, aes(x=Date, y=Electron_Density, colour="B")) +
geom_line(data=C, aes(x=Date, y=Electron_Density, colour="C")) +
geom_line(data=D, aes(x=Date, y=Electron_Density, colour="D")) +
scale_color_manual(name="Group", values=c("A"="red", "B"="green", "C"="blue", "D"="purple")) +
scale_x_date(date_labels = "%m-%d-%y") +
scale_y_log10() +
theme_bw() +
guides() +
ggtitle("Electron Density at 4 Magnetic-equator Crossings during 20 Oct 2019 through 15 Feb 2020") +
ylab(" Electron density e/cm**3")