Add remark to graph

1 view (last 30 days)
Le Mischa
Le Mischa on 22 Nov 2014
Edited: Image Analyst on 22 Nov 2014
Hi there
I'm a newbie in Matlab, and I'm trying to annotate some points in my graph. I did this:
% Wachstumsrate des BIP in %
clear all
format shortG;
Time2=xlsread('BIPProzent.xlsx','A1:A162');
Prozent=xlsread('BIPProzent.xlsx','B1:B162');
figure();
plot(Time2, Prozent);
title('Veränderung des BIPs in Prozent');
ylabel('Veränderung gegenüber Vorjahr in Prozent');
xlabel('Jahr');
minimum1=min(Time2);
maximum1=max(Time2);
axis([ minimum1 maximum1 -25 25]);
Now I want to remark some years. I plotted the year against the growth of the BIP in Switzerland. Now, how can I display, for example, the rate in the great depression in the year 1934? I want something like a circle at this point and perhaps a remark like "great depression"?
Help would be very appreciated! :)
Best regards Mischa

Answers (1)

Star Strider
Star Strider on 22 Nov 2014
For your remark, use text (and Text Properties).
You can plot the circle by finding the Time2 and Prozent values in your vectors that are in your areas of interest, perhaps using the find function, then plot them as:
k = find(Time2 == 1934);
plot(Time2(k), Prozent(k), 'o')
This is an example. You may have to experiment with it to get the result you want. If there are more than one value and you want an ellipse around all of them, see the documentation for rectangle.

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!