[Matplotlib-users] Ploting a sparse matrix with imshow
Dear matplotlib users, I am trying to plot a nxn symetric matrix containing zeros (in white) and ones (in black). Quite simple, I guessed. For that I use imshow as follows: imshow(W, cmap=cm.binary) # W is a Numpy Array with shape (100,100) However, this does not work the way i would like (the ones appear very blur). I would need the correct representation of a grid where the possition 0,0 is simply the entry W[0,0] of my array. There should be an easy way to plot this matrix, bu I cannot figure it out. Thanks for your help in advance. Jose -- Virtualization Cloud Management Using Capacity Planning Cloud computing makes use of virtualization - but cloud computing also focuses on allowing computing to be delivered as a service. http://www.accelacomm.com/jaw/sfnl/114/51521223/___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] Distance between y-x digits and the corresponding labels
Hi everybody is there anybody to set the distance between the x/y axis numbers and the corresponding axis labels. I found the default distance is rather small, and I would like to enlarge it. I was playing around in .matplolibrc but I did not find anything useful. Any suggestion?? Thanks in advance Jose -- The ultimate all-in-one performance toolkit: Intel(R) Parallel Studio XE: Pinpoint memory and threading errors before they happen. Find and fix more than 250 security defects in the development cycle. Locate bottlenecks in serial and parallel code that limit performance. http://p.sf.net/sfu/intel-dev2devfeb___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] Adding 2 Line2D objects to a Subplot
Hi everybody I wanted to collect a combination of plots to insert then in a subplot. I choose to create Line2D objects to use the .add_line() method of the AxesSubplot class, but unfortunately this does lead to the desired results. Here my dummy version: from matplotlib.lines import Line2D from matplotlib.pyplot import figure, show import numpy as np def subplot_foo(n): returns a the combination of 2 Line2D instances x = np.arange(0, 200, 0.1) y = np.random.randn(len(x)) print len(x) #y2 = y+n line1 = Line2D(x, y, color = 'k') #line2 = Line2D(x,y2, 'r') #return line1+line2 return line1 fig = figure() # create Figure object for i in range(1,5): ax = fig.add_subplot(2,2,i) ax.add_line(subplot_foo(i)) show() First, the Line2D object does not represent the plot I want to create. Second, I cannot collect various Line2D objects into a Subplot. Any good idea around? -- Lotusphere 2011 Register now for Lotusphere 2011 and learn how to connect the dots, take your collaborative environment to the next level, and enter the era of Social Business. http://p.sf.net/sfu/lotusphere-d2d___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] using plot(single_object)
I was wondering if there is an easy way to combine two vectors (x and y) into a single object to be ploted with the plot() method in matplotlib. Untill now, I did something like: import matplotlib.pyplot as plt x = np.nplinspace(0,5,1000) y = np.ones_like(x) plt.plot(x,y) # need an object here plt.show() But I would like to use plt.plot(my_object, 'r'). I tried to combine x and y in lists of lists, NumPy matrices, with zip, etc...but it only plots a collection of plots. Thanks a lot in advance. -- Oracle to DB2 Conversion Guide: Learn learn about native support for PL/SQL, new data types, scalar functions, improved concurrency, built-in packages, OCI, SQL*Plus, data movement tools, best practices and more. http://p.sf.net/sfu/oracle-sfdev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] To modify 'extend' in a 2D plot
Dear Matplotlib users, I need to plot a (time x distance) array of measurements associated with a color bar. Although time is fixed (i.e 0, 1, 2, etc..), to the number of rows, the distances are not evenly distributed (e.g are fixed to 1.22, 1.53, 1.84, 2,11.), although are always constant. My question is simple. How can I modify the 'extent ' argument so that I represent the real distance values, and not simply evenly distributed events? Any suggestion or comment would be greatly appreciated! A minimal example plot is given bellow: Thanks a lot in advance Jose. #= import matplotlib.pyplot as plt import numpy as np # fake data random = np.random.randint(0, 300, size=(55,127) fig = plt.figure() ax = fig.add_subplot(111) myaspect = 100.0 # How can adjust this data to my REAL distances # (e.g 1.22, 1.53, 1.84, 2,01) ???. myextent=[-400,800,0,10] cax = ax.imshow(random, aspect = myaspect, extent=myextent, vmin=0, vmax=300) ax.set_ylabel('Time (ms)') ax.set_xlabel('Distance (mm)') colorbar = fig.colorbar(cax, ticks=[0,100,200,300,400]) colorbar.ax.set_yticklabels(['0','100','200','300','400']) colorbar.ax.set_ylabel('Measurement') plt.show() #= -- ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users