2

I have data that I would like to plot and use shapes to symbolise the data . In total I have 20 potential different pieces of data to be represented by shapes.

e.g they are labeled such as R/Hand elbow, R/Hand knee, R/Hand foot, L/Hand shoulder, L/Hand neck etc etc

So far I keep coming up with a limitation of 6 shapes and they are all different colors.

One option I do have is to not only use shapes but also color code the shapes.

So 10 different shapes with each shape representing a different piece of categorical data, but all shapes being Blue.

and then the same 10 shapes but all shapes begin colored Red.

The 20 pieces of data are locations on the body (10 on the left and 10 on the right).

thanks

Jaap
  • 81,064
  • 34
  • 182
  • 193
user3754366
  • 521
  • 1
  • 5
  • 10
  • 1
    http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example – nico Jul 19 '14 at 10:32
  • Adding to @nico's comment about giving a [reproducible example](http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example/5963610#5963610), you might also want to read the info about [how to ask a good question](http://stackoverflow.com/help/how-to-ask). This will make it much easier for others to help you. – Jaap Jul 19 '14 at 11:05

1 Answers1

4

You can create your own discrete scale with the scale_manual variants. It this case you will need scale_shape_manual. When you type ?pch you get the help page hich gives the values you can use. In your case, you use for example:

scale_shape_manual(values=1:20, labels=c("R/Hand elbow", "R/Hand knee", "R/Hand foot", "L/Hand shoulder", "L/Hand neck", and so on ...))

However, using 20 different shapes could result in a confusing plot. As you want to distuinghish body parts, you might consider using faceting between for example left and right part of the body.

Jaap
  • 81,064
  • 34
  • 182
  • 193
  • 1
    thanks for that I hadn't thought of faceting. To honest I didn't know what it was . I have had a quick look and can see how it would be useful and have taken onboard the point about having 20 different shapes making a plot confusing. – user3754366 Jul 19 '14 at 11:42
  • With facets I'm struggling a bit as I want to compare changes between the left and right side over time. With faceting (and I'm totally new to it) I get the impression I'd need to compare the right and left hand plot side by side. My ideal plan is to be able to just look at a time on the x axis and see what is happening at that given moment. – user3754366 Jul 19 '14 at 11:50
  • If you include a `dput()` of (a part of) your data in the question, I can help you further. – Jaap Jul 19 '14 at 12:36
  • I'm not sure what a dput() is but ti sounds useful. I'll go and suss out what a dput() is and try and include it – user3754366 Jul 21 '14 at 05:59