Re: multi scatter plots, layout issues [message #90787 is a reply to message #90784] |
Wed, 15 April 2015 12:50   |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
Matteo writes:
> I'm interested in using CGSCATTER2D to produce multiple plots (3x2) in a single page. Not limited to CGSCATTER2D, I still find it difficult to control the positioning of multi plots and the size of their titles, specifically when I want to save to ps. For example the following instructions do not lead to the desired effect. Here I'm replotting the same plot 6 times, but the plots don't have an Aspect Ratio of 1, which I believe is mentioned in the documentation for
CGSCATTER2D, adn the resulting xgap is way too big:
>
>
> ----------------
> data_1 = cgDemoData(1)+ RandomU(seed, 101) * 10
> data_2 = cgDemoData(1)+ RandomU(seed, 101) * 20 + 50
>
> cgWindow, WXSize=900, WYSize=1200
> positions = cgLayout([2,3], OXMargin=[0,0], OYMargin=[2,2], XGap=0, YGap=2, Aspect=1.0)
>
> FOR j=0,5 DO BEGIN
> p=positions[*,j]
> cgScatter2D, data_1, data_2, position=p, XTitle='Study Time (minutes)', NoErase=j NE 0, charsize=0.5, PSym=16, FThick=2, /Add
> ENDFOR
> -----------------
>
> I know the CG routines are built to be device independent, so can anybody tell me what's the most straightforward way to obtain something as nice as the ?
> Should I give up CGLAYOUT and simply resort to P.MULTI? I would like the final result to look evenly distributed, say as in: http://www.idlcoyote.com/gallery/small_multiple_contour_plot .png or http://www.idlcoyote.com/gallery/histogram_plot.png.
For some reason I don't understand, when you try to put the scatter
plots into a resizeable window, the window sizes are not being reported
correctly. I'll have to look into this. But, I wouldn't be doing this in
a resizeable window, I don't think. I would try to do this in a regular
window like this:
Pro ScatterExample
data_1 = cgDemoData(1)+ RandomU(seed, 101) * 10
data_2 = cgDemoData(1)+ RandomU(seed, 101) * 20 + 50
cgDisplay, 900, 1200
positions = cgLayout([2,3], OXMargin=[0,0], OYMargin=[2,2], $
XGap=0, YGap=2, Aspect=1.0)
FOR j=0,5 DO BEGIN
p=positions[*,j]
cgScatter2D, data_1, data_2, position=p, $
XTitle='Study Time (minutes)', NoErase=j NE 0, $
charsize=0.5, PSym=16, FThick=2
ENDFOR
END
Then, if I wanted to display this in PostScript, I would do something
like this:
cgPS_Open, 'scatterexample.ps'
ScatterExample
cgPS_Close, /PNG
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.")
|
|
|