Notna
Notna

Reputation: 525

Histogram from two column array on Matlab

I'm struggling to understand how histograms work in Matlab. Say I have a numerical array of size 4x2:

A = [0.2 5; 0.3 11; 0.4 9; 0.1 2]

Which represents my portfolio: the proportion of my money invested in stock number 5, 11, 9, and 2 (so I have 20% of stock n°5, 30% of stock n°11, etc). And I would like to plot a simple histogram with 5, 11, 9, and 2 on the x-axis to show the proportion of money invested in each stock.

Could someone hint me the trick? Thank you!

Upvotes: 0

Views: 85

Answers (1)

bla
bla

Reputation: 26069

what you want is called a "bar plot", not a histogram. try bar(A(:,2),A(:,1))

Upvotes: 1

Related Questions