[Matplotlib-users] ramp shaped bars?
I am a newbie Python programmer trying to make 3d barplots like http://matplotlib.sourceforge.net/examples/mplot3d/bars3d_demo.html this one on the Matplotlib site. When I run the demo source (python bars3d_demo.py) it works fine. I then changed the way xs and ys are assigned, to xs = np.array([1.,2.,3.]) # was xs = np.arange(20) ys = np.array([1.,2.,3.]) # was ys = np.random.rand(20) ax.bar(xs, ys, zs=1, zdir='y', color='r', alpha=0.8) (ditto for two other data sets) Now the bars are triangles. The right side of each bar is of the correct height, but the left side of each bar starts at zero. Python version 2.6.5 Matplotlib version 1.0.1 Ubuntu 10.04 Thanks in advance! Complete source of my (misbehaving) program: from mpl_toolkits.mplot3d import Axes3D import matplotlib.pyplot as plt import numpy as np fig = plt.figure() ax = fig.add_subplot(111, projection='3d') xs = np.array([1.,2.,3.]) ys = np.array([1.,2.,3.]) ax.bar(xs, ys, zs=1, zdir='y', color='r', alpha=0.8) ys = np.array([1.,4.,9.]) ax.bar(xs, ys, zs=2, zdir='y', color='r', alpha=0.8) ys = np.array([2.,1.,2.]) ax.bar(xs, ys, zs=3, zdir='y', color='r', alpha=0.8) ax.set_xlabel('X') ax.set_ylabel('Y') ax.set_zlabel('Z') plt.show() -- View this message in context: http://old.nabble.com/ramp-shaped-bars--tp31236873p31236873.html Sent from the matplotlib - users mailing list archive at Nabble.com. -- Enable your software for Intel(R) Active Management Technology to meet the growing manageability and security demands of your customers. Businesses are taking advantage of Intel(R) vPro (TM) technology - will your software be a part of the solution? Download the Intel(R) Manageability Checker today! http://p.sf.net/sfu/intel-dev2devmar ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Specifying exactly zero inter-plot spacing in nested grids
Thanks Paul, On 24 March 2011 19:23, Paul Ivanov pivanov...@gmail.com wrote: I think you can get the desired functionality with gridspec alone. Take a look at doc/users/plotting/examples/demo_gridspec06.py which you can find here https://github.com/matplotlib/matplotlib/blob/f1c8/doc/users/plotting/examples/demo_gridspec06.py I've played around with this example, and it seems like I'm not quite there yet. I should add that I'm using imshow rather than plot here. In this case, the inter-inner-grid spacing becomes dependent on the figure aspect ratio. I presume this is because it is trying to maintain (as it should) the aspect ratio of the images, but it would be nice for it do this my manipulating only the outside margins, and honour the wspace=0., hspace=0. as requested. Here's a simplified version of the above script to illustrate my point: import matplotlib.pyplot as plt import matplotlib.gridspec as gridspec import numpy as np from itertools import product f = plt.figure(figsize=(9, 9)) # gridspec inside gridspec outer_grid = gridspec.GridSpec(2, 3, wspace=0.0, hspace=0.0) for i in xrange(6): inner_grid = gridspec.GridSpecFromSubplotSpec(3, 3, subplot_spec=outer_grid[i], wspace=0.0, hspace=0.0) for j, (c, d) in enumerate(product(range(1, 4), repeat=2)): ax = plt.Subplot(f, inner_grid[j]) ax.imshow(np.ones((10,10)) * c * d, vmin=1, vmax=9) ax.set_xticks([]) ax.set_yticks([]) f.add_subplot(ax) all_axes = f.get_axes() #show only the outside spines for ax in all_axes: for sp in ax.spines.values(): sp.set_visible(False) if ax.is_first_row(): ax.spines['top'].set_visible(True) if ax.is_last_row(): ax.spines['bottom'].set_visible(True) if ax.is_first_col(): ax.spines['left'].set_visible(True) if ax.is_last_col(): ax.spines['right'].set_visible(True) plt.show() Of course, it is relatively trivial to calculate the correct figure aspect ratio in this case, but after adding in other elements like labels, this can become problematic. Is it possible to specify exactly the inner spacing, and make the outer margins automatically adjusted to get everything to fit nicely? Thanks, Angus -- AJC McMorland Post-doctoral research fellow Neurobiology, University of Pittsburgh -- Enable your software for Intel(R) Active Management Technology to meet the growing manageability and security demands of your customers. Businesses are taking advantage of Intel(R) vPro (TM) technology - will your software be a part of the solution? Download the Intel(R) Manageability Checker today! http://p.sf.net/sfu/intel-dev2devmar ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] ramp shaped bars?
On 25 March 2011 07:31, jford14685 jford14...@gmail.com wrote: I am a newbie Python programmer trying to make 3d barplots like http://matplotlib.sourceforge.net/examples/mplot3d/bars3d_demo.html this one on the Matplotlib site. When I run the demo source (python bars3d_demo.py) it works fine. I then changed the way xs and ys are assigned, to xs = np.array([1.,2.,3.]) # was xs = np.arange(20) ys = np.array([1.,2.,3.]) # was ys = np.random.rand(20) ax.bar(xs, ys, zs=1, zdir='y', color='r', alpha=0.8) (ditto for two other data sets) Now the bars are triangles. The right side of each bar is of the correct height, but the left side of each bar starts at zero. Here's another data point. My guess is this is a bug with Axes3D: I can recreate the problem with 3 bars, but with 4 bars everything works okay. On my setup, with exactly 4 bars, the leftmost edge of the bars doesn't get a border, so something possibly related is going on there too. Angus. -- AJC McMorland Post-doctoral research fellow Neurobiology, University of Pittsburgh -- Enable your software for Intel(R) Active Management Technology to meet the growing manageability and security demands of your customers. Businesses are taking advantage of Intel(R) vPro (TM) technology - will your software be a part of the solution? Download the Intel(R) Manageability Checker today! http://p.sf.net/sfu/intel-dev2devmar ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] use of data coordinates in axhline?
What the best way to to use data coordinates rather than axes coordinates for xmin and xmax with axhline? Here's my kludgy solution, but it's not elegant: plot(arange(20)) ax = gca() inv = ax.transAxes.inverted() x = inv.transform(ax.transData.transform([10,0])) ax.axhline(10, xmax=x[0]) I tried doing this: ax.axhline(15, xmax=15, transform=ax.transData) but I get: ValueError: 'transform' is not allowed as a kwarg;axhline generates its own transform. which is a bit strange since transform is listed in the kwargs in the help, though there is also this: Valid kwargs are :class:`~matplotlib.lines.Line2D` properties, with the exception of 'transform': which could have two meanings: one is that all the kwargs listed are Line2D properties except 'transform' which is a valid kwarg, but not a Line2D property, OR even though 'transform' is listed, it's not a valid kwarg. Somewhat confusing especially given the ValueError... M -- Enable your software for Intel(R) Active Management Technology to meet the growing manageability and security demands of your customers. Businesses are taking advantage of Intel(R) vPro (TM) technology - will your software be a part of the solution? Download the Intel(R) Manageability Checker today! http://p.sf.net/sfu/intel-dev2devmar ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] Access to contents of bins of a matplotlib histogram
Hi, I would like to access values in the bins of a matplotlib histogram. The following example script is an attempt to do this. Clearly pdf contains floating point numbers, but I am unable to access them. Help with this problem would be much appreciated. Chris -- import numpy as np import matplotlib.pyplot as plt fig = plt.figure() ax = fig.add_subplot(111) mu, sigma = 100, 15 x = mu + sigma * np.random.randn(20) #Generate the histogram of the data. Example from Matplotlib documentation n, bins, patches = plt.hist(x, 50, normed=True, facecolor='g', alpha=0.75) plt.xlabel('Smarts') plt.ylabel('Probability') plt.title('Histogram of IQ') plt.text(60, .025, r'$\mu=100,\ \sigma=15$') plt.axis([40, 160, 0, 0.03]) plt.grid(True) #From Matplotlib documentation. #normed: If True, the first element of the return tuple will be the counts normalized #to form a probability density, i.e., n/(len(x)*dbin). In a probability density, #the integral of the histogram should be 1; you can verify that with a trapezoidal #integration of the probability density function. pdf, bins, patches = ax.hist(x, 50, normed=True, facecolor='g', alpha=0.75) #print pdf shows pdf contains the value in each bin of the normed histogram print pdf = , pdf print Integration of PDF = , np.sum(pdf * np.diff(bins)) #How to access values in pdf? Various tries made but none successful. Example attempt shown count=0 for line in open(pdf,'r+'): x=pdf.readline() z=('%.10f' % float(x)) count=count+1 print count = , count -- Enable your software for Intel(R) Active Management Technology to meet the growing manageability and security demands of your customers. Businesses are taking advantage of Intel(R) vPro (TM) technology - will your software be a part of the solution? Download the Intel(R) Manageability Checker today! http://p.sf.net/sfu/intel-dev2devmar ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] disable shortcut keys
Hello, I have written a program which plots some data and then performs certain actions when the down arrow key is pressed. The problem is that the down arrow key is also used to move the focus to the pylab tool bar at the bottom of the window. It seems to move the focus to the tool bar before it gets to my key press call back function which handles all key strokes, which implies that I cannot do anything to stop it from performing the default behavior from my key press function. I was curious if anyone knew of a way to disable the default short cuts in pylab so that the down arrow will not switch focus to the new window. If someone knows of a way to override the default behavior, that would also suffice. My backend is GTKAgg. Regards, Neko -- Enable your software for Intel(R) Active Management Technology to meet the growing manageability and security demands of your customers. Businesses are taking advantage of Intel(R) vPro (TM) technology - will your software be a part of the solution? Download the Intel(R) Manageability Checker today! http://p.sf.net/sfu/intel-dev2devmar___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] orienting 2d plots in 3d
I would like to construct a 3d plot consisting of several 2d quiver plots on orthogonal, intersecting planes. Is this possible with matplotlib? In matlab I do it by construct several 2d graph and then reorienting them in the 3d space using the 'rotate' function. E.g. xaxis = [1 0 0]; h = quiver('v6', z, y, w, v, 'k'); rotate(h, xaxis, 90, [0 0 0]); This produces a 2d quiver plot of [v,w](y,z) oriented along the y,z axes of the 3d space, and then I do the same for x,y and x,z quiver plots. Any ideas for matplotib 3d? Thanks! John Gibson -- View this message in context: http://old.nabble.com/orienting-2d-plots-in-3d-tp31140854p31140854.html Sent from the matplotlib - users mailing list archive at Nabble.com. -- Enable your software for Intel(R) Active Management Technology to meet the growing manageability and security demands of your customers. Businesses are taking advantage of Intel(R) vPro (TM) technology - will your software be a part of the solution? Download the Intel(R) Manageability Checker today! http://p.sf.net/sfu/intel-dev2devmar ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] savefig not deducing file format
Hi all, I call savefig by passing to it a file-like object but it appears to not get the graphics format right: f = open('not_a_pdf.pdf', 'w') plot([1,2,3]) savefig(f) but it produces a PNG image. Can anybody confirm this? I am on matplotlib 0.99.3 Cheers, -- Giovanni L. Ciampaglia PhD Student University of Lugano, MACS Lab -- Enable your software for Intel(R) Active Management Technology to meet the growing manageability and security demands of your customers. Businesses are taking advantage of Intel(R) vPro (TM) technology - will your software be a part of the solution? Download the Intel(R) Manageability Checker today! http://p.sf.net/sfu/intel-dev2devmar ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] 3d Surface-Contour Plot
Hello, I basically have a Chi-Squared distribution that is dependent on 3 variables. eg. X2(x, y, z) What I would like to do is be able to plot the chi-squared + 1 surface in 3-dimensions. eg. I would like to have the three axes as x, y and z. and then have a surface (its going to look like a closed blob effectively) that maps the chi-squared plus one surface. I have no idea how to do this though. Is it possible? any ideas? -- View this message in context: http://old.nabble.com/3d-Surface-Contour-Plot-tp31143849p31143849.html Sent from the matplotlib - users mailing list archive at Nabble.com. -- Enable your software for Intel(R) Active Management Technology to meet the growing manageability and security demands of your customers. Businesses are taking advantage of Intel(R) vPro (TM) technology - will your software be a part of the solution? Download the Intel(R) Manageability Checker today! http://p.sf.net/sfu/intel-dev2devmar ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] Different xtick pads for subplots within figure
I'm plotting a series of sub plots within a figure, where most are small sub plots, but the last one spans the width of the figure. For the final subplot only, I want to set the xtick pad to 20. Something like: import matplotlib.pyplot as plt fig = plt.figure() ax1 = fig.add_subplot(2,2,1) ax2 = fig.add_subplot(2,2,2) ax3 = fig.add_subplot(2,1,3) plt.setp(ax3.xaxis.get_major_ticks(), pad=20) plt.show() But this doesn't have any effect on the final plot. I've also tried getting the ticks individually and calling set_pad(20) i.e.: for tick in ax3.xaxis.get_major_ticks(): tick.set_pad(20) But this does't work either. Anyone have an ideas? -- View this message in context: http://old.nabble.com/Different-xtick-pads-for-subplots-within-figure-tp31150430p31150430.html Sent from the matplotlib - users mailing list archive at Nabble.com. -- Enable your software for Intel(R) Active Management Technology to meet the growing manageability and security demands of your customers. Businesses are taking advantage of Intel(R) vPro (TM) technology - will your software be a part of the solution? Download the Intel(R) Manageability Checker today! http://p.sf.net/sfu/intel-dev2devmar ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] savefig not deducing file format
Le mardi 15 mars 2011 à 11:30 +0100, Giovanni Luca Ciampaglia a écrit : Hi all, I call savefig by passing to it a file-like object but it appears to not get the graphics format right: f = open('not_a_pdf.pdf', 'w') plot([1,2,3]) savefig(f) but it produces a PNG image. Can anybody confirm this? I am on matplotlib 0.99.3 Cheers, You may give savefig a filename (string 'tmp.pdf') instead of the file descriptor (file object f), or use the format keyword argument. Automatic format selection is not handled for file object (as visible in backend_bases.py:FigureCanvasBase.print_figure method). -- Fabrice -- Enable your software for Intel(R) Active Management Technology to meet the growing manageability and security demands of your customers. Businesses are taking advantage of Intel(R) vPro (TM) technology - will your software be a part of the solution? Download the Intel(R) Manageability Checker today! http://p.sf.net/sfu/intel-dev2devmar ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] ramp shaped bars?
Well, what do you know? For once, the call of the noob, Hey! there must be a bug speaks truth. Thanks, Angus! I added a little code to duplicate the last point until the array length is at least 5, and everything looks just fine. On 03/25/2011 01:10 PM, Angus McMorland wrote: On 25 March 2011 07:31, jford14685jford14...@gmail.com wrote: I am a newbie Python programmer trying to make 3d barplots like http://matplotlib.sourceforge.net/examples/mplot3d/bars3d_demo.html this one on the Matplotlib site. When I run the demo source (python bars3d_demo.py) it works fine. I then changed the way xs and ys are assigned, to xs = np.array([1.,2.,3.]) # was xs = np.arange(20) ys = np.array([1.,2.,3.]) # was ys = np.random.rand(20) ax.bar(xs, ys, zs=1, zdir='y', color='r', alpha=0.8) (ditto for two other data sets) Now the bars are triangles. The right side of each bar is of the correct height, but the left side of each bar starts at zero. Here's another data point. My guess is this is a bug with Axes3D: I can recreate the problem with 3 bars, but with4 bars everything works okay. On my setup, with exactly 4 bars, the leftmost edge of the bars doesn't get a border, so something possibly related is going on there too. Angus. -- Enable your software for Intel(R) Active Management Technology to meet the growing manageability and security demands of your customers. Businesses are taking advantage of Intel(R) vPro (TM) technology - will your software be a part of the solution? Download the Intel(R) Manageability Checker today! http://p.sf.net/sfu/intel-dev2devmar ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] savefig not deducing file format
Ah, sorry for the duplicate message! Cheers, G On 15/03/2011 11:30, Giovanni Luca Ciampaglia wrote: Hi all, I call savefig by passing to it a file-like object but it appears to not get the graphics format right: f = open('not_a_pdf.pdf', 'w') plot([1,2,3]) savefig(f) but it produces a PNG image. Can anybody confirm this? I am on matplotlib 0.99.3 Cheers, -- Enable your software for Intel(R) Active Management Technology to meet the growing manageability and security demands of your customers. Businesses are taking advantage of Intel(R) vPro (TM) technology - will your software be a part of the solution? Download the Intel(R) Manageability Checker today! http://p.sf.net/sfu/intel-dev2devmar ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Access to contents of bins of a matplotlib histogram
Hi Chris, I think I understand what you are asking. I think the key point is I have used np.histogram where you are using np.hist When I make my plots, I use np.hist, but then to access the data, I use np.histogram. Just to demonstrate, incase this is not what you want, I have found, if I create a bin bin = np.histogram(binData,range=(ymin,ymax),weights=binQ,bins=np.arange(ymin,ymax,dm0/4)) where ind = np.argsort(my_data) # list to order the data from low to high binDat = my_data[ind] binQ = weights[ind] / np.sum(weights) #ordered list of weight factors for the data (for a weighted distribution. example, if you have data with uncertainties, the weights are given by the inverse uncertainties) and ymin, ymax and dm0 are params I have specified (based on the data) to set the bin size and range of bins The pdf, in this case, is given by pdf[i] = binQ[i]. I can then access this with bin[0][i] #this is the i'th weight (the pdf at i) also, the data (the x values) can be accessed by bin[1][i] At the very least, this gives a poor-working man's solution. I couldn't figure out how to get it from np.hist. Andre On Mar 24, 2011, at 8:47 PM, Chris Edwards wrote: Hi, I would like to access values in the bins of a matplotlib histogram. The following example script is an attempt to do this. Clearly pdf contains floating point numbers, but I am unable to access them. Help with this problem would be much appreciated. Chris -- import numpy as np import matplotlib.pyplot as plt fig = plt.figure() ax = fig.add_subplot(111) mu, sigma = 100, 15 x = mu + sigma * np.random.randn(20) #Generate the histogram of the data. Example from Matplotlib documentation n, bins, patches = plt.hist(x, 50, normed=True, facecolor='g', alpha=0.75) plt.xlabel('Smarts') plt.ylabel('Probability') plt.title('Histogram of IQ') plt.text(60, .025, r'$\mu=100,\ \sigma=15$') plt.axis([40, 160, 0, 0.03]) plt.grid(True) #From Matplotlib documentation. #normed: If True, the first element of the return tuple will be the counts normalized #to form a probability density, i.e., n/(len(x)*dbin). In a probability density, #the integral of the histogram should be 1; you can verify that with a trapezoidal #integration of the probability density function. pdf, bins, patches = ax.hist(x, 50, normed=True, facecolor='g', alpha=0.75) #print pdf shows pdf contains the value in each bin of the normed histogram print pdf = , pdf print Integration of PDF = , np.sum(pdf * np.diff(bins)) #How to access values in pdf? Various tries made but none successful. Example attempt shown count=0 for line in open(pdf,'r+'): x=pdf.readline() z=('%.10f' % float(x)) count=count+1 print count = , count -- Enable your software for Intel(R) Active Management Technology to meet the growing manageability and security demands of your customers. Businesses are taking advantage of Intel(R) vPro (TM) technology - will your software be a part of the solution? Download the Intel(R) Manageability Checker today! http://p.sf.net/sfu/intel-dev2devmar ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Enable your software for Intel(R) Active Management Technology to meet the growing manageability and security demands of your customers. Businesses are taking advantage of Intel(R) vPro (TM) technology - will your software be a part of the solution? Download the Intel(R) Manageability Checker today! http://p.sf.net/sfu/intel-dev2devmar ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] mpl on OS X with Python 3.1 (was Re: [matplotlib-devel] Help)
Georges Arsouze, on 2011-03-16 09:48, wrote: Hello I'am working with Python3.1 under Mac Os Snow Leopard I download matplotlib with http://www.cgl.ucsf.edu/Outreach/pc204/matplotlib.html It doesn't work Can you help me ? Hi Georges, What version of matplotlib are you trying to run? At the moment, there isn't a stable release which is compatible with Python 3, and you have to grab it from: https://github.com/matplotlib/matplotlib-py3 Not all of the backends work in -py3, mostly because the underlying toolkits have not been ported to Python 3. You can notes about the work in progress, what's been completed, and what's left to do here: https://github.com/matplotlib/matplotlib-py3/wiki (Also, this is more of a matplotlib-users question, so I'm replying to that list) best, -- Paul Ivanov 314 address only used for lists, off-list direct email at: http://pirsquared.org | GPG/PGP key id: 0x0F3E28F7 signature.asc Description: Digital signature -- Enable your software for Intel(R) Active Management Technology to meet the growing manageability and security demands of your customers. Businesses are taking advantage of Intel(R) vPro (TM) technology - will your software be a part of the solution? Download the Intel(R) Manageability Checker today! http://p.sf.net/sfu/intel-dev2devmar___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] How to control grid properties in 3D?
Dear All, I can't figure out how to make the grid and axes lines more apparent in 3D plot created by Axes3D. Similar problem was posted a while ago (http://old.nabble.com/How-to-make-3-D-axes-grid-more-visible--td28917367.html#a28917367) but there was no resolution. I know how to turn the grid on/off. But is there any way to set the width/color of the grid lines? Because when I save the plot with default gray lines, they are almost invisible. Thanks a lot for advice! -- View this message in context: http://old.nabble.com/How-to-control-grid-properties-in-3D--tp31206307p31206307.html Sent from the matplotlib - users mailing list archive at Nabble.com. -- Enable your software for Intel(R) Active Management Technology to meet the growing manageability and security demands of your customers. Businesses are taking advantage of Intel(R) vPro (TM) technology - will your software be a part of the solution? Download the Intel(R) Manageability Checker today! http://p.sf.net/sfu/intel-dev2devmar ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] usetex = True + eps output - letters are only curves
Hi, if I create an eps from a matplotlib chart with matplot.rc('font', size=fsize, family='serif', serif='Computer Modern Roman') matplot.rc('text', usetex = True) matplot.rc('text.latex', unicode = True) then I can't mark the letters in eps viewer. And I can't search for letters and words in the eps. It seems, the letters are curves in the eps. Why? If I create a pdf, I can mark letters and words an I can search too. How I can create an eps output with embedded font and real letters? -- View this message in context: http://old.nabble.com/usetex-%3D-True-%2B-eps-output--%3E-letters-are-only-curves-tp31242096p31242096.html Sent from the matplotlib - users mailing list archive at Nabble.com. -- Enable your software for Intel(R) Active Management Technology to meet the growing manageability and security demands of your customers. Businesses are taking advantage of Intel(R) vPro (TM) technology - will your software be a part of the solution? Download the Intel(R) Manageability Checker today! http://p.sf.net/sfu/intel-dev2devmar ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] 3D line segment plots?
I have used the following code (taken from a matplotlib example) to produce a 3D plot of planar polygons, from mpl_toolkits.mplot3d import Axes3D from matplotlib.collections import PolyCollection from matplotlib.colors import colorConverter import matplotlib.pyplot as plt import numpy as np np.random.seed(40040157) # Used to allow repeatable experiments (plots) fig = plt.figure() ax = fig.gca(projection='3d') cc = [colorConverter.to_rgba(c,alpha=0.6) for c in ('r','g','b','c','y','m','k')] ncc = len(cc) nxs = 5 xs = np.arange(1, nxs+1, 1) # (X's) # Add boundary X's xs = np.insert(xs,0,1); xs = np.append(xs,nxs) # Create array for Z's ys = np.zeros(len(xs)) # Create list for all Y's npolys = 9 zs = [zs+1 for zs in range(npolys)] # Y coordinates (list of integers) # Create list of colors (cyclic) for all polygons colorlist = [cc[j%ncc] for j in range(npolys)] verts = [] # Generate vertices for polygons for j in zs: # loop on polys ys = np.random.rand(len(ys)) ys[0], ys[-1] = 0,0 # end points for filled polygons (1,0),(n,0) verts.append(zip(xs, ys)) poly = PolyCollection(verts, facecolors = colorlist) poly.set_alpha(0.7) ax.add_collection3d(poly, zs=zs, zdir='y') # Right-handed coordinate system ax.set_xlabel('X') # points to right (X) ax.set_xlim3d(0, nxs+1) ax.set_ylabel('Y') # points into screen (Y) ax.set_ylim3d(0, npolys+1) ax.set_zlabel('Z') # points up (Z) ax.set_zlim3d(0, 1) plt.show() and this works fine. I then tried to produce a 3D plot of the same form as this one,*but with only the top of the polygons plotted* (4 connected line segments for each of the 9 polygons). I thought this would be easily accomplished, by replacing PolyCollection with LineCollection. However, I have been unable to produce a 3D plot for line segments connecting the tops of the polygons. Note, I am using Python 2.6.6, numpy 1.5.1, and matplotlib 1.0.1. Any help on producing 3D line segment plot would be appreciated. -- Enable your software for Intel(R) Active Management Technology to meet the growing manageability and security demands of your customers. Businesses are taking advantage of Intel(R) vPro (TM) technology - will your software be a part of the solution? Download the Intel(R) Manageability Checker today! http://p.sf.net/sfu/intel-dev2devmar___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] matplotlib.test() no errors, but $nosetest matplotlib.tests - errors and failure?
Blast from the past! I just ran into this and it comes from the fact that 'matplotlib.tests.test_text' is not in the default_test_modules variable inside matplotlib's __init__.py Here's the necessary diff: index 82633a5..649e4d8 100644 --- a/lib/matplotlib/__init__.py +++ b/lib/matplotlib/__init__.py @@ -968,7 +968,8 @@ default_test_modules =3D [ 'matplotlib.tests.test_spines', 'matplotlib.tests.test_image', 'matplotlib.tests.test_simplification', -'matplotlib.tests.test_mathtext' +'matplotlib.tests.test_mathtext', +'matplotlib.tests.test_text' ] I added a pull request for this two line change just in case there was a specific reason to *exclude* test_text from the test modules?=20 For instance, right now, I get one failure in the test suite if I include it. The failure is in test_text:test_font_styles, but this has been the case for a while, it's just that these tests weren't running before. Any developers want to chime in on this? best, -- Paul Ivanov http://pirsquared.org | GPG/PGP key id: 0x0F3E28F7 Michael Droettboom, on 2010-07-27 11:19, wrote: Hmm... surprisingly, I am actually able to reproduce this sort of=20 behaviour here. I'll look into it further. =20 Mike =20 On 07/27/2010 09:49 AM, Michael Droettboom wrote: Of course, we'll prefer to see all of the tests pass... I'm surprised the two modes of running the tests gives different results. Are you sure they are running the same python? Does python `which nosetests` matplotlib.tests give you the same result as nosetests matplotlib.tests ? There must be some environmental difference between the two to cause the different results. Mike On 07/24/2010 05:09 PM, Adam wrote: =20 Hello, I have just updated to v1.0.0 and am trying to run the test suite to make sure everything is ok. There seems to be two different suites and I am not sure which is correct/current: $python -c 'import matplotlib; matplotlib.test()' [...snipped output...] Ran 138 tests in 390.991s OK (KNOWNFAIL=3D2) $nosetests matplotlib.tests I get: [...snipped output] Ran 144 tests in 380.165s FAILED (errors=3D4, failures=3D1) Two of these errors are the known failures from above, and the other two are in matplotlib.tests.test_text.test_font_styles: ImageComparisonFailure: images not close: /home/adam/result_images/test_text/font_styles.png vs. /home/adam/result_images/test_text/expected-font_styles.png (RMS 23.833) ImageComparisonFailure: images not close: /home/adam/result_images/test_text/font_styles_svg.png vs. /home/adam/result_images/test_text/expected-font_styles_svg.png (RMS 12.961) The module that fails is: FAIL: matplotlib.tests.test_mlab.test_recarray_csv_roundtrip -- Traceback (most recent call last): File /usr/local/lib/python2.6/dist-packages/nose-0.11.4-py2.6.egg/= nose/case.py, line 186, in runTest self.test(*self.arg) File /usr/local/lib/python2.6/dist-packages/matplotlib/tests/test_= mlab.py, line 24, in test_recarray_csv_roundtrip assert np.allclose( expected['x'], actual['x'] ) AssertionError I am not sure of the importance level of these - but I wanted to ask to see if I should do anything or if they can safely be ignored. Thanks, Adam. signature.asc Description: Digital signature -- Enable your software for Intel(R) Active Management Technology to meet the growing manageability and security demands of your customers. Businesses are taking advantage of Intel(R) vPro (TM) technology - will your software be a part of the solution? Download the Intel(R) Manageability Checker today! http://p.sf.net/sfu/intel-dev2devmar___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users