cgBoxPlot not responding to xCharsize [message #85075] |
Tue, 02 July 2013 00:19  |
JP
Messages: 55 Registered: April 2008
|
Member |
|
|
Hi David et al,
It seems that cgBoxPlot is not responding to the xCharsize keyword. I tried the code below:
PS_Start, 'cgHistoplot.png'
!P.Multi=[0,3,1]
labels=['var1','var2','var3','var4']
cgdisplay, 1000, 300
cgBoxPlot, randomn(seed, 4, 1000), labels=labels
cgBoxPlot, randomn(seed, 4, 1000), labels=labels, xCharsize=0.5
cgBoxPlot, randomn(seed, 4, 1000), labels=labels, xCharsize=0.25
PS_End, resize=100, /png
the results looks like:
https://lh6.googleusercontent.com/-ppRoZheCmwk/UdJ-laUulrI/A AAAAAAAipg/LBKMp-QCcJE/w1358-h406-no/cgHistoplot.png
I've just updated the library to make sure I'm using the latest version.
IDL version: 8.2.0 on Windows
cheers
JP
|
|
|
Re: cgBoxPlot not responding to xCharsize [message #85078 is a reply to message #85075] |
Tue, 02 July 2013 06:21   |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
JP writes:
> It seems that cgBoxPlot is not responding to the xCharsize keyword. I
tried the code below:
>
> PS_Start, 'cgHistoplot.png'
> !P.Multi=[0,3,1]
> labels=['var1','var2','var3','var4']
> cgdisplay, 1000, 300
> cgBoxPlot, randomn(seed, 4, 1000), labels=labels
> cgBoxPlot, randomn(seed, 4, 1000), labels=labels, xCharsize=0.5
> cgBoxPlot, randomn(seed, 4, 1000), labels=labels, xCharsize=0.25
> PS_End, resize=100, /png
Yes, I was using the XCharsize value incorrectly in this program. You
can find an updated version here:
http://www.idlcoyote.com/programs/cgboxplot.pro
Unfortunately, this is not going to solve all your problems. :-)
The larger problem here is doing multiple plots with !P.Multi. This
method of doing multiple plots is great as long as you are willing to
surrender all control over plot position and character size and rely
completely on the !P.Multi algorithm to set these for you. But, if you
wish to control this aspect of your plots (as I do in cgBoxPlot), then
chaos is certain to ensue.
In this particular case, since I am putting plot labels on with XYOutS,
there will be a terrible mismatch between the size of the plot
annotation, which is under the influence of !P.Multi, and the plot
labels, which are not. Basically, you will never be able to get the two
sizes to match! (Or, if you do, immediately call me with the algorithm
you used!)
Download the updated program, then consider this code. Here is how you
are doing things now.
!P.Multi=[0,3,1]
labels=['var1','var2','var3','var4']
cgdisplay, 1000, 300, wid=1
cgBoxPlot, randomn(seed, 4, 1000), labels=labels
cgBoxPlot, randomn(seed, 4, 1000), labels=labels, xCharsize=0.75
cgBoxPlot, randomn(seed, 4, 1000), labels=labels, xCharsize=1.25
!P.multi=0
You can see the plot annotations are all over the map!
In this case, it will make a LOT more sense to use cgLayout to set up
your plot positions, which will allow you to control your plot
annotations exactly. There will be no interference from !P.Multi.
See how much more sense this way of drawing the plots makes.
positions = cgLayout([3,1], xGap=5, oxMargin=[5,5], $
oyMargin=[5,3])
labels=['var1','var2','var3','var4']
cgdisplay, 1000, 300
cgBoxPlot, randomn(seed, 4, 1000), labels=labels, $
Position=positions[*,0]
cgBoxPlot, randomn(seed, 4, 1000), labels=labels, $
Position=positions[*,1], /NoErase, XCharsize=0.75, $
Charsize=0.75
cgBoxPlot, randomn(seed, 4, 1000), labels=labels, $
Position=positions[*,2], /NoErase, XCharsize=1.25, $
Charsize=1.25
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: cgBoxPlot not responding to xCharsize [message #85090 is a reply to message #85078] |
Tue, 02 July 2013 18:26  |
JP
Messages: 55 Registered: April 2008
|
Member |
|
|
Thanks David, will try with the updated version.
RE !P.Multi, your explanation is useful as I have already noticed some funny things happening with fonts in some of your programs.
cheers
JP
On Tuesday, 2 July 2013 23:21:43 UTC+10, David Fanning wrote:
> JP writes:
>
>
>
>> It seems that cgBoxPlot is not responding to the xCharsize keyword. I
>
> tried the code below:
>
>>
>
>> PS_Start, 'cgHistoplot.png'
>
>> !P.Multi=[0,3,1]
>
>> labels=['var1','var2','var3','var4']
>
>> cgdisplay, 1000, 300
>
>> cgBoxPlot, randomn(seed, 4, 1000), labels=labels
>
>> cgBoxPlot, randomn(seed, 4, 1000), labels=labels, xCharsize=0.5
>
>> cgBoxPlot, randomn(seed, 4, 1000), labels=labels, xCharsize=0.25
>
>> PS_End, resize=100, /png
>
>
>
> Yes, I was using the XCharsize value incorrectly in this program. You
>
> can find an updated version here:
>
>
>
> http://www.idlcoyote.com/programs/cgboxplot.pro
>
>
>
> Unfortunately, this is not going to solve all your problems. :-)
>
>
>
> The larger problem here is doing multiple plots with !P.Multi. This
>
> method of doing multiple plots is great as long as you are willing to
>
> surrender all control over plot position and character size and rely
>
> completely on the !P.Multi algorithm to set these for you. But, if you
>
> wish to control this aspect of your plots (as I do in cgBoxPlot), then
>
> chaos is certain to ensue.
>
>
>
> In this particular case, since I am putting plot labels on with XYOutS,
>
> there will be a terrible mismatch between the size of the plot
>
> annotation, which is under the influence of !P.Multi, and the plot
>
> labels, which are not. Basically, you will never be able to get the two
>
> sizes to match! (Or, if you do, immediately call me with the algorithm
>
> you used!)
>
>
>
> Download the updated program, then consider this code. Here is how you
>
> are doing things now.
>
>
>
> !P.Multi=[0,3,1]
>
> labels=['var1','var2','var3','var4']
>
> cgdisplay, 1000, 300, wid=1
>
> cgBoxPlot, randomn(seed, 4, 1000), labels=labels
>
> cgBoxPlot, randomn(seed, 4, 1000), labels=labels, xCharsize=0.75
>
> cgBoxPlot, randomn(seed, 4, 1000), labels=labels, xCharsize=1.25
>
> !P.multi=0
>
>
>
> You can see the plot annotations are all over the map!
>
>
>
> In this case, it will make a LOT more sense to use cgLayout to set up
>
> your plot positions, which will allow you to control your plot
>
> annotations exactly. There will be no interference from !P.Multi.
>
>
>
> See how much more sense this way of drawing the plots makes.
>
>
>
> positions = cgLayout([3,1], xGap=5, oxMargin=[5,5], $
>
> oyMargin=[5,3])
>
> labels=['var1','var2','var3','var4']
>
> cgdisplay, 1000, 300
>
> cgBoxPlot, randomn(seed, 4, 1000), labels=labels, $
>
> Position=positions[*,0]
>
> cgBoxPlot, randomn(seed, 4, 1000), labels=labels, $
>
> Position=positions[*,1], /NoErase, XCharsize=0.75, $
>
> Charsize=0.75
>
> cgBoxPlot, randomn(seed, 4, 1000), labels=labels, $
>
> Position=positions[*,2], /NoErase, XCharsize=1.25, $
>
> Charsize=1.25
>
>
>
>
>
> 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.")
|
|
|