0

I have an earthquake data. This is my data frame:

NGDC_damage<-data.frame(x=earthquakedata$ISO_country,y=earthquakedata$NGDC_damage)

I would like to plot them on a histogram via ggplot.

qplot(NGDC_damage[,2],geom="histogram",binwidth = 0.25,  
  main = "Histogram", 
  xlab = "Economic Loss(in billion dollars)",  
  fill=I("blue"), 
  col=I("red"), 
  alpha=I(.2),
  )

Since most of the data is accumulated in the first bar, smaller bars coming after that look very small, they look like equal to zero.In other words, there are some extreme values, but since the first bar is already vert high, the extreme ones look like only a horizontal line However, I want to show them they are indeed different. although their frequency is small. I am not sure if expressed myself clearly. Please let me know if it is not clear. Any help will greatly appreciated. Thank you all!!!

Denis
  • 1
  • 1
  • try adding layer `+scale_y_log()` – Marcin Dec 08 '15 at 16:15
  • Thank you for you quick response, I am having this error: Error: could not find function "scale_y_log" – Denis Dec 08 '15 at 16:22
  • I figured it out Marcin thank you. I added scale_x_log(). – Denis Dec 08 '15 at 16:34
  • Try `+ scale_y_log10()` instead. You may want to look at scale_x_log10() too. – asachet Dec 08 '15 at 16:36
  • Possible duplicate of [Transform only one axis to log10 scale with ggplot2](http://stackoverflow.com/questions/4699493/transform-only-one-axis-to-log10-scale-with-ggplot2) – germcd Dec 08 '15 at 16:46
  • @germcd Hardly a duplicate as the user is asking advice on how to best represent the data and using a log scale is merely one of the proposed solution. Arguably statexchange could be more helpful. – asachet Dec 09 '15 at 12:58

0 Answers0