Prev: Remove elements from sparse matrix
Next: bvp5c question
From: sscnekro on 5 Jun 2010 09:38 Hey guys, I hope for one of you this is a simple task. I need to adjust the line plot so that the first observation is not plotted at zero, but at one (2nd tick on x axis). Also, the last observation should correspond with the 2nd last tick on the x axis. Visually the result should be a line plot surrounded by some blank space. It's a fashion matter, but it is required from me. I need to combine it with adjusting the limit to x axis, for this I know the command axis([xmin,xmax,ymin,ymax]). Thanks for hints.
From: dpb on 5 Jun 2010 10:47 sscnekro wrote: > Hey guys, > > I hope for one of you this is a simple task. I need to adjust the line > plot so that the first observation is not plotted at zero, but at one > (2nd tick on x axis). Also, the last observation should correspond with > the 2nd last tick on the x axis. Visually the result should be a line > plot surrounded by some blank space. It's a fashion matter, but it is > required from me. > I need to combine it with adjusting the limit to x axis, for this I know > the command axis([xmin,xmax,ymin,ymax]). There may be some more clever way but it doesn't come to me at the moment. As you say, set the axis limits to place the axis position as desired. To adjust the labels, get() the tick values, convert to character array and then clear the first and last entries and set() them back. --
From: sscnekro on 5 Jun 2010 13:28 Hi, dpb, appreciate your help a lot, thanks. After experimenting .. there is a funny way of doing it. Small hint for guys with the same problem: % x .. < n x 1 double> plot([Nan; x; Nan], properties) axis([ 0, (n + 2), ...]) I have another question to which I'm not able of finding the answer, bcs have no idea on the right vocabulary. In Excel it is called kinda Value (Y) axis scale / Category (X) crosses at: 0. I mean I need to display a "zero line" in the plot. Any ideas out there? Thanks!
From: dpb on 5 Jun 2010 13:43 sscnekro wrote: > Hi, dpb, appreciate your help a lot, thanks. After experimenting .. > there is a funny way of doing it. Small hint for guys with the same > problem: > > % x .. < n x 1 double> > plot([Nan; x; Nan], properties) > axis([ 0, (n + 2), ...]) Yeah, I knew plot() ignored NaN's which will give the extra point; thought your intention was for the end tick label to be totally blank. > I have another question to which I'm not able of finding the answer, bcs > have no idea on the right vocabulary. In Excel it is called kinda Value > (Y) axis scale / Category (X) crosses at: 0. > > I mean I need to display a "zero line" in the plot. Any ideas out there? Do a set(gca,'xaxislocation') And see what you get. My (somewhat dated) version only allows [top|bottom]; perhaps later versions would let you place axes at other locations. BTW, set(gca) will show a list of all properties of the axes object and there is, of course, descriptions/examples in the online doc's that hopefully are installed locally or you can install from the distribution CD if not. Failing in putting the x- or y- axis somewhere other than the default or allowable choices, doc line will let you add a reference line wherever you wish... --
From: us on 5 Jun 2010 13:48
"sscnekro " <stiahni.mail(a)zoznam.sk> wrote in message <hue1f3$921$1(a)fred.mathworks.com>... > Hi, dpb, appreciate your help a lot, thanks. After experimenting .. there is a funny way of doing it. Small hint for guys with the same problem: > > % x .. < n x 1 double> > plot([Nan; x; Nan], properties) > axis([ 0, (n + 2), ...]) > > I have another question to which I'm not able of finding the answer, bcs have no idea on the right vocabulary. In Excel it is called kinda Value (Y) axis scale / Category (X) crosses at: 0. > > I mean I need to display a "zero line" in the plot. Any ideas out there? Thanks! one of the many solutions x=-3:4; line(x,rand(size(x))); zp=0; line([zp,zp],get(gca,'ylim'),'color',[0,0,0]); us |