Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.


Math Forum » Discussions » Software » comp.soft-sys.matlab

Topic: Plot multiple lines with their values
Replies: 2   Last Post: Oct 24, 2012 6:02 AM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
Adam Chapman

Posts: 170
Registered: 1/12/09
Re: Plot multiple lines with their values
Posted: Oct 24, 2012 6:02 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

On Wednesday, October 24, 2012 10:10:09 AM UTC+1, Idra wrote:
> Hi!
>
> I want to decrease the value of each point to 4 decimal places only from the plot, but I dont know how to do it. This is what i've done.Thanks for helping!
>
>
>
> clear
>
> figure
>
>
>
> x=3.6330;
>
> y1=0.9787;
>
> y2=0.9743;
>
> y3=0.9577;
>
> plot(x,y1,'.-','MarkerSize',15)
>
> hold all
>
> plot(x,y2,'*-','MarkerSize',10)
>
> plot(x,y3,'+-', 'MarkerSize',10)
>
>
>
> title('Comparison of power, n=7, outlier=10{\sigma},{\alpha}=0.15')
>
> hleg1 = legend('Lenth', 'Dong', 'Berk & Piacard',2);
>
> set(hleg1,'FontSize',7)
>
> set(hleg1,'FontAngle','italic')
>
> strValues = strtrim(cellstr(num2str([x(:) y1(:)],'(%f,%f)')));
>
> text(x,y1,strValues,'VerticalAlignment','bottom');
>
> strValues = strtrim(cellstr(num2str([x(:) y2(:)],'(%f,%f)')));
>
> text(x,y2,strValues,'VerticalAlignment','bottom');
>
> strValues = strtrim(cellstr(num2str([x(:) y3(:)],'(%f,%f)')));
>
> text(x,y3,strValues,'VerticalAlignment','bottom');
>
> xlabel('Contrasts')
>
> ylabel('Power')


sorry, should be:
this code rounds a number to 3dp:
a=rand(1)
a_rounded=round(a*1000)/1000
string=num2str(a_rounded)



Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.