0
$\begingroup$

I am trying to create a plot with the axes labelled and for some reason the x axis label is getting cutoff. I've tried resizing the plot and it does not fix it. I am using the following code:

Plot with cutoff labels

The data stored in allData is here, in case you want to recreate the problem.

allData={{{1,0.00016},{2,0.00006},{4,8.^-6},{8,7.*^-6},{16,7.^-6},{32,7.*^-6},{64,6.^-6},{128,7.*^-6},{256,7.^-6},{512,7.*^-6},{1024,8.^-6},{2048,0.00001},{4096,0.000015},{8192,0.000019},{16384,0.00003},{32768,0.000056},{65536,0.000433},{131072,0.00071},{262144,0.001277},{524288,0.002439},{1048576,0.004779},{2097152,0.009294},{4194304,0.018461},{8388608,0.036768},{16777216,0.073468}},{{1,0.000163},{2,0.000094},{4,6.*^-6},{8,6.^-6},{16,6.*^-6},{32,6.^-6},{64,6.*^-6},{128,6.^-6},{256,6.*^-6},{512,6.^-6},{1024,7.*^-6},{2048,8.^-6},{4096,0.000014},{8192,0.000017},{16384,0.00003},{32768,0.000055},{65536,0.000448},{131072,0.000714},{262144,0.001282},{524288,0.002422},{1048576,0.004701},{2097152,0.009263},{4194304,0.018312},{8388608,0.036492},{16777216,0.073259}},{{1,0.000105},{2,8.*^-6},{4,2.^-6},{8,2.*^-6},{16,2.^-6},{32,2.*^-6},{64,2.^-6},{128,2.*^-6},{256,2.^-6},{512,2.*^-6},{1024,3.^-6},{2048,5.*^-6},{4096,9.^-6},{8192,0.000014},{16384,0.000025},{32768,0.000048},{65536,0.000393},{131072,0.000731},{262144,0.001266},{524288,0.002407},{1048576,0.004663},{2097152,0.009127},{4194304,0.018178},{8388608,0.036096},{16777216,0.071814}},{{1,0.000105},{2,0.000015},{4,2.*^-6},{8,2.^-6},{16,2.*^-6},{32,2.^-6},{64,2.*^-6},{128,2.^-6},{256,2.*^-6},{512,2.^-6},{1024,2.*^-6},{2048,5.*^-6},{4096,0.000012},{8192,0.000013},{16384,0.000022},{32768,0.00004},{65536,0.00039},{131072,0.000728},{262144,0.001266},{524288,0.002402},{1048576,0.004629},{2097152,0.009103},{4194304,0.018147},{8388608,0.036348},{16777216,0.072373}}}

$\endgroup$
1
  • $\begingroup$ try the option PlotRangeClipping ->False and/or the option ImagePadding $\endgroup$
    – kglr
    Commented Oct 16, 2020 at 19:56

1 Answer 1

3
$\begingroup$

For lengthy labels, FrameLabel generally works better. You may also want to consider "Log" scaling.

allData = {{{1, 0.00016}, {2, 0.00006}, {4, 8.^-6}, {8, 7.*^-6}, {16, 
     7.^-6}, {32, 7.*^-6}, {64, 6.^-6}, {128, 7.*^-6}, {256, 7.^-6}, {512, 
     7.*^-6}, {1024, 8.^-6}, {2048, 0.00001}, {4096, 0.000015}, {8192, 
     0.000019}, {16384, 0.00003}, {32768, 0.000056}, {65536, 
     0.000433}, {131072, 0.00071}, {262144, 0.001277}, {524288, 
     0.002439}, {1048576, 0.004779}, {2097152, 0.009294}, {4194304, 
     0.018461}, {8388608, 0.036768}, {16777216, 0.073468}}, {{1, 
     0.000163}, {2, 0.000094}, {4, 6.*^-6}, {8, 6.^-6}, {16, 6.*^-6}, {32, 
     6.^-6}, {64, 6.*^-6}, {128, 6.^-6}, {256, 6.*^-6}, {512, 6.^-6}, {1024, 
     7.*^-6}, {2048, 8.^-6}, {4096, 0.000014}, {8192, 0.000017}, {16384, 
     0.00003}, {32768, 0.000055}, {65536, 0.000448}, {131072, 
     0.000714}, {262144, 0.001282}, {524288, 0.002422}, {1048576, 
     0.004701}, {2097152, 0.009263}, {4194304, 0.018312}, {8388608, 
     0.036492}, {16777216, 0.073259}}, {{1, 0.000105}, {2, 8.*^-6}, {4, 
     2.^-6}, {8, 2.*^-6}, {16, 2.^-6}, {32, 2.*^-6}, {64, 2.^-6}, {128, 
     2.*^-6}, {256, 2.^-6}, {512, 2.*^-6}, {1024, 3.^-6}, {2048, 
     5.*^-6}, {4096, 9.^-6}, {8192, 0.000014}, {16384, 0.000025}, {32768, 
     0.000048}, {65536, 0.000393}, {131072, 0.000731}, {262144, 
     0.001266}, {524288, 0.002407}, {1048576, 0.004663}, {2097152, 
     0.009127}, {4194304, 0.018178}, {8388608, 0.036096}, {16777216, 
     0.071814}}, {{1, 0.000105}, {2, 0.000015}, {4, 2.*^-6}, {8, 2.^-6}, {16, 
     2.*^-6}, {32, 2.^-6}, {64, 2.*^-6}, {128, 2.^-6}, {256, 2.*^-6}, {512, 
     2.^-6}, {1024, 2.*^-6}, {2048, 5.*^-6}, {4096, 0.000012}, {8192, 
     0.000013}, {16384, 0.000022}, {32768, 0.00004}, {65536, 
     0.00039}, {131072, 0.000728}, {262144, 0.001266}, {524288, 
     0.002402}, {1048576, 0.004629}, {2097152, 0.009103}, {4194304, 
     0.018147}, {8388608, 0.036348}, {16777216, 0.072373}}};

ListPlot[allData, Frame -> True,
 FrameLabel -> (Style[#, 14] & /@ {"Message Size (Bytes)", "Time (s)"}),
 PlotLegends -> {"40Block", "41Block", "40NonBlock", "41NonBlock"},
 ScalingFunctions -> {"Log", None},
 ImageSize -> Medium,
 PlotMarkers -> Automatic]

enter image description here

ListPlot[allData, Frame -> True,
 FrameLabel -> (Style[#, 14] & /@ {"Message Size (Bytes)", "Time (s)"}),
 PlotLegends -> {"40Block", "41Block", "40NonBlock", "41NonBlock"},
 ScalingFunctions -> "Log",
 ImageSize -> Medium,
 PlotMarkers -> Automatic]

enter image description here

$\endgroup$

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.