comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » formatting y-axis when plotting relative frequency using cgHistoplot
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
formatting y-axis when plotting relative frequency using cgHistoplot [message #91230] Thu, 18 June 2015 13:23 Go to next message
Steve Super is currently offline  Steve Super
Messages: 13
Registered: August 2014
Junior Member
I'm trying to determine if there is a simple way to control the y-axis labels when using the relative frequency keyword with cgHistoplot.

I know IDL format codes can be used with the ytickformat keyword, however what I am hoping to do is display the relative frequency as a percentage instead of in decimal form. (e.g. 1.5% versus 0.015)

The simplest option would be a keyword to set the y axis to be in %, however it doesn't appear that's possible. Does anyone know if there a way to output the label values used to an array? That way they can be converted to a percentage and then be explicitly set using the yticknames keyword?


-Steve
Re: formatting y-axis when plotting relative frequency using cgHistoplot [message #91231 is a reply to message #91230] Thu, 18 June 2015 13:42 Go to previous messageGo to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Steve Super writes:

> I'm trying to determine if there is a simple way to control the y-axis labels when using the relative frequency keyword with cgHistoplot.
>
> I know IDL format codes can be used with the ytickformat keyword, however what I am hoping to do is display the relative frequency as a percentage instead of in decimal form. (e.g. 1.5% versus 0.015)
>
> The simplest option would be a keyword to set the y axis to be in %, however it doesn't appear that's possible. Does anyone know if there a way to output the label values used to an array? That way they can be converted to a percentage and then be explicitly set using the yticknames keyword?

Have you tried the usual method of setting the YTickFormat keyword to
the name of a function you write to format the axis is any way you see
fit?

See the documentation for the [XYZ]Tickformat graphics keyword for
examples.

Cheers,

David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thue. ("Perhaps thou speakest truth.")
Re: formatting y-axis when plotting relative frequency using cgHistoplot [message #91232 is a reply to message #91230] Thu, 18 June 2015 13:53 Go to previous messageGo to next message
Yngvar Larsen is currently offline  Yngvar Larsen
Messages: 134
Registered: January 2010
Senior Member
On Thursday, 18 June 2015 22:23:05 UTC+2, Steve Super wrote:
> I'm trying to determine if there is a simple way to control the y-axis labels when using the relative frequency keyword with cgHistoplot.
>
> I know IDL format codes can be used with the ytickformat keyword, however what I am hoping to do is display the relative frequency as a percentage instead of in decimal form. (e.g. 1.5% versus 0.015)
>
> The simplest option would be a keyword to set the y axis to be in %, however it doesn't appear that's possible.

You can do that with YTICKFORMAT.

plot, dindgen(100), ytickformat='(I0, "%")'

(or something very similar with cgHistoPlot, since I assume it supports the same keywords as PLOT.)

Does anyone know if there a way to output the label values used to an array? That way they can be converted to a percentage and then be explicitly set using the yticknames keyword?

plot, dindgen(100), ytick_get=yvalues

But you don't need to do that, see above.

--
Yngvar
Re: formatting y-axis when plotting relative frequency using cgHistoplot [message #91236 is a reply to message #91230] Fri, 19 June 2015 06:22 Go to previous message
Steve Super is currently offline  Steve Super
Messages: 13
Registered: August 2014
Junior Member
Great, thanks for the tips on using format functions.

-Steve
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: cgWindow - what am I doing wrong that makes winID change values?
Next Topic: size(/dimen) that automatically fills in extra dimensions

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 09:22:38 PDT 2025

Total time taken to generate the page: 0.00500 seconds