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

Question about MeshFunctions (Plot function)

21 views
Skip to first unread message

Vicent

unread,
Nov 19, 2009, 5:24:46 AM11/19/09
to
Hello.

Thank you for all your answers to my previous question. They were very useful.

I have a question related to the MeshFunctions option in the Plot function.

I've tried this

Plot[ f[x] , {x , 5 , 10} , Frame -> True , PlotRange -> { 2 ,
4 } , AspectRatio -> 1/GoldenRatio , PerformanceGoal -> "Quality"
,
Mesh -> { { 0. } } , MeshFunctions -> { f1[#] & , f2[#] & } ,
MeshStyle -> { Directive[ PointSize[ Large ] , Red ] , Directive[
PointSize[ Large ] , Blue ] } ]

and it works OK: it plots the curve for f[x] and marks (in my case)
two points on it: one red and one blue, at the points where functions
f1[x] and f2[x] take value 0.

I could do the same with other different functions g[x], g1[x] and g2[x].

But, is it possible to draw both curves in the same frame?? I don't
know which is the proper syntax --I mean, this:

Plot[ { f[x] , g[x] } , {x , 5 , 10} , Frame -> True ,
PlotRange -> { 2 , 4 } , AspectRatio -> 1/GoldenRatio ,
PerformanceGoal -> "Quality" ,
Mesh -> { { 0. } } , MeshFunctions -> { { f1[#] & , f2[#] & } , {
g1[#] & , g2[#] & } },
MeshStyle -> { Directive[ PointSize[ Large ] , Red ] , Directive[
PointSize[ Large ] , Blue ] } ]

produces an error message. How can I get the kind of graphic I want?

By the way (and this is another question, in fact), as I've just tried
to explain, I decided to use "MeshFunctions" in order to draw a curve
with three parts distinguished in it (the boundaries being the red and
the blue point, I mean). I also was trying to do it with the
"RegionFunction" option of the "Plot" sentence, but I couldn't get the
same result (I don't want the curve to be drawn only within a given
range, but I want the whole curve to be drawn and the different parts
of the curve to be indicated). The different parts of the curve f[x]
are bounded by the zeros of the functions f1[x] and f2[x], in my
example.

Are there any other ways to get what I want??

Please, if I didn't manage to explain my questions clearly enough, let
me know. I could attach a picture of what I want to draw.

Thank you in advance.

dh

unread,
Nov 20, 2009, 6:40:43 AM11/20/09
to

Vicent wrote:

> Hello.

>

>

>

> I've tried this

>

> ,

> PointSize[ Large ] , Blue ] } ]

>

>

>

>

> PerformanceGoal -> "Quality" ,

> PointSize[ Large ] , Blue ] } ]

>

>

> example.

>

>

>

> Thank you in advance.

>

Hi, here is an example:

Plot[{3 + Cos[x], 3 + Sin[x]}, {x, 5, 10}, Frame -> True,

PlotRange -> {2, 4}, AspectRatio -> 1/GoldenRatio,

PerformanceGoal -> "Quality", Mesh -> {{0}},

MeshFunctions -> {#1 - 6 &, #1 - 7 &},

MeshStyle -> {Directive[PointSize[Large], Red],

Directive[PointSize[Large], Blue]}]

Daniel

Vicent

unread,
Nov 20, 2009, 6:41:26 AM11/20/09
to
On Thu, Nov 19, 2009 at 11:24, Vicent <vgi...@gmail.com> wrote:

> I've tried this
>
> Plot[ f[x] , {x , 5 , 10} , Frame -> True , PlotRange -> { 2 ,
> 4 } , AspectRatio -> 1/GoldenRatio , PerformanceGoal -> "Quality"
> ,
> Mesh -> { { 0. } } , MeshFunctions -> { f1[#] & , f2[#] & } ,
> MeshStyle -> { Directive[ PointSize[ Large ] , Red ] , Directive[
> PointSize[ Large ] , Blue ] } ]
>
> and it works OK: it plots the curve for f[x] and marks (in my case)
> two points on it: one red and one blue, at the points where functions
> f1[x] and f2[x] take value 0.
>
> I could do the same with other different functions g[x], g1[x] and g2[x].
>
> But, is it possible to draw both curves in the same frame?? I don't
> know which is the proper syntax --I mean, this:
>
> Plot[ { f[x] , g[x] } , {x , 5 , 10} , Frame -> True ,
> PlotRange -> { 2 , 4 } , AspectRatio -> 1/GoldenRatio ,
> PerformanceGoal -> "Quality" ,
> Mesh -> { { 0. } } , MeshFunctions -> { { f1[#] & , f2[#] & }, {
> g1[#] & , g2[#] & } },
> MeshStyle -> { Directive[ PointSize[ Large ] , Red ] , Directive[
> PointSize[ Large ] , Blue ] } ]
>
> produces an error message. How can I get the kind of graphic I want?
>

Hello again.

I would like to make my question clearer, if possible.

I was not asking for this:


Plot[ { f[x] , g[x] } , { x , 5 , 10} , Frame -> True, PlotRange


-> {2, 4}, AspectRatio -> 1/GoldenRatio,
PerformanceGoal -> "Quality",

Mesh -> {{0}}, MeshFunctions -> {f1[#] & , f2[#] &}, MeshStyle ->


{Directive[PointSize[Large], Red], Directive[PointSize[Large],
Blue]}]


because I need the red and blue points to be defined in each curve (f
and g) by two different
pairs of functions f1, f2 and g1, g2. I mean, in my case, the
x-position (horizontal coordinate) of the red and blue
points could be different in curves f and g.

I've been told to previously compute the x-positions of the blue and
red point for each curve, and then put them in the graphic with
Epilog.

I am going to try it, but if you have different approaches, I would
like to know them.

Thank you in advance.

--
Vicent Giner-Bosch

David Park

unread,
Nov 21, 2009, 3:38:35 AM11/21/09
to
It would help if you posted everything in the example so responders could
evaluate it and not have to make up their own functions.


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

David Park

unread,
Nov 21, 2009, 3:43:21 AM11/21/09
to
0 new messages