# Edit specific parts of vector fields?

Posted 5 months ago
603 Views
|
3 Replies
|
1 Total Likes
|
 I would like to take a specific part of a given vector field, and make all the vectors bold. For example, I want to take the {x, y} vector field, and make all the vectors from x=0 to x=10 to be bold, and the rest of the field to be regular. I would appreciate it if anyone could help me figure this out!
3 Replies
Sort By:
Posted 5 months ago
 Hafez,You should post an example so people can help you more easily. I grabbed one of the examples to demonstrate.One way to highlight is with color functions: (note that VectorColorFunctionScaling must be false to get the color you specify) VectorPlot[{y, -x }, {x, -3, 3}, {y, -3, 3}, VectorScale -> Large, VectorColorFunction -> Function[{x, y, vx, vy, n}, If[x <= 1.5 || Abs[y] >= 1, Black, Red]], VectorColorFunctionScaling -> False] To getto make them bold use VectorScale's function option: (note scale value is between 0 and 1, or it will autoscale) VectorPlot[{y, -x }, {x, -3, 3}, {y, -3, 3}, VectorScale -> {Large, Automatic, If[#1 <= 1.5 || Abs[#2] >= 1, 0.3, 0.8] &}] To get:You can further adjust the options to get what you want.Regards,Neil
 Hafez,The color function and the scale function both get 5 arguments: x, y, vx, vy, Norm[{vx, vy}] from these inputs you can calculate angle or any other value. For example, the vector angle would be ArcTan[vx,vy]As to the line thickness you can specify the thickness (and many other attributes) with VectorStyle -> Thickness[.01] I do not see how you can specify the vectorStyle in one plot based on a function, however, You can use the RegionFunction to plot your vectors in different regions with different attributes.Here is an example: one = VectorPlot[{y, -x }, {x, -3, 3}, {y, -3, 3}, VectorScale -> Medium, RegionFunction -> Function[{x, y, vx, vy, n}, x <= 1.5 || Abs[y] >= 1]]; two = VectorPlot[{y, -x }, {x, -3, 3}, {y, -3, 3}, VectorScale -> Large, RegionFunction -> Function[{x, y, vx, vy, n}, Not[x <= 1.5 || Abs[y] >= 1]], VectorStyle -> {Thickness[0.01], Red}]; Show[{one, two}] to get a region with thick, red vectors and thin blue vectors everywhere else.