On Friday, November 23, 2012 11:29:42 AM UTC+1, simona bellavista wrote:
> I am trying to save a plot to eps, I use the keyword output in cgplot, but this doesn't work with overplot, because it only write to eps the portion of the plot that is being drawn. example:
>
>
>
> window,0
>
> cgerase
>
> cgplot, x, y, output='out.eps'
>
> cgplot, x, t, /overplot
>
>
>
> and moreover the part that is being printed to eps is not shown in window 0.
>
> I know I can use ps_start and ps_end, but I would like to know if there is a way that allows me to visualize the plot on x window and to print to eps at the same time.
>
>
>
> Thanx
Hi,
I was trying just this morning also to get this sorted.
I managed to do it this way:
window,0
PS_Start, FILENAME='PlotExport.eps'
cgerase
cgplot, x, y
cgplot, x, t, /overplot
PS_END
This works fine at first and I think it is the simplest thing you can try.
I then started fiddling with the PS_Start and PS_End commands and got fancy by looking at how David does it.
Well, I added slightly more complicated start and end commands (from cgPlot):
ps_filename = 'PlotExport.eps'
cgWindow_GetDefs, $
PS_Charsize = ps_charsize, $ ; The PostScript character size.
PS_FONT = ps_font, $ ; Select the font for PostScript output.
PS_Decomposed = ps_decomposed, $ ; Sets the PostScript color mode.
PS_Delete = ps_delete, $ ; Delete PS file when making IM raster.
PS_Metric = ps_metric, $ ; Select metric measurements in PostScript output.
PS_Scale_factor = ps_scale_factor, $ ; Select the scale factor for PostScript output.
PS_TT_Font = ps_tt_font ; Select the true-type font to use for PostScript output.
;Set up the PostScript device.
PS_Start, $
CHARSIZE=ps_charsize, $
DECOMPOSED=ps_decomposed, $
FILENAME=ps_filename, $
FONT=ps_font , $
ENCAPSULATED=encapsulated, $
METRIC=ps_metric, $
SCALE_FACTOR=ps_scale_factor, $
TT_FONT=ps_tt_font, $
QUIET=1
[... do the plotting here...]
cgWindow_GetDefs, $
IM_Density = im_density, $ ; Sets the density parameter on ImageMagick convert command.
IM_Options = im_options, $ ; Sets extra ImageMagick options on the ImageMagick convert command.
IM_Resize = im_resize, $ ; Sets the resize parameter on ImageMagick convert command.
IM_Transparent = im_transparent, $ ; Sets the "alpha" keyword on ImageMagick convert command.
IM_Width = im_width, $ ; Sets the width of raster file output created with ImageMagick.
PDF_Unix_Convert_Cmd = pdf_unix_convert_cmd, $ ; Command to convert PS to PDF.
PDF_Path = pdf_path ; The path to the Ghostscript conversion command.
; Close the PostScript file and create whatever output is needed.
PS_END, ALLOW_TRANSPARENT=im_transparent, $
DENSITY=im_density, $
GS_PATH=pdf_path, $
IM_OPTIONS=im_options, $
RESIZE=im_resize, $
UNIX_CONVERT_CMD=pdf_unix_convert_cmd, $
WIDTH=im_width
However, after this command, when I try to plot again on a normal window, I get strange fonts (thicker)... Still have to figure out this one.
The above is not fully tested, but did the job for me pretty well!
Cheers,
Helder
|