[gradsusr] Display only 1 decimal of a real number

Jeff Duda jeffduda319 at gmail.com
Wed Apr 15 21:33:45 EDT 2015

Use the math script functions (
http://www.iges.org/grads/gadoc/mathfunctions.html), in particular,
math_format(). Use a C-language style format statement. For your case,
something like '%3.1f' or '%4.2f' (make sure to include the quotes) would
give you what you want.

Jeff Duda

On Wed, Apr 15, 2015 at 7:14 PM, Thomas Robinson <ter at hawaii.edu> wrote:

> Aloha GrADS Users,
> I am displaying my maximum values on a plot where they occur.  The values
> are all real numbers, so they are like 6.92051, 12.048, etc.  They seem to
> be 7 characters long at the most. My script code looks like this:
> 'set string 1 t1 8.5'
> 'draw string 'xx' 'yy' 'val
> where xx and yy are the coordinates where I want to plot and val is the
> value that I'm plotting.
> What I want to do is have grads plot 6.9 or 12.0 instead of 6.92051 or
> 12.048.  Is there a way to specify how many characters of a string I
> display, or restrict my values to display only one digit after the decimal
> point?  I would settle for 6.92 if I had to display 4 characters.
> Thanks for the help,
> Tom
> --
> Tom Robinson
> Treasurer - Graduate Student Organization
> Secretary - Student Athletic Fee Committee
> Graduate Student - Department of Atmospheric Science
> _______________________________________________
> gradsusr mailing list
> gradsusr at gradsusr.org
> http://gradsusr.org/mailman/listinfo/gradsusr

Jeff Duda
Graduate research assistant
University of Oklahoma School of Meteorology
Center for Analysis and Prediction of Storms
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://gradsusr.org/pipermail/gradsusr/attachments/20150415/309bdb26/attachment.html 

More information about the gradsusr mailing list