Re: [matplotlib-devel] Asking for code review: Xelatex / PGF backend

2012-08-08 Thread Trémouilles David
Le 07/08/12 01:17, Peter Würtz a écrit :
> Hi!
> I would like to ask for a code review for a new backend I wrote for creating
> figures with Xelatex/Lualatex. It uses the PGF (Tikz) Package for all
> drawing operations and enables full unicode support and typesetting of
> texts/formulas using Latex. This way, the figures created fit perfectly in
> Latex documents. Furthermore, Xelatex/Lualatex is able to use the fonts
> installed on your operating system. The drawing commands of the PGF pictures
> can be included in Latex documents or can be directly compiled to PDF by the
> backend.
>
> Github project for hosting the code, usage instructions and examples:
> https://github.com/pwuertz/matplotlib-backend-pgf
>
> A document demonstrating the benefits of using Xelatex/PGF:
> https://github.com/pwuertz/matplotlib-backend-pgf/raw/master/demo/demo.pdf
>
> Gallery of the matplotlib examples processed with backend_pgf:
> https://github.com/pwuertz/matplotlib-backend-pgf/wiki/Examples%20Gallery
> A few exceptions are known to fail due to Latex incompatible math-text.
>
> This is a matplotlib branch set up as suggested in the matplotlib developer
> wiki. It includes the code from above and adds new rc-parameters and the
> '.pgf' file type.
> https://github.com/pwuertz/matplotlib/compare/master...pgf-backend
>
> Discussions are usually taking place at the github diff, right? I hope
> you'll find this an interesting option for creating figures with matplotlib.
>
> Cheers,
> Peter
Very interesting work. Thanks.

Is there any reason that the generated figure could not
be used with pdflatex ?

I ask the question before giving it a try (I use pdflatex).

Regards,

David


--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
___
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel


[matplotlib-devel] The beauty of Breseham's algorithm

2012-08-08 Thread Damon McDougall
I saw this article on hacker news and wondered if it would be applicable
to us? http://free.pages.at/easyfilter/bresenham.html

Perhaps not, but I certainly learned something from it so I thought I'd
share anyway.

Best,
Damon

-- 
Damon McDougall
http://damon-is-a-geek.com
B2.39
Mathematics Institute
University of Warwick
Coventry
West Midlands
CV4 7AL
United Kingdom

--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
___
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel


Re: [matplotlib-devel] The beauty of Breseham's algorithm

2012-08-08 Thread Damon McDougall
On Wed, Aug 08, 2012 at 09:26:58AM +0100, Damon McDougall wrote:
> I saw this article on hacker news and wondered if it would be applicable
> to us? http://free.pages.at/easyfilter/bresenham.html
> 
> Perhaps not, but I certainly learned something from it so I thought I'd
> share anyway.
> 
> Best,
> Damon

...and that should be 'Bresenham', not 'Breseham'.

-- 
Damon McDougall
http://damon-is-a-geek.com
B2.39
Mathematics Institute
University of Warwick
Coventry
West Midlands
CV4 7AL
United Kingdom

--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
___
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel


Re: [matplotlib-devel] Asking for code review: Xelatex / PGF backend

2012-08-08 Thread Peter Würtz


David Trémouilles wrote:
> 
> Is there any reason that the generated figure could not be used with
> pdflatex ?
> 

The PGF pictures should work with pdflatex, xelatex and lualatex alike.
Xelatex (or lualatex) must be installed though because I use it for
obtaining the font metrics when the figure is created. In principle I could
use pdflatex for this as well, I just saw no reason to use it anymore when I
learned about the newer implementations.

So in order to get the font metrics right you should tell the backend which
fonts you are going to use later. You need to disable the default font
configuration that uses the system fonts specified in the matplotlib rc
paramteres and fully configure the latex environment using your own
preamble. This can be done using the rc parameters:

matplotlib.rcParams.update({
  "pgf.rcfonts": False,
  "pgf.preamble": [r"\usepackage{siunitx}",
r"\usepackage{somefontpackage}"],
})

I never thought about it, but if there interest in using this with pdflatex
I could add this as an option. It might just be a little bit confusing since
the font setup will be different when switching from xelatex to pdflatex due
to its limitations.
-- 
View this message in context: 
http://old.nabble.com/Asking-for-code-review%3A-Xelatex---PGF-backend-tp34263853p34270497.html
Sent from the matplotlib - devel mailing list archive at Nabble.com.


--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
___
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel


Re: [matplotlib-devel] Asking for code review: Xelatex / PGF backend

2012-08-08 Thread Peter Würtz


Peter Würtz wrote:
> 
> 
> David Trémouilles wrote:
>> 
>> Is there any reason that the generated figure could not be used with
>> pdflatex ?
>> 
> 
> The PGF pictures should work with pdflatex, xelatex and lualatex alike.
> Xelatex (or lualatex) must be installed though because I use it for
> obtaining the font metrics when the figure is created. In principle I
> could use pdflatex for this as well, I just saw no reason to use it
> anymore when I learned about the newer implementations.
> 

Ok, the latest commit now allows you to rely on pdflatex only. Xelatex is
still the default, but you can change that using the rc parameters:

matplotlib.rcParams.update({
  "font.family": "serif",
  "pgf.texsystem": "pdflatex",
  "pgf.preamble": [r"\usepackage{siunitx}",
r"\usepackage{somefontpackage}"],
})

System fonts specified in the rc parameters will be ignored since pdflatex
cannot use them. Font metrics will be obtained from a pdflatex process. If
you save the figure as pdf, pdflatex will be used to compile the figure.

Hope this helps.
-- 
View this message in context: 
http://old.nabble.com/Asking-for-code-review%3A-Xelatex---PGF-backend-tp34263853p34271056.html
Sent from the matplotlib - devel mailing list archive at Nabble.com.


--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
___
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel


Re: [matplotlib-devel] Asking for code review: Xelatex / PGF backend

2012-08-08 Thread Trémouilles David
Thank you very much Peter :-)
I'm going to test...

David

Le 08/08/12 12:59, Peter Würtz a écrit :
>
> Peter Würtz wrote:
>>
>> David Trémouilles wrote:
>>> Is there any reason that the generated figure could not be used with
>>> pdflatex ?
>>>
>> The PGF pictures should work with pdflatex, xelatex and lualatex alike.
>> Xelatex (or lualatex) must be installed though because I use it for
>> obtaining the font metrics when the figure is created. In principle I
>> could use pdflatex for this as well, I just saw no reason to use it
>> anymore when I learned about the newer implementations.
>>
> Ok, the latest commit now allows you to rely on pdflatex only. Xelatex is
> still the default, but you can change that using the rc parameters:
>
> matplotlib.rcParams.update({
>"font.family": "serif",
>"pgf.texsystem": "pdflatex",
>"pgf.preamble": [r"\usepackage{siunitx}",
> r"\usepackage{somefontpackage}"],
> })
>
> System fonts specified in the rc parameters will be ignored since pdflatex
> cannot use them. Font metrics will be obtained from a pdflatex process. If
> you save the figure as pdf, pdflatex will be used to compile the figure.
>
> Hope this helps.


--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
___
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel