[Matplotlib-users] plot with marker color coded according to z-value
Hi, is there a way to adjust the marker color in a xy-plot in relation to the value of a third parameter. Something as the following - not working - example 1. Example 2 is working but rather slow for large arrays. cheers Elmar # example 1 import matplotlib.pyplot as plt x = [1,2,3,4] y = x c = ((1.0, 0.0, 0.0), (0.8, 0.1, 0.1), (0.6, 0.2, 0.6), (0.4, 0.3, 0.3)) plt.plot(x,y, color=c, marker='s') plt.show() example 2: import matplotlib.pyplot as plt x = [1,2,3,4] y = x c = ((1.0, 0.0, 0.0), (0.8, 0.1, 0.1), (0.6, 0.2, 0.6), (0.4, 0.3, 0.3)) for i in range(len(x)): plt.plot(x[i], y[i], color=c[i], marker='s') plt.show() -- Everyone hates slow websites. So do we. Make your web apps faster with AppDynamics Download AppDynamics Lite for free today: http://p.sf.net/sfu/appdyn_sfd2d_oct ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] plot with marker color coded according to z-value
thanks for help, finally I found the following solution elmar import numpy as np import matplotlib as mpl import matplotlib.pyplot as plt N = 200 x = np.linspace(0,1,N) y = np.random.randn(N) z = np.random.randn(N)*2+5 cm = mpl.cm.get_cmap('RdYlBu') sc = plt.scatter(x, y, c=z, vmin=min(z), vmax=max(z), s=35, cmap=cm) plt.colorbar(sc) plt.show() Am 19.10.2012 21:59, schrieb Joe Kington: plt.scatter(x, y, c=z, marker='s') plt.colorbar() -- Everyone hates slow websites. So do we. Make your web apps faster with AppDynamics Download AppDynamics Lite for free today: http://p.sf.net/sfu/appdyn_sfd2d_oct ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] plot with marker color coded according to z-value
Am 19.10.2012 23:26, schrieb Damon McDougall: Correct me if I'm wrong, but I don't even think you need them. I think the default cmap behaviour is to normalise to the min and max of the data. yes, default cmap behaviour will normalise to the min and max of the data. -- Everyone hates slow websites. So do we. Make your web apps faster with AppDynamics Download AppDynamics Lite for free today: http://p.sf.net/sfu/appdyn_sfd2d_oct ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] python3 and matplotlib installation problem
Hi, just installed matplotlib by doing git clone https://github.com/matplotlib/matplotlib cd matplotlib python3 setup.py build sudo python3 setup.py install When I import matplotlib.pyplot I get the following error message. Any help is wellcome Elmar Python 3.2.1 (default, Jul 18 2011, 16:24:40) [GCC] on linux2 Type copyright, credits or license() for more information. import numpy import matplotlib numpy.__version__ '1.6.2' matplotlib.__version__ '1.2.x' import matplotlib.pyplot Traceback (most recent call last): File pyshell#4, line 1, in module import matplotlib.pyplot File /usr/local/lib/python3.2/site-packages/matplotlib/pyplot.py, line 26, in module from matplotlib.figure import Figure, figaspect File /usr/local/lib/python3.2/site-packages/matplotlib/figure.py, line 19, in module from .axes import Axes, SubplotBase, subplot_class_factory File /usr/local/lib/python3.2/site-packages/matplotlib/axes.py, line 21, in module import matplotlib.dates as mdates File /usr/local/lib/python3.2/site-packages/matplotlib/dates.py, line 122, in module from dateutil.rrule import rrule, MO, TU, WE, TH, FR, SA, SU, YEARLY, \ File /usr/local/lib/python3.2/site-packages/dateutil/rrule.py, line 55 raise ValueError, Can't create weekday with n == 0 ^ SyntaxError: invalid syntax -- 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-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] python3 and matplotlib installation problem
Am 28.07.2012 21:46, schrieb Christoph Gohlke: On 7/28/2012 12:29 PM, elmar werling wrote: Hi, just installed matplotlib by doing git clone https://github.com/matplotlib/matplotlib cd matplotlib python3 setup.py build sudo python3 setup.py install When I import matplotlib.pyplot I get the following error message. Any help is wellcome Elmar Python 3.2.1 (default, Jul 18 2011, 16:24:40) [GCC] on linux2 Type copyright, credits or license() for more information. import numpy import matplotlib numpy.__version__ '1.6.2' matplotlib.__version__ '1.2.x' import matplotlib.pyplot Traceback (most recent call last): File pyshell#4, line 1, in module import matplotlib.pyplot File /usr/local/lib/python3.2/site-packages/matplotlib/pyplot.py, line 26, in module from matplotlib.figure import Figure, figaspect File /usr/local/lib/python3.2/site-packages/matplotlib/figure.py, line 19, in module from .axes import Axes, SubplotBase, subplot_class_factory File /usr/local/lib/python3.2/site-packages/matplotlib/axes.py, line 21, in module import matplotlib.dates as mdates File /usr/local/lib/python3.2/site-packages/matplotlib/dates.py, line 122, in module from dateutil.rrule import rrule, MO, TU, WE, TH, FR, SA, SU, YEARLY, \ File /usr/local/lib/python3.2/site-packages/dateutil/rrule.py, line 55 raise ValueError, Can't create weekday with n == 0 ^ SyntaxError: invalid syntax Install python-dateutil 2.1 http://labix.org/python-dateutil/. Do not use not dateutil 1.5 or the version included with matplotlib. See also https://github.com/matplotlib/matplotlib/issues/983 Christoph -- 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/ thank you, will test it tommorow, first i have to install setuptools -- 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-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Problem with ani.save
yeap, thanks a lot. after installing ffmpeg everything is working smoothly. On 29.12.2011 12:12, Fabrice Silva wrote: It seems that the Animation.save method assume that ffmpeg is installed, as there is no cmd_gen keyword argument for this method. As a quick and dirty fix, you may change the imposed commandline constructor overloading the ffmpeg_cmd method ani.ffmpeg_cmd = ani.mencoder_cmd or, if you prefer using gstreamer, something like that (not tested) def gst_cmd(fname, fps, codec, frame_prefix): cmd = 'gst-launch multifilesrc location={prefix}%%04d.png index={i0} num-buffers={nb} '\ 'caps=image/png,framerate=\(fraction\){fps}/1 ! pngdec ! ffmpegcolorspace ! '\ '{codec_f} ! filesink location={fname} ' nb_frames = len([tmp for tmp in os.listdir('./') if tmp.endswith('.png') and tmp.startswith(frame_prefix)]) return cmd.format(prefix=frame_prefix, i0=0, nb=nb_frames, fps=fps, codec_f=codec+'mux', fname=fname) ani.ffmpeg_cmd = gst_cmd -- Ridiculously easy VDI. With Citrix VDI-in-a-Box, you don't need a complex infrastructure or vast IT resources to deliver seamless, secure access to virtual desktops. With this all-in-one solution, easily deploy virtual desktops for less than the cost of PCs and save 60% on VDI infrastructure costs. Try it free! http://p.sf.net/sfu/Citrix-VDIinabox ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] Problem with ani.save
Hi, running the AnimatedImage.py I get the appended error message. What's wrong? Cheers Elmar In [5]: run AnimatedImage.py ERROR: An unexpected error occurred while tokenizing input The following traceback may be corrupted or invalid The error message is: ('EOF in multi-line statement', (23, 0)) --- OSError Traceback (most recent call last) /usr/local/lib/python2.7/dist-packages/IPython/utils/py3compat.pyc in execfile(fname, *where) 173 else: 174 filename = fname -- 175 __builtin__.execfile(filename, *where) /home/elmar/PyScripts/examples_mpl/AnimatedImage.py in module() 27 repeat_delay=1000) 28 --- 29 ani.save('dynamic_images.mp4') 30 31 /usr/local/lib/python2.7/dist-packages/matplotlib/animation.pyc in save(self, filename, fps, codec, clear_temp, frame_prefix) 125 self._fig.savefig(fname) 126 -- 127 self._make_movie(filename, fps, codec, frame_prefix) 128 129 #Delete temporary files /usr/local/lib/python2.7/dist-packages/matplotlib/animation.pyc in _make_movie(self, fname, fps, codec, frame_prefix, cmd_gen) 162 verbose.report('Animation._make_movie running command: %s'%' '.join(command)) 163 proc = Popen(command, shell=False, -- 164 stdout=PIPE, stderr=PIPE) 165 proc.wait() 166 /usr/lib/python2.7/subprocess.pyc in __init__(self, args, bufsize, executable, stdin, stdout, stderr, preexec_fn, close_fds, shell, cwd, env, universal_newlines, startupinfo, creationflags) 677 p2cread, p2cwrite, 678 c2pread, c2pwrite, -- 679 errread, errwrite) 680 681 if mswindows: /usr/lib/python2.7/subprocess.pyc in _execute_child(self, args, executable, preexec_fn, close_fds, cwd, env, universal_newlines, startupinfo, creationflags, shell, p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite) 1237 if fd is not None: 1238 os.close(fd) - 1239 raise child_exception 1240 1241 -- Ridiculously easy VDI. With Citrix VDI-in-a-Box, you don't need a complex infrastructure or vast IT resources to deliver seamless, secure access to virtual desktops. With this all-in-one solution, easily deploy virtual desktops for less than the cost of PCs and save 60% on VDI infrastructure costs. Try it free! http://p.sf.net/sfu/Citrix-VDIinabox ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] Ternary Plot
Hi, could not found anything like plot_ternary() in the matplotlib documentation. Is there an easy to use method to plot data points and lines in a ternary plot using matplotlib? Any hint is wellcome Elmar -- RSA(R) Conference 2012 Save $700 by Nov 18 Register now http://p.sf.net/sfu/rsa-sfdev2dev1 ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users