Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Simple Histogram using Mathematica - need help please

  1. Aug 30, 2009 #1
    Hi. I am new to using Mathematica v7 and would like to know how to generate a very simple histogram.

    The data is:

    data = {1.5, 2, 0, 0.5, 1, 2, 1.5, 3, 0, 0.5, 1, 2, 2, 3, 3.5, 0, 1, 4, 2, 0.5, 1, 0, 2, 1.5, 0, 1.5}

    I can generate the histogram using Histogram[data] but how do I set the histogram to generate columns that represent 0, 0.5, 1, 1.5, ... etc with the columns labeled with those values centred underneath each column? Is it possible also to have the x-axis label centred underneath the chart?

    Thank you to anyone who can help me out.
     
  2. jcsd
  3. Aug 30, 2009 #2

    CompuChip

    User Avatar
    Science Advisor
    Homework Helper

    You can try something like
    Code (Text):
    Histogram[data, HistogramCategories -> Range[Min[data], Max[data], 1/2]]
    There doesn't seem to be an option to adapt the scale though (I found somewhere the option Ticks -> IntervalCenters, although it gives me errors).
     
  4. Aug 30, 2009 #3
    Thank you. HistogramCategories and IntervalCenters appears to be in a previous version of Mathematica and not in version 7. If anyone knows what they have been changed to in version 7, I'd appreciate your help!
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook




Similar Discussions: Simple Histogram using Mathematica - need help please
  1. Mathematica help (Replies: 3)

  2. Mathematica help (Replies: 2)

Loading...