1
$\begingroup$

I produce a plot using

ListPlot[{scaled3, scaled2, scaled1}, Frame -> True, FrameLabel -> {"t/t_c", "<X>/t_c"}, ImageSize -> 150]

which is intentionally small, because it is meant to enter the inset of a bigger plot. The result is the following:

Plot

and it is quite clear that axes labels (like "t/t_c" in the picture) are way too far from the tick numbers. How can I reduce this space? Bear in mind that the ultimate goal is to produce a decent looking inset for another plot (simply reducing the fontsize would make the labels barely visible).

I am aware that a very similar question was already asked in an old post, but the presentation was very confused; moreover, all the answers relied on the use of Framed[], which rotates the y-axis label by 90°, thus wasting even more space.

$\endgroup$
6
  • 2
    $\begingroup$ I can propose a workaround. You could make the inset without FrameLabels and then draw the labels separately using the following construct: Show[{ListPlot[{scaled3, scaled2, scaled1},...], Graphics[{Text[Style["t/t_c",10],{point}],....}]}] where you select the point "point" such that the label goes into a desired place. For the label at the y axis you will have to also rotate the label. $\endgroup$ Dec 11, 2021 at 12:36
  • $\begingroup$ When posting questions, please provide code and data for minimal concrete examples that demonstrate the issue. In general, there may be multiple possible approaches depending on the particular circumstances. $\endgroup$
    – Bob Hanlon
    Dec 11, 2021 at 17:27
  • $\begingroup$ You're certainly right, but in this case you could plot literally any array (instead of {scaled3, scaled2, scaled1}) using the sintax in my example and you would still observe the same problem. $\endgroup$ Dec 11, 2021 at 21:12
  • 1
    $\begingroup$ tried Labeled[ListPlot[{scaled3, scaled2, scaled1}, Frame -> True, ImageSize -> 150], {"<X>/t_c", "t/t_c"}, {Left, Bottom}, Spacings -> {0, 0}, RotateLabel -> True]? $\endgroup$
    – kglr
    Dec 12, 2021 at 4:47
  • $\begingroup$ @kglr this seems to work pretty well. The only flaw is that the lower label is now placed horizontally at the center of the whole graph (including ticks on the y-axis), which does not coincide with the center of the x-axis (excluding y-axis ticks). Is there a way to slightly pan the label horizontally? $\endgroup$ Dec 12, 2021 at 13:10

1 Answer 1

2
$\begingroup$
Legended[ListPlot[{scaled3, scaled2, scaled1}, Frame -> True, ImageSize -> 150], 
 Thread[Placed[{"<X>/t_c", "t/t_c"}, 
        {{Left, {0.1, .4}}, {Bottom, {.4, .7}}}, 
        {Rotate[#, 90 Degree] &, Identity}]]]

enter image description here

Play with the offset positions ({.1, .4} and {.4,.7}) to put the labels in desired positions.

Using Labeled:

Labeled[ListPlot[{scaled3, scaled2, scaled1}, Frame -> True, ImageSize -> 150],
  {"  " <> "<X>/t_c", "  " <> "t/t_c"}, 
  {Left, Bottom}, Spacings -> {0, 0}, RotateLabel -> True]

enter image description here

$\endgroup$
1
  • $\begingroup$ Thanks, this completely solves the problem. $\endgroup$ Dec 12, 2021 at 14:37

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.