2
$\begingroup$

I have the following code:

Here is the link to electrons.xlsx

electrons = = Import["electrons.xlsx"];
electronslist = 
  Transpose@{electrons[[1]][[1 ;; All, 2]]/10^20, 
    electrons[[1]][[1 ;; All, 1]]*10^7};
electronsplot = 
 ListLinePlot[electronslist, Frame -> True, 
  AspectRatio -> GoldenRatio, PlotRange -> {{-0.1, 2}, {-3, 30}}, 
  FrameLabel -> {"", ""}, Axes -> None, BaseStyle -> {FontSize -> 20},
   PlotStyle -> {Opacity[1], Thick, Orange} , ImageSize -> 400, 
  FrameStyle -> Black, ScalingFunctions -> {Automatic, "Reverse"}, 
  FrameTicks -> {{Automatic, Automatic}, {Automatic, All}}, 
  FrameTicksStyle -> {Directive[FontOpacity -> 0, FontSize -> 0], 
    Automatic, Automatic, Directive[FontOpacity -> 0, FontSize -> 0]}]

It yields an output like this: enter image description here

The y-axis ticks are hardly visible. How can I make them more prominent? I want the ticks to be like the one in the figure below.plot Also is there a way to shade the curve like done here:

enter image description here

$\endgroup$
0

1 Answer 1

5
$\begingroup$
tF = Charting`ScaledTicks[{Identity, Identity}, TicksLength -> {.035, .02}][##] /. 
    AbsoluteThickness[_] -> AbsoluteThickness[2] &;

llp = ListLinePlot[electronslist,
  Frame -> True,
  AspectRatio -> GoldenRatio,
  PlotRange -> {{-0.1, 2}, {-2, 30}}, FrameLabel -> {"", ""},
  Axes -> None,
  BaseStyle -> {FontSize -> 20},
  PlotStyle -> {Opacity[1], Thick, Orange},
  ImageSize -> 400,
  FrameStyle -> Directive[Black, AbsoluteThickness[2]],
  ScalingFunctions -> {Automatic, "Reverse"},
  FrameTicks -> ConstantArray[tF, {2, 2}],
  FrameTicksStyle -> {FontOpacity -> # & /@ {1, 0}, 
    FontOpacity -> # & /@ {0, 1}}] /. l_Line :> {l, Opacity[.5], FilledCurve[l]}

enter image description here

Post-process to change the automatic formating of tick labels:

reFormatLabel = ReplaceAll[t: {_Real, label_, {_Real, _Real}, {___}} :> Rationalize @ t]

reFormatLabel @ llp

enter image description here

$\endgroup$
10
  • $\begingroup$ Thanks that was useful, can you also please tell me how to shade the area under the curve just like shown in the example? $\endgroup$ Commented Feb 15, 2022 at 14:42
  • 1
    $\begingroup$ @Indeterminate, please see the update. $\endgroup$
    – kglr
    Commented Feb 15, 2022 at 14:50
  • $\begingroup$ Why is there a decimal point after the numbers on y axis? $\endgroup$ Commented Feb 15, 2022 at 14:53
  • $\begingroup$ @Indeterminate, that's what is produced by ChartingScaledTicks`. Update with a method to re-format the labels. $\endgroup$
    – kglr
    Commented Feb 15, 2022 at 14:59
  • $\begingroup$ Thank you, is there a way to do it in while defining tF or ticks itself? $\endgroup$ Commented Feb 15, 2022 at 15:04

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.