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?


2 Answers 2


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.

  • $\begingroup$ Indeed, it should give an error message. $\endgroup$
    – Jens
    Apr 3, 2012 at 21:14
  • $\begingroup$ Indeed. Thank you @F'x, Eli. I'm so used to GraphicConverter and other apps that have default 90 deg Rotate. $\endgroup$ Apr 4, 2012 at 0:43
  • $\begingroup$ @jens In cases where the inputs do not match the defined formats Mathematica just returns the function unevaluated. This is by design. $\endgroup$ Apr 4, 2012 at 16:09
  • $\begingroup$ @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). $\endgroup$
    – Jens
    Apr 4, 2012 at 16:22
  • $\begingroup$ @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. $\endgroup$ Apr 4, 2012 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

  • $\begingroup$ Thanks @Brett. These features and options (eg "Percentile") are barely mentioned in Documentation. If only Wolfram would link MMA.SE to help. $\endgroup$ Apr 4, 2012 at 0:44

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.