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

Home » Public Forums » archive » Re: cgplot and eps
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
Re: cgplot and eps [message #82276] Sat, 24 November 2012 08:30
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
simona bellavista writes:

> I found that this method doesn't work in combination with
> textoidl. If there are some symbols written with texttoidl
> they will not rendered correctly if saving the eps with
> the 'output' keyword. For example, try textoidl('\tau') and
> textoidl('\times')

I have added the symbols "times" (for multiplication)
and "div" (for division) to cgSymbol today.

But, I have also gone further than that and made it
possible to use TexToIDL codes directly from Coyote
Graphics routines by embedding them in graphics text.

Please see the post "Using TexToIDL with Coyote Graphics
Routines" that follows. An updated Coyote Library will be
required.

Cheers,

David



--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thue. ("Perhaps thou speakest truth.")
Re: cgplot and eps [message #82279 is a reply to message #82276] Fri, 23 November 2012 14:18 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
simona bellavista writes:

>
> for example, try textoidl('\tau') and textoidl('\times')

Just going for a post-Thanksgiving hike now. But, you
may want to read this article:

http://www.idlcoyote.com/cg_tips/kwexpressions.php

I don't have much control over TexToIDL, and I don't
know what the \times thing does, but most of the
things you want to do in TexToIDL can be done in
cgSymbol, which I DO have control over. If something
is not there, let me know. :-)

Greek and other symbols can be embedded directly into
the text:

http://www.idlcoyote.com/cg_tips/embedsymbols.php

Cheers,

David


--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thue. ("Perhaps thou speakest truth.")
Re: cgplot and eps [message #82283 is a reply to message #82279] Fri, 23 November 2012 06:49 Go to previous message
simona bellavista is currently offline  simona bellavista
Messages: 56
Registered: December 2009
Member
for example, try textoidl('\tau') and textoidl('\times')

On Friday, November 23, 2012 2:47:41 PM UTC, simona bellavista wrote:
> I found that this method doesn't work in combination with textoidl. If there are some symbols written with texttoidl they will not rendered correctly if saving the eps with the 'output' keyword.
>
>
>
> On Friday, November 23, 2012 2:32:54 PM UTC, David Fanning wrote:
>
>> simona bellavista writes:
>
>>
>
>>
>
>>
>
>>> that works, thank you. but of course I also want to add a legend I created with al_legend. how do I do that?
>
>>
>
>>
>
>>
>
>> cgplot, x, y, /window
>
>>
>
>> cgplot, x, t, /overplot, /addcmd
>
>>
>
>> al_legend, ..., /window
>
>>
>
>> cgcontrol, output='out.eps'
>
>>
>
>>
>
>>
>
>> Cheers,
>
>>
>
>>
>
>>
>
>> David
>
>>
>
>> --
>
>>
>
>> David Fanning, Ph.D.
>
>>
>
>> Fanning Software Consulting, Inc.
>
>>
>
>> Coyote's Guide to IDL Programming: http://www.dfanning.com/
>
>>
>
>> Sepore ma de ni thue. ("Perhaps thou speakest truth.")
Re: cgplot and eps [message #82284 is a reply to message #82283] Fri, 23 November 2012 06:47 Go to previous message
simona bellavista is currently offline  simona bellavista
Messages: 56
Registered: December 2009
Member
I found that this method doesn't work in combination with textoidl. If there are some symbols written with texttoidl they will not rendered correctly if saving the eps with the 'output' keyword.

On Friday, November 23, 2012 2:32:54 PM UTC, David Fanning wrote:
> simona bellavista writes:
>
>
>
>> that works, thank you. but of course I also want to add a legend I created with al_legend. how do I do that?
>
>
>
> cgplot, x, y, /window
>
> cgplot, x, t, /overplot, /addcmd
>
> al_legend, ..., /window
>
> cgcontrol, output='out.eps'
>
>
>
> Cheers,
>
>
>
> David
>
> --
>
> David Fanning, Ph.D.
>
> Fanning Software Consulting, Inc.
>
> Coyote's Guide to IDL Programming: http://www.dfanning.com/
>
> Sepore ma de ni thue. ("Perhaps thou speakest truth.")
Re: cgplot and eps [message #82285 is a reply to message #82284] Fri, 23 November 2012 06:32 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
simona bellavista writes:

> that works, thank you. but of course I also want to add a legend I created with al_legend. how do I do that?

cgplot, x, y, /window
cgplot, x, t, /overplot, /addcmd
al_legend, ..., /window
cgcontrol, output='out.eps'

Cheers,

David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thue. ("Perhaps thou speakest truth.")
Re: cgplot and eps [message #82286 is a reply to message #82285] Fri, 23 November 2012 06:17 Go to previous message
simona bellavista is currently offline  simona bellavista
Messages: 56
Registered: December 2009
Member
that works, thank you. but of course I also want to add a legend I created with al_legend. how do I do that?

> I would do it this way:
>
>
>
> cgplot, x, y, /window
>
> cgplot, x, t, /overplot, /addcmd
>
> cgcontrol, output='out.eps'
>
>
>
> Cheers,
>
>
>
> David
>
>
>
>
>
> --
>
> David Fanning, Ph.D.
>
> Fanning Software Consulting, Inc.
>
> Coyote's Guide to IDL Programming: http://www.dfanning.com/
>
> Sepore ma de ni thue. ("Perhaps thou speakest truth.")
Re: cgplot and eps [message #82288 is a reply to message #82286] Fri, 23 November 2012 05:48 Go to previous message
Helder Marchetto is currently offline  Helder Marchetto
Messages: 520
Registered: November 2011
Senior Member
On Friday, November 23, 2012 2:40:29 PM UTC+1, David Fanning wrote:
> simona bellavista writes:
>
>
>
>> 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.
>
>
>
> I would do it this way:
>
>
>
> cgplot, x, y, /window
>
> cgplot, x, t, /overplot, /addcmd
>
> cgcontrol, output='out.eps'
>
>
>
> Cheers,
>
>
>
> David
>
>
>
>
>
> --
>
> David Fanning, Ph.D.
>
> Fanning Software Consulting, Inc.
>
> Coyote's Guide to IDL Programming: http://www.dfanning.com/
>
> Sepore ma de ni thue. ("Perhaps thou speakest truth.")

I knew there was an easier way...

Oh well, gotta through away a few lines of code.

Thanks,
Helder
Re: cgplot and eps [message #82289 is a reply to message #82288] Fri, 23 November 2012 05:40 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
simona bellavista writes:

> 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.

I would do it this way:

cgplot, x, y, /window
cgplot, x, t, /overplot, /addcmd
cgcontrol, output='out.eps'

Cheers,

David


--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thue. ("Perhaps thou speakest truth.")
Re: cgplot and eps [message #82292 is a reply to message #82289] Fri, 23 November 2012 05:13 Go to previous message
Helder Marchetto is currently offline  Helder Marchetto
Messages: 520
Registered: November 2011
Senior Member
On Friday, November 23, 2012 12:01:43 PM UTC+1, Helder wrote:
> 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

Well, I have to say that if your final output is going to be a PS, then you don't need all the IM_* commands. You may actually only use:

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 , $
METRIC=ps_metric, $
SCALE_FACTOR=ps_scale_factor, $
TT_FONT=ps_tt_font, $
QUIET=1

cgPlot, cgDemoData(1)
cgPlot, findgen(101)*30.0/100.0, /overplot
;do all the overplotting before the ps_end command

PS_END

Regarding my problem with the fonts... Well, that was just a big error of mine.. I was saving the !P variable for other purposes and re-plotting set the PS conditions.

Cheers,
Helder
Re: cgplot and eps [message #82294 is a reply to message #82292] Fri, 23 November 2012 03:01 Go to previous message
Helder Marchetto is currently offline  Helder Marchetto
Messages: 520
Registered: November 2011
Senior Member
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
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: extract raster statistics from vector
Next Topic: Using TexToIDL in Coyote Graphics Routines

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

Current Time: Wed Oct 08 15:06:03 PDT 2025

Total time taken to generate the page: 0.00710 seconds