# [pstricks] pstricks and mathematica output

Jon Joseph josco.jon at gmail.com
Sat Dec 5 05:24:33 CET 2009

Michael: Thanks for your response. What I try to incorporate into PSTricks / LateX are 3D images that, sometimes, are more easily rendered in Mathematica. My experience with saving these in EPS are that they don't look nearly as good as when I save the image as a PDF.  Some of the Mathematica examples under the Help topic "PieChart3D" show some images that are easy in Mathematica but hard in under any PSTricks package - even pst-solide3d. Any further thoughts?  Jon

On Dec 4, 2009, at 5:00 AM, pstricks-request at tug.org wrote:

> Send PSTricks mailing list submissions to
> 	pstricks at tug.org
>
> To subscribe or unsubscribe via the World Wide Web, visit
> 	http://tug.org/mailman/listinfo/pstricks
> or, via email, send a message with subject or body 'help' to
> 	pstricks-request at tug.org
>
> You can reach the person managing the list at
> 	pstricks-owner at tug.org
>
> than "Re: Contents of PSTricks digest..."
>
>
> Today's Topics:
>
>   1. Custom plotting of data (custom coloring of select	points in
>      a data set) (Jorge Nto)
>   2. Re: Custom plotting of data (custom coloring of select points
>      in a data set) (Herbert Voss)
>   3. pstricks and mathematica output (Jon Joseph)
>   4. Re: pstricks and mathematica output (Michael Sharpe)
>   5. include eps code within pstricks commands (mathias legrand)
>   6. Re: include eps code within pstricks commands (Herbert Voss)
>
>
> ----------------------------------------------------------------------
>
> Message: 1
> Date: Thu, 3 Dec 2009 14:43:45 +0100
> From: Jorge Nto <jorgento at gmail.com>
> To: pstricks at tug.org
> Subject: [pstricks] Custom plotting of data (custom coloring of select
> 	points in a data set)
> Message-ID:
> 	<55f7e68f0912030543q726df6c0oaab3c308c11bc2d8 at mail.gmail.com>
> Content-Type: text/plain; charset="iso-8859-1"
>
> Hi there!
>
> After a long search on Internet I decided to post my question here (I'm a
> newbie in this posting-list).
> I have a set of 2D data (DAT-file) which I would like to plot and color
> according to their Y value. Until now I can only plot all points with
> listplot having all the same color (ex: \listplot[plotstyle= dots
> linecolor=red]). But for my purpose I would have to use a \forloop or
> \multido command to read every single point in the data set and plot it by
> chosing a color according to its Y-coordinate value, for example using the
> \hsv command. The question is: How can I access the elements of data as
> single points? Is there a syntax like: \data[20][1] or \data(20) (or for
> those who know MATLAB:  data(20,:) -colon syntax to access the coordinates).
>
> I  did not find any similar on Internet. Maybe I must re-define the listplot
> command but I could do this only if I had the source code of the original
> command or something like that.
>
> Any ideas? I would really appreciate it.
>
>
> Regards,
>
>
> Jorge
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: <http://tug.org/pipermail/pstricks/attachments/20091203/cb9eeeaf/attachment-0001.html>
>
> ------------------------------
>
> Message: 2
> Date: Thu, 03 Dec 2009 16:36:46 +0100
> From: Herbert Voss <Herbert.Voss at FU-Berlin.DE>
> To: pstricks at tug.org
> Subject: Re: [pstricks] Custom plotting of data (custom coloring of
> 	select points in a data set)
> Message-ID: <4B17DB0E.80909 at FU-Berlin.DE>
> Content-Type: text/plain; charset=ISO-8859-1
>
> Am 03.12.2009 14:43, schrieb Jorge Nto:
>
>> I have a set of 2D data (DAT-file) which I would like to plot and color
>> according to their Y value. Until now I can only plot all points with
>> listplot having all the same color (ex: \listplot[plotstyle= dots
>> linecolor=red]). But for my purpose I would have to use a \forloop or
>> \multido command to read every single point in the data set and plot it by
>> chosing a color according to its Y-coordinate value, for example using the
>> \hsv command. The question is: How can I access the elements of data as
>> single points? Is there a syntax like: \data[20][1] or \data(20) (or for
>> those who know MATLAB:  data(20,:) -colon syntax to access the coordinates).
>>
>> I  did not find any similar on Internet. Maybe I must re-define the listplot
>> command but I could do this only if I had the source code of the original
>> command or something like that.
>
> \documentclass{minimal}
> \begin{filecontents*}{demo.data}
>    0.1414    0.0052
>    0.2828    0.0217
>    0.4243    0.0480
>    0.5657    0.0890
>    0.7071    0.1375
>    0.8485    0.1906
>    0.9899    0.2663
>    1.1314    0.3580
>    1.2728    0.4644
>    1.4142    0.5801
>    1.5556    0.7033
>    1.6971    0.8899
>    1.8385    1.1143
>    1.9799    1.2593
>    2.1213    1.5692
>    2.2627    3.2331
>    2.4042    4.4097
>    2.5456    5.8186
>    2.6870    7.4441
>    2.8284    8.2287
> \end{filecontents*}
>
> \makeatletter
> \def\psdots at iii{%
>  \psk at dotsize
>  \@nameuse{psds@\psk at dotstyle}
>  newpath
>  n { dup   % y y
>      \pst at number\psyunit div % to orig y value
>      180 exch dup sethsbcolor % 180 Y Y hsb color
>      transform floor .5 add exch floor
>      .5 add exch itransform Dot stroke} repeat }
> \makeatother
> \begin{document}
>
> \psset{xunit=3}
> \begin{pspicture}(0,0)(3,10)
>  \psaxes{->}(0,0)(3,10)
>  \listplot[plotstyle=dots]{\data}
> \end{pspicture}
>
> \end{document}
>
> the only important lines are
>      \pst at number\psyunit div % to orig y value
>      180 exch dup sethsbcolor % 180 Y Y hsb color
>
> Herbert
>
>
> ------------------------------
>
> Message: 3
> Date: Thu, 3 Dec 2009 20:01:07 -0600
> From: Jon Joseph <josco.jon at gmail.com>
> To: pstricks at tug.org
> Subject: [pstricks] pstricks and mathematica output
> Message-ID: <329CC594-43F3-4217-86A0-7575A2431EDE at gmail.com>
> Content-Type: text/plain; charset=us-ascii
>
> I am looking for a simple way to occasionally incorporate graphical output from Mathematica with LateX graphics using PSTricks. I can save the Mathematica graphical output as an EPS file but I lose resolution so I would rather save the pictures as a PDF which makes it very difficult to use PSTricks. While I have made this work the process seems very cumbersome.
>
> I would like the whole process to be as simple as using plain old PSTricks. Anyone have an outline of algorithm that can simplify the process?  Thanks, Jon.
>
> ------------------------------
>
> Message: 4
> Date: Thu, 3 Dec 2009 18:19:32 -0800
> From: Michael Sharpe <mchl.sharpe at gmail.com>
> To: Graphics with PSTricks <pstricks at tug.org>
> Cc: Michael Sharpe <mchl.sharpe at gmail.com>
> Subject: Re: [pstricks] pstricks and mathematica output
> Message-ID: <D02812EE-0CB2-4379-BDAE-1499AE4DBC59 at gmail.com>
> Content-Type: text/plain; charset=us-ascii
>
>
> On Dec 3, 2009, at 6:01 PM, Jon Joseph wrote:
>
>> I am looking for a simple way to occasionally incorporate graphical output from Mathematica with LateX graphics using PSTricks. I can save the Mathematica graphical output as an EPS file but I lose resolution so I would rather save the pictures as a PDF which makes it very difficult to use PSTricks. While I have made this work the process seems very cumbersome.
>>
>> I would like the whole process to be as simple as using plain old PSTricks. Anyone have an outline of algorithm that can simplify the process?  Thanks, Jon.
>
> Saving the Mathematica output as eps should not lose resolution---it involves no rasterization of the image. You have to decide whether you want to (a) use Mathematica fonts for the labels; (b) use placeholders for the labels and replace them while importing the eps using Mathpsfrag; (c) add all labels in pstricks. The other option with Mathematica is to use the raw data from the Graphics[] output in the form of coordinate lists which you render with listplot. This is easy to automate.
>
> Michael
>
>
>
> ------------------------------
>
> Message: 5
> Date: Thu, 03 Dec 2009 23:02:24 -0500
> From: mathias legrand <legrand.mathias at gmail.com>
> To: pstricks at tug.org
> Subject: [pstricks] include eps code within pstricks commands
> Message-ID: <4B1889D0.1070806 at gmail.com>
> Content-Type: text/plain; charset=ISO-8859-1; format=flowed
>
> Hi all,
>
> is it possible through pstricks to include a part of an eps figure
> directly in the Latex code ? Something like :
>
> \begin{pspicture}
> \include{epslines} % <--- lines taken from an eps file
> \psaxes{}....
>
> \end{pspicture}
>
>
> Thank you
>
>
> ------------------------------
>
> Message: 6
> Date: Fri, 04 Dec 2009 09:39:27 +0100
> From: Herbert Voss <Herbert.Voss at FU-Berlin.DE>
> To: pstricks at tug.org
> Subject: Re: [pstricks] include eps code within pstricks commands
> Message-ID: <4B18CABF.6050204 at FU-Berlin.DE>
> Content-Type: text/plain; charset=ISO-8859-1
>
> Am 04.12.2009 05:02, schrieb mathias legrand:
>
>> is it possible through pstricks to include a part of an eps figure
>> directly in the Latex code ? Something like :
>>
>> \begin{pspicture}
>> \include{epslines} % <--- lines taken from an eps file
>> \psaxes{}....
>>
>> \end{pspicture}
>
> \pstVerb{ (Test.eps) run }
>
> but it makes no sense. because the eps is an image _per_ page.
> You have to delete some lines in the eps to get rid of
> some commands.
>
> Herbert
>
>
> ------------------------------
>
> _______________________________________________
> PSTricks mailing list
> PSTricks at tug.org
> http://tug.org/mailman/listinfo/pstricks
>
>
> End of PSTricks Digest, Vol 83, Issue 4
> ***************************************