Skip to content

Commit

Permalink
replace myDisqus with pageSlug
Browse files Browse the repository at this point in the history
  • Loading branch information
holtzy committed Jun 3, 2024
1 parent 4293f75 commit 91af277
Show file tree
Hide file tree
Showing 83 changed files with 2,619 additions and 2,701 deletions.
14 changes: 7 additions & 7 deletions caveat/3d.Rmd
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
myimage1: "../img/mistake/3d.png"
mytitle: "The issue with 3D in data visualization"
mydisqus: "3d"
pathSlug: "3d"
output:
html_document:
template: template_caveat.html
Expand All @@ -13,7 +13,7 @@ output:
number_section: FALSE
df_print: "paged"
code_folding: "hide"
includes:
includes:
after_body: footer.html
---

Expand Down Expand Up @@ -51,7 +51,7 @@ Here is a 3d barplot. You are probably familiar with this kind of figure since i

# 3D Pie charts: Don't
***
Nothing is worse than a [pie chart](https://www.data-to-viz.com/caveat/pie.html) in dataviz, except a 3D pie chart. Data to viz offers a whole post on [pie chart issues](https://www.data-to-viz.com/caveat/pie.html).
Nothing is worse than a [pie chart](https://www.data-to-viz.com/caveat/pie.html) in dataviz, except a 3D pie chart. Data to viz offers a whole post on [pie chart issues](https://www.data-to-viz.com/caveat/pie.html).

Adding 3D makes it even worse since it distorts reality. Indeed, the part at the back looks smaller than the one at the front, which is not the case.

Expand Down Expand Up @@ -104,10 +104,10 @@ data$color <- mycolors[ as.numeric(data$Species) ]
# Plot
par(mar=c(0,0,0,0))
plot3d(
x=data$`Sepal.Length`, y=data$`Sepal.Width`, z=data$`Petal.Length`,
col = data$color,
type = 's',
plot3d(
x=data$`Sepal.Length`, y=data$`Sepal.Width`, z=data$`Petal.Length`,
col = data$color,
type = 's',
radius = .1,
xlab="Sepal Length", ylab="Sepal Width", zlab="Petal Length")
```
Expand Down
6 changes: 3 additions & 3 deletions caveat/annotation.Rmd
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
myimage1: "../img/mistake/annotate.png"
mytitle: "Annotation is crucial for your dataviz"
mydisqus: "annotation"
pathSlug: "annotation"
output:
html_document:
template: template_caveat.html
Expand All @@ -13,7 +13,7 @@ output:
number_section: FALSE
df_print: "paged"
code_folding: "hide"
includes:
includes:
after_body: footer.html
---

Expand All @@ -40,7 +40,7 @@ library(babynames)
library(viridis)
# Load dataset from github
data <- babynames %>%
data <- babynames %>%
filter(name %in% c("Mary","Emma", "Ida", "Ashley", "Amanda", "Jessica", "Patricia", "Linda", "Deborah", "Dorothy", "Betty", "Helen")) %>%
filter(sex=="F")
Expand Down
8 changes: 4 additions & 4 deletions caveat/area_hard.Rmd
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
myimage1: "../img/mistake/bubble_hard.png"
mytitle: "Area is a poor metaphor"
mydisqus: "area_hard"
pathSlug: "area_hard"
output:
html_document:
template: template_caveat.html
Expand All @@ -13,14 +13,14 @@ output:
number_section: FALSE
df_print: "paged"
code_folding: "hide"
includes:
includes:
after_body: footer.html
---

<br><br><br><br>
<div class="mycontent">

The human eye does not perform well when it has to translate areas to numeric values. Let's consider the following five bubbles. Try to rank them by decreasing area. You will probably agree that this is possible, but takes some time.
The human eye does not perform well when it has to translate areas to numeric values. Let's consider the following five bubbles. Try to rank them by decreasing area. You will probably agree that this is possible, but takes some time.

```{r, warning=FALSE, message=FALSE, fig.align="center", fig.width=7, fig.height=1}
# Libraries
Expand Down Expand Up @@ -71,7 +71,7 @@ This does not mean that area must never been used to represent a numeric variabl

#Going further
***
- Using bubbles: [scaling to radius or area](https://www.data-to-viz.com/caveat/radius_or_area.html)?
- Using bubbles: [scaling to radius or area](https://www.data-to-viz.com/caveat/radius_or_area.html)?
- Data visualization: basic principles. [link](http://paldhous.github.io/ucb/2016/dataviz/week2.html)


Expand Down
6 changes: 3 additions & 3 deletions caveat/aspect_ratio.Rmd
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
myimage1: "../img/mistake/aspect_ratio.png"
mytitle: "Mind the aspect ratio"
mydisqus: "aspect_ratio"
pathSlug: "aspect_ratio"
output:
html_document:
template: template_caveat.html
Expand All @@ -13,14 +13,14 @@ output:
number_section: FALSE
df_print: "paged"
code_folding: "hide"
includes:
includes:
after_body: footer.html
---

<br><br>
<div class="mycontent">

`Aspect ratio` is defined as the ratio of the width to the height of a graphic. It can have a strong impact on the insights gained from your graphic.
`Aspect ratio` is defined as the ratio of the width to the height of a graphic. It can have a strong impact on the insights gained from your graphic.

<br>

Expand Down
8 changes: 4 additions & 4 deletions caveat/bin_size.Rmd
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
myimage1: "../img/mistake/bin_size.png"
mytitle: "Play with your histogram bin size"
mydisqus: "bin_size"
pathSlug: "bin_size"
output:
html_document:
template: template_caveat.html
Expand All @@ -13,13 +13,13 @@ output:
number_section: FALSE
df_print: "paged"
code_folding: "hide"
includes:
includes:
after_body: footer.html
---

<br><br>
<div class="mycontent">
A [histogram](https://www.data-to-viz.com/graph/histogram.html) takes as input a numeric variable and cuts it into several bins. The number of observations in each bin is represented by the height of the bar. It is a very common type of graphic and most tools select a bin size value by default.
A [histogram](https://www.data-to-viz.com/graph/histogram.html) takes as input a numeric variable and cuts it into several bins. The number of observations in each bin is represented by the height of the bar. It is a very common type of graphic and most tools select a bin size value by default.
<br><br>
However, this bin size choice can have a strong impact on the chart insight. Let's look at the distribution of [Airbnb night prices on the French Riviera](http://www.data-to-viz.com/story/OneNum.html):

Expand All @@ -45,7 +45,7 @@ data %>%
)
```

The price ranges between 10 and 300 euros, with most of the apartments ranging between 60 and 150 euros per night. In this chart, prices are cut in several 10 euro bins: between 0 and 10 euros a night, between 10 and 20, and so on. This is represented on the X-axis. Then, the number of apartments per bin is counted and represented by the Y-axis.
The price ranges between 10 and 300 euros, with most of the apartments ranging between 60 and 150 euros per night. In this chart, prices are cut in several 10 euro bins: between 0 and 10 euros a night, between 10 and 20, and so on. This is represented on the X-axis. Then, the number of apartments per bin is counted and represented by the Y-axis.

<br>

Expand Down
4 changes: 2 additions & 2 deletions caveat/boxplot.Rmd
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
myimage1: "../img/mistake/boxplot.png"
mytitle: "The Boxplot and its pitfalls"
mydisqus: "boxplot"
pathSlug: "boxplot"
output:
html_document:
template: template_caveat.html
Expand All @@ -27,7 +27,7 @@ A boxplot gives a nice summary of one or more numeric variables. A boxplot is co
- The ends of the box shows the upper (Q3) and lower (Q1) [quartiles](https://en.wikipedia.org/wiki/Quartile). If the third quartile is 15, it means that 75% of the observation are lower than 15.
- The difference between Quartiles 1 and 3 is called the [interquartile range](https://en.wikipedia.org/wiki/Interquartile_range) (IQR)
- The extreme line shows Q3+1.5xIQR to Q1-1.5xIQR (the highest and lowest value excluding outliers).
- Dots (or other markers) beyond the extreme line shows potntial outliers.
- Dots (or other markers) beyond the extreme line shows potntial outliers.

<br>

Expand Down
6 changes: 3 additions & 3 deletions caveat/calculation_error.Rmd
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
myimage1: "../img/mistake/calculation_error.png"
mydisqus: "calculation_error"
pathSlug: "calculation_error"
mytitle: "Calculation errors"
output:
html_document:
Expand All @@ -13,9 +13,9 @@ output:
number_section: FALSE
df_print: "paged"
code_folding: "hide"
includes:
includes:
after_body: footer.html

---


Expand Down
2 changes: 1 addition & 1 deletion caveat/circular_bar_yaxis.Rmd
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
myimage1: "../img/mistake/circular_bar_yaxis.png"
mytitle: "Circular barplot and distortion"
mydisqus: "circular_bar_yaxis"
pathSlug: "circular_bar_yaxis"
output:
html_document:
template: template_caveat.html
Expand Down
8 changes: 4 additions & 4 deletions caveat/circular_barplot_accordeon.Rmd
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
myimage1: "../img/mistake/calculation_error.png"
mydisqus: "circular_bar_yaxis"
pathSlug: "circular_bar_yaxis"
mytitle: "Mind the radial bar charts"
output:
html_document:
Expand All @@ -13,9 +13,9 @@ output:
number_section: FALSE
df_print: "paged"
code_folding: "hide"
includes:
includes:
after_body: footer.html

---

<br><br>
Expand Down Expand Up @@ -52,7 +52,7 @@ data %>%
xlab("") +
ylab("") +
coord_polar(theta = "y") +
ylim(0,15000)
ylim(0,15000)
```

The good thing about this kind of graphic is that it is quite eye-catching. However, because the bars are plotted on different radial points of the polar axis, they have different radii and cannot be compared by their lengths. A bar on the outside will be longer by construction than one on the inside, even with an equal value.
Expand Down
6 changes: 3 additions & 3 deletions caveat/color_com_nothing.Rmd
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
myimage1: "../img/mistake/color_com_nothing.png"
mytitle: "Don't use color if they communicate nothing"
mydisqus: "color_com_nothing"
pathSlug: "color_com_nothing"
output:
html_document:
template: template_caveat.html
Expand All @@ -13,7 +13,7 @@ output:
number_section: FALSE
df_print: "paged"
code_folding: "hide"
includes:
includes:
after_body: footer.html
---

Expand All @@ -35,7 +35,7 @@ data <- read.table("https://raw.githubusercontent.com/holtzy/data_to_viz/master/
# create random color palette
mycolors <- colors()[sample(1:400, nrow(data))]
# Barplot
data %>%
filter(!is.na(Value)) %>%
Expand Down
4 changes: 2 additions & 2 deletions caveat/connect_your_dot.Rmd
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
myimage1: "../img/mistake/connect_your_dot.png"
mytitle: "Connect your dots when the X-axis is ordered"
mydisqus: "connect_your_dot"
pathSlug: "connect_your_dot"
output:
html_document:
self_contained: FALSE
Expand All @@ -14,7 +14,7 @@ output:
number_section: FALSE
df_print: "paged"
code_folding: "hide"
includes:
includes:
after_body: footer.html
---

Expand Down
26 changes: 13 additions & 13 deletions caveat/consistency.Rmd
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
myimage1: "../img/mistake/consistency_sev_graph.png"
mytitle: "Consistency between charts"
mydisqus: "consistency"
pathSlug: "consistency"
output:
html_document:
template: template_caveat.html
Expand All @@ -13,14 +13,14 @@ output:
number_section: FALSE
df_print: "paged"
code_folding: "hide"
includes:
includes:
after_body: footer.html
---

<br><br>
<div class="mycontent">

Let's consider a small report where you present several graphics to your audience. The report is composed of:
Let's consider a small report where you present several graphics to your audience. The report is composed of:

- a [barplot](https://www.data-to-viz.com/graph/barplot.html) showing the total amount of money spent on the five products of the company
- a [line plot](https://www.data-to-viz.com/graph/line.html) showing the evolution of the money generated by these five products in the last ten years:
Expand Down Expand Up @@ -58,11 +58,11 @@ a <- data %>%
data <- data.frame(
year = rep( seq(1,10), 5 ),
product = rep(LETTERS[1:5], each=10 ),
value = c(
seq(1,10) + sample( 1:3, 10, replace = TRUE),
seq(5,14) + sample( 4:10, 10, replace=TRUE),
seq(10,1)*2 + sample( 3:5, 10, replace=TRUE),
seq(20,11) + sample( 12:17, 10, replace=TRUE),
value = c(
seq(1,10) + sample( 1:3, 10, replace = TRUE),
seq(5,14) + sample( 4:10, 10, replace=TRUE),
seq(10,1)*2 + sample( 3:5, 10, replace=TRUE),
seq(20,11) + sample( 12:17, 10, replace=TRUE),
seq(1,10) + sample( 40:10, 10))
)
Expand Down Expand Up @@ -124,11 +124,11 @@ a <- data %>%
data <- data.frame(
year = rep( seq(1,10), 5 ),
product = rep(LETTERS[1:5], each=10 ),
value = c(
seq(1,10) + sample( 1:3, 10, replace = TRUE),
seq(5,14) + sample( 4:10, 10, replace=TRUE),
seq(10,1)*2 + sample( 3:5, 10, replace=TRUE),
seq(20,11) + sample( 12:17, 10, replace=TRUE),
value = c(
seq(1,10) + sample( 1:3, 10, replace = TRUE),
seq(5,14) + sample( 4:10, 10, replace=TRUE),
seq(10,1)*2 + sample( 3:5, 10, replace=TRUE),
seq(20,11) + sample( 12:17, 10, replace=TRUE),
seq(1,10) + sample( 40:10, 10))
)
Expand Down
6 changes: 3 additions & 3 deletions caveat/counter_intuitive.Rmd
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
myimage1: "../img/mistake/counter_intuitive.png"
mytitle: "Don't be counter intuitive"
mydisqus: "counter_intuitive"
pathSlug: "counter_intuitive"
output:
html_document:
template: template_caveat.html
Expand All @@ -13,7 +13,7 @@ output:
number_section: FALSE
df_print: "paged"
code_folding: "hide"
includes:
includes:
after_body: footer.html
---

Expand All @@ -25,7 +25,7 @@ People are used to seeing data displayed in a usual and logical way. Not respect

#Reversing axis
***
The Y-axis almost always rises from the bottom to the top of the graphic. Here is an example with a reverse Y-axis. It comes from an article in [business insider](https://www.businessinsider.in/This-Chart-Shows-What-Happened-To-Gun-Deaths-In-Florida-After-Stand-Your-Ground-Was-Enacted/articleshow/30635752.cms) and describes the evolution of gun deaths in Florida.
The Y-axis almost always rises from the bottom to the top of the graphic. Here is an example with a reverse Y-axis. It comes from an article in [business insider](https://www.businessinsider.in/This-Chart-Shows-What-Happened-To-Gun-Deaths-In-Florida-After-Stand-Your-Ground-Was-Enacted/articleshow/30635752.cms) and describes the evolution of gun deaths in Florida.

*Disclaimer*: I found this image on [KD Nuggets](https://www.kdnuggets.com/2016/02/common-data-visualization-mistakes.html)

Expand Down
Loading

0 comments on commit 91af277

Please sign in to comment.