# Aligning a plot with another function through bar legend

I have a parametric funtion say, (f(t) cos t, f(t) sin t) and another function g(t). Now I want to plot (f(t) cos t, f(t) sin t) and show g(t) in bar legend for same range of t. for example t=0.5 corresponds to same color in g(t) bar and the plot. Is there any way to do it?

Here is a simple example code,

f[t_] := t + 1
g[t_] := t^3 + 3*t + 12
ParametricPlot[{f[t]*Cos[\[Theta]], f[t]*Sin[\[Theta]]}, {t, 0, 1}, {\[Theta], 0, 2*Pi}, ColorFunction -> Function[{x, y, t}, ColorData["SolarColors"][Rescale[g[t], {g[0], g[1]}, {0, 1}]]]


This give the following figure,

The figure is ok, but i want to show g[t] in bar legend for the same range of t. Is there any way?

• Yes, there is. Look at ParametricPlot and the corresponding option ColorFunction. Try it yourself, then edit the question and include the code if you encounter any problems. Commented May 1 at 8:14
• @Domen First of all I would like to express my gratitude and thanks for all your response and efforts you have shown. Yes, I am trying but cannot join two different function with same color scheme. I will try and update the code later on. Thank you very much again. Commented May 1 at 8:35
• One way to join the functions would be using Show function as follows: Show[{ParametricPlot[body], Plot[g[t],{t,t1,t2},PlotStyle->White, PlotLegends...]}] In this case, the plot of the function g(t) will not be visible, but its legend will still appear. Hope I understood your problem correctly, and it helps. Commented May 1 at 11:29
• @Domen Thank you for your response... I have updated my question in simplest way possible. Commented May 2 at 7:18
• @AlexeiBoulbitch Here is updated question with simple code. Commented May 2 at 7:19

I have used the code ParametricPlot[{f[t]*Cos[\[Theta]], f[t]*Sin[\[Theta]]}, {t, 0, 1}, {\[Theta], 0, 2*Pi}, ColorFunction -> Function[{x, y, t}, ColorData["SolarColors"][Rescale[g[t], {g[0], g[1]}]]], PlotLegends -> BarLegend[{"SolarColors", {g[0], g[1]}}, LegendLabel -> Style[HoldForm[g], 14]]