2
$\begingroup$

In two side by side panels, using LevelScheme, I output the same data using ListPlot. In the first panel I use option Joined->False, while in the second Joined->True. The data in the second panel is properly limited by the size of the panel, while in the first panel it goes beyond the panel limits. So, my question is: how to make objects being displayed be cut exactly by the size of the panel, if even explicitly specifying the PlotRange in ListPlots doesn't make any difference?

<< "LevelScheme"`
Figure[{
  Multipanel[{{0, 1}, {0, 1}}, {1, 2}, XGapSizes -> {.5}],

  FigurePanel[{1, 1}, PlotRange -> {{0, 10}, {0, 1}}],
  RawGraphics[
   ListPlot[Table[{.1 x, Sinc[.1 x]}, {x, Range@200}], 
    PlotRange -> {{0, 1}, {0, 1}},Joined->False]
   ],

  FigurePanel[{1, 2}, PlotRange -> {{0, 10}, {0, 1}}],
  RawGraphics[
   ListPlot[Table[{.1 x, Sinc[.1 x]}, {x, Range@200}], 
    PlotRange -> {{0, 1}, {0, 1}}, Joined -> True]
   ]

  },


 PlotRange -> {{-0.1, 1.1}, {-0.1, 1.1}}]

results in

result of the aforementioned code execution in Mathematica 9

$\endgroup$

1 Answer 1

1
$\begingroup$

You should prepend to the code of your question

<< "LevelScheme"`

However, this doesn't open with my version of MMA (10.0)

As an alternative one could use

a = ListPlot[Table[{.1 x, Sinc[.1 x]}, {x, Range@200}],
  Frame -> True,
  PlotRange -> {{0, 10}, {0, 1}},
  Joined -> False,
  AspectRatio -> 1.5,
  PlotLegends -> Placed[{"(a)"}, {0.3, 0.95}]];

b = ListPlot[Table[{.1 x, Sinc[.1 x]}, {x, Range@200}],
  Frame -> True,
  PlotRange -> {{0, 10}, {0, 1}},
  Joined -> True,
  AspectRatio -> 1.5,
  PlotLegends -> Placed[{"(b)"}, {0.3, 0.95}]];

Grid[{{a, b}}]

UPDATE (based on comment)

For a grid of these plots without spaces:

Change PlotRange to

  PlotRange -> {{0, 10}, {0, 1.1}}

Then:

Grid[{{a, b}}, Spacings -> {-1, 0}]
$\endgroup$
1
  • $\begingroup$ Thank you for your answer and the suggestion (I added the line). However, Grid is not an alternative to me, because I want to use LevelScheme for much more complicated manipulations with graphics. For example, I want to draw both panels side by side without any space between them. Grid doesn't have such an option afaik. $\endgroup$ Jul 20, 2014 at 18:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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