Message Boards Message Boards

GROUPS:

[✓] Use ScalingFunction "Reverse" in a Log Plot?

Posted 1 year ago
1500 Views
|
4 Replies
|
0 Total Likes
|

I wrote the code reported below, but i want to plot the graphics on a logarithmic scale on the y-axis. Can Someone help me please?

data1 = {{0.18170805572380375`, 10.66}, {0.18170805572380375`, 
    10.6925}, {0.18170805572380375`, 10.725}, {0.18170805572380375`, 
    10.7575}, {0.18170805572380375`, 10.79}, {0.18170805572380375`, 
    10.8225}, {0.18170805572380375`, 10.855}, {0.18170805572380375`, 
    10.8875}, {0.17947950942267424`, 11.2125}, {0.17947950942267424`, 
    11.5375}, {0.17947950942267424`, 11.83}, {0.17730496453900707`, 
    12.1875}, {0.17730496453900707`, 12.51255}, {0.17730496453900707`,
     12.7075}, {0.17730496453900707`, 12.8375}, {0.1751824817518248`, 
    13.065}, {0.1751824817518248`, 13.4875}, {0.1751824817518248`, 
    13.8125}, {0.1751824817518248`, 14.1375}, {0.17311021350259664`, 
    14.4625}, {0.17311021350259664`, 14.7875}, {0.17108639863130878`, 
    16.0875}, {0.1691093573844419`, 18.6875}, {0.1691093573844419`, 
    21.9375}, {0.16717748676511562`, 25.1875}, {0.16717748676511562`, 
    27.4625}, {0.16717748676511562`, 29.0875}, {0.16528925619834708`, 
    30.0625}, {0.16528925619834708`, 31.3625}, {0.16528925619834708`, 
    33.9625}, {0.16528925619834708`, 36.5625}};
data2 = {{0.11846001974333663`, 10.66}, {0.11657276083155237`, 
    10.6925}, {0.11565150346954509` , 10.725}, {0.11385199240986715`, 
    10.7575}, {0.1129730747505178`, 10.79}, {0.11125533098460968`, 
    10.8225}, {0.11041589988958408`, 10.855}, {0.10877447425670773`, 
    10.8875}, {0.10055304172951232`, 11.2125}, { 0.09408812921436412`,
     11.5375}, {0.08894159501927067`, 11.83}, {0.08432888264230498`, 
    12.1875}, {0.08017103153393906`, 12.5125}, {0.07845188284518828`, 
    12.7075}, {0.07680491551459293`, 12.8375}, {0.07484096295372333`, 
    13.065}, {0.07119971520113919`, 13.4875}, { 0.06853226727584237`, 
    13.8125}, {0.06635700066357`, 14.1375}, {0.06403415154749198`, 
    14.4625}, { 0.06213109661385523`, 
    14.7875}, {0.055319933616079654`, 16.0875}, {0.04537205081669691`,
     18.6875}, {0.037091988130563795`, 
    21.9375}, {0.03143500812071043`, 25.1875}, {0.028386242134645405`,
     27.4625}, {0.026581605528973946` , 
    29.0875}, {0.025560194257476354` , 
    30.0625}, {0.024368450978799448` , 
    31.3625}, {0.02225601839830854`, 33.9625}};
Show[Plot[
  7.672566821271195` + 0.19053345681644884`/t^1.3`, {t, 0, 0.18251}, 
  PlotRange -> {{0, 0.2}, {0, 50}}, AxesOrigin -> {0, 50}, 
  ScalingFunctions -> "Reverse", 
  AxesStyle -> {Directive[Black, Thick], Directive[Black, Thick]}, 
  TicksStyle -> {{FontSize -> 20, Black}, {FontSize -> 20, Black}}, 
  LabelStyle -> {Directive[22, "Times", Red, Bold]}, 
  PlotStyle -> {Blue, Thickness[.008]}, 
  AxesLabel -> {Style[
     Text["   \!\(\*SuperscriptBox[\(\[Beta]\), \(-1\)]\) "], 
     FontSize -> 26, Bold, Black], 
    Style[Text["  L "], FontSize -> 26, Italic, Bold, Black]}, 
  PlotRange -> {{0, 0.20}, {0, 50}}],
 Plot[-2.381937082936315` Tan[9.946572527751202486`3. t], {t, 0, 
   0.18251}, PlotRange -> {0, 50}, AxesOrigin -> {0, 50}, 
  ScalingFunctions -> "Reverse", 
  AxesStyle -> {Directive[Black, Thick], Directive[Black, Thick]}, 
  TicksStyle -> {{FontSize -> 20, Black}, {FontSize -> 20, Black}}, 
  LabelStyle -> {Directive[22, "Times", Red, Bold]}, 
  PlotStyle -> {Red, Thickness[.008]}, 
  AxesLabel -> {Style[
     Text["    \!\(\*SuperscriptBox[\(\[Beta]\), \(-1\)]\) "], 
     FontSize -> 26, Bold, Black], 
    Style[Text[" L"], FontSize -> 26, Italic, Bold, Black]}, 
  PlotRange -> {{0, 0.20}, {0, 50}}],
 ListPlot[{data1, data2}, 
  PlotStyle -> {{Black, PointSize[0.010]}, {Black, PointSize[0.012]}},
   AxesStyle -> {Directive[Black, Thick], Directive[Black, Thick]}, 
  TicksStyle -> {{FontSize -> 20, Black}, {FontSize -> 20, Black}}, 
  AxesLabel -> {Style[
     Text["    \!\(\*SuperscriptBox[\(\[Beta]\), \(-1\)]\) "], 
     FontSize -> 26, Bold, Black], 
    Style[Text[" L"], FontSize -> 26, Italic, Bold, Black]}, 
  PlotRange -> {{0, 0.20}, {0, 50}}, AxesOrigin -> {0, 50}, 
  ScalingFunctions -> "Reverse"]]
Attachments:
4 Replies

Perhaps you want

ScalingFunctions -> {-Log[#] &, Exp[-#] &}]

But try it after deleting all the PlotRange options scattered through your code and just add this one to Show after the last plot:

PlotRange -> {{0, 0.2}, {-Log[50], Automatic}}]

You can adjust it if desired, but pay attention to the vertical range: You have to give it in scaled form, -Log[value], where value is one of the extreme values you wish to have for the range.

Posted 1 year ago

Thank you, Michael. One more question: Why if I choose AxesOrigin -> {0,70} and PlotRange -> {{0, 0.2}, {-Log[50], Automatic}}] it doesn't work? Thanks.

What if you use

PlotRange -> {{0, 0.2}, {-Log[70], Automatic}}]

?

In general, I think you need

    PlotRange -> {{0, 0.2}, {-Log[ymax], -Log[ymin]}}]

(the max & min being reversed because of the reverse scaling).

Posted 1 year ago

Ok. Thank you Michael.

Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract