How to plot the half multi pie ?

16 views
Skip to first unread message

linchen...@gmail.com

unread,
Jul 12, 2017, 6:40:09 AM7/12/17
to ggplot2



Hello guys, I'm trying to plot a chart as showed above.
The principle is :
1. the center point "Point de vente" is a point of interest.
2. 5KM - 25KM mean the distance between the traffic and the point of interest
3.all the data are calculated
4. there's no relation between the size and the data

demo data frame as below:

data.frame(dist = c("0-5","5-10","10-15","15-20","20-25",">25"),portion = c(44,35,15,3,2,1), price = c(4.51,4.54,3.99,3.55,5.49,4.07))


Thanks a lot

Thierry Onkelinx

unread,
Jul 12, 2017, 7:43:46 AM7/12/17
to linchen...@gmail.com, ggplot2
Hi Anonymous,

There are IMHO better ways to visualise such dataset. Here is my attempt

library(ggplot2)
dataset <- data.frame(
  dist = factor(
    1:6,
    labels = c("0-5","5-10","10-15","15-20","20-25",">25"),
    ordered = TRUE
  ),
  portion = c(44,35,15,3,2,1), 
  price = c(4.51,4.54,3.99,3.55,5.49,4.07)
)
ggplot(dataset, aes(x = dist, y = portion)) +
  geom_path(group = 1) +
  geom_point(aes(size = price, colour = price)) +
  geom_text(aes(label = price), hjust = -0.5, vjust = -0.5) +
  scale_colour_gradient2(midpoint = 4.5)

Best regards,


ir. Thierry Onkelinx
Instituut voor natuur- en bosonderzoek / Research Institute for Nature and Forest
team Biometrie & Kwaliteitszorg / team Biometrics & Quality Assurance
Kliniekstraat 25
1070 Anderlecht
Belgium

To call in the statistician after the experiment is done may be no more than asking him to perform a post-mortem examination: he may be able to say what the experiment died of. ~ Sir Ronald Aylmer Fisher
The plural of anecdote is not data. ~ Roger Brinner
The combination of some data and an aching desire for an answer does not ensure that a reasonable answer can be extracted from a given body of data. ~ John Tukey

--
--
You received this message because you are subscribed to the ggplot2 mailing list.
Please provide a reproducible example: https://github.com/hadley/devtools/wiki/Reproducibility
 
To post: email ggp...@googlegroups.com
To unsubscribe: email ggplot2+unsubscribe@googlegroups.com
More options: http://groups.google.com/group/ggplot2

---
You received this message because you are subscribed to the Google Groups "ggplot2" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ggplot2+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages