I've been stuck on a seemingly simple Graphics issue for quite a while now...
I am trying to make a temperature distribution Plot that will have a colorFunction filling to show red when at a higher temperature, then fading to blue as it gets colder, etc. My plot has temperature in the y-axis, and length (of a fin) in the x-axis.
When I try to put it into effect, the filling is filled with the gradient but it goes from left to right, along the x-axis. However, I want it to be fading top to bottom, to illustrate how the temperature decreases. One of my cells of test code is included below:
Manipulate[
Plot[T[x, length, h, P, A, k, Tinf, T0], {x, 0, length},
ColorFunction ->
Function[{x, T},
Directive[
Opacity[0.7], (ColorData["DeepSeaColors"][Rescale[T, {0, 50}]])]],
ColorFunctionScaling -> False,
ImageSize -> 200,
PlotRange -> {0, T0},
Filling -> Axis,
PlotStyle -> Thick,
AxesLabel -> {x, \[Theta]}],
{{length, 5}, 1, 30, 1, Appearance -> "Labeled"}
]
I've tried a lot of convoluted methods like making a customized Raster image for the filling color, but I'm sure there has to be a simpler way to do this!
EDIT:
I want to be able to do this with the Plot function, so it is easier to Manipulate for the user. Right now I was able to get it to work by creating the data separately and then using a ListLinePlot, like so:
heatData = Transpose[{Range[100], Table[-0.5 x + 50, {x, 1, 100}]}];
bands = 50;
ListLinePlot[Table[{1, i} # & /@ heatData, {i, 0`, 1`, 1/bands}],
Background -> White, ColorFunction -> "TemperatureMap",
Filling -> True]
Thank you so much!
Plot
function has this capability, so the question becomes what is an acceptable substitute? Heike showed how to useParametricPlot
with essentially the same appearance asPlot
. Do you understand how to use it? Do you need help writing it as a function e.g.myPlot
that automatically fills with a vertical gradient? Do you need a specific feature ofPlot
that is not present or does not work the same inParametricPlot
? $\endgroup$