Problem exploiting interpreter property

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Problem exploiting interpreter property

David M. Cook

3 March 2017

 

Hello,

 

I am apparently overlooking something in my attempt with OCTAVE 4.0.0 running on a Windows 7 HP laptop to produce an output EPS file of a graph containing labels with some characters modified with TeX-style adjustments, i.e., exploiting the interpreter property (for which ‘tex’ appears to be the default setting, though adding the option ‘interpreter’, ‘tex’ in the title, xlabel, and ylabel statements below appears to make no difference).  Because of the statement

 

“Note that for on-screen display the interpreter property is honored by all graphics toolkits. However for printing, only the "gnuplot" toolkit renders TeX instructions”

 

in the on-line OCTAVE help at the link

 

https://www.gnu.org/software/octave/doc/v4.0.0/Use-of-the-interpreter-Property.html

 

I use the gnuplot graphics toolkit.  The code

 

close all

dz = 8.0/100.0;

z = [ -4.0 : dz : 4.0 ];

B = (1.0 + z.^2).^(-1.5);

graphics_toolkit(  ‘gnuplot’ )

plot( z, B, 'color', 'black', 'linewidth', 4 )

grid on

title('Magnetic Field on {\it z} Axis', 'FontSize', 20 )

xlabel('Dimensionless Position, {\it z}', 'FontSize', 16 )

ylabel( '{\it B}({\it z} )=1/(1+{\it z}^2)^{3/2}', 'FontSize', 16 )

 

produces the on-screen graph in the attached file trial-gnuplot.JPG obtained via screencopy.   In particular (and contrary to what I expected from the above quotation from the OCTAVE manual), the TeX stipulations \it are not rendered and the exponents 2 and 3/2 in the y label are displayed in the wrong orientation.  Further, creating an EPS file of this display with the statement

 

print –depsc2 ‘trial-gnuplot.eps’

 

produces the attached file, which is still  not correct.  The exponents are properly oriented but the italic specification is rendered differently than in the file trial-gnuplot.JPG.

 

 

If, however, I continue by executing the code

 

close all

graphics_toolkit(  ‘qt’ )

plot( z, B, 'color', 'black', 'linewidth', 4 )

grid on

title('Magnetic Field on {\it z} Axis', 'FontSize', 20 )

xlabel('Dimensionless Position, {\it z}', 'FontSize', 16 )

ylabel( '{\it B}({\it z} )=1/(1+{\it z}^2)^{3/2}', 'FontSize', 16 )

 

the resulting on-screen graph, shown in the attached screencopy file trial-qt.JPG,  is what I expected and is correct.  The EPS file created with the statement

 

print –depsc2 ‘trial-qt.eps’

 

in the attached file trial-qt.eps does not reflect my intent, indeed, is the same as trial-gnuplot.eps.

 

Based on the above quotation I expected

 

·         trial-gnuplot.JPG and trial-qt.jpg to be correct.

·         trial-qt.eps to be incorrect.

·         trial-gnuplot.eps to be correct.

 

Note, incidentally, that it seems to be particularly \it that is not properly rendered either on the screen or in the file by gnuplot.  If with graphics toolkit gnuplot the y label were, for example,

 

ylabel( ‘\Gamma = 1/(1+\alpha^2)^{3/2}’, ‘FontSize’, 16 )

 

\Gamma and \alpha would be properly rendered on screen but the exponents would still be incorrectly oriented but the y-axis label in the EPS file produced by the print command would be exactly correct.

 

What am I overlooking or how am I misinterpreting the quotation from the OCTAVE manual?

 

Thanks for your help.

 

David

 

 

David M. Cook                      VOICE:  920-832-6721

Department of Physics     FAX:    920-832-6962

Lawrence University         Email:  [hidden email]

711 E Boldt Way, SPC24

Appleton, WI 54911

 


_______________________________________________
Help-octave mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/help-octave

trial-gnuplot.JPG (70K) Download Attachment
trial-gnuplot.eps (125K) Download Attachment
trial-qt.JPG (69K) Download Attachment
trial-qt.eps (125K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Problem exploiting interpreter property

Pantxo
Hi,

You may want try Octave 4.2, especially the gnuplot graphics toolkit:
* Gnuplot: the interface has been much refreshed and the 'cairo' terminal (for printed output) has been added
* Qt and fltk now have a basic support for tex formated strings but long stings (like in your example) currently lead to poor results (see this bug https://savannah.gnu.org/bugs/?func=detailitem&item_id=48567)
Reply | Threaded
Open this post in threaded view
|

Re: Problem exploiting interpreter property

karl
In reply to this post by David M. Cook
Am 03.03.2017 um 21:50 schrieb David M. Cook:

3 March 2017

 

Hello,

 

I am apparently overlooking something in my attempt with OCTAVE 4.0.0 running on a Windows 7 HP laptop to produce an output EPS file of a graph containing labels with some characters modified with TeX-style adjustments, i.e., exploiting the interpreter property (for which ‘tex’ appears to be the default setting, though adding the option ‘interpreter’, ‘tex’ in the title, xlabel, and ylabel statements below appears to make no difference).  Because of the statement

 

“Note that for on-screen display the interpreter property is honored by all graphics toolkits. However for printing, only the "gnuplot" toolkit renders TeX instructions”

 

in the on-line OCTAVE help at the link

 

https://www.gnu.org/software/octave/doc/v4.0.0/Use-of-the-interpreter-Property.html

 

I use the gnuplot graphics toolkit.  The code

 

close all

dz = 8.0/100.0;

z = [ -4.0 : dz : 4.0 ];

B = (1.0 + z.^2).^(-1.5);

graphics_toolkit(  ‘gnuplot’ )

plot( z, B, 'color', 'black', 'linewidth', 4 )

grid on

title('Magnetic Field on {\it z} Axis', 'FontSize', 20 )

xlabel('Dimensionless Position, {\it z}', 'FontSize', 16 )

ylabel( '{\it B}({\it z} )=1/(1+{\it z}^2)^{3/2}', 'FontSize', 16 )

 

produces the on-screen graph in the attached file trial-gnuplot.JPG obtained via screencopy.   In particular (and contrary to what I expected from the above quotation from the OCTAVE manual), the TeX stipulations \it are not rendered and the exponents 2 and 3/2 in the y label are displayed in the wrong orientation.  Further, creating an EPS file of this display with the statement

 

print –depsc2 ‘trial-gnuplot.eps’

 

produces the attached file, which is still  not correct.  The exponents are properly oriented but the italic specification is rendered differently than in the file trial-gnuplot.JPG.

 

 

If, however, I continue by executing the code

 

close all

graphics_toolkit(  ‘qt’ )

plot( z, B, 'color', 'black', 'linewidth', 4 )

grid on

title('Magnetic Field on {\it z} Axis', 'FontSize', 20 )

xlabel('Dimensionless Position, {\it z}', 'FontSize', 16 )

ylabel( '{\it B}({\it z} )=1/(1+{\it z}^2)^{3/2}', 'FontSize', 16 )

 

the resulting on-screen graph, shown in the attached screencopy file trial-qt.JPG,  is what I expected and is correct.  The EPS file created with the statement

 

print –depsc2 ‘trial-qt.eps’

 

in the attached file trial-qt.eps does not reflect my intent, indeed, is the same as trial-gnuplot.eps.

 

Based on the above quotation I expected

 

·         trial-gnuplot.JPG and trial-qt.jpg to be correct.

·         trial-qt.eps to be incorrect.

·         trial-gnuplot.eps to be correct.

 

Note, incidentally, that it seems to be particularly \it that is not properly rendered either on the screen or in the file by gnuplot.  If with graphics toolkit gnuplot the y label were, for example,

 

ylabel( ‘\Gamma = 1/(1+\alpha^2)^{3/2}’, ‘FontSize’, 16 )

 

\Gamma and \alpha would be properly rendered on screen but the exponents would still be incorrectly oriented but the y-axis label in the EPS file produced by the print command would be exactly correct.

 

What am I overlooking or how am I misinterpreting the quotation from the OCTAVE manual?

 

Thanks for your help.

 

David

 

 

David M. Cook                      VOICE:  920-832-6721

Department of Physics     FAX:    920-832-6962

Lawrence University         Email:  [hidden email]

711 E Boldt Way, SPC24

Appleton, WI 54911

 



_______________________________________________
Help-octave mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/help-octave

If you use the first proposal in the answer in this link,

<http://stackoverflow.com/questions/25023312/greek-letters-in-octave-plot-not-exporting-to-eps>

you get a .tex file. Compiling this then should give you the

correct latex-symbols.


_______________________________________________
Help-octave mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/help-octave
Reply | Threaded
Open this post in threaded view
|

Re: Problem exploiting interpreter property

tmacchant
In reply to this post by Pantxo
----- Original Message -----

> From: Pantxo 
> To: help-octave
> Cc:
> Date: 2017/3/4, Sat 07:41
> Subject: Re: Problem exploiting interpreter property
>
> Hi,
>
> You may want try Octave 4.2, especially the gnuplot graphics toolkit:
> * Gnuplot: the interface has been much refreshed and the 'cairo'
> terminal
> (for printed output) has been added
> * Qt and fltk now have a basic support for tex formated strings but long
> stings (like in your example) currently lead to poor results (see this bug
> https://savannah.gnu.org/bugs/?func=detailitem&item_id=48567)
>
>
>

Windows binary ships gnuplot 5.0.x but octave 4.0.x has bugs for handling with gnuplot 5.0.x.
Bus for gnuplot 5.0.x is fixed on octave 4.2.x.

Especially, for octave 4.2.1, embedded gnuplot has support for cairo based terminal and wxt terminal.  

I attached the screen shot on the interactive terminal (wxt) and eps file.

HTH

Tatsuro
_______________________________________________
Help-octave mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/help-octave

trial-gnuplot_oct4.2.1.png (39K) Download Attachment
trial-gnuplot_oct4.2.1.eps (38K) Download Attachment