Mathematica Stack Exchange is a question and answer site for users of Mathematica. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top
Rotate@BarChart[RandomReal[1, {4, 5}], ChartLayout -> "Percentile"] 

Even though the FullForm generated by BarChart is Graphics expression, Rotate has no effect on BarChart and many other packaged plot functions. However, it's frequently necessary to rotate, scale and align such plots to other graphics in composite data visualizations (eg, imagine a heatmap augmented with row and column descriptive statistics visualized with two corresponding BoxWhiskerChart)

How can rotatable, translatable, etc. graphics be extracted from functions like BarChart and BoxWhiskerChart?

share|improve this question
up vote 7 down vote accepted

You left off the angle to rotate through:

Rotate[BarChart[RandomReal[1, {4, 5}], ChartLayout -> "Percentile"], 90 Degree]

Mathematica graphics

Rotate[BarChart[RandomReal[1, {4, 5}], ChartLayout -> "Percentile"], 45 Degree]

Mathematica graphics

Strange that it didn't throw an error, though.

share|improve this answer
Indeed, it should give an error message. – Jens Apr 3 '12 at 21:14
Indeed. Thank you @F'x, Eli. I'm so used to GraphicConverter and other apps that have default 90 deg Rotate. – alancalvitti Apr 4 '12 at 0:43
@jens In cases where the inputs do not match the defined formats Mathematica just returns the function unevaluated. This is by design. – Sjoerd C. de Vries Apr 4 '12 at 16:09
@SjoerdC Not really. Try Map[x] where you see the red pointer because of the wrong format, and you get a message ::argtu: The same holds here with Rotate[x] (you get a red pointer to warn you, but no message). – Jens Apr 4 '12 at 16:22
@jens The OP used the function in prefix format. In that case there is no possibility for syntax coloring. I guess many functions have a reasonable output built-in given insufficient parameters . Take RotateLeft[{x}] for instance. Same for Rotate[x]. Simple user-defined functions return unevaluated if the argument patterns don't match the definition. – Sjoerd C. de Vries Apr 4 '12 at 16:37

In addition to Rotate you could use the BarOrigin option to BarChart to change the orientation. In this case the graphic is still wider than it is tall:

BarChart[RandomReal[1, {4, 5}],
 ChartLayout -> "Percentile", BarOrigin -> Left]

enter image description here

share|improve this answer
Thanks @Brett. These features and options (eg "Percentile") are barely mentioned in Documentation. If only Wolfram would link MMA.SE to help. – alancalvitti Apr 4 '12 at 0:44

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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