[R] Contour plot on a triangular mesh

Jim Lemon jim at bitwrit.com.au
Sun Jan 22 07:39:23 CET 2012


On 01/21/2012 09:38 PM, Roary wrote:
> Thanks for your responses Jason and Jim. The ternary plot is definitely the
> right style with the triangle fill. However, one of the important features
> (that perhaps I understated) is that X3 will have more categories than X1
> and X2, therefore the triangular shape is not appropriate. If X1 has I
> categories and X2 has J categories, then X3 has I+J-1 categories. Therefore,
> the overall plot would be in the shape of a parralelogram. Almost like an
> extended ternary plot... The goal is to view these unbalanced categories on
> the same scaling as each other... Would this be possible to construct?
>
Hi Roary,
Possible, yes. Easy, no, unfortunately. The attached PDF shows unequal 
categories drawn using the triax.abline function. It's easy enough to 
get the edges by simply drawing lines across the plot. Filling the 
resulting polygons would take quite a bit of calculation to work out the 
segments necessary to draw each one. The equilateral triangles in 
triax.fill are just drawn at equal spacings, edges across the x axis and 
heights down the y axis.

Alternatively, triax.plot and triax.fill could be rewritten to use a 
non-equilateral triangle as the plotting field, which would have 
internal triangles of the same proportions. Either way it means a fair 
amount of calculation, which I can't do at the moment. If you would like 
to work out the trigonometry, I could probably knock it over...

Jim

-------------- next part --------------
A non-text attachment was scrubbed...
Name: triax_test.pdf
Type: application/pdf
Size: 5136 bytes
Desc: not available
URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20120122/22530867/attachment.pdf>


More information about the R-help mailing list