Re: [Matplotlib-users] plot different columns
Hi Jouni, Jouni K. Seppänen schrieb am 09/20/2007 06:50 PM: > Fabian Braennstroem <[EMAIL PROTECTED]> writes: > >> Jouni K. Seppänen schrieb am 09/16/2007 05:51 PM: >>> def myplot(ax, matrix, linestyle, color): >[...] >> Thanks for your help! add_line seems to be the right >> function... I am not sure yet, if I need your function call, >> but I will check it!? > > Oh, I just wrote my suggestion as a "myplot" function called by a main > program as an example of what you could use instead of the built-in > "plot". There are of course many possible ways to organize your program. Thanks for your help; I was just a bit confused. I got it now. Fabian - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2005. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] plot different columns
Hi Jouni, Jouni K. Seppänen schrieb am 09/16/2007 05:51 PM: > Fabian Braennstroem <[EMAIL PROTECTED]> writes: > >> Lets say I have to columns, the I could use in a script: >> >>res=plot(array_mapped[:,0],array_mapped[:,1], 'b', >> array_mapped[:,0],array_mapped[:,2], 'g') >> >> The next time a have 5 columns in a file and want to plot all 5 >> columns without adjusting the 'plot' command in the script, but just >> by defining an argument when starting the script. > > Perhaps 'plot' is not the ideal interface for your purposes. How about > something like this: > > > > > > #!/usr/bin/env python > > import matplotlib > from matplotlib.lines import Line2D > import pylab > import numpy as npy > > def myplot(ax, matrix, linestyle, color): > for column in range(1, matrix.shape[1]): > line = Line2D(matrix[:,0], matrix[:,column], > linestyle=linestyle, color=color) > ax.add_line(line) > > colors = 'brk' > > for d in range(2,5): > fig=pylab.figure() > ax=fig.add_subplot(111) > matrix = npy.random.rand(d,d) > matrix[:,0] = npy.linspace(0, 1, num=d) > myplot(ax, matrix, '-', colors[d-2]) > > pylab.show() Thanks for your help! add_line seems to be the right function... I am not sure yet, if I need your function call, but I will check it!? Fabian - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2005. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] plot different columns
Hi, Alan G Isaac schrieb am 09/13/2007 06:15 PM: > On Thu, 13 Sep 2007, Fabian Braennstroem apparently wrote: >> Does nobody have an idea; especially for the 'dynamic' >> number of plotted arrays!? > > The question is unclear. > The problem seems easy enough, > if you get your hands on the arguments to your script. > http://homepage.mac.com/andykopra/pdm/tutorials/simplifying_script_arguments.html Thanks for your help; the question is a bit unclear indeed... Handling the sys.argv was not the problem; actually my main problem is to tell the 'plot' or 'loglog' command, that I have a different number of arrays. Lets say I have to columns, the I could use in a script: res=plot(array_mapped[:,0],array_mapped[:,1], 'b', array_mapped[:,0],array_mapped[:,2], 'g') The next time a have 5 columns in a file and want to plot all 5 columns without adjusting the 'plot' command in the script, but just by defining an argument when starting the script. I have to adjust somehow dynamically the plot command to adjust the number of graphs in one figure; but that is the problem... Fabian - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2005. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] plot different columns
Does nobody have an idea; especially for the 'dynamic' number of plotted arrays!? Regards! Fabian Fabian Braennstroem schrieb am 09/09/2007 09:01 PM: > Hi, > > I have a small script which reads a csv file with several > columns and puts it into an scipay array, which > I can plot using matplotlib. It works fine, but just with > explicitly setting the number of columns: > > res=loglog(array_mapped[:,0],array_mapped[:,1], 'b', > array_mapped[:,0],array_mapped[:,2], 'g', > array_mapped[:,0],array_mapped[:,3], 'r', > array_mapped[:,0],array_mapped[:,4], 'y', > array_mapped[:,0],array_mapped[:,5], 'k', > array_mapped[:,0],array_mapped[:,6], '-bo', > linewidth = 2) > > Is there a way to define the number of columns, which I want > to plot? Or even better, can I apply an sys.argv to > define the plotted columns, e.g. > "python csvplot.py all": which plots all columns with its > value for the y-coordinate and the line-number as x-coordinate > "python csvplot.py all1": which does the same as above, but > using column 1 as abscissae > "python csvplot.py 1 2 5": which plots columns 2 and 5 > against column 1... > > Would be nice, if anybody has an idea, how to achieve this!? > Regards! > Fabian > > > - > This SF.net email is sponsored by: Microsoft > Defy all challenges. Microsoft(R) Visual Studio 2005. > http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2005. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] plot different columns
Hi, I have a small script which reads a csv file with several columns and puts it into an scipay array, which I can plot using matplotlib. It works fine, but just with explicitly setting the number of columns: res=loglog(array_mapped[:,0],array_mapped[:,1], 'b', array_mapped[:,0],array_mapped[:,2], 'g', array_mapped[:,0],array_mapped[:,3], 'r', array_mapped[:,0],array_mapped[:,4], 'y', array_mapped[:,0],array_mapped[:,5], 'k', array_mapped[:,0],array_mapped[:,6], '-bo', linewidth = 2) Is there a way to define the number of columns, which I want to plot? Or even better, can I apply an sys.argv to define the plotted columns, e.g. "python csvplot.py all": which plots all columns with its value for the y-coordinate and the line-number as x-coordinate "python csvplot.py all1": which does the same as above, but using column 1 as abscissae "python csvplot.py 1 2 5": which plots columns 2 and 5 against column 1... Would be nice, if anybody has an idea, how to achieve this!? Regards! Fabian - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2005. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] install problem with python 2.5
Hi John, * John Hunter <[EMAIL PROTECTED]> wrote: >>>>>> "Fabian" == Fabian Braennstroem <[EMAIL PROTECTED]> writes: > >>> I am trying to install matplotlib 0.87.7 with my newly separate >>> installed python 2.5. For this I installed 'pygtk 2.4.1' and >>> numpy 1.0 using this python 2.5 installation. Now, running >>> 'python2.5 setup.py build' I get this error: >>> >>> ... /usr/include/pygtk-2.0/pygobject.h:140: error: expected >>> `,' or `...' before "typename" > >>> it seems, that matplotlib tries to use the old installed pygtk >>> version; the new one is located in /usr/local/include/... > > Yes, this is the old pygtk bug covered in this FAQ > > http://matplotlib.sourceforge.net/faq.html#PYGTK24 Sorry, I did not see that ... thanks! > > maptlotlib gets its gtk configuration from the pkg-config commands, eg > > > pkg-config --cflags-only-I gtk+-2.0 > > make sure your pkg-config is picking up the new pygtk you have > installed, and if not set the PKG_CONFIG_PATH environment variable. > See 'man pkg-config' for more details. > >Fabian> from matplotlib.pylab import * File >Fabian> "/opt/python-2.5//lib/python2.5/site-packages/matplotlib/pylab.py", >Fabian> line 199, in import mlab #so I can override hist, >Fabian> psd, etc... File >Fabian> "/opt/python-2.5//lib/python2.5/site-packages/matplotlib/mlab.py", >Fabian> line 6 4, in import nxutils File >Fabian> > "/opt/python-2.5//lib/python2.5/site-packages/matplotlib/nxutils.py", >Fabian> lin e 17, in from matplotlib._ns_nxutils import * >Fabian> ImportError: No module named _ns_nxutils >>>>> import numpy > > It appears you did not have numpy installed when you built > matplotlib. Grab numpy-1.0 from http://numpy.scipy.org and install it > (it's an easy install compared to mpl). Then rebuild and reinstall > matplotlib and you should be good to go. The numpy module is actually working (at least I could do an 'import numpy' without any response and was installed before the matplotlib!? I try it again ... Thanks and Greetings! Fabian - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys - and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] install problem with python 2.5
Hi, me again :-) * Fabian Braennstroem <[EMAIL PROTECTED]> wrote: > Hi, > > I am trying to install matplotlib 0.87.7 with my newly > separate installed python 2.5. For this I installed 'pygtk > 2.4.1' and numpy 1.0 using this python 2.5 installation. > Now, running 'python2.5 setup.py build' I get this error: > > ... > /usr/include/pygtk-2.0/pygobject.h:140: error: expected `,' or `...' before > "typename" > /usr/include/pygtk-2.0/pygobject.h:147: error: expected `,' or `...' before > "typename" > ./CXX/Extensions.hxx: In constructor > `Py::PythonExtension::PythonExtension() [with T = BufferRegion]': > src/_backend_agg.h:50: instantiated from here > ./CXX/Extensions.hxx:477: warning: right-hand operand of comma has no effect > ./CXX/Extensions.hxx: In constructor > `Py::PythonExtension::PythonExtension() [with T = LazyValue]': > src/_transforms.h:57: instantiated from here > ./CXX/Extensions.hxx:477: warning: right-hand operand of comma has no effect > ./CXX/Extensions.hxx: In constructor > `Py::PythonExtension::PythonExtension() [with T = Func]': > src/_transforms.h:379: instantiated from here > ./CXX/Extensions.hxx:477: warning: right-hand operand of comma has no effect > ./CXX/Extensions.hxx: In constructor > `Py::PythonExtension::PythonExtension() [with T = FuncXY]': > src/_transforms.h:466: instantiated from here > ./CXX/Extensions.hxx:477: warning: right-hand operand of comma has no effect > ./CXX/Extensions.hxx: In constructor > `Py::PythonExtension::PythonExtension() [with T = Transformation]': > src/_transforms.h:538: instantiated from here > ./CXX/Extensions.hxx:477: warning: right-hand operand of comma has no effect > error: Command "gcc -pthread -fno-strict-aliasing -DNDEBUG -g -O3 -Wall > -Wstrict-prototypes -fPIC -I/usr/local/include -I/usr/include -I. -Isrc > -Iswig -Iagg23/include -I. -I/usr/local/include -I/usr/include -I. > -I/usr/local/include/freetype2 -I/usr/include/freetype2 -I./freetype2 > -Isrc/freetype2 -Iswig/freetype2 -Iagg23/include/freetype2 -I./freetype2 > -I/usr/local/include/freetype2 -I/usr/include/freetype2 -I./freetype2 > -I/usr/local/include -I/usr/include -I. -I/usr/include/pygtk-2.0 > -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/gtk-2.0 > -I/usr/lib/gtk-2.0/include -I/usr/X11R6/include -I/usr/include/atk-1.0 > -I/usr/include/pango-1.0 -I/usr/include/freetype2 > -I/usr/include/freetype2/config -I/usr/include/glib-2.0 > -I/usr/lib/glib-2.0/include -I/opt/python-2.5/include/python2.5 -c > src/_gtkagg.cpp -o build/temp.linux-i686-2.5/src/_gtkagg.o" failed with exit > status 1 > > it seems, that matplotlib tries to use the old installed pygtk version; the > new > one is located in /usr/local/include/... I could fix this problem with setting: BUILD_AGG = 0 BUILD_GTKAGG = 0 BUILD_GTK = 1 but now, I get the following problem: node1~$ python2.5 [05 Dec 7:45am] Python 2.5 (r25:51908, Dec 2 2006, 19:02:24) [GCC 3.4.5 20051201 (Red Hat 3.4.5-2)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import pylab The import of the numpy version of the nxutils module, _nsnxutils, failed. This is is either because numpy was unavailable when matplotlib was compiled, because a dependency of _nsnxutils could not be satisfied, or because the build flag for this module was turned off in setup.py. If it appears that _nsnxutils was not built, make sure you have a working copy of numpy and then re-install matplotlib. Otherwise, the following traceback gives more details: Traceback (most recent call last): File "", line 1, in File "/opt/python-2.5//lib/python2.5/site-packages/pylab.py", line 1, in from matplotlib.pylab import * File "/opt/python-2.5//lib/python2.5/site-packages/matplotlib/pylab.py", line 199, in import mlab #so I can override hist, psd, etc... File "/opt/python-2.5//lib/python2.5/site-packages/matplotlib/mlab.py", line 6 4, in import nxutils File "/opt/python-2.5//lib/python2.5/site-packages/matplotlib/nxutils.py", lin e 17, in from matplotlib._ns_nxutils import * ImportError: No module named _ns_nxutils >>> import numpy >>> I checked the setup script; it says: # these are not optional BUILD_FT2FONT = 1 BUILD_CONTOUR = 1 BUILD_NXUTILS = 1 so _nxutils should be installed and numpy loads without any problems!? Does anybody have an idea? Greetings! Fabian - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net'
[Matplotlib-users] install problem with python 2.5
Hi, I am trying to install matplotlib 0.87.7 with my newly separate installed python 2.5. For this I installed 'pygtk 2.4.1' and numpy 1.0 using this python 2.5 installation. Now, running 'python2.5 setup.py build' I get this error: ... /usr/include/pygtk-2.0/pygobject.h:140: error: expected `,' or `...' before "typename" /usr/include/pygtk-2.0/pygobject.h:147: error: expected `,' or `...' before "typename" ./CXX/Extensions.hxx: In constructor `Py::PythonExtension::PythonExtension() [with T = BufferRegion]': src/_backend_agg.h:50: instantiated from here ./CXX/Extensions.hxx:477: warning: right-hand operand of comma has no effect ./CXX/Extensions.hxx: In constructor `Py::PythonExtension::PythonExtension() [with T = LazyValue]': src/_transforms.h:57: instantiated from here ./CXX/Extensions.hxx:477: warning: right-hand operand of comma has no effect ./CXX/Extensions.hxx: In constructor `Py::PythonExtension::PythonExtension() [with T = Func]': src/_transforms.h:379: instantiated from here ./CXX/Extensions.hxx:477: warning: right-hand operand of comma has no effect ./CXX/Extensions.hxx: In constructor `Py::PythonExtension::PythonExtension() [with T = FuncXY]': src/_transforms.h:466: instantiated from here ./CXX/Extensions.hxx:477: warning: right-hand operand of comma has no effect ./CXX/Extensions.hxx: In constructor `Py::PythonExtension::PythonExtension() [with T = Transformation]': src/_transforms.h:538: instantiated from here ./CXX/Extensions.hxx:477: warning: right-hand operand of comma has no effect error: Command "gcc -pthread -fno-strict-aliasing -DNDEBUG -g -O3 -Wall -Wstrict-prototypes -fPIC -I/usr/local/include -I/usr/include -I. -Isrc -Iswig -Iagg23/include -I. -I/usr/local/include -I/usr/include -I. -I/usr/local/include/freetype2 -I/usr/include/freetype2 -I./freetype2 -Isrc/freetype2 -Iswig/freetype2 -Iagg23/include/freetype2 -I./freetype2 -I/usr/local/include/freetype2 -I/usr/include/freetype2 -I./freetype2 -I/usr/local/include -I/usr/include -I. -I/usr/include/pygtk-2.0 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/gtk-2.0 -I/usr/lib/gtk-2.0/include -I/usr/X11R6/include -I/usr/include/atk-1.0 -I/usr/include/pango-1.0 -I/usr/include/freetype2 -I/usr/include/freetype2/config -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/opt/python-2.5/include/python2.5 -c src/_gtkagg.cpp -o build/temp.linux-i686-2.5/src/_gtkagg.o" failed with exit status 1 it seems, that matplotlib tries to use the old installed pygtk version; the new one is located in /usr/local/include/... Can I adjust this problem somewhere? Greetings! Fabian - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys - and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] matplotlib with openoffice
Hi, since openoffice can use python as macro language, does anyone know or has an idea, if is possible to use matplotlib for plotting inside it. Would be nice to create diagrams just be marking columns!? Greetings! Fabian - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys -- and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users