Shortly ago I did something similar to what you intend to.
The data frame was called 'fore'. There were eight different variables
and I wanted to plot each one by column, and depict the frequencies in terms of
the size of the dots. The problem I ran into is that the plots got extremely big
for some particular cases with high frequencies -fortunately, in my case, it
didn't matter whether I had a value of 4 or more: I could depict them all
with the same size. Hence, I plotted frequency values 1, 2, 3, and 4.
There may be more elegant ways, but this was my rough and ready attempt:
> op <- par(mar=c(3,4,1,1))
> plot(c(1:8),col="white",
+ ylim=c(min(na.omit(fore)),max(na.omit(fore))),xaxt="n",
xlab="",ylab="%")> grid()
> for (i in 1:ncol(fore)){
+
cex.dots=ifelse(as.numeric(table(fore[,i]))>4,4,as.numeric(table(fore[,i])))
+ points(x=rep(i,length(na.omit(fore[,i]))),
+ y=na.omit(fore[,i]),pch=19, cex=cex.dots)
+ }
> title, etc...
> par(op)
Forgive me for the shameless plugging, but you can see the final result on page
44, Figure 39, of Age UK's Chief Economist's Report
(http://www.ageuk.org.uk/Documents/EN-GB/For-professionals/Research/Age%20UK%20Chief%20Economist%20Report%20Autumn%202012.pdf)
Hope this helps!
Jos?
Jos? Iparraguirre
Chief Economist
Age UK
T 020 303 31482
E Jose.Iparraguirre at ageuk.org.uk
Twitter @jose.iparraguirre at ageuk
Tavis House, 1- 6 Tavistock Square
London, WC1H 9NB
www.ageuk.org.uk?| ageukblog.org.uk | @ageukcampaigns
-----Original Message-----
From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org]
On Behalf Of swertie
Sent: 22 October 2012 09:35
To: r-help at r-project.org
Subject: [R] Represent point size according to frequency
Hello! I would like to make a scatterplot of my data, but the problem is that
several points have the same x and y values and are represented as only one
point. I wonder if there is a way to represent the data points, but with
point size representing the frequency of the depicted x-y value?
Thank you!
--
View this message in context:
http://r.789695.n4.nabble.com/Represent-point-size-according-to-frequency-tp4646976.html
Sent from the R help mailing list archive at Nabble.com.
______________________________________________
R-help at r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Age UK and YouthNet are official charities for the Virgin London Marathon 2013
We need you to Run for it. Join the team and help raise vital funds to bring
generations together to combat loneliness and isolation.
Go to http://www.runforit.org.uk for more information or contact Helen Parson at
helen.parsons at ageuk.org.uk or on 020 303 31369.
Age UK and YouthNet. A lifeline, online.
www.runforit.org.uk
Age UK Improving later life
www.ageuk.org.uk
-------------------------------
Age UK is a registered charity and company limited by guarantee, (registered
charity number 1128267, registered company number 6825798).
Registered office: Tavis House, 1-6 Tavistock Square, London WC1H 9NA.
For the purposes of promoting Age UK Insurance, Age UK is an Appointed
Representative of Age UK Enterprises Limited, Age UK is an Introducer
Appointed Representative of JLT Benefit Solutions Limited and Simplyhealth
Access for the purposes of introducing potential annuity and health
cash plans customers respectively. Age UK Enterprises Limited, JLT Benefit
Solutions Limited and Simplyhealth Access are all authorised and
regulated by the Financial Services Authority.
------------------------------
This email and any files transmitted with it are confide...{{dropped:28}}