Re: [Matplotlib-users] Fwd: best format for MS word?

2009-09-03 Thread Shixin Zeng
Yes, Me feel sad as well. But I don't think he wants to learn python
and then matplotlib. He is not a computer professor after all.

Best Regards

Shixin Zeng



On Thu, Sep 3, 2009 at 8:54 AM, Nicolas Bigaouettenbigaoue...@gmail.com wrote:
 I'm sure everybody find this really sad... If he wants control over the
 ploting capabilities, then why not have matplotlib and send him the script?
 I know when I switched to matplotlib from matlab I wanted to be able to edit
 directly the graph with point and click, but sometimes it is more powerful
 or even easier to edit the script.

 If the changes are really small, you could always send him an SVG that he
 edits in Inkscape. I do that sometimes.
 There might be other open source plotting packages which are WYSIWYG, like
 qtiplot. Please, please! don't go with excel ;) Its quality is so much lower
 then any other software.

 2009/9/3 Shixin Zeng zeng.shi...@gmail.com

 Forgot CC list.

 Thanks for your helps.

 Best Regards

 Shixin Zeng




 -- Forwarded message --
 From: Shixin Zeng zeng.shi...@gmail.com
 Date: Wed, Sep 2, 2009 at 11:02 PM
 Subject: Re: [Matplotlib-users] best format for MS word?
 To: Stan West stan.w...@nrl.navy.mil


 On Wed, Sep 2, 2009 at 8:59 PM, Stan Weststan.w...@nrl.navy.mil wrote:
  -Original Message-
  From: Shixin Zeng [mailto:zeng.shi...@gmail.com]
  Sent: Wednesday, September 02, 2009 16:11
 
  While for embeding eps files in word, I've just tried that. MS word
  2007 seems to have some problem on this. See the attached eps
  file produced from matplotlib. In MS word 2007, the labels
  and titles of axes are gone, even on the printed version of
  the word file. It's there when I view/print it with gsview.
 
  I don't have Word 2007, but I imported your file into Word 2003 and saw
  that
  the titles and labels were missing.  I would blame that on shortcomings
  of the
  Word PS engine.  When I printed to a non-PostScript printer, the titles
  and
  labels were missing as in your test; that doesn't surprise me, because
  the
  Word PS engine would be used to render for a non-PS printer.  However,
  when I
  printed to PostScript devices (the Adobe PDF driver and the PDFCreator
  driver), the titles and text were present; Word shouldn't invoke its PS
  engine
  when the printer understands PS.  Is there any chance that you were
  using a
  non-PS printer, or that your printer has two or more modes (like the
  Hewlett-Packard models that automatically switch between PCL and PS) and
  you
  were not using a PS driver?  How about testing with PDFCreator?
 
 
 I'm not sure if my printer supports PS or not, it's Dell Laser 1320c,
 I couldn't find any information from its property page.

 I'm afraid that I'm giving up matplotlib for my paper plotting, since
 my professor wants me to do plotting with excel such that he doesn't
 have to ask me to do every small change on the plot if he could do it
 himself.


 --
 Let Crystal Reports handle the reporting - Free Crystal Reports 2008
 30-Day
 trial. Simplify your report design, integration and deployment - and focus
 on
 what you do best, core application coding. Discover what's new with
 Crystal Reports now.  http://p.sf.net/sfu/bobj-july
 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users


 --
 Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
 trial. Simplify your report design, integration and deployment - and focus
 on
 what you do best, core application coding. Discover what's new with
 Crystal Reports now.  http://p.sf.net/sfu/bobj-july
 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users



--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] best format for MS word?

2009-09-02 Thread Shixin Zeng
OK,

I'm attaching a file that converts svg to emf, which is based on
librsvg and cairo.

I've spent the all night working on this, but the result is still not
satisfying. The converted emf file is even worse than the png file
produced from matplotlib. I'm not sure if it's because I did something
wrong or it's because of the limitation of this method itself. I'm
posting here in hope of some one with more knowledge would enlighten
me. Thanks.

To build the problem, you need to download librsvg and it's dependency
from http://ftp.gnome.org/pub/gnome/binaries/win32/

Best Regards

Shixin Zeng



On Tue, Sep 1, 2009 at 6:43 PM, Shixin Zengzeng.shi...@gmail.com wrote:
 Hi,

 Could someone tell me what's the best format that matplotlib can
 produce for insertion to MS word? I'm working on a paper using MS
 word. I used matplotlib to produce the pictures in png' format, but
 my professor doesn't satisfy with the quality of the pictures, he asks
 me to do it in emf format, but I can't get an emf output from
 matplotlib. While other vector formats that are supported by
 matplotlib are not supported by MS word. I have worked days on
 producing this pictures, I don't want to abandon them just because
 they can't be imported to MS word. I really like to produce my
 pictures by using matplotlib, but I can't really throw away MS word. I
 also tried pstoedit to try to convert to emf from the ps, but it
 doesn't work on my system due to some weired missing procedure entry
 points in imagick dll.

 I'm kinda in a hurry, any help would be greatly appreciated.

 Best Regards

 Shixin Zeng

/* A simple program that converts an svg file to an emf file
 * based on librsvg and cairo
 *
 * Author Shixin Zeng zeng.shi...@gmail.com
 * License: GPL V2 or newer
 **/

#include cairo.h
#include librsvg/rsvg.h

#include windows.h

//#define FACTOR_INCH_TO_MM 25.4
//#define DPI   90

//static double dpi = 90;
static char *src = NULL;
static char *dest = NULL;
static GOptionEntry entries[] =
{
//{dpi, 'd', 0, G_OPTION_ARG_DOUBLE, dpi, the source dpi, dpi},
{from, 'f', 0, G_OPTION_ARG_STRING, src, the source file, src},
{to, 't', 0, G_OPTION_ARG_STRING, dest, the destination file, 
dest},
{NULL}
};

int
main (int argc, char *argv[])
{
cairo_surface_t *surface;
cairo_t *cr;
HDC hdc;
RsvgHandle * rsvg_hd = NULL;
RsvgDimensionData rdim;
HDC dc = GetDC(NULL);
RECT dim;
float MetaPixelsX, MetaPixelsY;
float MetaMMX, MetaMMY;


int i = 1;
GError *error = NULL;
GOptionContext *context;

context = g_option_context_new(Convert SVG to EMF);
g_option_context_add_main_entries(context, entries, SVG_TO_EMF);
if(!g_option_context_parse(context, argc, argv, error))
{
g_print(option parsing failed: %s\n, error-message);
return 1;
}

if (src == NULL || dest == NULL){
g_print(source and dest files must be given\n%s, 
g_option_context_get_help(context, TRUE, NULL));
return 1;
}

rsvg_init();
rsvg_hd = rsvg_handle_new_from_file(src, NULL);

//dpi =  GetDeviceCaps(dc, HORZRES);
//rsvg_handle_set_dpi (rsvg_hd, dpi); 
rsvg_handle_get_dimensions(rsvg_hd, rdim);

g_print(SVG: height = %d pt, width = %d pit\n, rdim.height, 
rdim.width);

/* MetaPixelsX = MetaWidthMM * MetaPixels / (MetaMM * 100)
 *
 * where MetaPixelsX = number of pixels on the X axis
 * MetaWidthMM = metafile width in 0.01mm units
 * MetaPixels  = width in pixels of the reference device
 * MetaMM  = width in millimeters of the reference device
 * 
 * MetaWidthMM = MetaPixelsx * MetaMM * 100 / MetaPixels
 */

MetaPixelsX =  GetDeviceCaps(dc, HORZRES);
MetaPixelsY =  GetDeviceCaps(dc, VERTRES);

MetaMMX = GetDeviceCaps(dc, HORZSIZE);
MetaMMY = GetDeviceCaps(dc, VERTSIZE);

dim.left = 0;
dim.top = 0;
dim.bottom = rdim.height * MetaMMY * 100 / MetaPixelsY;
dim.right = rdim.width * MetaMMX * 100 / MetaPixelsX;

g_print(EMF: height = %d mm, width = %d mm\n, dim.bottom/100, 
dim.right/100);
hdc = CreateEnhMetaFile(dc, 
dest,
dim,
NULL);
ReleaseDC(NULL, dc);
if(!hdc){
g_print(creating emf file failed\n);
return 1;
}

surface = cairo_win32_printing_surface_create (hdc);
cr = cairo_create(surface);
if(!rsvg_handle_render_cairo(rsvg_hd, cr))
g_print(render to cairo failed\n);

cairo_destroy (cr);
cairo_surface_destroy (surface);

CloseEnhMetaFile(hdc

Re: [Matplotlib-users] best format for MS word?

2009-09-02 Thread Shixin Zeng
No, I'm not scaling it down actually, I use the exact size matplotlib
produces. So this is not a problem about scaling.

Best Regards

Shixin Zeng



On Wed, Sep 2, 2009 at 11:35 AM, Chip Webberchipweb...@gmail.com wrote:
 If Word has problems scaling down the png image for viewing maybe you could
 try writing the image out to a smaller size or using imagemagick to scale it
 to the size you need.

 Shixin Zeng wrote:

 Yes, with large pictures, PNG is good enough, but when scaling down,
 it looks a bit fuzzy.

 Best Regards

 Shixin Zeng



--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] best format for MS word?

2009-09-02 Thread Shixin Zeng
On Wed, Sep 2, 2009 at 11:43 AM, Christopher
Barkerchris.bar...@noaa.gov wrote:
 MS simply doesn't lay well with open vector formats, I think PNG with
 the right DPI, etc is still probably your best bet.

Yes, I think I have to stick to this option

 Shixin Zeng wrote:
 I'm attaching a file that converts svg to emf, which is based on
 librsvg and cairo.

 I've spent the all night working on this, but the result is still not
 satisfying. The converted emf file is even worse than the png file
 produced from matplotlib. I'm not sure if it's because I did something
 wrong or it's because of the limitation of this method itself.

 I suspect you are getting a raster embedded in the emf, rather than
 proper vector graphics, but that's just a guess. This message is a
 couple years old, but does seem to indicate the vector emf is not
 supported (or wasn't then):

 http://lists.cairographics.org/archives/cairo/2007-February/009805.html

 However, if Cairo does support verctor emf, than you might be able to
 use the MPL Cairo back-end, rather than trying to go to SVG-emf.


I looked at the cairo backend of MPL, it doesn't support EMF, it has
only pdf, ps, svg, svgz outputs.

 good luck!

 -Chris


 --
 Christopher Barker, Ph.D.
 Oceanographer

 Emergency Response Division
 NOAA/NOS/ORR            (206) 526-6959   voice
 7600 Sand Point Way NE   (206) 526-6329   fax
 Seattle, WA  98115       (206) 526-6317   main reception

 chris.bar...@noaa.gov

 --
 Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
 trial. Simplify your report design, integration and deployment - and focus on
 what you do best, core application coding. Discover what's new with
 Crystal Reports now.  http://p.sf.net/sfu/bobj-july
 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users


--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] best format for MS word?

2009-09-02 Thread Shixin Zeng
No, it doesn't work for me. Either it can't convert, or the quality is
pretty low, there are some black blocks in the converted plot.

Best Regards

Shixin Zeng



On Wed, Sep 2, 2009 at 8:30 AM, Gary Rubengru...@bigpond.net.au wrote:
 I haven't tried it myself, but this converter may do the trick. If it works,
 can you report back? I'd be interested to know:
 http://sk1project.org/modules.php?name=Productsproduct=uniconvertor

 Gary R.

 Shixin Zeng wrote:

 Hi,

 Could someone tell me what's the best format that matplotlib can
 produce for insertion to MS word? I'm working on a paper using MS
 word. I used matplotlib to produce the pictures in png' format, but
 my professor doesn't satisfy with the quality of the pictures, he asks
 me to do it in emf format, but I can't get an emf output from
 matplotlib. While other vector formats that are supported by
 matplotlib are not supported by MS word. I have worked days on
 producing this pictures, I don't want to abandon them just because
 they can't be imported to MS word. I really like to produce my
 pictures by using matplotlib, but I can't really throw away MS word. I
 also tried pstoedit to try to convert to emf from the ps, but it
 doesn't work on my system due to some weired missing procedure entry
 points in imagick dll.

 I'm kinda in a hurry, any help would be greatly appreciated.

 Best Regards

 Shixin Zeng


 --
 Let Crystal Reports handle the reporting - Free Crystal Reports 2008
 30-Day trial. Simplify your report design, integration and deployment - and
 focus on what you do best, core application coding. Discover what's new with
 Crystal Reports now.  http://p.sf.net/sfu/bobj-july
 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users



--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Fwd: best format for MS word?

2009-09-02 Thread Shixin Zeng
Forgot CC list.

Thanks for your helps.

Best Regards

Shixin Zeng




-- Forwarded message --
From: Shixin Zeng zeng.shi...@gmail.com
Date: Wed, Sep 2, 2009 at 11:02 PM
Subject: Re: [Matplotlib-users] best format for MS word?
To: Stan West stan.w...@nrl.navy.mil


On Wed, Sep 2, 2009 at 8:59 PM, Stan Weststan.w...@nrl.navy.mil wrote:
 -Original Message-
 From: Shixin Zeng [mailto:zeng.shi...@gmail.com]
 Sent: Wednesday, September 02, 2009 16:11

 While for embeding eps files in word, I've just tried that. MS word
 2007 seems to have some problem on this. See the attached eps
 file produced from matplotlib. In MS word 2007, the labels
 and titles of axes are gone, even on the printed version of
 the word file. It's there when I view/print it with gsview.

 I don't have Word 2007, but I imported your file into Word 2003 and saw that
 the titles and labels were missing.  I would blame that on shortcomings of the
 Word PS engine.  When I printed to a non-PostScript printer, the titles and
 labels were missing as in your test; that doesn't surprise me, because the
 Word PS engine would be used to render for a non-PS printer.  However, when I
 printed to PostScript devices (the Adobe PDF driver and the PDFCreator
 driver), the titles and text were present; Word shouldn't invoke its PS engine
 when the printer understands PS.  Is there any chance that you were using a
 non-PS printer, or that your printer has two or more modes (like the
 Hewlett-Packard models that automatically switch between PCL and PS) and you
 were not using a PS driver?  How about testing with PDFCreator?


I'm not sure if my printer supports PS or not, it's Dell Laser 1320c,
I couldn't find any information from its property page.

I'm afraid that I'm giving up matplotlib for my paper plotting, since
my professor wants me to do plotting with excel such that he doesn't
have to ask me to do every small change on the plot if he could do it
himself.

--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] best format for MS word?

2009-09-01 Thread Shixin Zeng
Yes, I tried OOo. But its pdf/ps/svg importer is not good enough, it
kinda screwed up my pictures, so ...

Best Regards

Shixin Zeng



On Tue, Sep 1, 2009 at 6:50 PM, jason-s...@creativetrax.com wrote:
 Shixin Zeng wrote:

 Hi,

 Could someone tell me what's the best format that matplotlib can
 produce for insertion to MS word? I'm working on a paper using MS
 word. I used matplotlib to produce the pictures in png' format, but
 my professor doesn't satisfy with the quality of the pictures, he asks
 me to do it in emf format, but I can't get an emf output from
 matplotlib. While other vector formats that are supported by
 matplotlib are not supported by MS word. I have worked days on
 producing this pictures, I don't want to abandon them just because
 they can't be imported to MS word. I really like to produce my
 pictures by using matplotlib, but I can't really throw away MS word. I
 also tried pstoedit to try to convert to emf from the ps, but it
 doesn't work on my system due to some weired missing procedure entry
 points in imagick dll.

 I'm kinda in a hurry, any help would be greatly appreciated.



 A quick google search indicates that OpenOffice can read EPS files
 (postscript) and convert to emf.

 Jason



--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] best format for MS word?

2009-09-01 Thread Shixin Zeng
How do I utilize pyEmf? AFAIK, it's used by the old emf backend in
matplotlib, which is not maintained or functional any more.

Best Regards

Shixin Zeng



On Tue, Sep 1, 2009 at 8:14 PM, Andrew Strawstraw...@astraw.com wrote:
 Shixin Zeng wrote:
 Hi,

 Could someone tell me what's the best format that matplotlib can
 produce for insertion to MS word?

 You can try PyEMF. I don't know its status -- it might need some TLC.
 http://pyemf.sourceforge.net/


--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] best format for MS word?

2009-09-01 Thread Shixin Zeng
Yes, with large pictures, PNG is good enough, but when scaling down,
it looks a bit fuzzy.

Best Regards

Shixin Zeng



On Tue, Sep 1, 2009 at 8:05 PM, Alan G Isaacalan.is...@gmail.com wrote:
 On 9/1/2009 8:22 PM Shixin Zeng apparently wrote:
 Yes, I tried OOo. But its pdf/ps/svg importer is not good enough


 I'm afraid that for EPS you will not do better
 by moving to a MS product.  At least my luck
 has been bad.  Otoh, I have had pretty good
 luck with PNG.

 Alan Isaac

 PS http://wiki.services.openoffice.org/wiki/SVG_Import_Filter


 --
 Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
 trial. Simplify your report design, integration and deployment - and focus on
 what you do best, core application coding. Discover what's new with
 Crystal Reports now.  http://p.sf.net/sfu/bobj-july
 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users


--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] best format for MS word?

2009-09-01 Thread Shixin Zeng
Yes, the DPI i'm using is 300, and I tried to change it to 600, or
1200, but I can't see much difference.

Best Regards

Shixin Zeng



On Tue, Sep 1, 2009 at 9:28 PM, Eric Firingefir...@hawaii.edu wrote:
 Shixin Zeng wrote:

 Hi,

 Could someone tell me what's the best format that matplotlib can
 produce for insertion to MS word? I'm working on a paper using MS
 word. I used matplotlib to produce the pictures in png' format, but
 my professor doesn't satisfy with the quality of the pictures, he asks
 me to do it in emf format, but I can't get an emf output from
 matplotlib. While other vector formats that are supported by
 matplotlib are not supported by MS word. I have worked days on
 producing this pictures, I don't want to abandon them just because
 they can't be imported to MS word. I really like to produce my
 pictures by using matplotlib, but I can't really throw away MS word. I
 also tried pstoedit to try to convert to emf from the ps, but it
 doesn't work on my system due to some weired missing procedure entry
 points in imagick dll.

 Have you tried brute-force?  Make a very high-resolution png  (use a high
 dpi setting in savefig), and import that?

 Eric



 I'm kinda in a hurry, any help would be greatly appreciated.

 Best Regards

 Shixin Zeng


 --
 Let Crystal Reports handle the reporting - Free Crystal Reports 2008
 30-Day trial. Simplify your report design, integration and deployment - and
 focus on what you do best, core application coding. Discover what's new with
 Crystal Reports now.  http://p.sf.net/sfu/bobj-july
 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users



--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users