1
$\begingroup$

I'm trying to lable each point in data set and adjust corresponding TickLabels. Here is my code:

<< SciDraw`;
EM = {{3, 4.6928886 10^(-2)}, {2, 2.5835689 10^(-2)}, {1.3, 
1.440918 10^(-2)}, {1, 1.2898527 10^(-2)}};(*data set*)
maxEM = Max[#[[2]] & /@ EM];(*maximum of data set*)
Figure[
      FigurePanel[
               {
                DataPlot[EM, XAxisScale -> Log, DataLine -> {Show -> False}, 
                DataSymbol -> {SymbolSize -> 5, FillColor -> Firebrick}]
               },
               YPlotRange -> {0, maxEM + 0.01},
               XPlotRange -> {-0.045, 0.55},
               XTicks -> 
               LinTicks[{Log[10, EM[[4, 1]]], Log[10, EM[[3, 1]]], 
               N[Log[10, EM[[2, 1]]]], N[Log[10, EM[[1, 1]]]]}, {0}, 
               DecimalDigits -> 2],
               YTicks -> 
              LinTicks[Delete[#[[2]] & /@ EM, 3], Delete[#[[2]] & /@ EM, 3], 
              DecimalDigits -> 2],
              XFrameLabel -> textit["Log(step)"],
              YFrameLabel -> "EM", ShowFrameLabel -> True
                 ],
     Canvas -> {10, 10}
     ]

Please note that horizontal axis is logarithmic. The output is: enter image description here

I would like to get something similiar to this: enter image description here

Also I wonder if you can put some Graphics object like Circle[] on Canvas(outside of FigurePanel) in SciDraw. So something like this: enter image description here

$\endgroup$
2
$\begingroup$

I'm no expert on SciDraw, perhaps one will chime in. I'm sure the way to do what you are asking is somewhere in the accepted options, there are many of them

Options@DataPlot // Length
Options@FigurePanel // Length
Options@Multipanel // Length
(* 204 *)
(* 495 *)
(* 502 *)

Here is the best kludge I could work out using this package without learning all the options:

labels = Reverse@{"\"0h\"", "\"1h\"", "\"2h\"", "\"3h\""};
Figure[
 FigurePanel[{
   DataPlot[#1,
      XAxisScale -> Log,
      DataLine -> {Show -> False},
      DataSymbol -> {SymbolSize -> 5, FillColor -> Firebrick}, 
      CenterLabel -> #2, CenterTextNudge -> {0, 15}] & @@@ 
    Transpose[{{#, {#[[1]] + .001, #[[2]]}} & /@ EM, labels}]
   },
  YPlotRange -> {0, maxEM + 0.01},
  XPlotRange -> {-0.045, 0.55},
  XTicks -> 
   Evaluate[{N@Log10[#1[[1]]], #2} & @@@ Transpose[{EM, labels}]],
  YTicks -> 
   LinTicks[Delete[#[[2]] & /@ EM, 3], Delete[#[[2]] & /@ EM, 3], 
    DecimalDigits -> 2],
  XFrameLabel -> textit["Log(step)"],
  YFrameLabel -> "EM",
  ShowFrameLabel -> True],
 Canvas -> {10, 10}]

Mathematica graphics

To bring in the circle, I think you need to make a Multipanel, but I gave up on that after a bit. Here is the same plot using ListLogLinearPlot

labels = Reverse@{"\"0h\"", "\"1h\"", "\"2h\"", "\"3h\""};
Grid[
 {{Null, Graphics[Circle[], ImageSize -> 50]},
  {Show[
    ListLogLinearPlot[EM, Frame -> True, Axes -> False, FrameTicks ->
      {{LinTicks[Delete[#[[2]] & /@ EM, 3], Delete[#[[2]] & /@ EM, 3],
          DecimalDigits -> 2],
        StripTickLabels@
         LinTicks[Delete[#[[2]] & /@ EM, 3], 
          Delete[#[[2]] & /@ EM, 3], DecimalDigits -> 2]},
       {{Log[#1[[1]]], #2} & @@@ Transpose[{EM, labels}],
        {Log[#1[[1]]], ""} & @@@ Transpose[{EM, labels}]}},
     PlotRange -> {{0.9, 3.5}, {0, maxEM + 0.01}},
     PlotStyle -> Directive[Firebrick, PointSize[Large]],
     ImageSize -> 500, 
     BaseStyle -> {15, FontFamily -> "Times New Roman"},
     FrameLabel -> {"\!\(\*
StyleBox[\"Log\",\nFontSlant->\"Italic\"]\)\!\(\*
StyleBox[\"(\",\nFontSlant->\"Italic\"]\)\!\(\*
StyleBox[\"step\",\nFontSlant->\"Italic\"]\)\!\(\*
StyleBox[\")\",\nFontSlant->\"Italic\"]\)", "EM"}, 
     PlotTheme -> "Classic"],
    Graphics[
     Text[#2, {Log@#1[[1]], #1[[2]] + .0025}, BaseStyle -> 12] & @@@ 
      Transpose[{EM, labels}],
     ]
    ], Null}},
 Spacings -> None]

Mathematica graphics

$\endgroup$
  • $\begingroup$ Great answer!!! As I noticed you even improved my code. Many, many thanks! $\endgroup$ – Moonwalk May 23 '16 at 12:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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