File:Visualizing Loglog Normal Data.png
Size of this preview: 800 × 400 pixels. Other resolutions: 320 × 160 pixels | 640 × 320 pixels | 1,024 × 512 pixels | 1,280 × 640 pixels | 2,400 × 1,200 pixels.
Original file (2,400 × 1,200 pixels, file size: 439 KB, MIME type: image/png)
This is a file from the Wikimedia Commons. The description on its description page there is shown below.
|
Summary
DescriptionVisualizing Loglog Normal Data.png |
English: This image presents two plots generated from a dataset of 10,000 points.
The first plot, titled 'Concave Line with Log-Normal Noise', displays a scatter plot of the observed data (y_observed) against the independent variable (x). The red line represents the 'Median line', while the blue line is the 'Mean line'. The y-axis is limited to a range of 0 to 20. The second plot, titled 'Log-Log Linear Line with Normal Noise', also displays a scatter plot of the observed data against the independent variable, but both axes are on a logarithmic scale. Here, both the mean and median lines are the same (red) line. |
Date | |
Source | Own work |
Author | Talgalili |
# Reproducible R code # Load necessary libraries library(ggplot2) library(patchwork) # Set seed for reproducibility set.seed(123) # Generate data n <- 10000 x <- sort(runif(n, min = 1, max = 100)) intercept <- 0.000001 slope <- 0.5 y_true_log <- intercept + slope * log10(x) noise <- rnorm(n, mean = 0, sd = .1) y_observed_log <- y_true_log + noise y_observed <- 10^y_observed_log y_true <- 10^y_true_log # Create data frame df <- data.frame(x = x, y_true = y_true, y_observed = y_observed) # For jupyter notebook options( repr.plot.width = 20, # in inches (default = 7) repr.plot.height = 10 # in inches (default = 7) ) # Plot data p1 <- ggplot(df, aes(x = x, y = y_observed)) + geom_point() + geom_line(aes(y = y_true, color = 'Median line'), size = 3) + geom_smooth(aes(color = 'Mean line'), size = 3, se = F) + coord_cartesian(ylim = c(0, 20)) + # Set the limits of the plot without excluding obs scale_color_manual(values = c('Median line' = 'red', 'Mean line' = 'blue')) + theme_bw() + theme(text = element_text(size = 25)) + theme(legend.position="bottom") + labs(x = 'X', y = 'Y', title = 'Concave Line with Log-Normal Noise') p2 <- ggplot(df, aes(x = x, y = y_observed)) + geom_point() + geom_line(aes(y = y_true, color = 'Mean and Median line'), size = 3) + scale_x_log10() + scale_y_log10() + scale_color_manual(values = c('Mean and Median line' = 'red')) + theme_bw() + theme(text = element_text(size = 25)) + theme(legend.position="bottom") + labs(x = 'X (log scale)', y = 'Y (log scale)', title = 'Log-Log Linear Line with Normal Noise') p1 + p2 + plot_annotation( title = 'Visualizing Loglog Normal Data: Scatter-plots in Original and Log10 Scales', theme = theme(plot.title = element_text(hjust = 0.5, size = 40)) )
Licensing
I, the copyright holder of this work, hereby publish it under the following license:
This file is licensed under the Creative Commons Attribution 4.0 International license.
- You are free:
- to share – to copy, distribute and transmit the work
- to remix – to adapt the work
- Under the following conditions:
- attribution – You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use.
Items portrayed in this file
depicts
some value
15 April 2024
image/png
File history
Click on a date/time to view the file as it appeared at that time.
Date/Time | Dimensions | User | Comment | |
---|---|---|---|---|
current | 03:25, 15 April 2024 | 2,400 × 1,200 (439 KB) | Talgalili | Uploaded own work with UploadWizard |
File usage
The following page uses this file:
Metadata
This file contains additional information, probably added from the digital camera or scanner used to create or digitize it.
If the file has been modified from its original state, some details may not fully reflect the modified file.
Horizontal resolution | 47.24 dpc |
---|---|
Vertical resolution | 47.24 dpc |