1
$\begingroup$

I am wondering how to describe the reasoning behind the None setting in ChartLabels to label a group of data. It's a very common way of using a bar chart but it wasn't immediately obvious from the help menu - I had to figure it out from other BarChart questions (very common).

I like in Mathematica that I can describe what I want and then translate that to the functions and settings (with some practice and vocab) - I can't figure out how to do it for this though.

The help menu says "None indicates no label. If there are more elements in a dataset than Subscript[lbl, i] specified, the subsequent Subscript[lbl, i] are taken to be None".

The default behaviour is to label each data point in the group with as many labels as needed or as many as you have - this is how I interpret the help description.

My question is: how would I have figured out that ChartLabels->{blah, None} would generate labels for each group of data? I hate memorising 'tricks' - is there an obvious way to describe this behaviour that makes adding None obvious?

{BarChart[
  {{1, 2, 3}, {2, 3, 5}, {1, 5, 3}},
  ChartLabels -> Range[3]],
 BarChart[
  {{1, 2, 3}, {2, 3, 5}, {1, 5, 3}},
  ChartLabels -> {Range[2]}],
 BarChart[
  {{1, 2, 3}, {2, 3, 5}, {1, 5, 3}},
  ChartLabels -> {Range[2], None}],
 BarChart[
  {{1, 2, 3}, {2, 3, 5}, {1, 5, 3}},
  ChartLabels -> {Range[10], None}] (* at least 3 but mma ignores >3 *)}
$\endgroup$
  • 2
    $\begingroup$ ChartLabels-> $\{spec_1, spec_2, \ldots\}$ uses the successive $spec_i$ to specify labels for successive dimensions in nested lists of datasets. $\endgroup$ – kglr Oct 3 '18 at 23:47
  • $\begingroup$ Thx! - I know it was a trivial question but I just couldn't see it... This helped clear it up for me: BarChart[ {{1, 2, 3}, {2, 3, 5}, {1, 5, 3}}, ChartLabels -> {Range[3], Range[3]}] $\endgroup$ – Joe Oct 4 '18 at 0:12
  • $\begingroup$ Joe, posted the comment as an answer. $\endgroup$ – kglr Oct 4 '18 at 0:37
0
$\begingroup$

ChartLabels >> Details

ChartLabels -> $\{spec_1, spec_2, \ldots\}$ uses the successive $spec_i$ to specify labels for successive dimensions in nested lists of datasets

$\endgroup$

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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