# How to make such good detailed plot with color bars?

The paper consists a no of plots which have color bars as axis but I think all of them followed the same procedure, I want to plot such good looking plots (like fig 1 or 2 or any)can anybody guide me how to do them, since I am very new to Mathematica

arxiv.org/abs/1910.00234

I think the problem is very similar like the below mentioned example

v = 246
E1 = 9000

PT = ((Subscript[E1, T]*v)/(
Subscript[v, n]*E1))/((Subscript[v, n]/Subscript[T, n])^-1*(v/
E1)) - 7*(Log[Subscript[v, n]]/Subscript[T, n]) +
Log[Subscript[T, n]/100]
Subscript[v, n]/Subscript[T, n] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
Subscript[T, n] = {300, 500, 469, 650, 546, 389, 456, 411, 523,
700};
((Subscript[E1, T]*v)/(Subscript[v, n]*E1)) =
RandomReal[{1, 3.1}, {10}]


Now I have to randomly vary the last ratio to some range and make it the color bar axis and the values for PT and v_n/T_n for each ratios can be plotted PT vs v_n/T_n plot making the ratio as color axis

• Something is wrong with your idea. If you take 1 value of x you get a curve F[x,y] vs. y, not just one point! Please, make a more realistic example. Oct 3, 2020 at 12:58
• Do you want the contour line(s) for y == Sqrt[Tan[x]] colored according to the value of F? Oct 3, 2020 at 13:16

## 3 Answers

Clear["Global*"]

F[x_, y_] := Sqrt[(5*10^-6)*x^2*(5*10^-9)^y]

y = Sqrt[Tan[x]];

ParametricPlot[
{y, F[x, y]}, {x, 10^-5, 1},
Frame -> True,
FrameLabel -> (Style[#, 12, Bold] & /@ {"y", "F"}),
ColorFunction -> Function[{y, F, x}, ColorData["Rainbow"][x]],
AspectRatio -> 1,
PlotLegends -> Placed[
BarLegend[{"Rainbow", {10^-5, 1}},
LegendLabel -> Style["x", 12, Bold],
LegendMarkerSize -> 200],
{.75, .5}]]


Using Bob Hanlon's method in alternative way -- plotting two curves with ParametricPlot and making the second look like a bar legend:

ClearAll[F, x, y]
F[x_, y_] := Sqrt[(5*10^-6)*x^2*(5*10^-9)^y]
y = Sqrt[Tan[x]];

ParametricPlot[{{y, F[x, y]}, {y, -10^-6}}, {x, 10^-5, 1},
Frame -> True, Axes -> False,
FrameLabel -> (Style[#, 12, Bold] & /@ {"y", "F"}),
PlotStyle -> {Automatic, Directive[Opacity[1], AbsoluteThickness[20], CapForm["Butt"]]},
ColorFunction -> Function[{y, F, x}, ColorData["Rainbow"][x]],
AspectRatio -> 1, PlotRange -> All, ImageSize -> Large]


Same approach with an alternative color function:

ParametricPlot[{{y, F[x, y]}, {1.3, F[x, y]}}, {x, 10^-5, 1},
Frame -> True,
FrameTicks -> {{Automatic, All}, {Automatic, Automatic}},
Axes -> False, FrameLabel -> (Style[#, 12, Bold] & /@ {"y", "F"}),
PlotStyle -> {Automatic, Directive[Opacity[1], AbsoluteThickness[20], CapForm["Butt"]]},
ColorFunction -> Function[{y, F, x}, ColorData["Rainbow"][F]],
AspectRatio -> 1, PlotRange -> All,
PlotRangePadding -> {{Automatic, .04}, {Automatic, Automatic}},
ImageSize -> Large, PlotRangeClipping -> False]


I assume you're asking how to generate a bar plot with your given function, and not how to solve some sort of thing.

This can easily be done with BarLegend`

Plot[Sqrt[x], {x, 0, 1}, ColorFunction -> "Rainbow", PlotLegends -> BarLegend["Rainbow"]]

• It is quite far from the appearance in the OP. Oct 3, 2020 at 12:59
• The op needs to be more specific if they want an exact replicable of their drawing, or how to add a barlegend...at the moment the only question i see, is how to add a barlegend. Their equation model also doesn‘t represent their drawing. Which is a different problem Oct 3, 2020 at 13:01
• Yes, fully agree, I wrote a comment above. It is better to wait for clarifications. Oct 3, 2020 at 13:02