Azzera filtri
Azzera filtri

Annotating Plots

1 visualizzazione (ultimi 30 giorni)
Amandeep
Amandeep il 10 Set 2011
Hi, I am trying to annotate a plot with specific coordinantes, but I am not sure how to have the coordinantes displayed with brackets around them, and how to create an arrow, from the line to the annotation, so that the curve can be seen.
I am creating 10 plots like this, so I was also wondering if there was a way to automatically create arrows pointing in the correct direction to display the curve and the annotation.
Here is what I have done so far:-
A = [0,0.0590000000000000; 1,0.0608180621083432; 2,0.0615879573422760; 3,0.0603386593147987; 4,0.0598305894162876; 5,0.0598623273619486; 6,0.0584945748794018; 7,0.0577702151590919; 8,0.0605129150799025; 9,0.0620048213373498; 10,0.0605393857529640; 11,0.0577228309148774; 12,0.0545269901805093; 13,0.0565073063213107; 14,0.0588962692968848; 15,0.0646554192002185; 16,0.0653529156588946; 17,0.0640673165727952; 18,0.0624340511194904; 19,0.0631543194996316; 20,0.0629452706226184; 21,0.0646757622166786; 22,0.0647175708496279; 23,0.0656249289159351; 24,0.0658196162947984; 25,0.0655795574615578; 26,0.0631977170251018; 27,0.0609979983473740; 28,0.0629218306380116; 29,0.0610501667442434; 30,0.0585487582819609; 31,0.0580821579803593; 32,0.0562292159538292; 33,0.0572340748081928; 34,0.0562691703206619; 35,0.0575612158992794; 36,0.0583245385835296; 37,0.0588496200538721; 38,0.0572538716856298; 39,0.0566640164178741; 40,0.0551814025803676; 41,0.0587963688120286; 42,0.0579968315568868; 43,0.0536895112169952; 44,0.0551626051371020; 45,0.0540816350078450; 46,0.0547008772575487; 47,0.0541332759920487; 48,0.0530038170579354; 49,0.0494052496047877; 50,0.0495345840243639; 51,0.0484584597544044; 52,0.0460596033130027; 53,0.0474563474278678; 54,0.0444466067730615; 55,0.0429326641254798; 56,0.0451957674464573; 57,0.0427474722695884; 58,0.0402749977640400; 59,0.0367917420128257; 60,0.0326702213512802; 61,0.0322733521533463; 62,0.0297719248040272; 63,0.0290634547328883; 64,0.0253755104823977; 65,0.0242282988693209; 66,0.0220403843276571; 67,0.0141681138079521; 68,0.0138603809990626; 69,0.0166901467287308; 70,0.0177565201087299; 71,0.0178903024012334; 72,0.0183834476605889; 73,0.0172760072302439; 74,0.0188915053604907; 75,0.0170741035963220; 76,0.0149854280071022];
B = [54,0.0444466067730615; 60,0.0326702213512802; 65,0.0242282988693209; 67,0.0141681138079521];
figure(1), plot(A(:,1),A(:,2),'+-');
n=num2str(B,'%5.3g,');
n=n(:,1:end-1);
text(B(:,1),B(:,2),n,'HorizontalAlignment','center','BackgroundColor',[1 1 1],'EdgeColor','red');
So from the code I get the annotation without brackets around them and I'm not sure how to add arrows for the above code.
Thanks, any help will be fantastic.

Risposta accettata

Fangjun Jiang
Fangjun Jiang il 10 Set 2011
To include brackets, you could use for example, a=mat2str(B(1,:)). Or n=num2str(B,'[%5.3g],'), or str=['[',num2str(3),']']
To add an arrow, use annotation('arrow') or annotation('doublearrow')
  1 Commento
Amandeep
Amandeep il 11 Set 2011
Thanks, used arrow function from file exchange.
Regarding the brackets, I can't get brackets for each row

Accedi per commentare.

Più risposte (0)

Tag

Community Treasure Hunt

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

Start Hunting!

Translated by