Plotting multiple columns with ggplot2

I need to plot the following dataset in the same graph.

Bin1,Bin2,Bin3,Cat
4,3,5,S
6,4,5,M
3,5,4,M
1,4,5,M
 ,5, ,M

In each bin, first data point belongs to a different category than the rest. (So I added the Cat column)

I need to plot these as points (different colors for the different categories)

Following lines of code achieve what I need for a single bin

p <- ggplot(data,aes(Bin1,1))
p + geom_point(aes(color=Cat, size=Cat))

How do I do this for the entire dataset ?


Here is a related question?

What if I need to use a bunch of columns to color the points. Color Bin1 points according to Cat1 and so on..

Bin1,Cat1,Bin2,Cat2
4,S,5,S
6,L,5,M
3,M,4,L
1,M,5,L
    3,M

How do I do this??

Answers


library(reshape2)
library(ggplot2)
ggplot(melt(df, id.vars = "Cat"), aes(value, variable, colour = Cat)) + 
geom_point(size = 4)


Need Your Help

Noise in sound in ios 4.3.x and 5.0 after recording

iphone ios core-audio audio

I've got an app where I use Core Audio for sound recording. Sound is made from some parts and then must be saved to the device. It was working fine but in some new ios versions I have a noise, some...

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.