help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: revised: How to set xtics in 2-D plot in Octave 3.0.0 on a PC with W


From: Mr. E
Subject: Re: revised: How to set xtics in 2-D plot in Octave 3.0.0 on a PC with Windows Vista
Date: Mon, 10 Mar 2008 23:07:15 -0700 (PDT)

thanks to everyone who replied....I now have it
working again.

here are two sample programs that show the two methods
suggested in the thread.

To get the xtics spaced on a your display, run the
program once, the open the graphic window in
'maximize' format, and then run the program again.  If
you have a pc with the new screen proportions, the
tics should be readable.  If you have an old screen
(non widescreen display) then a few labels might be
touching each other.

There may be a more eloquent way of doing this, but
the labels should just barely fit if the drawing is
made with a large window and a new-size screen.

Does anyone know how do reduce the font size on the
x-tic labels (and for that matter the same on the
y-axis?)  this would resolve many issues.

thanks,
Lalu
-------------------






xmin=0.0; 
xmax=2*pi; 
ymin=-1; 
ymax=1; 
deltax=(xmax-xmin)/200; 
axis([xmin  xmax  ymin  ymax]); 
x=xmin: deltax: xmax; 
y=sin(x); 
plot(x,y) 
ax=gca() ;
set (ax, "xtick", [0, pi/6, pi/4, pi/3, pi/2, pi,
3*pi/2, 2*pi]) 
set (ax, "xticklabelmode", "Manual") 
set (ax, "xticklabel", ["0"; "Pi/6"; "Pi/4";  "Pi/3";
"Pi/2";"Pi";"3Pi/2";"2Pi"]) 

a(1:5)=sqrt(0:4)/2;

set (ax, "ytick",[-a(5:-1:1), a(2:5)])
set (ax, "yticklabelmode", "Manual") 
set (ax, "yticklabel", ["-1"; "-sqrt(3)/2";
"-sqrt(2)/2";  "-1/2"; "0"; "1/2";  "sqrt(2)/2"; 
"sqrt(3)/2"; "1"]) 
 
grid on







-------------

and 

----------------

## plots sin and cos with all special values labelled

xmin=0;
xmax=2*pi;


x = linspace (xmin, xmax, 201);
y = sin (x);


ymin=min(y);
ymax=max(y);

axis ([xmin xmax ymin ymax]);
plot (x, y,x,cos(x))

xtick=[0 1/6 1/4  1/3 1/2  2/3 3/4 5/6 1 7/6 5/4 4/3
3/2 5/3 7/4 11/6 2];

a(1:5)= sqrt(0:4)/2;
ytick= [-a(5:-1:1), a(2:5)];

set (gca, 'xtick', xtick*pi, 'xticklabel', char(['0'
;'pi/6' ;'pi/4'; 'pi/3'; 'pi/2'; '2pi/3'; '3pi/4'
;'5pi/6'; 'pi';  '7pi/6'; '5pi/4'; '4pi/3'; '3pi/2';
'5pi/3'; '7pi/4'; '11pi/6'; '2pi']),'ytick', ytick,
'yticklabel', char(['-1'; '-sqrt(3)/2'; '-sqrt(2)/2'; 
'-1/2'; '0'; '1/2';  'sqrt(2)/2';  'sqrt(3)/2'; '1']) 
)

grid on


,¸¸,ø¤º°`°º¤ø,¸¸,ø¤º°`°º¤ø,¸¸,ø¤º°`°º¤ø

Please reply to address@hidden

google has good spam filtering!


      
____________________________________________________________________________________
Looking for last minute shopping deals?  
Find them fast with Yahoo! Search.  
http://tools.search.yahoo.com/newsearch/category.php?category=shopping


reply via email to

[Prev in Thread] Current Thread [Next in Thread]