Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Intersection points of two contour plots

315 views
Skip to first unread message

Luiz Melo

unread,
May 1, 2013, 3:35:43 AM5/1/13
to
Hi group,
Please consider the example below to illustrate my question (the
original problem is somehow much more complicated):

t1 = Table[Sin[3 x*y], {x, -3, 3, .1}, {y, -3, 3, .1}];

t2 = Table[If[x*y < 0, Sin[3 x*y]], {x, -3, 3, .1}, {y, -3, 3, .1}];

p1 = ListContourPlot[t1, Contours -> {0}, ContourShading -> False,
DataRange -> {{-3, 3}, {-3, 3}}, ContourStyle -> Black];

p2 = ListContourPlot[t2, Contours -> {0}, ContourShading -> False,
DataRange -> {{-3, 3}, {-3, 3}}, ContourStyle -> {Red, Dashed, Thick}];

Show[p1, p2]

Is there a way to show only the results of the intersection of these
two contour plots?

Thank you
Luiz

djmpark

unread,
May 1, 2013, 9:39:25 PM5/1/13
to
Do you want something like this:

ContourPlot[Sin[3 x y], {x, -3, 3}, {y, -3, 3},
Contours -> {0},
ContourShading -> False,
ContourStyle -> Red,
RegionFunction -> Function[{x, y}, x y <= 0],
Exclusions -> {x == 0, y == 0}]


David Park
djm...@comcast.net
http://home.comcast.net/~djmpark/index.html

Bob Hanlon

unread,
May 1, 2013, 9:40:13 PM5/1/13
to

ContourPlot[Sin[3 x*y] == 0,
{x, -3, 3}, {y, -3, 3},
RegionFunction ->
Function[{x, y}, x*y < 0],
Exclusions -> {x*y == 0},
ContourStyle -> Black]


or


t1 = Table[
If[x*y < 0, Sin[3 x*y], Sequence[]],
{x, -3, 3, .1}, {y, -3, 3, .1}];


ListContourPlot[t1,
Contours -> {0},
ContourShading -> False,
DataRange -> {{-3, 3}, {-3, 3}},
RegionFunction ->
Function[{x, y}, x*y < 0],
ContourStyle -> Black]



Bob Hanlon

Luiz Melo

unread,
May 1, 2013, 9:40:02 PM5/1/13
to
Hi,
The given example was just to illustrate. In the original problem, I
cannot specify the region function. Also,
I have two tables t1 and t2 with a finite number of points, and I use
ListContourPlot with the option Contours -> {0} to see the contours at
z = 0. The solution to my problem occurs when both t1 and t2 intercept
at z = 0, as in the example given.

I can reformulate my problem in the following way: Given some contour plot

p0 = ListContourPlot[Table[Sin[3 x*y], {x, -3, 3, .1}, {y, -3, 3,
.1}], Contours -> {0}, ContourShading -> False,
DataRange -> {{-3, 3}, {-3, 3}}, ContourStyle -> Black];

How to extract the x and y coordinates of the plot p0 in the form of a
list of values t0 = {{x1,y2},{x2,y2},....} . ??
I found an old thread (mg98726) involving the same issue, but the
answer (mg98760) doesn't help much.

Thanks in advance.
Luiz


On Wed, May 1, 2013 at 9:56 AM, djmpark <djm...@comcast.net> wrote:
> Do you want something like this:
>
> ContourPlot[Sin[3 x y], {x, -3, 3}, {y, -3, 3},
> Contours -> {0},
> ContourShading -> False,
> ContourStyle -> Red,
> RegionFunction -> Function[{x, y}, x y <= 0],
> Exclusions -> {x == 0, y == 0}]
>
>
> David Park
> djm...@comcast.net
> http://home.comcast.net/~djmpark/index.html
>
>
> From: Luiz Melo [mailto:lm...@ufsj.edu.br]
>
>
0 new messages