From: John H. <jdh...@ac...> - 2003-11-17 15:50:14
|
>>>>> "Nelson" == Nelson Minar <ne...@mo...> writes: Nelson> John Hunter <jdh...@ac...> writes: >> There are a lot of good plotting libraries out there. I'll >> pitch mine. http://matplotlib.sourceforge.net Nelson> Thanks for posting this! I've been using gdchart for a Nelson> long time because it's simple and the graphs aren't too Nelson> bad. But it's very limited, in particular your X axis has Nelson> to be equally spaced. Hi Nelson, thanks for the email and the detailed comments. It would be great to have you join the mailing list - other users would benefit from your comments - http://lists.sourceforge.net/mailman/listinfo/matplotlib-users Nelson> I spent about an hour with matplotlib. It's clear you put Nelson> a lot of work into this, and I think this could be a Nelson> really great library. Some thoughts for you from a casual Nelson> user: Nelson> The installation prerequisites are a bit daunting but on a Nelson> Debian system it's not too bad. Debian has many of the Nelson> packages you need: apt-get install python2.3-numeric Nelson> python2.3-numarray python2.3-numeric-ext apt-get install Nelson> fonttools libgd2-dev python2.3-gtk2 python2.3-numeric-ext Nelson> is easy to forget: you need that for FFT and MLab. I'll update the web page with this information for debian users. Debian is great; unfortunately, I don't get much opportunity to use it so I haven't gone through the process of installing matplotlib on debian. There was some interest on the mailing list earlier about getting matplotlib packaged for debian, and an RFP was made, but I don't there has been any any progress on this front. Charles, Nathan, any comments here? Nelson> The only things I had to install from sources were Nelson> TTFQuery and gdmodule, and both of those were easy. Nelson> I'd like to use this module as a simple thing to create Nelson> PNGs of graphs from data to put on web pages. The GD Nelson> driver is most of what I need, and the idea that I could Nelson> also do postscript output is great. But the packaging of Nelson> matplotlib is a bit funky. The most confusing thing was Nelson> the way you read sys.argv - that's probably not good for a Nelson> resuable library. I agree to a certain extent. But I don't modify the args and they will be without effect if you use the incantation, as you did import matplotlib matplotlib.use('GD') Mainly, I did it because I wanted an easy way to switch between backends without switching scripts. There are other ways to do this however. Unless the presence of the sys.argv is causing a problem, I am hesitant to remove it to maintain backwards compatibility. If you can think of a problem, please let me know. Nelson> I was also mystified as to how to set the plotsize using Nelson> the matlab module. I gave up and ended up doing something Nelson> else, but it was so much work I felt like I probably did Nelson> something wrong: Nelson> import matplotlib Nelson> matplotlib.use('GD') Nelson> from matplotlib.backends import Figure Nelson> from matplotlib.axes import Subplot Nelson> f = Figure(figsize=(3, 2), dpi=100) Nelson> a = Subplot(111) Nelson> a.plot([1,2,3,4], [1,4,9,16]) Nelson> f.add_axis(a) Nelson> f.print_figure("nelson2.png", 100) You're right on the money here. The ability to control the dpi, figsize and other attributes from the matlab interface is limited. I think I'll add kwargs to the fig command to enable this, and plan to go to a backend specific config file for the next release -- a .matplotlibrc file containing a dictionary that provided default font, figsize, dpi, etc, for each backend. But beyond this, it is important to be able to control these attributes at the script level using the matlab interface. I'm glad you figured out the workaround by using the API. JDH |