3
$\begingroup$

What is the nicest way to visualize change of variables as below density as below? IE, value 2 appears 3 times, so it gets a higher bin-count than other values, but the histogram is vertical to align with the values in the leftmost plot.

enter image description here

Here's the visualization of the leftmost plot

ListPlot[{4, 3, 2, 2, 2, 1}, Filling -> Axis]
$\endgroup$

2 Answers 2

8
$\begingroup$
Histogram[{4, 3, 2, 2, 2, 1}, BarOrigin -> Left]

enter image description here

$\endgroup$
1
  • 2
    $\begingroup$ Simple & nice ! $\endgroup$
    – A. Kato
    Commented Oct 30 at 8:15
3
$\begingroup$

I don't fully understand what is your question. If the rightmost plot is what you want, then how about this?

data = {4, 3, 2, 2, 2, 1};
Graphics[{EdgeForm[{Thick, Orange}], White, 
  Rectangle[{0, #[[1]] - 1}, #[[{2, 1}]]] & /@ Tally[data]}, 
 Axes -> True]

hist-horizontal

$\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.