[Top][All Lists]

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

Re: Plot Number Formats

From: Ben Abbott
Subject: Re: Plot Number Formats
Date: Wed, 07 Sep 2011 09:29:43 -0400

On Sep 6, 2011, at 11:37 PM, Jason C. Wells wrote:

> How does one set the number format of numbers on a plot axis?  I'd like my 
> number to keep a constant number of significant digits.
> Thanks,
> Jason

You can get the result you desire by modifying the ticklabels.

For example ...

plot ([0,1], [0,1])
xtick = get (gca, "xtick");
xticklabel = strsplit (sprintf ("%.3f\n", xtick), "\n", true);
set (gca, "xticklabel", xticklabel)
ytick = get (gca, "ytick");
yticklabel = strsplit (sprintf ("%.3f\n", ytick), "\n", true);
set (gca, "yticklabel", yticklabel)


reply via email to

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