Mathematica Asked by user14750 on July 21, 2021
I want to find the output of RegionPlot for a simple condition namely n*(x + y) < 1, where n is a varying number.
Here I have used Manipulate command in order to generate multiple RegionPlots (with different areas) for varying n values.
Manipulate[RegionPlot[{nx + ny < 1}, {x, -1, 1}, {y, -1, 1}], {n, 1, 10, 0.1}]
Now I want to generate a single region whose area changes with n for all values n=1..10, and also its color (or color intensity) varies as n changes.
So for example, as n decreases the intensity of the color decreases and this intensity is shown as a Legend near the diagram.
Can anyone help me with this issue?
Thank you so much.
Clear["Global`*"]
Manipulate[
RegionPlot[{n*x + n*y < 1}, {x, -1, 1}, {y, -1, 1},
PlotStyle -> ColorData["Rainbow"][Rescale[n, {1, 10}]]], {{n, 5}, 1,
10, 0.1, Appearance -> "Labeled"}]
Legended[
Show[
RegionPlot[
{#*x + #*y < 1}, {x, -1, 1}, {y, -1, 1},
PlotStyle -> ColorData["Rainbow"][Rescale[#, {1, 10}]],
PlotPoints -> 75,
MaxRecursion -> 5] & /@ Range[10]],
SwatchLegend[
ColorData["Rainbow"][Rescale[#, {1, 10}]] & /@ Range[10],
Range[10]]]
Answered by Bob Hanlon on July 21, 2021
To get the continues effect I think we need to use ColorFunction
,here we try the LinearGradientFilling
.
normal = {1, 1};
Manipulate[
Region[Style[ImplicitRegion[n*normal . {x, y} < 1, {x, y}],
LinearGradientFilling[ColorData["Rainbow"] /@ Range[0, 1, .1],
ArcTan @@ normal]], PlotRange -> All], {n, 1, 10, .1}]
Answered by cvgmt on July 21, 2021
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP