问题
The vertical axis of a histogram is the frequency. However, I want them to multiply by a constant. How do I do that with Matlab?
For example:
Tickets are sold at 4 gates: North, South, East or West and I want to plot the amount earned at each gate in a histogram to see which gate earned the most.
The price of each ticket is $10. I want the histogram output to show the amount earned instead of just number of tickets sold.
回答1:
The hist
function called with no output assignment will draw the chart for you but if you call it like this
[contents, bins] = hist(data)
it won't draw the chart and will store the relevant values in the two output variables. Then you can modify the contents
variable and plot them with bar
to achieve wht you need
bar(bins, 10*contents)
来源:https://stackoverflow.com/questions/30779402/matlab-histogram-vertical-axis-frequency-multiply-by-constant