From: Ryan K. <gt...@ma...> - 2005-05-19 21:55:42
|
I would like to use Matplotlib for automatically generating reports in HTML. I would like to do this without having to use latex first and the convert from there (it would be much faster to make my own HTML directly and I don't need lots of complicated features yet). Has anyone already done this who is willing to share code with me? One thing I need to do that would make this work really well is to generate little PNG's of symbols and formulas to use in line with text in the HTML (sort of how LaTeX2HTML handles using $\theta$ in line. Is there a way to use the TeX rendering system used on figures to make little PNG's with just TeX expressions on them (i.e. theta.png)? Thanks, Ryan |
From: John H. <jdh...@ac...> - 2005-05-19 22:14:08
|
>>>>> "Ryan" == Ryan Krauss <gt...@ma...> writes: Ryan> I would like to use Matplotlib for automatically generating Ryan> reports in HTML. I would like to do this without having to Ryan> use latex first and the convert from there (it would be much Ryan> faster to make my own HTML directly and I don't need lots of Ryan> complicated features yet). Has anyone already done this who Ryan> is willing to share code with me? Ryan> One thing I need to do that would make this work really well Ryan> is to generate little PNG's of symbols and formulas to use Ryan> in line with text in the HTML (sort of how LaTeX2HTML Ryan> handles using $\theta$ in line. Is there a way to use the Ryan> TeX rendering system used on figures to make little PNG's Ryan> with just TeX expressions on them (i.e. theta.png)? TeX/LaTeX plus dvipng is really the right way to solve this problem. Coincidentally, I have been working to incorporate tex into backend_agg via dvipng (and into backend_ps via psfrag) and matplotlib has a tex manager class So if you don't mind installing tex and dvipng (on my Ubuntu system is is simply > sudo apt-get install dvipng then you can use the matplotlib texmanager class to handle the system calls, cacheing results it's seen before and so on >>> from matplotlib.texmanager import TexManager >>> m = TexManager() >>> pngfile = m.make_png("\TeX\ is Number $e^{-i\pi}$!", dpi=100) >>> print pngfile /home/jdhunter/.tex.cache/5b723d2ea8d0f15af94ec585aece1582_100.png You need to make sure you have texmanager revision 1.2 from CVS (or later). Of course if you are on a platform where TeX is not easily installed, this won't help much. In that case, you can use matplotlib to create the math images for you, but I would use the mathtext parser directly rather than the whole figure / axes api. Let me know if you still want/need to use mpl for this and I'll give you some pointers. JDH |
From: Ryan K. <rya...@co...> - 2005-05-20 00:41:31
|
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type"> <title></title> </head> <body bgcolor="#ffffff" text="#000000"> Thanks again John. The newest texmanager.py worked great.<br> <br> John Hunter wrote: <blockquote cite="mid...@pe..." type="cite"> <blockquote type="cite"> <blockquote type="cite"> <blockquote type="cite"> <blockquote type="cite"> <blockquote type="cite"> <pre wrap="">"Ryan" == Ryan Krauss <a class="moz-txt-link-rfc2396E" href="mailto:gt...@ma..."><gt...@ma...></a> writes: </pre> </blockquote> </blockquote> </blockquote> </blockquote> </blockquote> <pre wrap=""><!----> Ryan> I would like to use Matplotlib for automatically generating Ryan> reports in HTML. I would like to do this without having to Ryan> use latex first and the convert from there (it would be much Ryan> faster to make my own HTML directly and I don't need lots of Ryan> complicated features yet). Has anyone already done this who Ryan> is willing to share code with me? Ryan> One thing I need to do that would make this work really well Ryan> is to generate little PNG's of symbols and formulas to use Ryan> in line with text in the HTML (sort of how LaTeX2HTML Ryan> handles using $\theta$ in line. Is there a way to use the Ryan> TeX rendering system used on figures to make little PNG's Ryan> with just TeX expressions on them (i.e. theta.png)? TeX/LaTeX plus dvipng is really the right way to solve this problem. Coincidentally, I have been working to incorporate tex into backend_agg via dvipng (and into backend_ps via psfrag) and matplotlib has a tex manager class So if you don't mind installing tex and dvipng (on my Ubuntu system is is simply > sudo apt-get install dvipng then you can use the matplotlib texmanager class to handle the system calls, cacheing results it's seen before and so on >>> from matplotlib.texmanager import TexManager >>> m = TexManager() >>> pngfile = m.make_png("\TeX\ is Number $e^{-i\pi}$!", dpi=100) >>> print pngfile /home/jdhunter/.tex.cache/5b723d2ea8d0f15af94ec585aece1582_100.png You need to make sure you have texmanager revision 1.2 from CVS (or later). Of course if you are on a platform where TeX is not easily installed, this won't help much. In that case, you can use matplotlib to create the math images for you, but I would use the mathtext parser directly rather than the whole figure / axes api. Let me know if you still want/need to use mpl for this and I'll give you some pointers. JDH ------------------------------------------------------- This SF.Net email is sponsored by Oracle Space Sweepstakes Want to be the first software developer in space? Enter now for the Oracle Space Sweepstakes! <a class="moz-txt-link-freetext" href="http://ads.osdn.com/?ad_id=7412&alloc_id=16344&op=click">http://ads.osdn.com/?ad_id=7412&alloc_id=16344&op=click</a> _______________________________________________ Matplotlib-users mailing list <a class="moz-txt-link-abbreviated" href="mailto:Mat...@li...">Mat...@li...</a> <a class="moz-txt-link-freetext" href="https://lists.sourceforge.net/lists/listinfo/matplotlib-users">https://lists.sourceforge.net/lists/listinfo/matplotlib-users</a> </pre> </blockquote> <br> </body> </html> |