Re: [R] Contour plot on a triangular mesh

2012-01-21 Thread Jim Lemon

On 01/20/2012 11:28 PM, Roary wrote:

Hi All,

I have 3 variables which present a perfect linear dependency such that the
third is the sum of the first two. I have an ordinary 2D contour plot on a
square grid with the first two variables forming the axes and the third
naturally being the diagonals. From an interpretive point of view it would
be nice to plot these two variables on a finer grid such that the third can
have the same scaling (i.e. a finer grid) as the first two and this would
look better on a triangular mesh. Is this possible in R?


Hi Roary,
Have a look at the triax.fill function in the plotrix package.

Jim

__
R-help@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.


Re: [R] Contour plot on a triangular mesh

2012-01-21 Thread Roary
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?

Thanks again, Roary.


Jim Lemon wrote
 
 On 01/20/2012 11:28 PM, Roary wrote:
 Hi All,

 I have 3 variables which present a perfect linear dependency such that
 the
 third is the sum of the first two. I have an ordinary 2D contour plot on
 a
 square grid with the first two variables forming the axes and the third
 naturally being the diagonals. From an interpretive point of view it
 would
 be nice to plot these two variables on a finer grid such that the third
 can
 have the same scaling (i.e. a finer grid) as the first two and this would
 look better on a triangular mesh. Is this possible in R?

 Hi Roary,
 Have a look at the triax.fill function in the plotrix package.
 
 Jim
 
 __
 R-help@ 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.
 


--
View this message in context: 
http://r.789695.n4.nabble.com/Contour-plot-on-a-triangular-mesh-tp4313098p4315772.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@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.


Re: [R] Contour plot on a triangular mesh

2012-01-21 Thread Jim Lemon

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



triax_test.pdf
Description: Adobe PDF document
__
R-help@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.


[R] Contour plot on a triangular mesh

2012-01-20 Thread Roary
Hi All,

I have 3 variables which present a perfect linear dependency such that the
third is the sum of the first two. I have an ordinary 2D contour plot on a
square grid with the first two variables forming the axes and the third
naturally being the diagonals. From an interpretive point of view it would
be nice to plot these two variables on a finer grid such that the third can
have the same scaling (i.e. a finer grid) as the first two and this would
look better on a triangular mesh. Is this possible in R?

Many thanks,

Roary

--
View this message in context: 
http://r.789695.n4.nabble.com/Contour-plot-on-a-triangular-mesh-tp4313098p4313098.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@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.


Re: [R] Contour plot on a triangular mesh

2012-01-20 Thread Uwe Ligges
Not sure if I understand the question: If you have more data the grid 
produced by image() or contour() will be finer anyway...

Perhaps we just need an example what you are actually asking for.

Uwe Ligges


On 20.01.2012 13:28, Roary wrote:

Hi All,

I have 3 variables which present a perfect linear dependency such that the
third is the sum of the first two. I have an ordinary 2D contour plot on a
square grid with the first two variables forming the axes and the third
naturally being the diagonals. From an interpretive point of view it would
be nice to plot these two variables on a finer grid such that the third can
have the same scaling (i.e. a finer grid) as the first two and this would
look better on a triangular mesh. Is this possible in R?

Many thanks,

Roary

--
View this message in context: 
http://r.789695.n4.nabble.com/Contour-plot-on-a-triangular-mesh-tp4313098p4313098.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@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.


__
R-help@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.


Re: [R] Contour plot on a triangular mesh

2012-01-20 Thread Roary
I have two observed categorical variables X1 and X2, with X3=X1+X2, and a
continuous response Y. I can interpolate the surface and construct an
ordinary 2D square contour plot (with X1,X2 axes and X3 on the diagonal).
However,  I would like to change the orientation of the plot so that the
axes fit a parallelogram shaped grid made up from triangles. This would
place X3 on the same scale as X1 and X2 and allow for an easier
interpretation of the data for my research question.

I hope this makes more sense! Thanks, Roary.


Uwe Ligges-3 wrote
 
 Not sure if I understand the question: If you have more data the grid 
 produced by image() or contour() will be finer anyway...
 Perhaps we just need an example what you are actually asking for.
 
 Uwe Ligges
 
 
 On 20.01.2012 13:28, Roary wrote:
 Hi All,

 I have 3 variables which present a perfect linear dependency such that
 the
 third is the sum of the first two. I have an ordinary 2D contour plot on
 a
 square grid with the first two variables forming the axes and the third
 naturally being the diagonals. From an interpretive point of view it
 would
 be nice to plot these two variables on a finer grid such that the third
 can
 have the same scaling (i.e. a finer grid) as the first two and this would
 look better on a triangular mesh. Is this possible in R?

 Many thanks,

 Roary

 --
 View this message in context:
 http://r.789695.n4.nabble.com/Contour-plot-on-a-triangular-mesh-tp4313098p4313098.html
 Sent from the R help mailing list archive at Nabble.com.

 __
 R-help@ 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.
 
 __
 R-help@ 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.
 


--
View this message in context: 
http://r.789695.n4.nabble.com/Contour-plot-on-a-triangular-mesh-tp4313098p4314337.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@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.


Re: [R] Contour plot on a triangular mesh

2012-01-20 Thread Jason Edgecombe
I'm not sure if this is appropriate. If the sum of your variables is 
always the same constant, then you might try a Ternary plot ( 
http://en.wikipedia.org/wiki/Ternary_plot ).


The vcd package can make ternary plots.

On 01/20/2012 02:56 PM, Roary wrote:

I have two observed categorical variables X1 and X2, with X3=X1+X2, and a
continuous response Y. I can interpolate the surface and construct an
ordinary 2D square contour plot (with X1,X2 axes and X3 on the diagonal).
However,  I would like to change the orientation of the plot so that the
axes fit a parallelogram shaped grid made up from triangles. This would
place X3 on the same scale as X1 and X2 and allow for an easier
interpretation of the data for my research question.

I hope this makes more sense! Thanks, Roary.


Uwe Ligges-3 wrote

Not sure if I understand the question: If you have more data the grid
produced by image() or contour() will be finer anyway...
Perhaps we just need an example what you are actually asking for.

Uwe Ligges


On 20.01.2012 13:28, Roary wrote:

Hi All,

I have 3 variables which present a perfect linear dependency such that
the
third is the sum of the first two. I have an ordinary 2D contour plot on
a
square grid with the first two variables forming the axes and the third
naturally being the diagonals. From an interpretive point of view it
would
be nice to plot these two variables on a finer grid such that the third
can
have the same scaling (i.e. a finer grid) as the first two and this would
look better on a triangular mesh. Is this possible in R?

Many thanks,

Roary




__
R-help@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.