Re: Question about MeshFunctions (Plot function)
- To: mathgroup at smc.vnet.net
- Subject: [mg105084] Re: Question about MeshFunctions (Plot function)
- From: dh <dh at metrohm.com>
- Date: Fri, 20 Nov 2009 06:39:51 -0500 (EST)
- References: <he36de$ec9$1@smc.vnet.net>
Vicent wrote: > 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. > 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