3
$\begingroup$

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

$\endgroup$
2
  • $\begingroup$ 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. $\endgroup$
    – yarchik
    Commented Oct 3, 2020 at 12:58
  • $\begingroup$ Do you want the contour line(s) for y == Sqrt[Tan[x]] colored according to the value of F? $\endgroup$
    – Coolwater
    Commented Oct 3, 2020 at 13:16

3 Answers 3

2
$\begingroup$
Clear["Global`*"]

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

y = Sqrt[Tan[x]];

Use ParametricPlot

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}]]

enter image description here

$\endgroup$
1
$\begingroup$

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]

enter image description here

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]

enter image description here

$\endgroup$
0
$\begingroup$

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"]]

enter image description here

$\endgroup$
3
  • $\begingroup$ It is quite far from the appearance in the OP. $\endgroup$
    – yarchik
    Commented Oct 3, 2020 at 12:59
  • $\begingroup$ 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 $\endgroup$ Commented Oct 3, 2020 at 13:01
  • 2
    $\begingroup$ Yes, fully agree, I wrote a comment above. It is better to wait for clarifications. $\endgroup$
    – yarchik
    Commented Oct 3, 2020 at 13:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.