4
$\begingroup$

I would like to use SciDraw to draw my figures and I would like to label the top and right axes of the frame. I guess it should be possible using FigAxis or even maybe some equivalent of XTicks (I tried X2ticks but didn't work). Just the documentation does not seem to be specific enough for me to figure out how it might work.

Example:

plot

The figure was created using this code:

<< "SciDraw`"
test = Figure[
  {FigurePanel[{FigGraphics[DensityPlot[x + y, {x, 0, 2}, {y, 0, 4}]]},
     XPlotRange -> {0, 2},
     YPlotRange -> {0, 4},
     YTickLabelRange -> {0, 4},
     XTickLabelRange -> {0, 2},
     PanelLetter -> None
     ];
   },
  CanvasSize -> {4, 4}]
Export["test.png", test]

How can I get the tick labels on the right edge of the frame and ideally even have a label for that axis?

Update:

In the documentation it is claimed that regular mathematica plot options would work with SciDraw, too, but even then tick labels and axes labels are not shown:

test = Figure[
  {FigurePanel[{FigGraphics[DensityPlot[x + y, {x, 0, 2}, {y, 0, 4}]]},
     XPlotRange -> {0, 2},
     YPlotRange -> {0, 4},
     Ticks -> {{None, LinTicks}, {None, None}},
     FrameLabel -> {{"a", "b"}, {"c", "d"}},
     PanelLetter -> None
     ];
   },
  CanvasSize -> {4, 4}]

plot2

$\endgroup$
  • 1
    $\begingroup$ Documentation says to use XXFrameLabel and YYFrameLabel, but I couldn't get it to work. $\endgroup$ – Markus Roellig Dec 12 '16 at 13:02
  • $\begingroup$ @MarkusRoellig Also needs XXShowFrameLabel -> True, etc. Or alternatively, ShowFrameLabel -> {{True, True}, {True, True}}. $\endgroup$ – Szabolcs Dec 12 '16 at 15:21
3
$\begingroup$

Generally, X refers to the $x$ axis, XX refers to the secondary one. The same for Y and YY.

Your syntax

FrameLabel -> {{"a", "b"}, {"c", "d"}}

is correct, and so is

XFrameLabel -> "a", XXFrameLabel -> "b", ...

What's missing is enabling the label on the secondary axes:

XXShowFrameLabel -> True

or

ShowFrameLabel -> {{True, True}, {True, True}}
$\endgroup$
  • 1
    $\begingroup$ That's what I was missing. Just for completeness, XXShowTickLabels->True is required in addition to show the tick labels. $\endgroup$ – Felix Dec 12 '16 at 15:35
2
$\begingroup$

@Felix: a bit of a necrothread ....

With

<< "SciDraw`"
test = Figure[{FigurePanel[{FigGraphics[
       DensityPlot[x + y, {x, 0, 2}, {y, 0, 4}]]}, 
     XPlotRange -> {0, 2}, YPlotRange -> {0, 4},
     ShowFrameLabel -> {{True, True}, {True, True}}, 
     Ticks -> {{None, LinTicks}, {None, None}}, 
     FrameLabel -> {"a", "b", "c", "d"}, PanelLetter -> None];}, 
  CanvasSize -> {4, 4}]

we have

enter image description here

$\endgroup$
  • $\begingroup$ Thanks for your comment. Is there a trick that Szabolcs did not include in his post? I probably missed it. $\endgroup$ – Felix Jul 25 '17 at 2:06
  • $\begingroup$ @Felix: swings & roundabouts. The frame lablels can be added as a 4-element list as I've shown. Or they can be added Szabolcs-style, with the same syntax as standard Plot[]. $\endgroup$ – dwa Jul 25 '17 at 5:31

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.