Re: [Matplotlib-users] why legend does not show in matplotlib-1.2.1 py2.7
I do not have any access to mpl 0.98 so I cannot tell for sure. My guess is that you have been using a feature that has not been intended, that has fixed at some point. The first argument to legend should be a list of artists. And pie2010 is a tuple of a list of patches and a list of texts, i.e., they are not compatible with the current implementation of legend. Maybe the below is what you wanted? plt.legend( (pie2010[0]), ...) Regards, -JJ On Fri, May 24, 2013 at 6:19 AM, Paul Hobson pmhob...@gmail.com wrote: Sorry I have to be so brief, but just like the error says, you fed the legend function the wedges returned by the pie command. But legend can't handle wedges. As the proxy artist tutorial hints, you need to feed it rectangles created manually (i.e., outside of any plotting commands). Hope that gets you started, -paul On Wed, May 22, 2013 at 8:06 AM, oyster lepto.pyt...@gmail.com wrote: the following code runs ok with py2.4 and matplotlib.0.98.3 however no legend appears with py2.7.3 and matplotlib-1.2.1/1.3. and I get [quote] e:\prg\py\python-2.7.3\lib\site-packages\_matplotlib\matplotlib\legend.py:629: U serWarning: Legend does not support [matplotlib.patches.Wedge object at 0x03842 0F0, matplotlib.patches.Wedge object at 0x03842530, matplotlib.patches.Wedge object at 0x03842930, matplotlib.patches.Wedge object at 0x03842D30, matplo tlib.patches.Wedge object at 0x038B0150] Use proxy artist instead. http://matplotlib.sourceforge.net/users/legend_guide.html#using-proxy-artist (str(orig_handle),)) e:\prg\py\python-2.7.3\lib\site-packages\_matplotlib\matplotlib\legend.py:629: U serWarning: Legend does not support [matplotlib.text.Text object at 0x03842310 , matplotlib.text.Text object at 0x03842750, matplotlib.text.Text object at 0 x03842B50, matplotlib.text.Text object at 0x03842F50, matplotlib.text.Text o bject at 0x038B0370] Use proxy artist instead. http://matplotlib.sourceforge.net/users/legend_guide.html#using-proxy-artist (str(orig_handle),)) [/quote] what's the matter? thanks [code] #coding=utf-8 from pylab import * val2010 = [2, 10, 20, 15, 3] figure() pie2010=pie(val2010, labels=[u'%i persons' % i for i in val2010]) plt.legend( (pie2010), [u'60', u'60~70', u'70~80', u'80~90', u'90~100'], loc = 'best', bbox_to_anchor = (0.90, 0.75) ) axis('equal') show() [/code] -- Try New Relic Now We'll Send You this Cool Shirt New Relic is the only SaaS-based application performance monitoring service that delivers powerful full stack analytics. Optimize and monitor your browser, app, servers with just a few lines of code. Try New Relic and get this awesome Nerd Life shirt! http://p.sf.net/sfu/newrelic_d2d_may ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Try New Relic Now We'll Send You this Cool Shirt New Relic is the only SaaS-based application performance monitoring service that delivers powerful full stack analytics. Optimize and monitor your browser, app, servers with just a few lines of code. Try New Relic and get this awesome Nerd Life shirt! http://p.sf.net/sfu/newrelic_d2d_may ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Try New Relic Now We'll Send You this Cool Shirt New Relic is the only SaaS-based application performance monitoring service that delivers powerful full stack analytics. Optimize and monitor your browser, app, servers with just a few lines of code. Try New Relic and get this awesome Nerd Life shirt! http://p.sf.net/sfu/newrelic_d2d_may___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] tight_layout and ImageGrid
ImageGrid creates axes for colobar even if cbar_mode=None. These axes for colorbar are set to invisible, so usually they are harmless. tight_layout, however, do not care whether the axes is visible or not, and the warning is because of these invisible axes for colorbars. For comparison, if you turn on all colorbar with cbar_mode=each, the warning will go away. You may manually remove colorbar axes from the figure if you want, ``` for ax in grid.cbar_axes: fig._axstack.remove(ax) ``` but do this only when cbar_mode=None. So, I think the warning is harmless. I will make a pull request that make tight_layout to ignore any invisible axes soon. Regards, -JJ On Wed, May 8, 2013 at 10:21 PM, Jonathan Slavin jsla...@cfa.harvard.eduwrote: Hi, I wrote a short routine to look through a set of images that result from slightly different processing of the same data. I want to compare three different images and be able to zoom them all in the same way and then move onto the next set of three. The best way that I've found to do that so far involves using mpl_toolkits.axes_grid1.ImageGrid. It all works fine. I found that to get the most image on screen at once, using the tight_layout=True argument to plt.figure gives excellent results. My one question is that I get the following warning: WARNING: This figure includes Axes that are not compatible with tight_layout, so its results might be incorrect. [matplotlib.figure] As I say, the results are good, so it's not really a problem, but I do wonder about the source of the warngin -- and whether re-using the code in a different way in the future could lead to problems. So, my question is: what is the problem pointed to by the warning and how could I avoid it (while still getting the same good results)? Regards, Jon -- __ Jonathan D. Slavin Harvard-Smithsonian CfA jsla...@cfa.harvard.edu 60 Garden Street, MS 83 phone: (617) 496-7981 Cambridge, MA 02138-1516 cell: (781) 363-0035 USA __ -- Learn Graph Databases - Download FREE O'Reilly Book Graph Databases is the definitive new guide to graph databases and their applications. This 200-page book is written by three acclaimed leaders in the field. The early access version is available now. Download your free book today! http://p.sf.net/sfu/neotech_d2d_may ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Learn Graph Databases - Download FREE O'Reilly Book Graph Databases is the definitive new guide to graph databases and their applications. This 200-page book is written by three acclaimed leaders in the field. The early access version is available now. Download your free book today! http://p.sf.net/sfu/neotech_d2d_may___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] black and hatched legend handle
You need to create a new handler. I guess the code below is close to what you want. I hope this helps. http://nbviewer.ipython.org/5495680 Regards, -JJ On Wed, May 1, 2013 at 5:24 AM, mgurling magurl...@gmail.com wrote: I'm trying to make a legend handle that is half black and half hatched. I've tried ... ... rpos1 = ax.bar(ind, pos1, width, color='k', label='+1') rneg1 = ax.bar(ind, neg1, width, color='w', hatch='///', label='-1') rpos2 = ax.bar(ind, pos2, width, color='w', label='+2') rneg2 = ax.bar(ind, neg2, width, color='w', label='-2') handles, labels = ax.get_legend_handles_labels() ax.legend( ((handles[0], handles[1]), handles[2]) , ('one', 'two') ) ... The first handles--handles[0] and handles[1]--are combined but not side by side: the hatched rectangle is placed over the top of the black rectangle so the handle looks like it is just hatched. How might I create this mixed handle? -- View this message in context: http://matplotlib.1069221.n5.nabble.com/black-and-hatched-legend-handle-tp40979.html Sent from the matplotlib - users mailing list archive at Nabble.com. -- Introducing AppDynamics Lite, a free troubleshooting tool for Java/.NET Get 100% visibility into your production application - at no cost. Code-level diagnostics for performance bottlenecks with 2% overhead Download for free and get started troubleshooting in minutes. http://p.sf.net/sfu/appdyn_d2d_ap1 ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Introducing AppDynamics Lite, a free troubleshooting tool for Java/.NET Get 100% visibility into your production application - at no cost. Code-level diagnostics for performance bottlenecks with 2% overhead Download for free and get started troubleshooting in minutes. http://p.sf.net/sfu/appdyn_d2d_ap1___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] hammer projection
The code below uses axisartist toolkit. http://nbviewer.ipython.org/5467593 This is modified from 3rd example from the below example. http://matplotlib.org/examples/axes_grid/demo_floating_axes.html I hope this helps. Regards, -JJ On Tue, Apr 23, 2013 at 11:17 PM, Marian Jakubik mjaku...@ta3.sk wrote: Hi all, is there any possibility to show only first quadrant in hammer projection? If it is not implemented in matplotlib, have you any trick for doing this? Thanks in advance for your help. Best, Marian -- Try New Relic Now We'll Send You this Cool Shirt New Relic is the only SaaS-based application performance monitoring service that delivers powerful full stack analytics. Optimize and monitor your browser, app, servers with just a few lines of code. Try New Relic and get this awesome Nerd Life shirt! http://p.sf.net/sfu/newrelic_d2d_apr ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Introducing AppDynamics Lite, a free troubleshooting tool for Java/.NET Get 100% visibility into your production application - at no cost. Code-level diagnostics for performance bottlenecks with 2% overhead Download for free and get started troubleshooting in minutes. http://p.sf.net/sfu/appdyn_d2d_ap1___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] AnchoredSizeBar Color
The anchored_artists needs improvements and things are still opaque. For now you can do something like below, ``` a = AnchoredSizeBar(ax.transData, 0.1, test, loc=8, pad=0.1, borderpad=0.1, sep=2, prop=None, frameon=False) rect = a.size_bar._children[0] rect.set_ec(g) ``` `rect` is a patch instance responsible for the bar. By default its height is 0 and facecolor=none. Similarly, the text label can be accessed via `a.txt_label._text`. Regards, -JJ On Wed, Apr 17, 2013 at 1:47 AM, Mathew Topper mathew.top...@ed.ac.ukwrote: Hi, Is there anyway to set the color of an AnchoredSizeBar artist from the mpl_toolkits.axes_grid.anchored_artists toolkit? Thanks, Mat -- Dr. Mathew Topper Institute for Energy Systems School of Engineering The University of Edinburgh Faraday Building The King’s Buildings Edinburgh EH9 3JL Tel: +44 (0)131 650 5570 School fax: +44 (0)131 650 6554 mathew.top...@ed.ac.uk mailto:mathew.top...@ed.ac.uk http://www.see.ed.ac.uk http://www.see.ed.ac.uk/ The University of Edinburgh is a charitable body, registered in Scotland, with registration number SC005336. -- Precog is a next-generation analytics platform capable of advanced analytics on semi-structured data. The platform includes APIs for building apps and a phenomenal toolset for data science. Developers can use our toolset for easy data analysis visualization. Get a free account! http://www2.precog.com/precogplatform/slashdotnewsletter ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Precog is a next-generation analytics platform capable of advanced analytics on semi-structured data. The platform includes APIs for building apps and a phenomenal toolset for data science. Developers can use our toolset for easy data analysis visualization. Get a free account! http://www2.precog.com/precogplatform/slashdotnewsletter___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Trouble with legend and axis scaling
The first issue is a bug, and I opened a PR that fixes this. https://github.com/matplotlib/matplotlib/pull/1864 In the comments of the PR, you can find a workaround. Regards, -JJ On Wed, Mar 27, 2013 at 11:09 PM, Hackstein news.hackst...@gmx.net wrote: Sterling, I'm using matplotlib version 1.2.0 with agg backend. Here are two code examples, one for each problem. The first one doesn't save the figure due to the legend problem, seterr causes the script to stop with an error at that position. The second example shows the scientific labels on the y-axis, although it should be disabled in the code. I can't get the y-axis to display plain labels. First example: [code] import numpy as np np.seterr(all='raise') import matplotlib.pyplot as plt x_i = [11.7574075935, 11.66520713579, 11.6762413105, 11.6580992311, 11.65636838851] x_r = [] dates = [2.83611000e-01, 2.69330463e+02, 2.70280648e+02, 2.71359248e+02, 2.72320822e+02] diff = 0.16 ra = [0., 110.5349726] dec = [0., -16.1061281] med_i = np.median(x_i) med_r = np.median(x_r) plt.figure(i_only, figsize=(14.40, 9.00), dpi=100) if x_r == []: plt.plot(dates, np.asarray(x_i), 'r-', label = 'i_s') plt.title('i_mag', fontsize='16') else: plt.plot(dates, np.asarray(x_r), 'g-', label = 'r_s') plt.plot(dates, np.asarray(x_i), 'r-', label = 'i_s') plt.title('i_mag', fontsize='16') plt.rcParams['xtick.major.pad']=10 plt.rcParams['ytick.major.pad']=10 ax = plt.gca() ax.title.set_y(1.1) formy = plt.ScalarFormatter() formy.set_powerlimits((-5, 5)) formy.set_scientific(False) ax.yaxis.set_major_formatter(formy) ax.set_ylim(ax.get_ylim()[::-1]) for tick in ax.xaxis.get_major_ticks(): tick.label.set_fontsize(16) for tick in ax.yaxis.get_major_ticks(): tick.label.set_fontsize(16) plt.xlabel('Days', fontsize='20', labelpad=20) plt.ylabel('normalized magnitude / mag', fontsize='20', labelpad=20) if x_r == []: plt.legend(bbox_to_anchor=(0., 1.02, 1., 0.102), loc=3, mode='expand', numpoints=1, ncol=2, borderaxespad=0.) else: plt.legend(bbox_to_anchor=(0., 1.02, 1., 0.102), loc=3, mode='expand', numpoints=1, ncol=2, borderaxespad=0.) leg = plt.gca().get_legend() ltext = leg.get_texts() plt.setp(ltext, fontsize='16') plt.savefig('lc0.png', facecolor='white', bbox_inches='tight') plt.close(i_only) [/code] Second example: [code] import numpy as np import matplotlib.pyplot as plt y_i = [11.1044563514, 11.1228276748, 11.1361234115, 11.1298162168, 11.12513415219] y_r = [11.14866716899, 11.10194503, 11.11235246531, 11.11168787179, 11.1214449011] dates_i = [2.83611000e-01, 2.69330463e+02, 2.70280648e+02, 2.72320822e+02, 2.73250579e+02] dates_r = [311.28215, 324.25844, 325.25194, 330.20983, 338.21356] diff = 0.16 ra = [112.5379659, 110.5349726] dec = [ -15.9841039, -16.1061281] med_i = np.median(y_i) med_r = np.median(y_r) plt.figure(i_only, figsize=(14.40, 9.00), dpi=100) if y_r == []: plt.plot(dates_i, np.asarray(y_i), 'r-', label = 'i_s') plt.title('i_mag', fontsize='16') else: plt.plot(dates_r, np.asarray(y_r), 'g-', label = 'r_s') plt.plot(dates_i, np.asarray(y_i), 'r-', label = 'i_s') plt.title('i_mag', fontsize='16') plt.rcParams['xtick.major.pad']=10 plt.rcParams['ytick.major.pad']=10 ax = plt.gca() ax.title.set_y(1.1) formy = plt.ScalarFormatter() formy.set_powerlimits((-5, 5)) formy.set_scientific(False) ax.yaxis.set_major_formatter(formy) ax.set_ylim(ax.get_ylim()[::-1]) for tick in ax.xaxis.get_major_ticks(): tick.label.set_fontsize(16) for tick in ax.yaxis.get_major_ticks(): tick.label.set_fontsize(16) plt.xlabel('Days', fontsize='20', labelpad=20) plt.ylabel('normalized magnitude / mag', fontsize='20', labelpad=20) if y_r == []: plt.legend(bbox_to_anchor=(0., 1.02, 1., 0.102), loc=3, mode='expand', numpoints=1, ncol=2, borderaxespad=0.) else: plt.legend(bbox_to_anchor=(0., 1.02, 1., 0.102), loc=3, mode='expand', numpoints=1, ncol=2, borderaxespad=0.) leg = plt.gca().get_legend() ltext = leg.get_texts() plt.setp(ltext, fontsize='16') plt.savefig('lc0.png', facecolor='white', bbox_inches='tight') plt.close(i_only) [/code] Best regards, frix Am 26.03.2013 um 20:36 schrieb Sterling Smith smit...@fusion.gat.com: Frix, It may be useful to post the version and backend you are using to the list. import matplotlib print matplotlib.__version__ print matplotlib.get_backend() Also, if you can format the code as a simple self-contained example, that would help others confirm what you are seeing. -Sterling On Mar 26, 2013, at 12:01PM, Hackstein wrote: Hello everyone, I have two issues with my current projects: 1) I automatically generate plots of several data sets in a for-loop, all of which have the same shape of x and y values, but some of which have two of
Re: [Matplotlib-users] Squashed axes with AxesGrid
It is not clear what your problem is. AxesGrid implicitly assumes aspect=1 for each axes. So, I guess your y-limits are smaller (in its span) than x-limits. If you don't want this behavior, there is no need of using the AxesGrid. Rather use Grid, or simply subplots. import matplotlib.pyplot as plt from mpl_toolkits.axes_grid1 import Grid F = plt.figure(1,(5.5,3.5)) grid = Grid(F, 111, nrows_ncols=(1,3), axes_pad = 0.1, add_all=True, label_mode = 'L', ) If this is not the answer you're looking for, I recommend you to post a complete but simple script that reproduces your problem and describe the problem more explicitly. Regards, -JJ On Fri, Mar 22, 2013 at 6:03 AM, Steven Boada bo...@physics.tamu.eduwrote: Heya List, See attached image for what I mean. Here is the grid creation bit. I can't seem to figure out what might be causing such a problem. F = pyl.figure(1,(5.5,3.5)) grid = AxesGrid(F, 111, nrows_ncols=(1,3), axes_pad = 0.1, add_all=True, label_mode = 'L', aspect=True) Should be simple enough right? -- Steven Boada Doctoral Student Dept of Physics and Astronomy Texas AM University bo...@physics.tamu.edu -- 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_d2d_mar ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- 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_d2d_mar___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] removing paths inside polygon
On Wed, Mar 13, 2013 at 2:17 AM, Andrew Dawson daw...@atm.ox.ac.uk wrote: You should see that the circle is no longer circular, and also there are weird line width issues. What I want it basically exactly like the attached without_clipping.png but with paths inside the circle removed. The reason that circle is no more circle is that simply inverting the vertices does not always results in a correctly inverted path. Instead of following line. interior.vertices = interior.vertices[::-1] You should use something like below. interior = mpath.Path(np.concatenate([interior.vertices[-2::-1], interior.vertices[-1:]]), interior.codes) It would be good if we have a method to invert a path. This will give you a circle. But the weird line width issue remains. This seems to be an Agg issue, and the line width seems to depend on the dpi. I guess @mdboom nay have some insight on this. Regards, -JJ -- 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_d2d_mar___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] I cannot change the axis tick separation or nbins in Axis artist
AxisArtist utilizes a different (compared to the vanilla matplotlib) mechanism for determining tick location etc., so some of the matplotlibcommands do not work. Unfortunately, AxisArtist is still not well documented, and things are often opaque. Below I implemented a method that you can use to control the nbins. To manually specify the tick locations you need to use the FixedLocator. IHTH, -JJ class TaylorDiagram(object): ... def set_nbins(self, nbins): ghelper = self._ax.get_grid_helper() # get grid_helper ghelper.grid_finder.grid_locator2.set_params(nbins=nbins) # update the parameter of the grid_locator2 (2 means 2nd coordinate). Helper. invalidate () # invalidate the helper so that new parameters become effective On Thu, Feb 21, 2013 at 6:08 PM, patricia ptramba...@hotmail.com wrote: Dear Jody, This is the original code that I am using: http://old.nabble.com/Taylor-diagram-(2nd-take)-p33364690.html It is a code that plots Taylor diagrams. I would like to get ticks every two points in the standard deviation axis of the Taylor diagrams to avoid overlapping of labels (as I am making a figure with several small Taylor Diagrams subplots). Thanks! Patricia -- View this message in context: http://matplotlib.1069221.n5.nabble.com/I-cannot-change-the-axis-tick-separation-or-nbins-in-Axis-artist-tp40446p40454.html Sent from the matplotlib - users mailing list archive at Nabble.com. -- 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_d2d_feb ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- 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_d2d_feb___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Problem with PatchCollection and FancyArrowPatch?
FancyArrowPatch behaves quite differently from normal patches. Most importantly, the path must be reevaluated during the drawing time, so a normal PatchCollection, which evaluate the paths during the instance creation, won't work. i.e., you need a new Collection class. Below is a very incomplete implementation of FancyArrowPatchCollection, just for a demonstration purpose. And I recommend you to open a wishlist ticket at the issue tracker (https://github.com/matplotlib/matplotlib/issues ). Regards, -JJ class FancyArrowPatchCollection(PatchCollection): def set_paths(self, patches): self._patches = patches def get_paths(self): paths = [] for p in self._patches: p.set_transform(self.get_transform()) _path, fillable = p.get_path_in_displaycoord() paths.extend(_path) return paths def _prepare_points(self): import matplotlib.transforms as mtransforms transform, transOffset, offsets, paths = PatchCollection._prepare_points(self) return mtransforms.IdentityTransform(), transOffset, offsets, paths On Thu, Jan 31, 2013 at 6:33 AM, Skipper Seabold jsseab...@gmail.comwrote: Hi, Trying to figure out why these two do not create the same plot. Bug or user error? import matplotlib.pyplot as plt from matplotlib.patches import FancyArrowPatch from matplotlib.collections import PatchCollection def correct_patch(pos): fig, ax = plt.subplots() for src, dst in pos: arrow = FancyArrowPatch(posA=src, posB=dst, color='k', arrowstyle='-|', mutation_scale=30, connectionstyle=arc3) ax.add_patch(arrow) return fig def patch_collection_problem(pos): fig, ax = plt.subplots() pos = [[(.5, .5), (.25, .25)], [(.1, .5), (.2, .75)]] arrows = [] for src, dst in pos: arrows.append(FancyArrowPatch(posA=src, posB=dst, color='k', arrowstyle='-|', mutation_scale=30, connectionstyle=arc3)) collection = PatchCollection(arrows, match_original=True) ax.add_collection(collection, autolim=False) return fig pos = [[(.5, .5), (.25, .25)], [(.1, .5), (.2, .75)]] correct_patch(pos) patch_collection_problem(pos) -- 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_d2d_jan ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- 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_d2d_jan___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] FancyArrowPatch to edge of marker with known size?
On Wed, Jan 30, 2013 at 7:11 AM, Skipper Seabold jsseab...@gmail.comwrote: Say I have a marker with a known size in points and I want to draw an arrow to this point. How can I get the ends points for the arrow? As you can see in the below, it overlaps the markers. I want to go to the edge. I can use shrinkA and shrinkB to do what I want, but I don't see how they're related to the points size**.5. Or should I somehow do the transformation using the known angle between the two points and the point itself. I don't know how to translate a point in data coordinates and the offset it in a certain direction by size**.5 points. Can anyone help clear this up? Can you elaborate why you cannot just use shrinkA and shrinkB? arrows = FancyArrowPatch(posA=(x1, y1), posB=(x2, y2), color = 'k', arrowstyle=-|, mutation_scale=700**.5, shrinkA=(700**.5)*.5, shrinkB=(700**.5)*.5, connectionstyle=arc3) What the problem of doing above? Note that the unit of shrinkA and shrinkB is points, and they are independent of mutation_scale, which only affects the size of the arrow. Regards, -JJ -- 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_d2d_jan___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] CMYK
I agree with Eric that what we need is a backend that support CMYK color space. But matplotlib may need to provide some framework for handling the color profiles etc. My limited experience with ps_myck backend ( https://github.com/leejjoon/mpl_ps_cmyk) suggests that, as far as matplotlib provide some framework for color conversion, implementing/modifying a backend to support cmyk should not be difficult. So, yes, we need someone to write a MEP. Regards, -JJ On Thu, Jan 31, 2013 at 4:30 AM, Eric Firing efir...@hawaii.edu wrote: On 2013/01/30 9:13 AM, Paul Kuin wrote: For what it's worth. While the RGB system is native to monitor devices, since they produce light of certain colours, CMYK is the colour system of printer materials etc. since they absorb the colours, but reflect those we see. That means designs must be made in CMYK for pronter materials and in RGB for our devices. The response of each medium or device is different. RGB will have part of the colour space not accessible in some devices, while in printed materials it is different again. The basic thing is colour space, while RGB and CMYK can be seen as a map. In the real world you have to look at the product to see if the colours come out right. Not sure what to make of any implementation of this, but a simple mapping should not be impossible. Granted, a mapping within the intersection of the two spaces respectively accessibly to RGB and CMYK is possible, but I think it makes more sense to do it as a separate operation on the ps or pdf file than to try to build it into mpl. If it were to be built in, I think it would have to be bolted onto the ps and pdf backends. I suspect that the alpha channel will make this quite complicated, much more so than a simple mapping; it will require an intermediate rendering step. Eric Cheers, Paul On Wed, Jan 30, 2013 at 6:38 PM, Eric Firing efir...@hawaii.edu wrote: On 2013/01/30 6:43 AM, Michael Droettboom wrote: We don't currently have any support -- and we're still struggling in certain areas supporting RGBA consistently across the system. I think this would take someone writing a MEP (as a preliminary study of all of the changes that would be involved) and then shepherding it through implementation. My somewhat vague recollection is that CMYK is fundamentally output-device dependent, and therefore it really doesn't make much sense for a plotting library to support it directly. The conversion from RGBA should be made by the publisher, knowing what the output device characteristics are. Eric Mike On 01/30/2013 11:10 AM, Ignas Anikevičius wrote: On 29/01/13 03:37:51 -0800, Dieter wrote: I was wondering if anything changed regarding this within the last 2.5 years since the last thread. Is there a way to produce CMYK with matplotlib? Hello everybody, I would be also interested in how to produce CMYK graphics without external fiddling. Cheers, Ignas -- 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_d2d_jan ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- 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_d2d_jan___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Baseline of TeX fonts
I guess you have text.usetex=True? In this case, the baselines are not correct unless you also set text.latex.preview as True. For example, try to add following line in your rc file. text.latex.preview : True (You also need preview.sty installed) If this does not solve the problem, please post a screenshot that demonstrating the problem with your rc file. Regards, -JJ On Sun, Jan 20, 2013 at 5:24 PM, Magician f_magic...@mac.com wrote: Hi all, I'm using matplotlib 1.1.0 for Python27 on Windows 7. I'd like to apply TeX fonts at legends and labels. But if I try to do, the texts' baselines become upper, and the layouts get out of shapes. For example, I set legend titles as below: - 'Plot 1' - r'Plot 2 ($\alpha$)' -'Plot 3' then only the second one was raised. Both Computer Modern and \mathdefault fonts have same issues. I want to fix all the baselines as default positions. Does anyone have good ideas? Magician -- Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS, MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft MVPs and experts. ON SALE this month only -- learn more at: http://p.sf.net/sfu/learnmore_123012 ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS, MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft MVPs and experts. ON SALE this month only -- learn more at: http://p.sf.net/sfu/learnnow-d2d___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Subaxes deletion issue
The divider thing from axes_grid toolkit is primarily designed for a static layout. So, it may become quite tricky when you want to adjust the layout dynamically. Here is a modified version your code that I think does what you want. from matplotlib.figure import Figure from mpl_toolkits.axes_grid.axes_divider import make_axes_locatable from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg as FigureCanvas from PyQt4.QtCore import * from PyQt4.QtGui import * import sys class Test(QWidget): def __init__(self): QWidget.__init__(self) self.resize(1000, 600) self.fig = Figure(figsize=(100,100), dpi=75) axes1 = self.fig.add_subplot(121) axes2 = self.fig.add_subplot(122) self.subaxes = [] self.main_axes = [axes1, axes2] self.locators_orig = [] for ax in [axes1, axes2]: make_axes_locatable(ax) self.locators_orig.append(ax.get_axes_locator()) self.divider = make_axes_locatable(ax) self.subaxes.append(self.divider.append_axes(right, 40%, 20%)) b = QPushButton(Remove subaxes) b.clicked.connect(self.OnBtnClicked) l = QHBoxLayout() l.addWidget(FigureCanvas(self.fig)) l.addWidget(b) self.setLayout(l) def OnBtnClicked(self): for sa in self.subaxes: self.fig.delaxes(sa) del sa for ax, locator in zip(self.main_axes, self.locators_orig): ax.set_axes_locator(locator) self.fig.canvas.draw() app = QApplication(sys.argv) win = Test() win.show() sys.exit(app.exec_()) IHTH, -JJ On Fri, Jan 18, 2013 at 6:57 AM, gad massi_...@msn.com wrote: Hi everyone, I'm getting in trouble trying to delete a couple of subaxes from my canvas. The problem is shown by the example script below: from matplotlib.figure import Figure from mpl_toolkits.axes_grid.axes_divider import make_axes_locatable from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg as FigureCanvas from PyQt4.QtCore import * from PyQt4.QtGui import * import sys class Test(QWidget): def __init__(self): QWidget.__init__(self) self.resize(1000, 600) self.fig = Figure(figsize=(100,100), dpi=75) axes1 = self.fig.add_subplot(121) axes2 = self.fig.add_subplot(122) self.subaxes = [] for ax in [axes1, axes2]: self.divider = make_axes_locatable(ax) self.subaxes.append(self.divider.append_axes(right, 40%, 20%)) b = QPushButton(Remove subaxes) b.clicked.connect(self.OnBtnClicked) l = QHBoxLayout() l.addWidget(FigureCanvas(self.fig)) l.addWidget(b) self.setLayout(l) def OnBtnClicked(self): for sa in self.subaxes: self.fig.delaxes(sa) del sa self.fig.canvas.draw() app = QApplication(sys.argv) win = Test() win.show() sys.exit(app.exec_()) The main window is made up of two main axes an two subaxes placed on their right side. If you click the button in the window, the two subaxes disappear as I expect, but the orignal axes don't resize. Is there something I am missing? Or can anyone point me out if there is a better way to achieve this? Thanks in advance! -- View this message in context: http://matplotlib.1069221.n5.nabble.com/Subaxes-deletion-issue-tp40268.html Sent from the matplotlib - users mailing list archive at Nabble.com. -- Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS, MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft MVPs and experts. ON SALE this month only -- learn more at: http://p.sf.net/sfu/learnmore_122712 ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS, MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft MVPs and experts. ON SALE this month only -- learn more at: http://p.sf.net/sfu/learnnow-d2d___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] dpi
Yeah, that's what I feared. But in the mean time, are there any best practices to minimize undesired effects like the one above? For example, are there any other functions that need special parameters to not raster their output when writing to a vector format? And is there a way to get a figure on the screen with the right size when I don't know what dpi the monitor is running with? As I said, if you use interpolation=none with your inshow, the original image will be sent to the backends. Figuring out the dpi of the screen, I have no clue at this moment. Maybe this is something a gui expert can answer. Regards, -JJ -- 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] dpi
On Fri, Oct 12, 2012 at 3:39 AM, Nikolaus Rath nikol...@rath.org wrote: matplotlib actually rescales the raw imshow data when saving to a vector format? Why is that? I think it should embed the bitmap with full resolution in the vector file and rely on the consumer of the vector file to scale it to whatever resolution is supported by the display device. imshow supports interpolation and that's why rasterization comes in. If you turn off interpolation (w/ interpolation=none), the original image will be embedded. Of course dpi has no meaning in this case. However, I agree with you that dpi should be a property of the backend only, not the figure. But I am not sure if this can be fixed soon. It will be difficult and will take lots of effort I think. -JJ -- Don't let slow site performance ruin your business. Deploy New Relic APM Deploy New Relic app performance management and know exactly what is happening inside your Ruby, Python, PHP, Java, and .NET app Try New Relic at no cost today and get our sweet Data Nerd shirt too! http://p.sf.net/sfu/newrelic-dev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Fwd: zoomed in detail box
Your code works as expected in my side. So, changing (0.5, 0.5) to something like (0.6, 0.5) has no effect in your side? Hmm, what is you matplotlib version? Maybe this is a bug in old version of matplotlib. Regards, -JJ On Wed, Sep 12, 2012 at 6:16 PM, darkside in.the.darks...@gmail.com wrote: Thank you for your help. A simple example that doesn't work for me is: import pylab as p import numpy as np from mpl_toolkits.axes_grid.inset_locator import zoomed_inset_axes from mpl_toolkits.axes_grid.inset_locator import mark_inset from mpl_toolkits.axes_grid.anchored_artists import AnchoredSizeBar from matplotlib.ticker import MaxNLocator fig = p.figure(figsize=(12,8)) ax = p.subplot(111) z = p.arange(0,1.415,0.01) d = z**2+np.random.random(len(z)) ax.plot(z,d,'ro',label='text') p.xlabel('z',fontsize=18) p.ylabel('Luminosity distance',fontsize=18) p.grid(True) axins = zoomed_inset_axes(ax, 3,bbox_to_anchor=(0.5,0.5),bbox_transform=ax.figure.transFigure, loc=2) axins.plot(z,d,'r.') ax.legend(loc=2,bbox_to_anchor=(1,1)) x,y = (0.86,1.3) x2,y2 = (1,1.7) axins.set_xlim(x,x2) axins.set_ylim(y,y2) axins.tick_params(axis='both',labelsize=12) axins.xaxis.set_major_locator(MaxNLocator(2)) axins.yaxis.set_major_locator(MaxNLocator(3)) mark_inset(ax,axins,loc1=1,loc2=3, fc=none, ec=0.5) p.draw() p.show() --- The bbox_to_anchor label is supposed to move the zoomed axis, but it does nothing, no matter what two numbers I place there. I guess that I miss something, but I can't figure out what. I really appreciate your help. Best regards, Illa 2012/9/5 Jae-Joon Lee lee.j.j...@gmail.com On Mon, Aug 20, 2012 at 10:50 PM, darkside in.the.darks...@gmail.com wrote: I am using zoomed_inset_axes, but the default position overlaps the yticks and the parent axe ticks, so I am trying: axins = zoomed_inset_axes(ax, 3,bbox_to_anchor(0.5,1),bbox_transform=ax.figure.transFigure, loc=2) This is supposed to work, and my quick test did work. Can you post a complete but simple exampl? Regards, -JJ -- 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] Legend Marker Color Bug
On Wed, Sep 5, 2012 at 6:05 AM, Sterling Smith smit...@fusion.gat.com wrote: I still do not get black markers. Furthermore, if you try to make a new legend with the result of leg.get_lines(), you will get lines without markers, which leads me to the conclusion I stated in my previous email (which you did not copy) I suspect that this is because the legend marker is drawn separately from the legend line to accommodate the numpoints argument of the legend functions. Then the question is how to access these markers if they are separate from the line2d objects in the legend. I didn't even see them in the children of the legend [legend.get_children()]. This is correct. To support legend handle like --o-- (i.e., no markers at the ends), lines and markers are drawn as a separate artist. You may use something like, line[0]._legmarker.set_markerfacecolor('black') line[1]._legmarker.set_markerfacecolor('black') I, personally, recommend you to use a proxy artist. http://matplotlib.sourceforge.net/users/legend_guide.html#using-proxy-artist For example, You may do something like import pylab pylab.plot(pylab.linspace(0,1,100),marker='o',ls='') pylab.plot(pylab.linspace(0,1,100),marker='o',ls='-') # creates artists for legend purpose only l1, = pylab.plot(pylab.linspace(0,1,100), 'ko-') l2, = pylab.plot(pylab.linspace(0,1,100), 'ko') # remove them from the axes. l1.remove() l2.remove() leg=pylab.legend([l1, l2], [Test 1, Test 2], loc='best') Regards, -JJ -- 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] Problems with rasterizing multiple elements
I recommend you to use LineCollection as it is rasterized as a single image. For example, from matplotlib.collections import LineCollection d = [np.array([ts[0], ys1]).T for ys1 in ys] lc = LineCollection(d, color='r', lw=0.5, alpha=0.5, rasterized=True) ax.add_collection(lc) ax.set_xlim(0, 7) ax.set_ylim(-1, 1) If you need to stick to plot command somehow, you need to create your own artist. There is a similar example, http://matplotlib.sourceforge.net/examples/pylab_examples/demo_agg_filter.html Take a look at the FilteredArtistList class. Your draw method should be something like def draw(self, renderer): renderer.start_rasterizing() for a in self._artist_list: a.draw(renderer) renderer.stop_rasterizing() IHTH, -JJ On Wed, Aug 22, 2012 at 2:45 AM, Peter St. John peterc.stj...@gmail.com wrote: Hi Everyone, I'm having problems when rasterizing many lines in a plot using the rasterized=True keyword using the pdf output. Some version info: matplotlib version 1.1.1rc ubuntu 12.04 python 2.7.3 Here's a basic example that demonstrates my problem: # Import matplotlib to create a pdf document import matplotlib matplotlib.use('Agg') from matplotlib.backends.backend_pdf import PdfPages pdf = PdfPages('rasterized_test.pdf') import matplotlib.pylab as plt # some test data import numpy as np ts = np.linspace(0,2*np.pi,100) * np.ones((200,100)) ts += (np.linspace(0, np.pi, 200)[np.newaxis] * np.ones((100,200))).T ys = np.sin(ts) fig = plt.figure() ax = fig.add_subplot(111) ax.plot(ts[0], ys.T, color='r', lw=0.5, alpha=0.5, rasterized=True) pdf.savefig() pdf.close() Essentially, I have a lot (200 in this case) of closely overlapping lines which makes the resulting figure (not rasterized) overly difficult to load. I would like to rasterize these lines, such that the axis labels (and other elements of the plot, not shown) remain vectors while the solution trajectories are flattened to a single raster background. However, using the code above, the image still takes a long time to load since each trajectory is independently rasterized, resulting in multiple layers. (If I open the resulting pdf with a program like inkscape, I can manipulate each trajectory independently.) Is it possible to flatten all of the rasterized elements into a single layer, so the pdf size would be greatly reduced? Thanks, --Peter -- 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 -- 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] Fwd: zoomed in detail box
On Mon, Aug 20, 2012 at 10:50 PM, darkside in.the.darks...@gmail.com wrote: I am using zoomed_inset_axes, but the default position overlaps the yticks and the parent axe ticks, so I am trying: axins = zoomed_inset_axes(ax, 3,bbox_to_anchor(0.5,1),bbox_transform=ax.figure.transFigure, loc=2) This is supposed to work, and my quick test did work. Can you post a complete but simple exampl? Regards, -JJ -- 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] FancyBBox set_width
On Sun, Aug 19, 2012 at 3:41 PM, Peter Combs pcombs+...@gmail.com wrote: It seems like draw()ing the text object will reset the size of the BBox... Any idea how to fix this? At the moment, I'm experimenting with continually drawing, polling the get_width() method, and when it's too small, adding in spaces around the text field, but that seems both not to work reliably, and be an incredibly boneheaded way to go about it. I'm using matplotlib v. 1.1.0 if that makes a difference. --\ |text --/ not --\ | text --/ A recommended way of doing this is to make a custom BoxStyle, from matplotlib.patches import BoxStyle class MyRArrow(BoxStyle.RArrow): def transmute(self, x0, y0, width, height, mutation_size): # mutation_size is a fontsize in pixel scale. total_width = mutation_size*10 dw = (total_width-width)*.5 p = BoxStyle.RArrow.transmute(self, x0-dw, y0, total_width, height, mutation_size) return p ax = subplot(111) txtobj = ax.text(0.5, 0.5, 'text', ha=center, bbox=dict(boxstyle=MyRArrow())) txtobj = ax.text(0.5, 0.3, 'long text', ha=center, bbox=dict(boxstyle=MyRArrow())) However, BoxStyle does not know of the axes/figure/renderer, i.e., you cannot make its width to some fraction of figure width, for example. If this is what you want, you may need to derive from FancyBboxPatch as Daniel Hyams suggested. Regards, -JJ -- 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] Getting tight layout to recognize the second axis via twinx()
On Wed, Aug 29, 2012 at 4:52 PM, Eric Firing efir...@hawaii.edu wrote: twinx and twiny probably will need to return SubplotBase instances if their parent is a SubplotBase instance. My take on this. https://github.com/matplotlib/matplotlib/pull/1169 And, tight_layout seem to work okay with this change. Regards, -JJ -- 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] path effects question
I think it is me who put that code there. But I cannot recall why I did it. I may have copied that behavior from other code, but cannot find which. Yes, I agree that the current behavior is not very desirable. So, anyone who have an idea how this should behave, please go ahead and fix this. Regards, -JJ On Sun, Jul 15, 2012 at 1:54 AM, John Hunter jdh2...@gmail.com wrote: On Sat, Jul 14, 2012 at 11:48 AM, John Hunter jdh2...@gmail.com wrote: I do not understand why in the following example, if I set patch_alpha=1.0, I do not see the shadow effect. I would expect to see it for the the rightmost four bars, where the original bars do not entirely occlude the shadow, so even if alpha is 1.0, there are parts of the shadow that are not behind the original bars and should still be visible. I now see that this line explains the behavior https://github.com/matplotlib/matplotlib/blob/master/lib/matplotlib/patheffects.py#L183 gc0.set_alpha(1.-self._patch_alpha) so maybe I should amend my question: is this desirable that the shadow alpha is 1-patch_alpha, since an alpha of 1 on the patch does not imply that there is no visible shadow? -- 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] Bug in legend?
Handling alpha can become very tricky with matplotlib. The problem is not specific for legend thing, but how attribute of patches are updated when the update_from method is called. Here is an example. from matplotlib.patches import Patch pa1 = Patch(alpha=None, fc='none', ec='b') pb1 = Patch(alpha=1, fc='none', ec='b') pa2 = Patch() pb2 = Patch() pa2.update_from(pa1) pb2.update_from(pb1) assert pa1.get_fc() == pa2.get_fc() assert pb1.get_fc() == pb2.get_fc() And the second assertion fails. fc=none sets facecolor to (0,0,0,0) but when update_from is called, somehow its alpha value is overridden to 1 (because of alpha=1). This seems to be a bug and maybe we need to tweak the update_from method to get it right. But others may think differently. I'll file an issue with it. Meanwhile, please explicitly set fill=False to avoid filling. e.g., ax.fill(y,x, label='alpha=1', alpha=0.5, fc='none', ec='r', fill=False) Regards, -JJ On Tue, Apr 17, 2012 at 12:49 AM, Paul Hobson pmhob...@gmail.com wrote: On Mon, Apr 16, 2012 at 4:58 AM, Yannick Copin yannick.co...@laposte.net wrote: Hi List, I think I found a bug in legend of a fill command (see attached code and figure) when the facecolor is 'none' but the alpha is not None (I'm using latest matplotlib 1.1.0). If confirmed, should I fill in a but report? I see identical behavior in Christoph Gohlke's Windows build of Matplotlib 1.2.X for Python 3.2. The same thing occurs if you remove the alpha=None altogether. -paul -- For Developers, A Lot Can Happen In A Second. Boundary is the first to Know...and Tell You. Monitor Your Applications in Ultra-Fine Resolution. Try it FREE! http://p.sf.net/sfu/Boundary-d2dvs2 ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- For Developers, A Lot Can Happen In A Second. Boundary is the first to Know...and Tell You. Monitor Your Applications in Ultra-Fine Resolution. Try it FREE! http://p.sf.net/sfu/Boundary-d2dvs2 ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] move legend to the foreground: how to use set_zorder() correctly?
zorders are only meaningful among objects in a same axes. An easy workaround is to move the legend in ax1 to ax2. ax2.add_artist(leg1) ax1.legend = None Regards, -JJ On Thu, Mar 22, 2012 at 10:13 PM, David Verelst david.vere...@gmail.com wrote: Hi All, I am plotting on two different y-axes: one on the left (ax1) and one on the right (ax2). Both share the same x-axes. The problem I am facing relates back to the zorder of the legend (at least, that is what I think): I want it to be on the foreground at all times. In order to do so, I change the zorder of the ax1.legend (left y axes) such that the ax2.plots (right y-axes) are under ax1.legend. However, that doesn't work: all the plots on the right axes (so using ax2) end up above the legend 1 on the left, despite having a lower zorder. Note that I am also giving the grids on both ax1 and ax2 a lower zorder value compared to the legends, but the grid still ends up on top of legend 1 on the left. # version info: # Python 2.6.5 (r265:79063, Apr 16 2010, 13:57:41) [GCC 4.4.3] on linux2 # NumPy 1.6.1, Matplotlib 1.1.0 import pylab as plt import numpy as np # plotting on the left y-axes, ax1 = plt.axes(zorder=10) ax1.plot(range(0,5,1), 'r', label='ax1 ax1 ax1 ax1', zorder=11) ax1.plot(np.arange(3,4.1,1), 'r--', label='ax1 ax1 ax1 ax1', zorder=12) gr1 = ax1.grid(zorder=13) # legend of the left y-axes, force high zorder leg1 = ax1.legend(loc='upper left') leg1.set_zorder(30) # plotting on the right y-axes, ax2 = plt.twinx() ax2.set_zorder(20) ax2.plot(range(4,-1,-1), 'b', label='ax2 ax2 ax2 ax2', zorder=21) ax2.plot(np.arange(4,2.9,-1), np.arange(3,4.1,1), 'b--', label='ax2 ax2 ax2 ax2', zorder=22) gr2 = ax2.grid(zorder=23) # legend of the right y-axes, force high zorder leg2 = ax2.legend(loc='upper right') leg2.set_zorder(40) print '=== zorder:' print ' ax1: %i' % ax1.get_zorder() print ' ax2: %i' % ax2.get_zorder() print 'leg1: %i' % leg1.get_zorder() print 'leg2: %i' % leg2.get_zorder() What am I missing here? Thanks, David -- This SF email is sponsosred by: Try Windows Azure free for 90 days Click Here http://p.sf.net/sfu/sfd2d-msazure ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- This SF email is sponsosred by: Try Windows Azure free for 90 days Click Here http://p.sf.net/sfu/sfd2d-msazure ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Arrow with a dashed line
Just to clarify, both arrowstyle='simple' and arrowstyle='-|' draw arrows as patches. In your first example with arrowstyle='simple', the arrow is drawn as filled patch without edges, i.e., linestyle is not effective. arrowstyle=-| also uses a patch but no fill, only stroke. Regards, -JJ On Tue, Mar 13, 2012 at 3:28 AM, Tony Yu tsy...@gmail.com wrote: Nevermind: I though arrowstyle='simple' and arrowstyle='-|' were the same thing, but apparently not (I guess one draws the line as a patch, and the other as a line). So the following works as expected: -- This SF email is sponsosred by: Try Windows Azure free for 90 days Click Here http://p.sf.net/sfu/sfd2d-msazure ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Taylor diagram (2nd take)
On Wed, Feb 22, 2012 at 12:10 AM, Yannick Copin yannick.co...@laposte.net wrote: after iterating with Michael A. Rawlins over my previous attempt to code a Taylor diagram (see [1]), here's a new version of my code, along with an example plot. Maybe it could make its way into the gallery as an example of Floating Axes and Grid Finder (even though I'm not sure the code is particularly exemplary, comments are welcome). Good to know that someone is using axisartist toolkit. Just a quick comment. def add_grid(self, *args, **kwargs): Add a grid. self.ax.grid(*args, **kwargs) Maybe you wanted self._ax.grid? Regards, -JJ -- This SF email is sponsosred by: Try Windows Azure free for 90 days Click Here http://p.sf.net/sfu/sfd2d-msazure ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Centering Text with axes_divider
I wonder why the simple text command does not work for you? e.g., def add_center_text(ax): ax.text(0.5, 0.9075, Centered Title, ha='center', va='center', fontsize=18, bbox=dict(boxstyle='round, pad=0.5, rounding_size=0.25', fc=white, ec=k, lw=2), transform=ax.transAxes) Also, annotate command gives you more flexibility in text positioning. The axes location is supposed to be known during the drawing time. To get the axes position, you may do something like ax1._axes_locator(ax1, fig._cachedRenderer) Of course, this need to be done after the figure is properly drawn (e.g., after calling draw()) or during the drawing time. Regards, -JJ On Sat, Mar 10, 2012 at 1:00 PM, Patrick Marsh patrickmars...@gmail.com wrote: Hi, All, Here's an update to the problem I submitted last night. I was able to utilize anchored text to work for centering a title, which is ultimately what I'm wanting to do now. (Although, I'd still like to know the proper way to get the axes bounds when using axes_divider). The new problem lies how to horizontally align the text inside the anchored box. When the horizontal alignment is left, the text lines up in the anchored box. However, as the updated example below shows, then you use center or right, the text is now positioned outside the anchored box. Is this a bug in how the text is aligned? If so, how might I go about tracking it down? https://gist.github.com/2004869 (rev: b984ca) Cheers, Patrick --- Patrick Marsh Ph.D. Student / Liaison to the HWT School of Meteorology / University of Oklahoma Cooperative Institute for Mesoscale Meteorological Studies National Severe Storms Laboratory http://www.patricktmarsh.com On Fri, Mar 9, 2012 at 12:12 AM, Patrick Marsh patrickmars...@gmail.com wrote: Greetings, Let me begin by saying that I've fallen in love with ImageGrid. I love the control it gives me in setting up plots, and I really like the control it offers for setting up a colorbar. Unfortunately, like all relationships, ImageGrid and I have hit a rough patch. I like to manually place titles and other boxes of texts on plots that I make using ImageGrid. However, to center things I have to know what the axes bounds are so I can do the centering calculations. Unfortunately, when using ImageGrid, or axes_divider, I have yet to find a way to get the axes bounds that are actually used to do the plotting. When I try to use ax.get_position().bounds I get the pre-adjusted bounds, even if I use plt.draw() before requesting the axes_positions. This means the only way I can center the text is by guessing what the final axes bounds will be. Is there any way of getting the final bounds? It appears anchored text is able to do it, but I haven't been able to... Here's a self-contained example script that demonstrates the problem. I don't use ImageGrid, instead using axes_divider, however this is the same problem that AxesGrid has. (I'm guessing this is because ImageGrid ultimately does what I did here behind the scenes.) https://gist.github.com/2004869 Thanks for any help! Patrick --- Patrick Marsh Ph.D. Student / Liaison to the HWT School of Meteorology / University of Oklahoma Cooperative Institute for Mesoscale Meteorological Studies National Severe Storms Laboratory http://www.patricktmarsh.com -- 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 -- 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
Re: [Matplotlib-users] custom markers from images?
One way to use images as a marker would be to use offsetbox module. Here is an example adopted from http://matplotlib.sourceforge.net/examples/pylab_examples/demo_annotation_box.html Regards, -JJ import matplotlib.pyplot as plt from matplotlib.offsetbox import OffsetImage, AnnotationBbox from matplotlib.cbook import get_sample_data import numpy as np if 1: fig = plt.gcf() fig.clf() ax = plt.subplot(111) xy = [0.3, 0.55] arr = np.arange(100).reshape((10,10)) im = OffsetImage(arr, zoom=2) ab = AnnotationBbox(im, xy, xycoords='data', pad=0.3, ) ax.add_artist(ab) # another image from matplotlib._png import read_png fn = get_sample_data(lena.png, asfileobj=False) arr_lena = read_png(fn) imagebox = OffsetImage(arr_lena, zoom=0.1) xy = (0.7, 0.4) ab = AnnotationBbox(imagebox, xy, xycoords='data', pad=0.5, ) ax.add_artist(ab) ax.set_xlim(0, 1) ax.set_ylim(0, 1) plt.draw() plt.show() On Thu, Mar 8, 2012 at 4:25 AM, Michael Droettboom md...@stsci.edu wrote: It would be a nice idea. I'm not sure it's something that would work terribly well in vector backends as the images may not scale well. I should mention that there is already support to use arbitrary Unicode characters or math expressions as markers already, which does work well in vector backends. Mike On 03/07/2012 01:59 PM, C M wrote: I've for now taken a different approach that means I won't need custom markers from images. But I'm just curious: is there any wish/plans in Matplotlib to add support for this? I think it could do a lot to expand what's possible in terms of the look and feel of plots (even without things drifing into USA Today territory!). Just my $0.02 Che -- 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 -- 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 -- 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
Re: [Matplotlib-users] [SciPy-User] matplotlib: Simple legend code no longer works after upgrade to Ubuntu 11.10
Although this is quite an old post, one need to set the location again. e.g., lh._loc = 2 Regards, -JJ On Wed, Dec 14, 2011 at 12:09 AM, Warren Weckesser warren.weckes...@enthought.com wrote: On Mon, Dec 12, 2011 at 7:05 PM, C Barrington-Leigh cpblpub...@gmail.com wrote: Oops; I just posted this to comp.lang.python, but I wonder whether matplotlib questions are supposed to go to scipy-user? How about matplotlib-users@lists.sourceforge.net? I've cc'ed to that list. Warren Here it is: Before I upgraded to 2.7.2+ / 4 OCt 2011, the following code added a comment line to an axis legend using matplotlib / pylab. Now, the same code makes the legend appear off-screen, ie way outside the axes limits. Can anyone help? And/or is there a new way to add a title and footer to the legend? Thanks! from pylab import * plot([0,0],[1,1],label='Ubuntu 11.10') lh=legend(fancybox=True,shadow=False) lh.get_frame().set_alpha(0.5) from matplotlib.offsetbox import TextArea, VPacker fontsize=lh.get_texts()[0].get_fontsize() legendcomment=TextArea('extra comments here', textprops=dict(size=fontsize)) show() # Looks fine here lh._legend_box = VPacker(pad=5, sep=0, children=[lh._legend_box,legendcomment], align=left) lh._legend_box.set_figure(gcf()) draw() ___ SciPy-User mailing list scipy-u...@scipy.org http://mail.scipy.org/mailman/listinfo/scipy-user -- Systems Optimization Self Assessment Improve efficiency and utilization of IT resources. Drive out cost and improve service delivery. Take 5 minutes to use this Systems Optimization Self Assessment. http://www.accelacomm.com/jaw/sdnl/114/51450054/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- 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
Re: [Matplotlib-users] Dynamic adjustment of axis position and size in figure
tight_layout only works for instances of Subplots. However, ax2, which is created by calling twinx, is an instance of Axes, and is not accounted by the tight_layout command.It may be possible to improve the situation, I doubt it would be easy as the association between ax1 and ax2 is not very explicit in the current implementation. One workaround is to use axes_grid1 toolkit (this works with current git master branch but not sure if it will work with v1.1). Try to replace ax1 = fig.add_subplot(1,1,1) with from mpl_toolkits.axes_grid1.parasite_axes import SubplotHost ax1 = SubplotHost(fig, 1, 1, 1) fig.add_subplot(ax1) -JJ On Thu, Dec 8, 2011 at 5:28 AM, Jérôme jer...@jolimont.fr wrote: Wed, 7 Dec 2011 20:29:22 +0100 Jérôme a écrit: Is there a way to automatically resize the axis and nicely center the whole set {axes + ticklabels + labels} in the figure ? One could use add_axes and play with the coordinates until he gets something nice, but it gets complicated to have it automatic as things depends on - the number of digits of y-axis ticklabels - whether or not a secundary y-axis is added on the right (using twinx) Hi again, sorry for multi-posting. Apparently, figure.tight_layout() does not take into account the secondary y-axis on the right. Is this a known limitation ? (I don't see it on the caveats paragraph [1].) Or is this the use I make of it that is incorrect ? Example : -- import pylab fig = pylab.figure() data_1 = [0,1,2,3] data_2 = [0,5,250,3] lines = [] # Primary axis ax1 = fig.add_subplot(1,1,1) lines.extend (ax1.plot(data_1, 'b')) # Secondary axis ax2 = pylab.twinx(ax1) lines.extend (ax2.plot(data_2, 'g')) labels = ['Data 1', 'Data 2'] fig.tight_layout() pylab.show() -- Thanks. [1] http://matplotlib.sourceforge.net/users/tight_layout_guide.html -- Jérôme -- Cloud Services Checklist: Pricing and Packaging Optimization This white paper is intended to serve as a reference, checklist and point of discussion for anyone considering optimizing the pricing and packaging model of a cloud services business. Read Now! http://www.accelacomm.com/jaw/sfnl/114/51491232/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- 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
Re: [Matplotlib-users] Dynamically adjusting the color scale in NonUniformImage
As far as I can see, this is a bug of matplolib, although calling a set_data work around this. Can you open a bug report in our github repo? -JJ 2012. 2. 18. 오후 10:12에 Ray Osborn rosb...@anl.gov님이 작성: You're exactly right. That does fix it. Unfortunately, it means I have to refactor some of my code because the Pyside slot doesn't currently have access to the original data, but that's not a huge deal. Thanks, Ray On Feb 18, 2012, at 4:35 AM, Jerzy Karczmarczuk wrote: Ray Osborn: OK - it turns out I can reproduce it in a simple ipython session using ipython --pylab=qt. I set up an image plot as follows: import numpy as np import matplotlib.pyplot as plt from matplotlib.image import NonUniformImage x=y=np.linspace(0,2*np.pi,101) X,Y=np.meshgrid(x,y) z=sin(X)*sin(Y) ax=plt.gca() extent = (x[0],x[-1],y[0],y[-1]) im = NonUniformImage(ax, extent=extent, origin=None) im.set_data(x,y,z) ax.images.append(im) ax.set_xlim(x[0],x[-1]) ax.set_ylim(y[0],y[-1]) plt.colorbar(im) plt.gcf().canvas.draw() After that, I try to change the color scale using: im.set_clim(0,0.5) plt.gcf().canvas.draw() The colorbar changes scale, but the plot is untouched. Is that the expected behavior? Thanks, Ray Try, perhaps, after set_clim, to reinstall the data: im.set_data(x,y,z) plt.gcf().canvas.draw() = Jerzy Karczmarczuk -- 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 -- Ray Osborn Materials Science Division Argonne National Laboratory Argonne, IL 60439, USA Phone: +1 (630) 252-9011 Email: rosb...@anl.gov -- 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 -- 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
Re: [Matplotlib-users] Partial coloring of text in matplotlib
What can be done with the current Matplotlib is to use the offset boxes. Here is a modified version of a code snippet from http://abitofpythonabitofastronomy.blogspot.com/2009/05/mpl-multicolor-text.html Regards, -JJ from matplotlib.offsetbox import HPacker, TextArea, AnnotationBbox f = figure(1) ax = f.add_subplot(111) txt1 = TextArea(A$^3$, textprops=dict(color=r, size=150)) txt2 = TextArea(gb, textprops=dict(color=k, size=150)) txt = HPacker(children=[txt1, txt2], align=baseline, pad=0, sep=0) bbox = AnnotationBbox(txt, xy=(0.5, 0.5), xycoords='data', frameon=False, box_alignment=(0.5, 0.5), # alignment center, center ) ax.add_artist(bbox) show() On Wed, Feb 8, 2012 at 7:44 AM, Yann Tambouret yannp...@bu.edu wrote: Along the lines of Mike's suggestion, I thought this could be done using Latex. I posted an answer on SO with an example of doing this, but it seems only to work with postscript backend. Other backends override the color with the mpl text color setting. Is there a way to prevent this override? For example don't try to use 'PS' backend, and look at hte figure interactively. It defaults to black. http://stackoverflow.com/a/9185143/717357 -Yann On Tue, Feb 7, 2012 at 4:46 PM, Paul Ivanov pivanov...@gmail.com wrote: Benjamin Root, on 2012-02-07 13:46, wrote: Also, how deep should this rabbit hole go? I could imagine one could want this for title() and figtitle(). Maybe it would be best to implement this at the Text() constructor level? For this reason, I would discourage even implementing such functionality in the core of matplotlib. This functionality doesn't strike me as something that ought to be available everywhere by default - if someone needs it, they can implement it as follows: - import matplotlib.pyplot as plt from matplotlib import transforms def rainbow_text(x,y,ls,lc,**kw): Take a list of strings ``ls`` and colors ``lc`` and place them next to each other, with text ls[i] being shown in color lc[i]. This example shows how to do both vertical and horizontal text, and will pass all keyword arguments to plt.text, so you can set the font size, family, etc. t = plt.gca().transData fig = plt.gcf() plt.show() #horizontal version for s,c in zip(ls,lc): text = plt.text(x,y, +s+ ,color=c, transform=t, **kw) text.draw(fig.canvas.get_renderer()) ex = text.get_window_extent() t = transforms.offset_copy(text._transform, x=ex.width, units='dots') #vertical version for s,c in zip(ls,lc): text = plt.text(x,y, +s+ ,color=c, transform=t, rotation=90,va='bottom',ha='center',**kw) text.draw(fig.canvas.get_renderer()) ex = text.get_window_extent() t = transforms.offset_copy(text._transform, y=ex.height, units='dots') plt.figure() rainbow_text(0.5,0.5,all unicorns poop rainbows ! ! !.split(), ['red', 'orange', 'brown', 'green', 'blue', 'purple', 'black'], size=40) best, -- Paul Ivanov 314 address only used for lists, off-list direct email at: http://pirsquared.org | GPG/PGP key id: 0x0F3E28F7 -- Keep Your Developer Skills Current with LearnDevNow! The most comprehensive online learning library for Microsoft developers is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3, Metro Style Apps, more. Free future releases when you subscribe now! http://p.sf.net/sfu/learndevnow-d2d ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Keep Your Developer Skills Current with LearnDevNow! The most comprehensive online learning library for Microsoft developers is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3, Metro Style Apps, more. Free future releases when you subscribe now! http://p.sf.net/sfu/learndevnow-d2d ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Keep Your Developer Skills Current with LearnDevNow! The most comprehensive online learning library for Microsoft developers is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3, Metro Style Apps, more. Free future releases when you subscribe now! http://p.sf.net/sfu/learndevnow-d2d ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net
Re: [Matplotlib-users] Why pixel marker size is 4 pixels?
Thanks. Now I understand the situation. As far as I can see, marker=, is implemented as a rectangle path with width/height of 1 pixel, so this result in 2x2 pixel filled square. I tried to change the size of the rectangle, etc, to get a single pixel filled square, but did not get a satisfactory result. I think we need an Agg expert. I hope Mike or others take a look. Chris, if you do not get a response from others in this mailing list, I recommend you to open a new issue in our github page. Regards, -JJ On Mon, Feb 6, 2012 at 1:53 AM, Chris plut...@gmail.com wrote: Thanks JJ. The problem seems not to be a size issue -- markersize has no effect when use marker=, (pixel). I have also tried to turn off aa, and it doesn't help either. I also tried different backends. The PNG output from Agg and Cairo is slightly different: Agg's point has 4 solid pixel, while Cairo's has 4 pixel with random shade. Postscript output has the same problem. The pixel in an EPS file generated by mpl is significantly bigger than that from another drawing program I used. The problem occurs in all my plotting scripts, e.g., this basic one: [CODE] import numpy as np x=np.arange(100) y=np.random.randn(100) ioff() fig=gcf() fig.clf() ax=fig.add_axes(0.15,0.1,0.8, 0.85) ax.plot(x,y,k,) ion() fig.canvas.draw() [/CODE] Here is how I identify the problem: 1. use the above script to plot on screen 2. savefig(plot.png) 3. open plot.png in GIMP and check the pixel size. I also attached the two PNG files generated with Agg and Cairo backends. On Sun, Feb 5, 2012 at 6:45 AM, Jae-Joon Lee lee.j.j...@gmail.com wrote: How are you plotting your points. If you use *plot*, there is a *markersize* parameter. If you use *scatter*, the third argument controls the marker size. But you may actually complaining about other issues, e.g., antialiasing, etc. So, if above are not your answer, please post a complete example and describe your problem in more detail. Regards, -JJ On Sat, Feb 4, 2012 at 2:15 PM, Chris plut...@gmail.com wrote: I noticed this a few years back, but left it aside because most of the time I can live with it. Recently I need to make a few plots containing a few million points, and 4 pixels for a point is a disaster. So my question is why the pixel marker size is set at 4 pixels? And is there anyway to change it to a single pixel? Thanks, Chris -- Try before you buy = See our experts in action! The most comprehensive online learning library for Microsoft developers is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3, Metro Style Apps, more. Free future releases when you subscribe now! http://p.sf.net/sfu/learndevnow-dev2 ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Try before you buy = See our experts in action! The most comprehensive online learning library for Microsoft developers is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3, Metro Style Apps, more. Free future releases when you subscribe now! http://p.sf.net/sfu/learndevnow-dev2 ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] many plots
On Sat, Feb 4, 2012 at 1:27 AM, Saurav Pathak sau...@sas.upenn.edu wrote: Is there another way to do this more efficiently? I recommend you to use LineCollection, which should be much efficient. http://matplotlib.sourceforge.net/examples/api/collections_demo.html Regards, -JJ -- Try before you buy = See our experts in action! The most comprehensive online learning library for Microsoft developers is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3, Metro Style Apps, more. Free future releases when you subscribe now! http://p.sf.net/sfu/learndevnow-dev2 ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] legend not draggable when secondary y-axis present
For the legend to be picked by mouse, it must be placed in the top most axes. ax = subplot(111) l1, = ax.plot([1,3,2]) ax2 = ax.twinx() lab = ax2.legend([l1], [test]) I hope this clarifies your issue. If not, please post a simple but complete example that demonstrates your problem. Regards, -JJ On Wed, Jan 18, 2012 at 12:53 AM, German Salazar salger...@gmail.com wrote: Any ideas? Also, as in the example here, the legend seems to be behind the quantity being plotted against the one of the secondary y-axisdoes this have anything to do with that?...it is that maybe the legend is draggable but I am not getting to it? gsal -- Keep Your Developer Skills Current with LearnDevNow! The most comprehensive online learning library for Microsoft developers is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3, Metro Style Apps, more. Free future releases when you subscribe now! http://p.sf.net/sfu/learndevnow-d2d ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Try before you buy = See our experts in action! The most comprehensive online learning library for Microsoft developers is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3, Metro Style Apps, more. Free future releases when you subscribe now! http://p.sf.net/sfu/learndevnow-dev2 ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Why pixel marker size is 4 pixels?
How are you plotting your points. If you use *plot*, there is a *markersize* parameter. If you use *scatter*, the third argument controls the marker size. But you may actually complaining about other issues, e.g., antialiasing, etc. So, if above are not your answer, please post a complete example and describe your problem in more detail. Regards, -JJ On Sat, Feb 4, 2012 at 2:15 PM, Chris plut...@gmail.com wrote: I noticed this a few years back, but left it aside because most of the time I can live with it. Recently I need to make a few plots containing a few million points, and 4 pixels for a point is a disaster. So my question is why the pixel marker size is set at 4 pixels? And is there anyway to change it to a single pixel? Thanks, Chris -- Try before you buy = See our experts in action! The most comprehensive online learning library for Microsoft developers is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3, Metro Style Apps, more. Free future releases when you subscribe now! http://p.sf.net/sfu/learndevnow-dev2 ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Try before you buy = See our experts in action! The most comprehensive online learning library for Microsoft developers is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3, Metro Style Apps, more. Free future releases when you subscribe now! http://p.sf.net/sfu/learndevnow-dev2 ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] problem finding axes_grid1
I believe the matplotlib package in ubuntu 10.4 is v0.99.1, which does not include axes_grid1. You need to install newer version of matplotlib. Regards, -JJ On Mon, Jan 30, 2012 at 3:58 AM, BG barterguy8675...@gmail.com wrote: Hello all, I'm new to using Matplotlib. I am on Ubuntu 10.4, and I installed through apt-get. I then downloaded and installed basemap according to the instructions on the basemap site. However, when I run simpletest.py from the basemap package, I get an error ImportError: No module named axes_grid1. I thought this was a basemap problem at first, but I can reproduce this error using matplotlib tests. Am I doing something wrong? As I understand it, axes_grid1 is a set of helper classes which comes with Matplotlib. Does it need to be installed? Thanks! -BG -- Keep Your Developer Skills Current with LearnDevNow! The most comprehensive online learning library for Microsoft developers is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3, Metro Style Apps, more. Free future releases when you subscribe now! http://p.sf.net/sfu/learndevnow-d2d ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Keep Your Developer Skills Current with LearnDevNow! The most comprehensive online learning library for Microsoft developers is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3, Metro Style Apps, more. Free future releases when you subscribe now! http://p.sf.net/sfu/learndevnow-d2d ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] use legend's 'best' location for a text box
As far as I know, No, there is no such way inside matplotlib that does that for you. But, in theory, it should not be very difficult to implement. Can you open a new issue on our github page? Regards, -JJ On Thu, Jan 12, 2012 at 4:16 AM, Craig the Demolishor destrooo...@gmail.com wrote: Hi, I'm drawing a histogram and I would like to place a text box within the axes that shows the number of events. I like the way I can pass loc='best' to pyplot.legend() and it automatically does its best to avoid my data. Is there any way to replicate this for a simple call to pyplot.text(), like so: ax.text(0.05, 0.95, 'Entries: ' + len(myData), transform=ax.transAxes, fontsize=14, verticalalignment='top', bbox=dict(boxstyle='square', facecolor='white')) Thanks in advance! --craig -- 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 -- RSA(R) Conference 2012 Mar 27 - Feb 2 Save $400 by Jan. 27 Register now! http://p.sf.net/sfu/rsa-sfdev2dev2 ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] tailwidth?
I know this is an old post, but just in case. For arrowstyle=-, they are just lines (well, not exactly as a matter of fact). So, what you need is to change their linewidths. You may do arrow1=pylab.annotate(, xytext=(0.1,0.1), xy=(0.9,0.9),fontsize=8, arrowprops=dict(arrowstyle=-,head_length=1,head_width=0.8, # I'm changing the head_length and head_width to make the arrow more visible. linewidth=3)) On the other hand, the underlying artist associated with the arrow can be accessed by *arrow1.arrow_patch*. Note that it is actually an instance of Patch. Regards, -JJ On Fri, Dec 16, 2011 at 8:32 PM, Petro x.pi...@gmail.com wrote: How can I change linewidth of this arrow? arrow1=pylab.annotate(, xytext=(-3500,-1e8), xy=(-3500,8e8),fontsize=8,arrowprops=dict(arrowstyle=-)) Thank you in advance. Petro -- Learn Windows Azure Live! Tuesday, Dec 13, 2011 Microsoft is holding a special Learn Windows Azure training event for developers. It will provide a great way to learn Windows Azure and what it provides. You can attend the event by watching it streamed LIVE online. Learn more at http://p.sf.net/sfu/ms-windowsazure ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- RSA(R) Conference 2012 Mar 27 - Feb 2 Save $400 by Jan. 27 Register now! http://p.sf.net/sfu/rsa-sfdev2dev2 ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Colorbar on each subplot
Please post a complete (but simple) example that we can easily test. Doing the *subplot_adjust* will mess up the location of colorbars, but I believe that colorbars should be still there. If you're using v1.1 and later, see if using the use_gridspec parameter works. For example, colorbar(use_gridspec=True) Regards, -JJ On Sat, Jan 7, 2012 at 8:34 PM, davcra dcdavem...@gmail.com wrote: Hi, I need to add a colorbar to each plot in a subplot but cant seem to get it to work. My code is as follows, # Plot time series of slowness, baz, abs.power and rel.power labels = 'rel.power abs.power baz slow'.split() fig = plt.figure() for i, lab in enumerate(labels): ax = fig.add_subplot(4, 1, i + 1) ax.scatter(out[:, 0], out[:, i + 1], c=out[:, 1], alpha=0.6, edgecolors='none') ax.set_ylabel(lab) colorbar() fig.autofmt_xdate() fig.subplots_adjust(top=0.95, right=0.95, bottom=0.2, hspace=0.25) plt.show() Dont get any error but the colorbar is missing from the plot, anyone know how it is done -- View this message in context: http://old.nabble.com/Colorbar-on-each-subplot-tp33098035p33098035.html Sent from the matplotlib - users mailing list archive at Nabble.com. -- 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 -- 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
Re: [Matplotlib-users] draw bbox around axes title
On Fri, Jan 6, 2012 at 4:56 AM, Skipper Seabold jsseab...@gmail.com wrote: but when I call show, it seems the width of the box is reset. Yes. Because the location of the texts are backend-dependent, the location of the xbox surrounding the text are recalculated during the drawing time. I don't think there is no easy workaround unfortunately. If you are experienced in matplotlib, you may try is to rewrite the get_path method of the bbox. The example code below, while a bit complicated, tries to make the the bbox align with the axes. ax.title.set_ha(left) bbox_get_path = bbox.get_path def my_get_path(): pad = bbox.get_boxstyle().pad*bbox.get_mutation_scale() x0, y0 = bbox.get_transform().transform_point((0,0)) xx = ax.bbox.x0 - x0 bbox.set_x(xx+pad) bbox.set_width(ax.bbox.width-2*pad) return bbox_get_path() bbox.get_path = my_get_path regards, -JJ -- 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
Re: [Matplotlib-users] patheffects for Line2D objects
I just opened a pull request that implements the requested feature. https://github.com/matplotlib/matplotlib/pull/655 If you're familiar with Git, please test it and see if it works for your need. I believe I will merge this PR to the master branch in a few days unless there is any objection. Regards, -JJ On Tue, Dec 20, 2011 at 6:21 AM, Jonathan Slavin jsla...@cfa.harvard.edu wrote: Hi, It seems that patheffects are not supported for Line2D objects currently - only for Text and Patch objects. Is there any fundamental reason they couldn't be extended to support Line2D objects? I'm interested in this because I draw grid lines for some hammer projection plots and those lines are Line2D objects. For certain images, it'd be nicer to have the grid lines use patheffects so that any color of the image would still allow the grid line to show clearly. Jon -- __ Jonathan D. Slavin Harvard-Smithsonian CfA jsla...@cfa.harvard.edu 60 Garden Street, MS 83 phone: (617) 496-7981 Cambridge, MA 02138-1516 cell: (781) 363-0035 USA __ -- Write once. Port to many. Get the SDK and tools to simplify cross-platform app development. Create new or port existing apps to sell to consumers worldwide. Explore the Intel AppUpSM program developer opportunity. appdeveloper.intel.com/join http://p.sf.net/sfu/intel-appdev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Write once. Port to many. Get the SDK and tools to simplify cross-platform app development. Create new or port existing apps to sell to consumers worldwide. Explore the Intel AppUpSM program developer opportunity. appdeveloper.intel.com/join http://p.sf.net/sfu/intel-appdev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Inconsistent marker/line zorder in errorbar legend
I just pushed a change that I believe fixes this problem https://github.com/matplotlib/matplotlib/commit/96caca8dd48d08e3106337ecdeae82fa0236b86b Required change is very minor, so you may apply the patch by yourself. If you need a workaround, let me know. Regards, -JJ On Tue, Dec 6, 2011 at 11:46 AM, Adrian Del Maestro agde...@gmail.com wrote: Hello, I have run across an inconsistency in the zorder of markers and lines in the legend for an errorbar as opposed to a plot in matplotlib v1.1.0. After some considerable amount of time reading legend_handler.py and the information at http://matplotlib.sourceforge.net/users/legend_guide.html I was unable to figure out how to make the errorbar markers sit 'on top' of the lines in a legend. For example the following code: import pylab as pl import numpy as np x = pl.arange(-2,2,0.1) y = x**2 dy = np.random.random(len(x)) pl.figure(1) pl.plot(x,y, color='k', linewidth=0.5, linestyle='-', marker='o', markerfacecolor='lime', markeredgecolor='k', markeredgewidth=0.5, label='line1', markersize=10) pl.legend(loc='best', frameon=False) pl.figure(2) pl.errorbar(x,y,yerr=dy, color='k', linewidth=0.5, linestyle='-', marker='o', markerfacecolor='lime', markeredgecolor='k', markeredgewidth=0.5, label='line1', markersize=10, ecolor='lime', capsize=10) pl.legend(loc='best', frameon=False) pl.show() produces a legend for the plot (figure(1)) with the markers on top of the lines, but the legend for the errorbar (figure(2)) has this reversed. Any ideas/suggestions would be greatly appreciated. Best, Adrian. -- Cloud Services Checklist: Pricing and Packaging Optimization This white paper is intended to serve as a reference, checklist and point of discussion for anyone considering optimizing the pricing and packaging model of a cloud services business. Read Now! http://www.accelacomm.com/jaw/sfnl/114/51491232/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Cloud Services Checklist: Pricing and Packaging Optimization This white paper is intended to serve as a reference, checklist and point of discussion for anyone considering optimizing the pricing and packaging model of a cloud services business. Read Now! http://www.accelacomm.com/jaw/sfnl/114/51491232/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] problem with annotate
Can you post an standalone example? Maybe you want to set the *annotation_clip* parameter to False? http://matplotlib.sourceforge.net/api/pyplot_api.html#matplotlib.pyplot.annotate Regards, -JJ On Fri, Dec 2, 2011 at 10:19 PM, Neal Becker ndbeck...@gmail.com wrote: Using horizontalalignment='right', it seems that if a point lies on the right edge of the plot, the annotation does not appear, even though (since the text should be right aligned), the text would have been on the plot and be visible. Any workaround? -- All the data continuously generated in your IT infrastructure contains a definitive record of customers, application performance, security threats, fraudulent activity, and more. Splunk takes this data and makes sense of it. IT sense. And common sense. http://p.sf.net/sfu/splunk-novd2d ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Cloud Services Checklist: Pricing and Packaging Optimization This white paper is intended to serve as a reference, checklist and point of discussion for anyone considering optimizing the pricing and packaging model of a cloud services business. Read Now! http://www.accelacomm.com/jaw/sfnl/114/51491232/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Relpos only works once when using FancyArrow for annotation
On Mon, Nov 28, 2011 at 10:49 PM, Jae-Joon Lee lee.j.j...@gmail.com wrote: This is a bug. In the current implementation, annotate has a side-effect that modifies the arrowprops dictionary. For a future reference, this should now be fixed in the v1.1.x branch which also has been merged into the master branch. https://github.com/matplotlib/matplotlib/commit/b3a2ab77c89fdb3ab860edeb1a781b5307347070 Regards, -JJ -- All the data continuously generated in your IT infrastructure contains a definitive record of customers, application performance, security threats, fraudulent activity, and more. Splunk takes this data and makes sense of it. IT sense. And common sense. http://p.sf.net/sfu/splunk-novd2d ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Relpos only works once when using FancyArrow for annotation
On Mon, Nov 28, 2011 at 9:39 PM, Markus Baden markus.ba...@gmail.com wrote: anno_args = { 'annotation_clip': False, 'arrowprops': dict(arrowstyle='-', relpos=(0, 1)), } plt.annotate('Good relpos', (3, 3), xytext = (3, 2), **anno_args) plt.annotate('Bad relpos', (6, 6), xytext = (6, 5), **anno_args) This is a bug. In the current implementation, annotate has a side-effect that modifies the arrowprops dictionary. As a workaround, you may do, arrowprops = dict(arrowstyle='-', relpos=(0, 1)) plt.annotate('Good relpos', (3, 3), xytext = (3, 2), annotation_clip=False, arrowprops=arrowprops.copy()) plt.annotate('No ha/va', (5, 5), xytext = (5, 4), arrowprops=dict(arrowstyle='-'), ha='left', va='top') ha and va controls the location of the text relative to the xytext, and I believe it does work as expected. It has nothing to do with the starting point of the arrow, which should be controlled by the relpos parameter. Regards, -JJ -- All the data continuously generated in your IT infrastructure contains a definitive record of customers, application performance, security threats, fraudulent activity, and more. Splunk takes this data and makes sense of it. IT sense. And common sense. http://p.sf.net/sfu/splunk-novd2d ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Separate formatting for tick labels
Try something like this. ax = subplot(111) LabelsList = ['Prospero', 'Miranda', 'Caliban', 'Ariel'] ax.set_xticks(range(len(LabelsList)))xlabels = ax.set_xticklabels( LabelsList, rotation=35, horizontalalignment='right', fontstyle='italic', fontsize='10') ticklabels = ax.get_xticklabels()ticklabels[0].set_fontstyle(normal) Regards, -JJ On Wed, Nov 16, 2011 at 11:25 AM, magurling magurl...@gmail.com wrote: LabelsList = ['Prospero', 'Miranda', 'Caliban', 'Ariel'] xlabels = ax.set_xticklabels( LabelsList, rotation=35, horizontalalignment='right', fontstyle='italic', fontsize='10') -- All the data continuously generated in your IT infrastructure contains a definitive record of customers, application performance, security threats, fraudulent activity, and more. Splunk takes this data and makes sense of it. IT sense. And common sense. http://p.sf.net/sfu/splunk-novd2d ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] axes_grid1 and colorbar ticks
This seems to be a bug that need to be fixed. Meanwhile, use locator parameter as below. cbar = grid.cbar_axes[0].colorbar(im, locator=ticks) Regards, -JJ On Thu, Nov 17, 2011 at 5:35 AM, Yoshi Rokuko yo...@rokuko.net wrote: does someone knows how to specify ticks for a colorbar inside axesgrid? the following does not work as expected: from mpl_toolkits.axes_grid1 import AxesGrid ticks = [.01, .25, .5, .75, .99] grid = AxesGrid() [...] grid.cbar_axes[i].colorbar(im, ticks=ticks) i'm thankfull for any pointers, yoshi -- All the data continuously generated in your IT infrastructure contains a definitive record of customers, application performance, security threats, fraudulent activity, and more. Splunk takes this data and makes sense of it. IT sense. And common sense. http://p.sf.net/sfu/splunk-novd2d ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- All the data continuously generated in your IT infrastructure contains a definitive record of customers, application performance, security threats, fraudulent activity, and more. Splunk takes this data and makes sense of it. IT sense. And common sense. http://p.sf.net/sfu/splunk-novd2d ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Certain annotation parameters cause strange error
I believe I fixed this in this pull request. https://github.com/matplotlib/matplotlib/pull/566 Unfortunately, I don't think there is a easy workaround other than not using the fancy arrow style. Regards, -JJ On Sun, Oct 30, 2011 at 1:51 PM, Brendan Barnwell brenb...@brenbarn.net wrote: I encountered a strange error when trying to put some annotations on a graph. I was able to simplify it to this: pyplot.plot([1, 2, 3, 4], [0, -1, -2, 8]) pyplot.annotate(Blah, xy=(2, 2), xytext=(-20,-20), textcoords='offset points', bbox=dict(boxstyle='round,pad=0.5'), arrowprops=dict(arrowstyle='fancy', connectionstyle='arc3,rad=0')) On my system (matplotlib 1.1.0 with Python 2.6 on Windows XP), this causes a long traceback culminating in File C:\Program Files\Python\lib\site-packages\matplotlib\bezier.py, line 129, in find_bezier_t_intersecting_with_closedpath raise ValueError(the segment does not seemed to intersect with the path) Increasing the xytext coordinates (in absolute value), to for instance (-50, -50) works with no error, and it also works without the special bbox style. Just guessing from the error message, it looks like certain combinations of fancy patches are causing problems because the shapes don't intersect in the way the drawing code assumes they should. I don't see anything in the docs about such edge cases, so this looks like a bug. Judging from the way that small tweaks to the code can cause the error to disappear, I imagine it could be tricky to fix, but at the least there should probably be a warning in the docs that some kinds of anootation boxes won't work with some kinds of arrows when the text is too close to the annotated point. Any ideas? Thanks. -- Brendan Barnwell Do not follow where the path may lead. Go, instead, where there is no path, and leave a trail. --author unknown -- Get your Android app more play: Bring it to the BlackBerry PlayBook in minutes. BlackBerry App World#153; now supports Android#153; Apps for the BlackBerryreg; PlayBook#153;. Discover just how easy and simple it is! http://p.sf.net/sfu/android-dev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- 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
Re: [Matplotlib-users] Figure legend for 1.1.0 doesn't properly handle errorbars?
Somehow, Figure.legend flattens the given handle list and this is the cause of the problem. https://github.com/matplotlib/matplotlib/blob/master/lib/matplotlib/figure.py#L994 Does anyone know why this is necessary? I just filed a pull request to remove this. https://github.com/matplotlib/matplotlib/pull/534/files Meanwhile, you may do from matplotlib.legend import Legend l = Legend(fig, h, l, loc='lower right') fig.legends.append(l) This should be equivalent to fig.legend(h,l,loc='lower right'). Or, if you don't need axes legend, you may do legend(h,l,loc='lower right', bbox_to_anchor=[0,0,1,1], bbox_transform=fig.transFigure) Regards, -JJ On Tue, Oct 18, 2011 at 6:59 AM, Sterling Smith smit...@fusion.gat.com wrote: Let me first say that I appreciate the work that the developers have put into matplotlib. You're doing a great job. I have filed a bug report at https://github.com/matplotlib/matplotlib/issues/533 wherein I post the following Consider: from pylab import * x = arange(0,1,.01) y = x**2 fig = figure(2) ax = fig.add_subplot(111) errorbar(x,y,yerr=x/10.,label='$x^2$') errorbar(x,y**3,yerr=x/10.,label='$x^6$') legend(loc='upper center') h,l = ax.get_legend_handles_labels() fig.legend(h,l,loc='lower right') I am getting the right legend for the axes based legend, but the figure based legend seems to be using the different parts of the errorbar for subsequent handles, instead of using them as a group. From what I can tell, this has appeared since the upgrade to version 1.1.0. I am running on Linux, python 2.7, gtkAgg backend. Thanks, Sterling -- All the data continuously generated in your IT infrastructure contains a definitive record of customers, application performance, security threats, fraudulent activity and more. Splunk takes this data and makes sense of it. Business sense. IT sense. Common sense. http://p.sf.net/sfu/splunk-d2d-oct ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- All the data continuously generated in your IT infrastructure contains a definitive record of customers, application performance, security threats, fraudulent activity and more. Splunk takes this data and makes sense of it. Business sense. IT sense. Common sense. http://p.sf.net/sfu/splunk-d2d-oct ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] question about tight_layout()
On Sun, Oct 16, 2011 at 1:55 PM, C M cmpyt...@gmail.com wrote: However, I can't get it to work correct with Figure. I'm either getting that same error or failure to adjust the Figure's size to accommodate the axes' labels. I attach a minimal runnable sample that demonstrates these problems for those that embed in wxPython. In your example code, do you see the error raised only when you include the tight_layout call? Your comments seem to suggest that the error is raised regardless of the tight_layout call, in which case I doubt if this has anything to do with tight_layout. Anyhow, your code runs fine in my installment, linux + python 2.7.2 + wxgtk 2.8.11.0 + mpl master branch. On which platform you're running this? Regards, -JJ -- All the data continuously generated in your IT infrastructure contains a definitive record of customers, application performance, security threats, fraudulent activity and more. Splunk takes this data and makes sense of it. Business sense. IT sense. Common sense. http://p.sf.net/sfu/splunk-d2d-oct ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] question about tight_layout()
On Mon, Oct 17, 2011 at 1:03 AM, C M cmpyt...@gmail.com wrote: - Error if I call self.panel.Layout() before I call tight_layout(). In my system, I don't see any error whether ` self.panel.Layout() is in or not. - If I don't do this, no error, but it still isn't doing a proper tight layout. Your script DOES work in my system (but I'm using it with wxGTK) and it DOES a proper tight_layout. (However, the figure size never gets smaller than the original figure size so it shows only the part of the figure when the window is smaller than the original figure size). So, it seems that the issue is platform-dependent. As for the error message, it seems that the subplot_params values (left, right, top, bottom, etc) calculated by the tight_layout routine is somehow corrupted. Why this happens is hard to track down unless I can reproduce the error. And I hope any other windows developer out there can take a look at this issue. Meanwhile, can you play a little bit more with your script? 1) check the size of the figure (print self.figure.get_size_inches()) before a tight_layout is called. 2) see if calling the draw method (self.canvas.draw()) before the tight_layout helps. Also, please open a git issue on this so that others can take a look. Regards, -JJ -- All the data continuously generated in your IT infrastructure contains a definitive record of customers, application performance, security threats, fraudulent activity and more. Splunk takes this data and makes sense of it. Business sense. IT sense. Common sense. http://p.sf.net/sfu/splunk-d2d-oct ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] question about tight_layout()
Figure.tight_layout() is a correct way. Do you see that error only when you use Figure.tight_plot (and not when you use plt.tight_layout)? What happen you try the script below. import matplotlib.pyplot as plt fig = plt.figure(1)ax = fig.add_subplot(111)fig.tight_layout() Regards, -JJ On Sat, Oct 15, 2011 at 9:13 AM, C M cmpyt...@gmail.com wrote: Just trying out the latest mpl 1.1.0 and the tight_layout() method. I saw the guide written about it, but am a unsure how to use this when using the OO approach to using Matplotlib. When using pyplot, the method is: plt.tight_layout(). When using the OO form of mpl, is it: figure.tight_layout() ? I assume it is, because I tried this and it didn't give me a name error, but I did get an error: ValueError: left cannot be = right. What am I doing wrong? Thanks, Che -- All the data continuously generated in your IT infrastructure contains a definitive record of customers, application performance, security threats, fraudulent activity and more. Splunk takes this data and makes sense of it. Business sense. IT sense. Common sense. http://p.sf.net/sfu/splunk-d2d-oct ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- All the data continuously generated in your IT infrastructure contains a definitive record of customers, application performance, security threats, fraudulent activity and more. Splunk takes this data and makes sense of it. Business sense. IT sense. Common sense. http://p.sf.net/sfu/splunk-d2d-oct ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] rotating x tick labels, bold labels with axislines toolkit???
On Wed, Oct 5, 2011 at 11:50 AM, mdekauwe mdeka...@gmail.com wrote: Still haven't worked out the bold but I am sure there will be something on that page Try ax.axis[bottom].label.set_text(Test) ax.axis[bottom].label.set_weight(bold) IHTH, -JJ -- All the data continuously generated in your IT infrastructure contains a definitive record of customers, application performance, security threats, fraudulent activity and more. Splunk takes this data and makes sense of it. Business sense. IT sense. Common sense. http://p.sf.net/sfu/splunk-d2dcopy1 ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] twinx problem
On Tue, Oct 4, 2011 at 4:22 AM, Christopher Brown c...@asu.edu wrote: tick.label1.set_color('red') You should use tick.label2, not tick.label1. tick.label2.set_color('red') Anyhow, as Eric said, it is strongly advised to use the tick_params method. -JJ -- All the data continuously generated in your IT infrastructure contains a definitive record of customers, application performance, security threats, fraudulent activity and more. Splunk takes this data and makes sense of it. Business sense. IT sense. Common sense. http://p.sf.net/sfu/splunk-d2dcopy1 ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Using labels with twinx()
On Wed, Sep 28, 2011 at 3:32 PM, Klonuo Umom klo...@gmail.com wrote: How to deal with this, without manually positioning legends and if possible including all annotated plot lines in one legend? *twinx* creates a new axes. Thus there are TWO axes, and you need to do some manual adjustment. I believe that the solution suggested by Stephen George is essentially the best way, although you may try to tweak things using the Axes.get_legend_handles_labels method ( http://matplotlib.sourceforge.net/users/legend_guide.html#what-to-be-displayed ). Alternatively, you can try the axes_grid1 toolkit which automatically merges legends for you. Check out the example below. http://matplotlib.sourceforge.net/mpl_toolkits/axes_grid/users/overview.html#example-1-twinx Regards, -JJ -- All the data continuously generated in your IT infrastructure contains a definitive record of customers, application performance, security threats, fraudulent activity and more. Splunk takes this data and makes sense of it. Business sense. IT sense. Common sense. http://p.sf.net/sfu/splunk-d2dcopy1 ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] cross hatching in contours?
On Thu, Sep 15, 2011 at 10:33 PM, Jonathan Slavin jsla...@cfa.harvard.edu wrote: I'm wondering if there is some way to do cross hatching as a way to fill contours rather than colors (using contourf). The only references to cross hatching I see in the documentation are for patches type objects. As far as I can tell, contour and contourf return objects of their own type (contour.QuadContourSet) that do not have hatch as an attribute. Yes, it seems that hatching is only supported in patches. You may workaround this by converting contours to multiple patches. See the attachment. If it's not possible currently, how hard would it be to add that capability to contourf? What approach would you recommend? It may not be that difficult, but seems to require an api change (e.g., draw_path_collections). Can you file an issue on our github page? Regards, -JJ Regards, Jon -- Doing More with Less: The Next Generation Virtual Desktop What are the key obstacles that have prevented many mid-market businesses from deploying virtual desktops? How do next-generation virtual desktops provide companies an easier-to-deploy, easier-to-manage and more affordable virtual desktop model.http://www.accelacomm.com/jaw/sfnl/114/51426474/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users contour_to_hatched_patches.py Description: Binary data -- BlackBerryreg; DevCon Americas, Oct. 18-20, San Francisco, CA http://p.sf.net/sfu/rim-devcon-copy2___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] GridSpec has unecpected effect
Thanks for reporting this. I opened a pull request that I believe fixes this problem. https://github.com/matplotlib/matplotlib/pull/472 Please test this if you can. Depending on your need, you may work around this by calling all the set_position method always after all the GridSpec.update call. Regards, -JJ On Sat, Sep 17, 2011 at 1:37 AM, Kurt Mueller kurt.alfred.muel...@gmail.com wrote: Hi, In the following script, it seems to me, that GridSpec does not work as expected. #!/usr/bin/env python # vim: set fileencoding=utf-8 : # adapted from http://matplotlib.sourceforge.net/users/gridspec.html import matplotlib.pyplot as plt from matplotlib.gridspec import GridSpec fig = plt.figure() gs1 = GridSpec(3,3) gs1.update( left=0.10, right=0.45 ) ax1 = fig.add_subplot( gs1[ 0:1, 0:1 ] ) ax1.set_position( [0.1, 0.1, 0.2, 0.8] ) gs2 = GridSpec(3,3) gs2.update( left=0.55, right=0.95 ) ax2 = fig.add_subplot( gs2[ 1:3, 1:3 ] ) ax2.set_position( [0.5, 0.1, 0.2, 0.8] ) plt.show() First I put an Axes ax1 with gs1. For some reason, I want to adjust ax1 with ax1.set_position. (In the real application only fine adjust) If I run the script only to this point it works as expected. Next I put another Axes ax2 with a new GridSpec gs2. With the command gs2.update() the Axes ax1 will be put back to the place where it would be without ax1.set_position(). Is this behavior to be explained? Thanks -- Kurt Mueller -- BlackBerryreg; DevCon Americas, Oct. 18-20, San Francisco, CA http://p.sf.net/sfu/rim-devcon-copy2 ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- BlackBerryreg; DevCon Americas, Oct. 18-20, San Francisco, CA http://p.sf.net/sfu/rim-devcon-copy2 ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] bug report and fix for bracket arrow (annotations)
Thanks for reporting this. This is now fixed in the v1.0.x-maint branch and the master branch. Regards, -JJ On Sat, Sep 17, 2011 at 10:33 AM, Daniel Hyams dhy...@gmail.com wrote: In http://matplotlib.sourceforge.net/users/annotations_guide.html , about 1/3 of the way down, there is a little demonstrator for the different arrowstyles -, -, ]-, etc. Looking at the figure closely, there is no difference between the -[ and ]- styles. The fix for this is in patches.py, around line 3276 (matplotlib 1.0.0). Comments in that routine clipped out for brevity. class BracketA(_Bracket): def __init__(self, widthA=1., lengthA=0.2, angleA=None): super(ArrowStyle.BracketA, self).__init__(None,True, widthA=widthA, lengthA=lengthA, angleA=angleA ) If you flip the first two args of the __init__ call, that fixes it: class BracketA(_Bracket): def __init__(self, widthA=1., lengthA=0.2, angleA=None): super(ArrowStyle.BracketA, self).__init__(True,None, ## flip these arguments widthA=widthA, lengthA=lengthA, angleA=angleA ) -- Daniel Hyams dhy...@gmail.com -- BlackBerryreg; DevCon Americas, Oct. 18-20, San Francisco, CA http://p.sf.net/sfu/rim-devcon-copy2 ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- BlackBerryreg; DevCon Americas, Oct. 18-20, San Francisco, CA http://p.sf.net/sfu/rim-devcon-copy2 ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Drawing on a figure, not a subplot
On Sat, Sep 17, 2011 at 6:10 AM, John Ladasky john_lada...@sbcglobal.net wrote: But that isn't my goal here. I want to add lines to the FIGURE, outside of any Axes. Does anyone know how to accomplish this? Thanks! Not sure what you mean here. Adding a patch to an axes does not mean it cannot be drawn outside of axes. As far as you set (or unset) proper clip box, artists can be drawn anywhere in the canvas regardless of the axes it belongs to. Here is an example, Regards, -JJ ax = subplot(111) from matplotlib.patches import FancyArrow p = FancyArrow(0.05, 0.5, 0.2, 0.0, width=0.01, length_includes_head=False, head_width=None, head_length=None, shape='full', overhang=0, head_starts_at_zero=False, transform=ax.figure.transFigure, clip_on=False) ax.add_patch(p) -- BlackBerryreg; DevCon Americas, Oct. 18-20, San Francisco, CA http://p.sf.net/sfu/rim-devcon-copy2 ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] draggable annotation bug and fix
Thanks for reporting this. This is now fixed in the v1.0.x-maint branch and in the master branch. Regards, -JJ On Fri, Sep 16, 2011 at 9:43 AM, Daniel Hyams dhy...@gmail.com wrote: There seems to be a problem with the draggable annotation code when the annotation is just clicked, and not dragged. If you run the following code: import matplotlib.pyplot as plt fig = plt.figure() ax = fig.add_subplot(111) ann = ax.annotate('local max', xy=(2, 1), xytext=(3, 1.5),arrowprops=dict(facecolor='black', shrink=0.05)) ann.draggable() ax.set_ylim(-2,2) ax.set_xlim(0,5) plt.show() And click (just a single click) the annotation (the words local max), then resize your window a little to force a redraw. The annotation flips to the bottom left corner. The fix is in offsetbox.py, DraggableAnnotation.save_offset. If you add a call to update_offset() as the last call of that routine, everything is OK again. I think that finalize_offset is assuming that self.annotation.text is in pixels before it starts working with it, but when update_offset fails to get called (as the case with a click), self.annotation.xytext is still in axes fraction coordinates. def save_offset(self): ann = self.annotation x, y = ann.xytext if isinstance(ann.textcoords, tuple): xcoord, ycoord = ann.textcoords x1, y1 = ann._get_xy(self.canvas.renderer, x, y, xcoord) x2, y2 = ann._get_xy(self.canvas.renderer, x, y, ycoord) ox0, oy0 = x1, y2 else: ox0, oy0 = ann._get_xy(self.canvas.renderer, x, y, ann.textcoords) self.ox, self.oy = ox0, oy0 self.annotation.textcoords = figure pixels self.update_offset(0.0,0.0) # --- add this! It might be sufficient to just set self.annotation.xytext to self.ox,self.oy instead of calling update_offset like I did above. -- Daniel Hyams dhy...@gmail.com -- BlackBerryreg; DevCon Americas, Oct. 18-20, San Francisco, CA http://p.sf.net/sfu/rim-devcon-copy2 ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- BlackBerryreg; DevCon Americas, Oct. 18-20, San Francisco, CA http://p.sf.net/sfu/rim-devcon-copy2 ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] superimposition of Cartesian projection axis on a polar axis on the same position
On Thu, Sep 15, 2011 at 5:08 AM, Youngung Jeong youngung.je...@gmail.com wrote: But it only gives one axis added to 'fig.axes'. Is there any work-around? Or am I missing some other feature of matplotlib? Somehow, this is not clearly documented for the subplot command. You need to use label parameter to create multiple axes at a same position (for more details, http://matplotlib.sourceforge.net/api/figure_api.html#matplotlib.figure.Figure.add_axes) axr=fig.add_subplot(1,1,1, label=r) axp=fig.add_subplot(1,1,1,projection='polar', label=p) Regards, -JJ -- Doing More with Less: The Next Generation Virtual Desktop What are the key obstacles that have prevented many mid-market businesses from deploying virtual desktops? How do next-generation virtual desktops provide companies an easier-to-deploy, easier-to-manage and more affordable virtual desktop model.http://www.accelacomm.com/jaw/sfnl/114/51426474/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] superimposition of Cartesian projection axis on a polar axis on the same position
On Thu, Sep 15, 2011 at 6:18 AM, Benjamin Root ben.r...@ou.edu wrote: There are some ways to do this, but I haven't tried them myself. http://matplotlib.sourceforge.net/mpl_toolkits/axes_grid/users/axislines.html Ben Root You may better stick to the subplot with polar projection if your original data is in polar coordinate. The axislines module basically assumes that your data is in rectlinear coordinate system. It only draws the gridlines and labels in curvelinear system (although you can combine both). Regards, -JJ -- Doing More with Less: The Next Generation Virtual Desktop What are the key obstacles that have prevented many mid-market businesses from deploying virtual desktops? How do next-generation virtual desktops provide companies an easier-to-deploy, easier-to-manage and more affordable virtual desktop model.http://www.accelacomm.com/jaw/sfnl/114/51426474/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] superimposition of Cartesian projection axis on a polar axis on the same position
On Thu, Sep 15, 2011 at 5:08 AM, Youngung Jeong youngung.je...@gmail.com wrote: but since contour function does not plot on the polar coordinate system I think this is not True, but I may misunderstood you. Can you post an example that does not work? Here is a simple example that shows it does work. But I hardly use polar coordinate, and my example could be too simple. ax = subplot(111, polar=True) aa = np.indices((10,10)) x = np.linspace(0., np.pi*2, 10) y = np.linspace(0., 10, 10) ax.pcolormesh(x, y, aa[0], cmap=gray) ax.contour(x, y, aa[0]) Both pcolormesh and contour gives a consistent result. However, I think, while the resulting contour lines are drawn in polar coordinate system, the actual contouring is done in rectlinear cooridinate system. So there may be some caveats. Regards, -JJ -- Doing More with Less: The Next Generation Virtual Desktop What are the key obstacles that have prevented many mid-market businesses from deploying virtual desktops? How do next-generation virtual desktops provide companies an easier-to-deploy, easier-to-manage and more affordable virtual desktop model.http://www.accelacomm.com/jaw/sfnl/114/51426474/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Suggestion for annotation arrow clipping
On Mon, Sep 12, 2011 at 3:20 AM, Daniel Hyams dhy...@gmail.com wrote: I would suggest the following modification to Annotation.draw in text.py. All it does is set a clip box so that the annotation and arrow is still drawn, but the arrow is clipped at the axes boundary. It is a much nicer effect than the annotation disappearing. I have made this modification in my source locally, and it works very well, but I thought I would suggest here for inclusion into the main code base. Can you explain more explicitly why you think this behavior is better? For example, what is the point of annotating something if that something is not visible? Also, annotating texts are often placed outside of axes area. I don't think clipping out the arrow is a good idea in this case. Just in case, this is just a default behavior. You can override this behavior without changing the mpl source code. Regards, -JJ -- Doing More with Less: The Next Generation Virtual Desktop What are the key obstacles that have prevented many mid-market businesses from deploying virtual desktops? How do next-generation virtual desktops provide companies an easier-to-deploy, easier-to-manage and more affordable virtual desktop model.http://www.accelacomm.com/jaw/sfnl/114/51426474/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] 2 x-axes
Just in case, here is a version with axes_grid1 toolkit. Note that axes_grid is kind of deprecated. Regards, -JJ import numpy as np import matplotlib.pyplot as plt import mpl_toolkits.axes_grid1 as axes_grid1 host = axes_grid1.host_subplot(111) hplt, = host.plot(np.random.rand(100)) from matplotlib.transforms import Affine2D transfrom_from_parx_to_host = Affine2D().scale(1000, 1) parx = host.twin(transfrom_from_parx_to_host) if 1: # adjust axis postion etc. parx.axis[right].toggle(ticklabels=False) parx.axis[top].toggle(ticklabels=False) parx.axis[bottom].toggle(ticklabels=True) parx.axis[bottom].line.set_visible(True) parx.spines[bottom].set_position(('outward',20)) plt.show() On Sat, Sep 10, 2011 at 6:14 AM, Gökhan Sever gokhanse...@gmail.com wrote: Hi, The code below should create a properly placed 2nd x-axis. You might need to adjust the placement of the figure canvas to match into the window. import numpy as np import matplotlib.pyplot as plt from mpl_toolkits.axes_grid.parasite_axes import SubplotHost fig = plt.figure(figsize=(10,8)) host = SubplotHost(fig, 111) fig.add_subplot(host) parx = host.twiny() parx.axis[top].set_visible(False) offset = 0, -50 new_axisline = parx.get_grid_helper().new_fixed_axis parx.axis[bottom] = new_axisline(loc=bottom, axes=parx, offset=offset) parx.axis[bottom].label.set_visible(True) hplt, = host.plot(np.random.rand(100)) p2, = parx.plot(np.linspace(0,20,100), np.random.rand(100)*5.0, color='green') plt.show() There is also another example at: http://matplotlib.sourceforge.net/mpl_toolkits/axes_grid/users/overview.html#axisartist-with-parasiteaxes Hope this helps. On Fri, Sep 9, 2011 at 12:50 PM, Neal Becker ndbeck...@gmail.com wrote: Neal Becker wrote: I have a semilog plot. I'd like to add a second x axis (maybe below the existing one, or else maybe on top of graph). This second x axis is simply describing the same existing data, in different units. For example imagine a plot of x - time in seconds y - velocity x2 - time in minutes This almost works: fig = plt.figure() ax = fig.add_subplot(111) ... ax2 = ax.twiny() min_x, max_x = ax.get_xlim() ax2.set_xlim (min_x-1, max_x-1) except the 2nd x axis is on the top, and prints right on top of the title -- Why Cloud-Based Security and Archiving Make Sense Osterman Research conducted this study that outlines how and why cloud computing security and archiving is rapidly being adopted across the IT space for its ease of implementation, lower cost, and increased reliability. Learn more. http://www.accelacomm.com/jaw/sfnl/114/51425301/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Gökhan -- Why Cloud-Based Security and Archiving Make Sense Osterman Research conducted this study that outlines how and why cloud computing security and archiving is rapidly being adopted across the IT space for its ease of implementation, lower cost, and increased reliability. Learn more. http://www.accelacomm.com/jaw/sfnl/114/51425301/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Using storage to extend the benefits of virtualization and iSCSI Virtualization increases hardware utilization and delivers a new level of agility. Learn what those decisions are and how to modernize your storage and backup environments for virtualization. http://www.accelacomm.com/jaw/sfnl/114/51434361/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] 2 x-axes
On Sun, Sep 11, 2011 at 10:16 PM, Neal Becker ndbeck...@gmail.com wrote: Yes, that's very helpful. Just one thing. How would I get a bit more bottom margin on the main figure to leave more room for the extra axis? I'm using this as an example. I experimented with plt.subplots_adjust, which seems like it might do the right thing. Is this the 'best' approach? (I really don't know what all these methods do, just guessing) Yes, you need to fiddle with subplots_adjust command. The current development branch of matplotlib (not yet released) has a new function tight_layout, which does this automatically for you. Regards, -JJ -- Using storage to extend the benefits of virtualization and iSCSI Virtualization increases hardware utilization and delivers a new level of agility. Learn what those decisions are and how to modernize your storage and backup environments for virtualization. http://www.accelacomm.com/jaw/sfnl/114/51434361/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Figure clipping incorrectly ; specify whether clips horizontally or vertically
On Wed, Sep 7, 2011 at 12:09 AM, Jeffrey Spencer jeffspenc...@gmail.com wrote: Can I specify horizontal or vertical clipping?? Or what is the best way to get around this? my understanding is that the clipping is done with a closed path. so I don't think one can do such thing as horizontal clipping, etc. I guess one way is to simply increase the size of the clipping box toward the direction you want. Here is a simple example, Regards, -JJ x = np.arange(0, 8, 0.01) y = np.sin(x) ax = subplot(111) l1, = plot(x, y, lw=4) import matplotlib.transforms as mtransforms bbox_ = mtransforms.Bbox.from_bounds(0, 0, 1., 1 + 0.1) # increase the height bbox = mtransforms.TransformedBbox(bbox_, ax.transAxes) l1.set_clip_box(bbox) -- Doing More with Less: The Next Generation Virtual Desktop What are the key obstacles that have prevented many mid-market businesses from deploying virtual desktops? How do next-generation virtual desktops provide companies an easier-to-deploy, easier-to-manage and more affordable virtual desktop model.http://www.accelacomm.com/jaw/sfnl/114/51426474/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] edge joinstyle on rectangles
On Wed, Sep 7, 2011 at 12:47 AM, Jeffrey Blackburne jblackbu...@alum.mit.edu wrote: It would be nice to have. Since the patch edge seemed to be using a round style and I wanted miter, my workaround was just to use a separate step plot to overlay the outline. But for more general cases (e.g., a bar plot not created from a histogram or if I wanted a bevel style), I'm not sure how I would do it. Thanks, Jeff I also agree that this needs to be supported. Meanwhile, a workaround is to use the patheffects module. For example, from matplotlib.patheffects import Stroke b = bar([0, 1, 2], [1, 0.5, 2], linewidth=10, fc=none) for p in b: p.set_path_effects([Stroke(joinstyle=miter)]) -JJ -- Using storage to extend the benefits of virtualization and iSCSI Virtualization increases hardware utilization and delivers a new level of agility. Learn what those decisions are and how to modernize your storage and backup environments for virtualization. http://www.accelacomm.com/jaw/sfnl/114/51434361/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] contour's clabels overlap each other in an ImageGrid
Hi, I think this is partly because the current clabel implementation of matpltolib does not correctly account the dpi setting. I opened a pull request I think fix this problem. Please try that fix if you can. https://github.com/matplotlib/matplotlib/pull/453 Otherwise, I think you can workaround this by using the default dpi (72 or similar). Regards, -JJ On Fri, Sep 2, 2011 at 11:28 PM, R. O'Gara ronog...@yahoo.com wrote: Jae-Joon, thanks for your reply. There is a combination of effects that make my contour labels placed in unfortunate positions. Here is a self-contained example (somewhat different from issue I originally explained, but illustrates the fact clabels are not where I'd like them to be) import numpy as np import matplotlib as mpl ff = 10 params = { 'text.usetex': True, 'axes.labelsize': ff, 'axes.fontsize': ff, 'legend.fontsize' : ff, 'xtick.labelsize' : ff, 'ytick.labelsize' : ff, 'figure.dpi': 150, 'figure.figsize' : [5,2], } mpl.rcParams.update(params) import matplotlib.pyplot as plt import matplotlib.gridspec as gridspec gs = gridspec.GridSpec(1,2) ax = plt.subplot(gs[0]) xi = np.linspace(0,0.4,100) yi = np.linspace(0,0.4,100) xx,yy = np.meshgrid(xi,yi) zi = np.sin(5*xx*yy) v = np.arange(0.0, 0.5, 0.1) cplot = ax.contour(xi, yi, zi, v, linewidths=0.5, colors='k') ax.clabel(cplot, v, fontsize = 8, inline=True, fmt = %0.2f, ) ax.axis([np.min(xi),np.max(xi),np.min(yi),np.max(yi)]) plt.show() The end result is that contour labels are placed almost outside of the grid, with most of the area in the center being blank. I am pretty sure it has to do with the way rcParams are set, but I have no idea why. Params I do need to set are text.usetex, figure.dpi, and figure.figsize. I am using matplotlib 1.0.1. Thanks for your help, - Original Message - From: Jae-Joon Lee lee.j.j...@gmail.com To: R. O'Gara ronog...@yahoo.com Cc: matplotlib-users@lists.sourceforge.net matplotlib-users@lists.sourceforge.net Sent: Monday, August 22, 2011 11:56 PM Subject: Re: [Matplotlib-users] contour's clabels overlap each other in an ImageGrid Can you post an simple self-contained script that reproduces your problem? I just tried something similar but could not reproduces your problem. Here is what I did, Also, what version of matplotlb are you using? Regards, -JJ import matplotlib.pyplot as plt import numpy as np from mpl_toolkits.axes_grid1 import ImageGrid fig = plt.figure(1) arr = np.arange(100).reshape((10, 10)) grid = ImageGrid(fig, 111, (2, 2)) cntr0 = grid[0].contour(arr) cntr1 = grid[1].contour(arr) cntr2 = grid[2].contour(arr) cntr3 = grid[3].contour(arr) plt.clabel(cntr0, manual=True) plt.clabel(cntr1, manual=True) plt.clabel(cntr2, manual=True) plt.clabel(cntr3, manual=True) On Thu, Aug 18, 2011 at 1:10 PM, R. O'Gara ronog...@yahoo.com wrote: Hey guys, I was hoping someone could provide a hint for how I should go about correcting this. As you can see, locations for the inline labels for contours in this image are unfortunately chosen, and they overlap with one another. If I set manual to 'True' then I get this weird behavior where I can only choose labels in the top left grid and nothing is shownin any of the other grids. I am using a 2x2 Image Grid (I get the same problem when using gridspec instead of image grid), and loadingcontour data (2x2 array) from a file. Thanks for your help, Ron -- Get a FREE DOWNLOAD! and learn more about uberSVN rich system, user administration capabilities and model configuration. Take the hassle out of deploying and managing Subversion and the tools developers use with it. http://p.sf.net/sfu/wandisco-d2d-2 ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Special Offer -- Download ArcSight Logger for FREE! Finally, a world-class log management solution at an even better price-free! And you'll get a free Love Thy Logs t-shirt when you download Logger. Secure your free ArcSight Logger TODAY! http://p.sf.net/sfu/arcsisghtdev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] change font properties of legend title?
l = legend() l.get_title().set_fontproperties(...) -JJ On Thu, Sep 1, 2011 at 6:48 AM, Alan G Isaac alan.is...@gmail.com wrote: How can I change font properties of a legend title? Thanks, Alan Isaac -- Special Offer -- Download ArcSight Logger for FREE! Finally, a world-class log management solution at an even better price-free! And you'll get a free Love Thy Logs t-shirt when you download Logger. Secure your free ArcSight Logger TODAY! http://p.sf.net/sfu/arcsisghtdev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Special Offer -- Download ArcSight Logger for FREE! Finally, a world-class log management solution at an even better price-free! And you'll get a free Love Thy Logs t-shirt when you download Logger. Secure your free ArcSight Logger TODAY! http://p.sf.net/sfu/arcsisghtdev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] change font properties of legend title?
On Thu, Sep 1, 2011 at 7:21 AM, Alan G Isaac alan.is...@gmail.com wrote: On 8/31/2011 5:48 PM, Alan G Isaac wrote: How can I change font properties of a legend title? Related question: would it be a reasonable suggestion for Legend.set_title to take a ``prop`` argument? Alan Isaac Can you file an github issue for this? Regards, -JJ -- Special Offer -- Download ArcSight Logger for FREE! Finally, a world-class log management solution at an even better price-free! And you'll get a free Love Thy Logs t-shirt when you download Logger. Secure your free ArcSight Logger TODAY! http://p.sf.net/sfu/arcsisghtdev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Special Offer -- Download ArcSight Logger for FREE! Finally, a world-class log management solution at an even better price-free! And you'll get a free Love Thy Logs t-shirt when you download Logger. Secure your free ArcSight Logger TODAY! http://p.sf.net/sfu/arcsisghtdev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] ImageGrid, force grid boxes to be same size
If you don't care about the aspect ratio at all, you can use aspect=auto. Check the thread below. http://old.nabble.com/Re%3A-Can-I-change-pixel-aspect-with-axes_grid-p32300471.html Regards, -JJ On Sat, Aug 13, 2011 at 5:01 AM, R. O'Gara ronog...@yahoo.com wrote: Hi, From the attached figure, you can see that the plots I am trying to show in the bottom two quadrants, are too narrow. That is because the y-axis of those two plots is meant to be in the 0-1 range, i.e. much smaller than y-axis in the upper two, so the height of the bottom grid boxes is tiny. How can I force the heights of all boxes to be the same? Much appreciated, Ron -- FREE DOWNLOAD - uberSVN with Social Coding for Subversion. Subversion made easy with a complete admin console. Easy to use, easy to manage, easy to install, easy to extend. Get a Free download of the new open ALM Subversion platform now. http://p.sf.net/sfu/wandisco-dev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Get a FREE DOWNLOAD! and learn more about uberSVN rich system, user administration capabilities and model configuration. Take the hassle out of deploying and managing Subversion and the tools developers use with it. http://p.sf.net/sfu/wandisco-d2d-2 ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] contour's clabels overlap each other in an ImageGrid
Can you post an simple self-contained script that reproduces your problem? I just tried something similar but could not reproduces your problem. Here is what I did, Also, what version of matplotlb are you using? Regards, -JJ import matplotlib.pyplot as plt import numpy as np from mpl_toolkits.axes_grid1 import ImageGrid fig = plt.figure(1) arr = np.arange(100).reshape((10, 10)) grid = ImageGrid(fig, 111, (2, 2)) cntr0 = grid[0].contour(arr) cntr1 = grid[1].contour(arr) cntr2 = grid[2].contour(arr) cntr3 = grid[3].contour(arr) plt.clabel(cntr0, manual=True) plt.clabel(cntr1, manual=True) plt.clabel(cntr2, manual=True) plt.clabel(cntr3, manual=True) On Thu, Aug 18, 2011 at 1:10 PM, R. O'Gara ronog...@yahoo.com wrote: Hey guys, I was hoping someone could provide a hint for how I should go about correcting this. As you can see, locations for the inline labels for contours in this image are unfortunately chosen, and they overlap with one another. If I set manual to 'True' then I get this weird behavior where I can only choose labels in the top left grid and nothing is shownin any of the other grids. I am using a 2x2 Image Grid (I get the same problem when using gridspec instead of image grid), and loadingcontour data (2x2 array) from a file. Thanks for your help, Ron -- Get a FREE DOWNLOAD! and learn more about uberSVN rich system, user administration capabilities and model configuration. Take the hassle out of deploying and managing Subversion and the tools developers use with it. http://p.sf.net/sfu/wandisco-d2d-2 ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Get a FREE DOWNLOAD! and learn more about uberSVN rich system, user administration capabilities and model configuration. Take the hassle out of deploying and managing Subversion and the tools developers use with it. http://p.sf.net/sfu/wandisco-d2d-2 ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Gridspec and shared y-axis label
On Thu, Aug 18, 2011 at 5:53 PM, mogliii mogl...@gmx.net wrote: 2) I want to make a shared y-axis label. I found this page: http://www.scipy.org/Cookbook/Matplotlib/Multiple_Subplots_with_One_Axis_Label But any additional axis I put before the gridspec axis is not shown in the end. Is there a special procedure that can be used together with gridspec? This is general behavior of subplot command. http://matplotlib.sourceforge.net/api/pyplot_api.html#matplotlib.pyplot.subplot If you want to suppress this, do something like fig.add_subplot(gs[0]) Regards, -JJ -- Get a FREE DOWNLOAD! and learn more about uberSVN rich system, user administration capabilities and model configuration. Take the hassle out of deploying and managing Subversion and the tools developers use with it. http://p.sf.net/sfu/wandisco-d2d-2 ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] adding custom legends to multicolored line
You may use a proxy artist. http://matplotlib.sourceforge.net/users/legend_guide.html#using-proxy-artist for example, from matplotlib.lines import Line2D l1 = Line2D([], [], linewidth=3, color=r) l2 = Line2D([], [], linewidth=3, color=g) l3 = Line2D([], [], linewidth=3, color=b) legend([l1, l2, l3], [label 1, label 2, label 3]) Regards, -JJ On Wed, Aug 17, 2011 at 1:24 AM, Ravi Kanth Vanapalli vvnrk.vanapa...@gmail.com wrote: Hi , I wish to add a custom legend to a multicolored line drawn using matplotlib as shown in the figure below http://www.scipy.org/Cookbook/Matplotlib/MulticoloredLine I tried exploring the legend but somehow couldn't figure out its usage and how to adapt it to multicolored line as in the above link I need to use say Red line for label1 and blue line for label2 and green line for label3. All the three colors are a part of a single sinusoidal wave as in the above link. Any thoughts/ideas/suggestions which could provide me some direction on this would be highly appreciated. -- Thanks and Regards, RaviKanth -- uberSVN's rich system and user administration capabilities and model configuration take the hassle out of deploying and managing Subversion and the tools developers use with it. Learn more about uberSVN and get a free download at: http://p.sf.net/sfu/wandisco-dev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Get a FREE DOWNLOAD! and learn more about uberSVN rich system, user administration capabilities and model configuration. Take the hassle out of deploying and managing Subversion and the tools developers use with it. http://p.sf.net/sfu/wandisco-d2d-2 ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Can I change pixel aspect with axes_grid
If you want aspect=auto, this must also be set when you create ImageGrid. A simple example is attached. If you want a fixed aspect other than 1, it is doable but gets a bit tricky. Let me know if this is what you want. Regards, -JJ from mpl_toolkits.axes_grid1 import ImageGrid fig = plt.figure(1) grid = ImageGrid(fig, 111, (2, 1), aspect=False, label_mode='L', cbar_mode=single, ) arr = np.arange(100).reshape((10, 10)) im1 = grid[0].imshow(arr, aspect=auto) im2 = grid[1].imshow(arr, aspect=auto) grid[0].cax.colorbar(im1) On Sat, Aug 20, 2011 at 2:43 PM, gru...@bigpond.net.au gru...@bigpond.net.au wrote: Usually imshow(arr, aspect='auto') or imshow(arr, aspect=2.0) will display the image with pixels having some aspect ratio other than 1:1 However, I cannot get this to work when using imshow within an AxesGrid axis. Is there a way to get an array shown with imshow() within an AxesGrid axis to have a pixel aspect other than 1:1 ? If not, is there a simple way to add a shared colorbar when using subplots() ? Gary -- Get a FREE DOWNLOAD! and learn more about uberSVN rich system, user administration capabilities and model configuration. Take the hassle out of deploying and managing Subversion and the tools developers use with it. http://p.sf.net/sfu/wandisco-d2d-2 ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Get a FREE DOWNLOAD! and learn more about uberSVN rich system, user administration capabilities and model configuration. Take the hassle out of deploying and managing Subversion and the tools developers use with it. http://p.sf.net/sfu/wandisco-d2d-2 ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] mathtext in eps figures doesn't come out in pdf
When I converted the ps file to pdf, the result is okay. I tried * ps2pdf (from ghostscript version 8.61) * ps2pdf (from ghostscript version 9.02) * preview in mac os X and they all worked fine. I wonder if this could be a bug in the pspdf (ghostscript 8.70 I believe). Can you try other version of ps2pdf? Regards, -JJ On Wed, Aug 17, 2011 at 9:53 PM, Jonathan Slavin jsla...@cfa.harvard.edu wrote: Attached are examples of the problem -- a PostScript file and the pdf that is created using ps2pdf. The y-axis is properly labeled in the ps file, but the part of the label using mathtext becomes invisible in the pdf. Jon On Wed, 2011-08-17 at 14:09 +0900, Jae-Joon Lee wrote: Can you post an output eps file so that we can take a look? Regards, -JJ On Wed, Aug 17, 2011 at 5:52 AM, Jonathan Slavin jsla...@cfa.harvard.edu wrote: Hi all, I've been making figures for a paper I'm writing (to be submitted to the ApJ). I'm using LaTeX and so need to use encapsulated PostScript for the figures. The problem is that when the paper is translated to pdf from PostScript, the mathtext in the figures disappears. The reason that I think this is a matplotlib issue is that it's never happened to me with eps figures created in different ways. It's clear that this must be related to fonts, but I'm not sure how to get around it. Should I set text.usetex to True? I have a feeling this issue must have come up before, but I haven't found anything obviously pertinent in the mailing list archives. Jon -- Get a FREE DOWNLOAD! and learn more about uberSVN rich system, user administration capabilities and model configuration. Take the hassle out of deploying and managing Subversion and the tools developers use with it. http://p.sf.net/sfu/wandisco-d2d-2 ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- __ Jonathan D. Slavin Harvard-Smithsonian CfA jsla...@cfa.harvard.edu 60 Garden Street, MS 83 phone: (617) 496-7981 Cambridge, MA 02138-1516 cell: (781) 363-0035 USA __ -- Get a FREE DOWNLOAD! and learn more about uberSVN rich system, user administration capabilities and model configuration. Take the hassle out of deploying and managing Subversion and the tools developers use with it. http://p.sf.net/sfu/wandisco-d2d-2 ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Gridspec and shared y-axis label
On Fri, Aug 19, 2011 at 1:29 AM, mogliii mogl...@gmx.net wrote: Looking back I must say that http://matplotlib.sourceforge.net/api/gridspec_api.html#matplotlib.gridspec.GridSpecBase is not very helpful. And it is very counter-intuitive to the Axes dimension specification with location lower left and width/height plt.axes([0.1, 0.1, 0.8, 0.8]) Those parameters are inherited from subplot parameters http://matplotlib.sourceforge.net/api/pyplot_api.html#matplotlib.pyplot.subplots_adjust But, I agree that the documentation of grispec needs to be improved (any contribution will be appreciated). Regards, -JJ -- Get a FREE DOWNLOAD! and learn more about uberSVN rich system, user administration capabilities and model configuration. Take the hassle out of deploying and managing Subversion and the tools developers use with it. http://p.sf.net/sfu/wandisco-d2d-2 ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] mathtext in eps figures doesn't come out in pdf
Can you post an output eps file so that we can take a look? Regards, -JJ On Wed, Aug 17, 2011 at 5:52 AM, Jonathan Slavin jsla...@cfa.harvard.edu wrote: Hi all, I've been making figures for a paper I'm writing (to be submitted to the ApJ). I'm using LaTeX and so need to use encapsulated PostScript for the figures. The problem is that when the paper is translated to pdf from PostScript, the mathtext in the figures disappears. The reason that I think this is a matplotlib issue is that it's never happened to me with eps figures created in different ways. It's clear that this must be related to fonts, but I'm not sure how to get around it. Should I set text.usetex to True? I have a feeling this issue must have come up before, but I haven't found anything obviously pertinent in the mailing list archives. Jon -- Get a FREE DOWNLOAD! and learn more about uberSVN rich system, user administration capabilities and model configuration. Take the hassle out of deploying and managing Subversion and the tools developers use with it. http://p.sf.net/sfu/wandisco-d2d-2 ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Get a FREE DOWNLOAD! and learn more about uberSVN rich system, user administration capabilities and model configuration. Take the hassle out of deploying and managing Subversion and the tools developers use with it. http://p.sf.net/sfu/wandisco-d2d-2 ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Subplot of subplots.
There are a few options you can try. And I recommend you to use gridspec module. http://matplotlib.sourceforge.net/users/gridspec.html It can also be used with ImageGrid (at least in the master branch, but not sure for 1.0.1 release). I'm attaching a sample script. Regards, -JJ On Sat, Aug 6, 2011 at 12:57 AM, astabada astab...@gmail.com wrote: Hi, I am using add_subplot(...) to create a row of 4 plots, and have a tricky question. I have an image (a figure instance) composed of 4 subplots in a single row. I'd like to know how to arrange a number of these rows in a bigger grid, namely a grid of 10x3 plots, each plot made up of 1x4 subplots. The ideal solution would be: * function that returns 1x4 plots * call that function repeatedly I tried to do this with def function(figure, which_one, index): grid = ImageGrid(figure, 10,3,index, nrows_ncols = (1, 4)) grid[0].imshow(something(which_one)) grid[1].imshow(.) ... however the plots apparently share the y axis, which for me is unfeasable as: 1) the first of 4 images has about 1 pixels, while the others have 24 (6x4 pixels): no chance they can be on the same scale! 2) I want to plot a colorbar on top of the 6x4 subplots. 3) I want to write labels on top of the 6x4 subplots. This is what grid produces: an ugly white space if y axes don't have the same length. http://old.nabble.com/file/p32203453/grid.png This is my best attempt, still a lot of work to do, but don't know how to tile several of these in a 10x3 array. http://old.nabble.com/file/p32203453/ifu1_1plot.png Thank you very much. Desperately, astabada -- View this message in context: http://old.nabble.com/Subplot-of-subplots.-tp32203453p32203453.html Sent from the matplotlib - users mailing list archive at Nabble.com. -- uberSVN's rich system and user administration capabilities and model configuration take the hassle out of deploying and managing Subversion and the tools developers use with it. Learn more about uberSVN and get a free download at: http://p.sf.net/sfu/wandisco-dev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users subplot_in_subplot.py Description: Binary data -- Get a FREE DOWNLOAD! and learn more about uberSVN rich system, user administration capabilities and model configuration. Take the hassle out of deploying and managing Subversion and the tools developers use with it. http://p.sf.net/sfu/wandisco-dev2dev___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Using comma as decimal separator
I just installed the fr_FR locale and tested your patch, and I don't see any problem. I suspect that this is the problem of Axes3D (that has recently fixed by Ben), and has nothing with your patch. If I revert Ben's commit, than an error is raised regardless of the value of rcParams[axes.formatter.use_locale]. Regards, -JJ On Sat, Aug 6, 2011 at 12:49 AM, Michael Droettboom md...@stsci.edu wrote: I'm still puzzled here. The TeX file is definitely being generated with an unreasonably large size, which is what causes it to blow up. It gets the size from the size of the matplotlib figure, which I assume is being incorrectly calculated by the tight bounding box code. Of course, I can't reproduce that here, so I'm not sure what's going on. Do any of the developers who understand the tight bounding box code have any theories? Mike On 08/05/2011 09:57 AM, José Alexandre Nalon wrote: Hello! This is puzzling. I can't reproduce this -- I even get nice commas. Are you running the locale_formatting branch exactly as it is (i.e. not applying it as a patch to another version of matplotlib)? What platform are you on? Which backend? What does echo $LANG at the commandline say? I actually am getting this error with a couple of scripts, but both use bbox_inches='tight', and are 3D plots. I tried 2D plots with this option and there was no problem. In every script, I also get the commas. It is probably one of those bugs that appear because of the configuration of the many packages that are being used. I gathered some information, and I hope it helps. I am using Kubuntu 10.10, and Texlive distribution. I downloaded the .tar.gz package from github in your branch, and built it. At the time of compilation, I didn't have Tk or GTK headers (since I don't use matplotlib interactively, I don't really need them). Below, I also included the list of met dependencies, according to the installation script. I got no errors during compilation, only a warning (also listed below). Tex file and others are attached with this message (since my /tmp directory was wiped in reboot, I had to run the script again, hence the different names). This is all the information that I could think of, but if there is anything else, just send a message. Thanks again for your work! nalon@marvin:~/temp/test$ uname -a Linux marvin 2.6.35-30-generic #56-Ubuntu SMP Mon Jul 11 20:00:22 UTC 2011 i686 GNU/Linux nalon@marvin:~/temp/test$ echo $LANG pt_BR.UTF-8 nalon@marvin:~/temp/test$ latex -v pdfTeX 3.1415926-1.40.10-2.2 (TeX Live 2009/Debian) kpathsea version 5.0.0 Copyright 2009 Peter Breitenlohner (eTeX)/Han The Thanh (pdfTeX). There is NO warranty. Redistribution of this software is covered by the terms of both the pdfTeX copyright and the Lesser GNU General Public License. For more information about these matters, see the file named COPYING and the pdfTeX source. Primary author of pdfTeX: Peter Breitenlohner (eTeX)/Han The Thanh (pdfTeX). Compiled with libpng 1.2.44; using libpng 1.2.44 Compiled with zlib 1.2.3.4; using zlib 1.2.3.4 Compiled with poppler version 0.14.2 nalon@marvin:~/temp/test$ python Python 2.6.6 (r266:84292, Sep 15 2010, 15:52:39) [GCC 4.4.5] on linux2 numpy.__version__ '1.3.0' matplotlib.__version__ '1.1.0' print matplotlib.rcParams['backend'] agg Here is a relation of met dependencies and their versions (according to matplotlib installation script): Qt: 4.7.0 PyQt: 4.8.1 Freetype2: 12.0.6 Cairo: 1.8.8 libpng: 1.2.44 dvipng: 1.13 ghostscript: 8.71 latex: 3.1415926 pdftops: 0.14.3 No errors during installation, only these warnings: src/path.cpp: In member function ‘Py::Object _path_module::convert_to_svg(const Py::Tuple)’: src/path.cpp:1590: warning: format not a string literal and no format arguments src/path.cpp:1590: warning: format not a string literal and no format arguments src/path.cpp:1593: warning: format not a string literal and no format arguments src/path.cpp:1593: warning: format not a string literal and no format arguments src/path.cpp:1502: warning: ‘clip_rect.agg::rect_basedouble::y2’ may be used uninitialized in this function src/path.cpp:1502: warning: ‘clip_rect.agg::rect_basedouble::x2’ may be used uninitialized in this function src/path.cpp:1502: warning: ‘clip_rect.agg::rect_basedouble::y1’ may be used uninitialized in this function src/path.cpp:1502: warning: ‘clip_rect.agg::rect_basedouble::x1’ may be used uninitialized in this function --- José Alexandre Nalon na...@terra.com.br -- BlackBerryreg; DevCon Americas, Oct. 18-20, San Francisco, CA The must-attend event for mobile developers. Connect with experts. Get tools for creating Super Apps. See the latest technologies. Sessions, hands-on labs, demos much more. Register early save! http://p.sf.net/sfu/rim-blackberry-1
Re: [Matplotlib-users] Adding Title to RadioButtons Axis
On Fri, Aug 5, 2011 at 4:22 AM, Paul Blelloch paul.blell...@ata-e.com wrote: title = 'Overlap' Did you mean to do title(Overlap) ? And yes it works as expected. If it does not work for you, please post a simple but complete example. -JJ -- BlackBerryreg; DevCon Americas, Oct. 18-20, San Francisco, CA The must-attend event for mobile developers. Connect with experts. Get tools for creating Super Apps. See the latest technologies. Sessions, hands-on labs, demos much more. Register early save! http://p.sf.net/sfu/rim-blackberry-1 ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Customize Tick Labels with Axis Artist
There could be a few ways. What I recommend as a matter of fact is to use other method to draw gridlines. On the other hand, given that you have a working example, it could be better to have different axis to draw ticklabels in locations where you want. Here is a diff. Regards, -JJ *** qqwee2.py 2011-07-20 22:02:37.973960916 +0900 --- qqwee.py2011-07-20 22:04:46.063960883 +0900 *** *** 36,41 --- 36,60 ax1 = floating_axes.FloatingSubplot(fig, rect, grid_helper=grid_helper) fig.add_subplot(ax1) +grid_locator1 = FixedLocator([j-0.5*pi for j in theta[::10]]) +grid_locator2 = FixedLocator([i for i in rad[::5]]) + +grid_helper2 = floating_axes.GridHelperCurveLinear(tr, +extremes=(.5*pi-0.17, -.5*pi+0.17, 120, 1), +grid_locator1=grid_locator1, +grid_locator2=grid_locator2, +tick_formatter1=None, +tick_formatter2=None, +) + +ax1.axis[left2] = grid_helper2.new_fixed_axis(left, axes=ax1) +ax1.axis[left2].line.set_visible(False) +ax1.axis[left2].toggle(ticks=False) + +ax1.axis[bottom2] = grid_helper2.new_fixed_axis(bottom, axes=ax1) +ax1.axis[bottom2].line.set_visible(False) +ax1.axis[bottom2].toggle(ticks=False) + # create a parasite axes whose transData in RA, cz aux_ax = ax1.get_aux_axes(tr) On Tue, Jul 12, 2011 at 2:12 AM, bhargav vaidya coolas...@gmail.com wrote: Hello all, I need help to have customize tick labels using axis artist. My problem is to create a grid representation in polar co-ordinates (see fig) with r = logspace(log(1),log(120),128) and theta = linspace(0.17,2.97,64) # in radians I managed to to create the proper gridlines. But unfortunately I have to remove the tick labels as the way I describe the grid locator they crowd the axis. I would like to choose only certain points on the axis and label them as the plot would look nice. Regards Bhargav Vaidya. Here is my code modified to my need from already existing code found in the web : from matplotlib.transforms import Affine2D import mpl_toolkits.axisartist.floating_axes as floating_axes import numpy as np import mpl_toolkits.axisartist.angle_helper as angle_helper from matplotlib.projections import PolarAxes from mpl_toolkits.axisartist.grid_finder import FixedLocator, MaxNLocator, \ DictFormatter def setup_axes2(fig, rect): tr = PolarAxes.PolarTransform() pi = np.pi rad = np.logspace(np.log(1.),np.log(120.),128) # Radial theta = np.linspace(0.17,2.97,64) # Theta Co-ordinates angle_ticks = [(0, r$\frac{1}{2}\pi$), (.25*pi, r$\frac{1}{4}\pi$), (.5*pi, r$0$), (-.25*pi, r$\frac{3}{4}\pi$), (-0.5*pi, r$\pi$)] grid_locator1 = FixedLocator([j-0.5*pi for j in theta]) #grid_locator1 = FixedLocator([v for v, s in angle_ticks]) grid_locator2 = FixedLocator([i for i in rad]) grid_helper = floating_axes.GridHelperCurveLinear(tr, extremes=(.5*pi-0.17, -.5*pi+0.17, 120, 1), grid_locator1=grid_locator1, grid_locator2=grid_locator2, tick_formatter1=None, tick_formatter2=None, ) ax1 = floating_axes.FloatingSubplot(fig, rect, grid_helper=grid_helper) fig.add_subplot(ax1) # create a parasite axes whose transData in RA, cz aux_ax = ax1.get_aux_axes(tr) aux_ax.patch = ax1.patch # for aux_ax to have a clip path as in ax ax1.patch.zorder=0.9 # but this has a side effect that the patch is # drawn twice, and possibly over some other # artists. So, we decrease the zorder a bit to # prevent this. return ax1, aux_ax if 1: import matplotlib.ticker as mpltick import matplotlib.pyplot as plt fig = plt.figure(1, figsize=(10, 10)) ax2, aux_ax2 = setup_axes2(fig, 111) ax2.axis[left].major_ticklabels.set_visible(False) ax2.axis[bottom].major_ticklabels.set_visible(False) ax2.grid(color='k',linestyle='-',linewidth=0.5) plt.show() Here is the eps file -- All of the data generated in your IT infrastructure is seriously valuable. Why? It contains a definitive record of application performance, security threats, fraudulent activity, and more. Splunk takes this data and makes sense of it. IT sense. And common sense. http://p.sf.net/sfu/splunk-d2d-c2 ___ Matplotlib-users mailing list
Re: [Matplotlib-users] colorbar() moves to wrong place on subplots_adjust call
On Tue, Jun 14, 2011 at 4:58 AM, Nicholas Devenish misnomer+matplot...@gmail.com wrote: Is there a way I can avoid or correct this behaviour? It certainly seems erroneous that using the figure GUI to adjust plot bounds doesn't work, and is an especially nice way of tweaking for final plots. Unfortunately no. This is a limitation of how colobar is currently implemented (v1.1 will have a workaround to this). I think the simple (but may not be good enough) workaround is to call colorbar after subplot adjusting is done. Alternatively, you may try the axes_grid1 toolkit. http://matplotlib.sourceforge.net/mpl_toolkits/axes_grid/users/overview.html#colorbar-whose-height-or-width-in-sync-with-the-master-axes Regards, -JJ -- EditLive Enterprise is the world's most technically advanced content authoring tool. Experience the power of Track Changes, Inline Image Editing and ensure content is compliant with Accessibility Checking. http://p.sf.net/sfu/ephox-dev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Independent Legends
The first argument of the label command is a list of artist to be labeled. And it does not matter whether they are associated with axes or not. What you can do, therefore, is 1) draw something as you want them in the legend 2) remove them from the axes 3) make a legend from these artists. l1, = plt.plot([1,2,3]) l1.remove() plt.legend([l1], [test]) If you know how to create artists w/o using axes method (or. pyplot function), you may do so of course. Regards, -JJ On Thu, Jun 2, 2011 at 3:41 AM, htaunay htau...@gmail.com wrote: Is there anyway to set/create legends independent of what I am plotting? Simply manually create, position and show legends, that not necessarily are directly linked to the graph. To be specific, I am plotting several points, in a scatter form, individually, and depending on the given attributes, I manually set what colour and marker each point will present. My intention is to create legends that specify the categories of my data, in a way that I can manually define what colour/marker they are linked to. Thanks in advance for any help! -- View this message in context: http://old.nabble.com/Independent-Legends-tp31752112p31752112.html Sent from the matplotlib - users mailing list archive at Nabble.com. -- Simplify data backup and recovery for your virtual environment with vRanger. Installation's a snap, and flexible recovery options mean your data is safe, secure and there when you need it. Data protection magic? Nope - It's vRanger. Get your free trial download today. http://p.sf.net/sfu/quest-sfdev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Simplify data backup and recovery for your virtual environment with vRanger. Installation's a snap, and flexible recovery options mean your data is safe, secure and there when you need it. Discover what all the cheering's about. Get your free trial download today. http://p.sf.net/sfu/quest-dev2dev2 ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] bug in mpl_toolkits.axes_grid1.AxesGrid?
Using AxesGrid does not mean that color scales are shared. It only takes care of axes placement. And it is your responsibility to sync colorbars of multiple images. One option is to use *norm* attribute of images. norm = matplotlib.colors.Normalize() for i in range(3): im = grid[i].imshow(Z, extent=extent, interpolation=nearest, norm=norm) im = grid[3].imshow(1000 * Z, extent=extent, interpolation=nearest, norm=norm) Regards, -JJ On Wed, May 25, 2011 at 11:05 AM, Paul Anton Letnes paul.anton.let...@gmail.com wrote: Hi! I am wondering if there is a bug in: mpl_toolkits.axes_grid1.AxesGrid I am trying to run this example (I am of course working on something else, but I am trying to build a minimal example of my problem): http://matplotlib.sourceforge.net/examples/axes_grid/demo_axes_grid.html This would be a very compact and nice way of showing my results, and I am beginning to love it. There is one thing, though. Given the code attached at the end of this message, the two versions produce figures that look identical. To my mind, however, it doesn't exactly seem that the colorbars are shared in any real sense. Try commenting out the 2-3 lines marked # Version 1 and # Version 2. I attach two plots of what I get: same-looking plots with wildly varying colorbar numbers. I'd like to get the numbers to be the same. TL;DR: In version 1 I am scaling the data for one of the contour plots by a factor 1000, and would expect that plot to look quite different from the others. Cheers Paul. # CODE: import matplotlib matplotlib.use('agg') import matplotlib.pyplot as plt from mpl_toolkits.axes_grid1 import AxesGrid def get_demo_image(): import numpy as np from matplotlib.cbook import get_sample_data f = get_sample_data(axes_grid/bivariate_normal.npy, asfileobj=False) z = np.load(f) # z is a numpy array of 15x15 return z, (-3,4,-4,3) def demo_grid_with_single_cbar(fig): A grid of 2x2 images with a single colobar grid = AxesGrid(fig, 132, # similar to subplot(132) nrows_ncols = (2, 2), axes_pad = 0.0, share_all=True, label_mode = L, cbar_location = top, cbar_mode=single) Z, extent = get_demo_image() # Version 1 #for i in range(3): #im = grid[i].imshow(Z, extent=extent, interpolation=nearest) #im = grid[3].imshow(1000 * Z, extent=extent, interpolation=nearest) # Version 2 for i in range(4): im = grid[i].imshow(Z, extent=extent, interpolation=nearest) # The rest is the same grid.cbar_axes[0].colorbar(im) # This affects all axes as share_all = True. grid.axes_llc.set_xticks([-2, 0, 2]) grid.axes_llc.set_yticks([-2, 0, 2]) if 1: F = plt.figure(1, (5.5, 2.5)) F.subplots_adjust(left=0.05, right=0.98) demo_grid_with_single_cbar(F) plt.savefig('cbars') #plt.draw() #plt.show() -- vRanger cuts backup time in half-while increasing security. With the market-leading solution for virtual backup and recovery, you get blazing-fast, flexible, and affordable data protection. Download your free trial now. http://p.sf.net/sfu/quest-d2dcopy1 ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Simplify data backup and recovery for your virtual environment with vRanger. Installation's a snap, and flexible recovery options mean your data is safe, secure and there when you need it. Data protection magic? Nope - It's vRanger. Get your free trial download today. http://p.sf.net/sfu/quest-sfdev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] eps and useTex: tick labels drawn over legend box
I'm not 100% sure on this but it seems that this is a limitation of psfrag that the ps backend relies on. The ps backend first produces an eps file without TeX labels, and these TeX labels are put on the eps file with latex+psfrag. And it seems these TeX labels are always above the contents of the eps file. Unfortunately, I don't think this can be easily fixed. Regards, -JJ On Wed, Jun 1, 2011 at 6:34 AM, Brannon gilt...@gmail.com wrote: Hi, I am having trouble with matplotlib 1.0.1 drawing the axis tick labels over the legend box in the eps output when useTex is set to true. The plot shown after calling plt.show() looks fine, as does the output in pdf, png, svg etc. Only the postscript appears to be affected. The following simple example produces the png and eps files given at the bottom of this post: import matplotlib as mpl import matplotlib.pyplot as plt from matplotlib import rc rc('text', usetex=True) g1 = plt.plot([1,2,3,4],[500,600,700,800]) g2 = plt.plot([1,2,3,4],[700,300,700,200]) g3 = plt.plot([1,2,3,4],[800,600,900,800]) plt.figlegend([g1,g2,g3],['test1','test2','test3'],'upper left') plt.savefig('image.png') plt.savefig('image.eps') plt.show() http://old.nabble.com/file/p31744864/image.eps image.eps http://old.nabble.com/file/p31744864/image.png image.png I would very much appreciate some help resolving this issue. Thanks -- View this message in context: http://old.nabble.com/eps-and-useTex%3A-tick-labels-drawn-over-legend-box-tp31744864p31744864.html Sent from the matplotlib - users mailing list archive at Nabble.com. -- Simplify data backup and recovery for your virtual environment with vRanger. Installation's a snap, and flexible recovery options mean your data is safe, secure and there when you need it. Data protection magic? Nope - It's vRanger. Get your free trial download today. http://p.sf.net/sfu/quest-sfdev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Simplify data backup and recovery for your virtual environment with vRanger. Installation's a snap, and flexible recovery options mean your data is safe, secure and there when you need it. Data protection magic? Nope - It's vRanger. Get your free trial download today. http://p.sf.net/sfu/quest-sfdev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] eps and useTex: tick labels drawn over legend box
Just in case, I have opened a git issue on this. https://github.com/matplotlib/matplotlib/issues/131 -JJ On Wed, Jun 1, 2011 at 1:23 PM, Jae-Joon Lee lee.j.j...@gmail.com wrote: I'm not 100% sure on this but it seems that this is a limitation of psfrag that the ps backend relies on. The ps backend first produces an eps file without TeX labels, and these TeX labels are put on the eps file with latex+psfrag. And it seems these TeX labels are always above the contents of the eps file. Unfortunately, I don't think this can be easily fixed. Regards, -JJ On Wed, Jun 1, 2011 at 6:34 AM, Brannon gilt...@gmail.com wrote: Hi, I am having trouble with matplotlib 1.0.1 drawing the axis tick labels over the legend box in the eps output when useTex is set to true. The plot shown after calling plt.show() looks fine, as does the output in pdf, png, svg etc. Only the postscript appears to be affected. The following simple example produces the png and eps files given at the bottom of this post: import matplotlib as mpl import matplotlib.pyplot as plt from matplotlib import rc rc('text', usetex=True) g1 = plt.plot([1,2,3,4],[500,600,700,800]) g2 = plt.plot([1,2,3,4],[700,300,700,200]) g3 = plt.plot([1,2,3,4],[800,600,900,800]) plt.figlegend([g1,g2,g3],['test1','test2','test3'],'upper left') plt.savefig('image.png') plt.savefig('image.eps') plt.show() http://old.nabble.com/file/p31744864/image.eps image.eps http://old.nabble.com/file/p31744864/image.png image.png I would very much appreciate some help resolving this issue. Thanks -- View this message in context: http://old.nabble.com/eps-and-useTex%3A-tick-labels-drawn-over-legend-box-tp31744864p31744864.html Sent from the matplotlib - users mailing list archive at Nabble.com. -- Simplify data backup and recovery for your virtual environment with vRanger. Installation's a snap, and flexible recovery options mean your data is safe, secure and there when you need it. Data protection magic? Nope - It's vRanger. Get your free trial download today. http://p.sf.net/sfu/quest-sfdev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Simplify data backup and recovery for your virtual environment with vRanger. Installation's a snap, and flexible recovery options mean your data is safe, secure and there when you need it. Data protection magic? Nope - It's vRanger. Get your free trial download today. http://p.sf.net/sfu/quest-sfdev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Feature request: automatic scaling of subplots, margins, etc
Attached is a modified version of Tony's script. * no drawing is necessary * support subplots that span multiple rows/columns Please test it and let me know of any problem. I'm planning to push these functionality into matplolib after some refactoring (e.g., it would be good to have pyplot.tight_layout). Regards, -JJ On Wed, May 11, 2011 at 8:50 PM, Daniel Mader danielstefanma...@googlemail.com wrote: Hi again, Hi Jae-Loon, thanks for your comments! Of course I do agree that a figure layout should not change in interactive mode. However, I don't see why this should happen upon a panning action. A different case is when the label or title font sizes are changed, but I was assuming this is adjusted prior to the creation of the figure. Since you said the current design is broken, I thought you want things adjusted *whenever* a figure is updated. So, I guess what you want is some functionality like what Tony's script does? One of the reason that I was not very inclined to Tony's approach is that it only works for subplots (and I guess it only works with subplots with pure n x m grid. Correct me if I'm wrong). But maybe it is better than nothing. I'll consider how things can be improved. I do sense a match of ideas here :) This is exactly what I am missing! It is very good to hear that you are so open to suggestions and possible improvements! It is a great pleasure to work with Scipy/Matplotlib and interact with the community! Best regards, Daniel tight_layout.py Description: Binary data -- Achieve unprecedented app performance and reliability What every C/C++ and Fortran developer should know. Learn how Intel has extended the reach of its next-generation tools to help boost performance applications - inlcuding clusters. http://p.sf.net/sfu/intel-dev2devmay___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Feature request: automatic scaling of subplots, margins, etc
On Wed, May 11, 2011 at 5:03 PM, Daniel Mader danielstefanma...@googlemail.com wrote: Hi Jae-Loon, thanks for your comments! Of course I do agree that a figure layout should not change in interactive mode. However, I don't see why this should happen upon a panning action. A different case is when the label or title font sizes are changed, but I was assuming this is adjusted prior to the creation of the figure. Since you said the current design is broken, I thought you want things adjusted *whenever* a figure is updated. So, I guess what you want is some functionality like what Tony's script does? One of the reason that I was not very inclined to Tony's approach is that it only works for subplots (and I guess it only works with subplots with pure n x m grid. Correct me if I'm wrong). But maybe it is better than nothing. I'll consider how things can be improved. Regards, -JJ For the time being I am very happy with Tony's solution. It works nice most of the time, only very complex figures take forever now to be drawn. The current behavior *looks* broken to any user who does not understand the internals. And it's too likely that even simple figures look horrible. I'd definitely vote for a more end-user friendly solution (with end users I have scientific users in mind who generally appreciate the beauty of the generated plots but who don't integrated the library into some other application). Best regards, Daniel -- Achieve unprecedented app performance and reliability What every C/C++ and Fortran developer should know. Learn how Intel has extended the reach of its next-generation tools to help boost performance applications - inlcuding clusters. http://p.sf.net/sfu/intel-dev2devmay ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Feature request: automatic scaling of subplots, margins, etc
On Thu, May 12, 2011 at 2:37 AM, Brendan Barnwell brenb...@brenbarn.net wrote: One thing I've always wondered: is it fundamentally impossible to change the fact that, in matplotlib, you cannot know how big a drawn object will be until you actually draw it? Well, I don't think this is 100% correct. As far as I can see, there is two issues involved. 1) size of text may depend on the renderer (since font selection could be different). 2) Position of some artist depend on position of other artist (e.g., the exact location of axis label depend on sizes of tick labels). In fact, neither of these require drawing. But, the easiest way is to draw it (primarily due to the second point). Can you describe what you were doing with your animation? Matplotlib provide some framework to overcome these limitation (e.g., classes in the offsetbox module). And there may be easier ways that does what you want. Regards, -JJ -- Achieve unprecedented app performance and reliability What every C/C++ and Fortran developer should know. Learn how Intel has extended the reach of its next-generation tools to help boost performance applications - inlcuding clusters. http://p.sf.net/sfu/intel-dev2devmay ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Feature request: automatic scaling of subplots, margins, etc
On Thu, May 12, 2011 at 2:59 AM, Benjamin Root ben.r...@ou.edu wrote: Most things, we do know the sizes of. It is my understanding that it is the text objects that is the unknown. If this could be solved, then a layout engine would be much more feasible. I doubt it. As far as I know, the main reason that things needed to be drawn is because the location and size of some artist depends on location and size of other artists. Unfortunately, with current matplotlib code, most of these things are determined inside the draw method. Therefore, we need to separate out those things out from the draw method. Another option, which I think is more feasible, is to implement a BBoxRenderer which does not draw anything but only update the size and location of artists. Regards, -JJ The problem is that even LaTeX has to re-render things multiple times to get this right for an arbitrary font. If we were to restrict ourselves to particular fonts and package those fonts with matplotlib, then we could have an internal table of size information for each glyph and compute it on the fly and lay everything out right. But, that would cause us to give up significant benefits for another benefit. -- Achieve unprecedented app performance and reliability What every C/C++ and Fortran developer should know. Learn how Intel has extended the reach of its next-generation tools to help boost performance applications - inlcuding clusters. http://p.sf.net/sfu/intel-dev2devmay ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Possible bug / odd behaviour in GridSpec?
Yes, this is a bug that has been fixed. https://github.com/matplotlib/matplotlib/commit/76851eb Regards, -JJ On Thu, May 12, 2011 at 7:53 AM, Goyo goyod...@gmail.com wrote: 2011/5/12 David Andrews irbda...@gmail.com: Hi, I've come across something I don't entirely understand in the behaviour of gridspec. It's not obvious from the code docs for this module, but is it only supposed to be able to deal with 'square' layouts, e.g. 3x3, 4x4 etc? Taking some code from an example on the gridspec page ... import matplotlib.pylab as plt import matplotlib.gridspec as gridspec #gs = gridspec.GridSpec(3, 3) # OK gs = gridspec.GridSpec(6, 3) # Will cause an error later on ax1 = plt.subplot(gs[0, :]) ax2 = plt.subplot(gs[1,:-1]) ax3 = plt.subplot(gs[1:,-1]) ax4 = plt.subplot(gs[-1,0]) ax5 = plt.subplot(gs[-1,-2]) plt.show() ... will fail if that line is uncommented, giving an index error. Works for me. Ubuntu 11.04 Natty, stock python 2.7.1 and matplotlib 1.0.1 from https://launchpad.net/~valavanisalex/+archive/matplotlib. -- Achieve unprecedented app performance and reliability What every C/C++ and Fortran developer should know. Learn how Intel has extended the reach of its next-generation tools to help boost performance applications - inlcuding clusters. http://p.sf.net/sfu/intel-dev2devmay ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Achieve unprecedented app performance and reliability What every C/C++ and Fortran developer should know. Learn how Intel has extended the reach of its next-generation tools to help boost performance applications - inlcuding clusters. http://p.sf.net/sfu/intel-dev2devmay ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Possible bug / odd behaviour in GridSpec?
On Thu, May 12, 2011 at 7:18 AM, David Andrews irbda...@gmail.com wrote: I'm quite interested in getting involved with mpl development, partly as a way to get my head around python numpy and aid porting a bunch of stuff I use over to python from IDL. Unless I'm doing something totally wrong by expecting the above snippet to work, then I'd happily spend some time looking into this in more detail, having written some similar code in IDL. The docs for that module also look like they could benefit from some work. Yes, the docs need lots of work I guess and any contribution will be greatly appreciated. If you're willing to improve the docs for gridspec, I'm more than happy to help you (I am the main author of that module). The best way to contribute is to use github pull request and matplotlib is hosted here https://github.com/matplotlib/matplotlib Regards, -JJ -- Achieve unprecedented app performance and reliability What every C/C++ and Fortran developer should know. Learn how Intel has extended the reach of its next-generation tools to help boost performance applications - inlcuding clusters. http://p.sf.net/sfu/intel-dev2devmay ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Feature request: automatic scaling of subplots, margins, etc
On Fri, May 6, 2011 at 5:20 PM, Daniel Mader danielstefanma...@googlemail.com wrote: From many postings here I have learned that this is the absolute intention, i.e. it is broken by design unless the programmer takes care about this. I think there are pros and cons, and I don't think the current design is simply broken. For example, it will be very distracting if the axes area changes while you're doing some interactive stuff (e.g., panning). Anyhow I admit that the default layout may not be optimal for figures with multiple subplots, and there is a room for improvement. There are a few approach you can take. * If you're only interested in saved outputs, you may use savefig with bbox_inches=tight. Note that this changes the size of figure. * Use Tony's script to adjust the subplot params automatically. * use axes_grid1 toolkit which enables you to change the axes position on the fly. Check http://www.mail-archive.com/matplotlib-users@lists.sourceforge.net/msg18743.html. For current git master branch, check examples/axes_grid/make_room_for_ylabel_using_axesgrid.py Regards, -JJ -- Achieve unprecedented app performance and reliability What every C/C++ and Fortran developer should know. Learn how Intel has extended the reach of its next-generation tools to help boost performance applications - inlcuding clusters. http://p.sf.net/sfu/intel-dev2devmay ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] How do I make the radius logarithmic with axisartist?
The Axes class of the axisartist toolkit uses very different way to handle ticks and tick labels. Thus most of the tick-related commands of original matplotlib do not work! Unfortunately, there is no easy way to support a logarithmic scale. To utilize the full functionality, you need to create a transform object and provide an appropriate tick locator. The first part is easy but the second part is not. You can use origial mapltolib's tick locator, but it has a limitation that minor ticks are not well supported. The easiest way is to convert your data to log scale and use a fixed locator with a custom formatter. An example script is attached. The better approach is to create your own locator and formatter. Regards, -JJ On Fri, Apr 22, 2011 at 1:49 AM, Junghun Shin jhs...@ef.eie.eng.osaka-u.ac.jp wrote: Hi, everyone. Let me explain what I wanted to do: First, I wanted to make a polar plot with angles from 0 to 90. I could do it by adopting the curvelinear grid demo ( http://goo.gl/kruXf ). And then I wanted to present the radius in log10 scale. But setting the plot command to semilogy or trying to set 'set_rscale('log')' all failed. Below I pasted the code that works for radius in linear scale. [Code] #!/usr/bin/env python import matplotlib.pyplot as plt import numpy as np #Modified from http://matplotlib.sourceforge.net/plot_directive/mpl_toolkits/axes_grid/examples/demo_floating_axis.py #def curvelinear_test2(fig, lp_r, lp_t): def curvelinear_test2(fig, lp_t, lp_r, rLower, rUpper): rmin = np.min(lp_r) rmax = np.max(lp_r) print 'rm: ', rmin, 'rM: ', rmax,'rL: ', rLower, 'rU: ', rUpper polar projection, but in a rectangular box. global ax1 import mpl_toolkits.axisartist.angle_helper as angle_helper from matplotlib.projections import PolarAxes from matplotlib.transforms import Affine2D from mpl_toolkits.axisartist import SubplotHost, ParasiteAxesAuxTrans from mpl_toolkits.axisartist import GridHelperCurveLinear from mpl_toolkits.axisartist.grid_helper_curvelinear import GridHelperCurveLinear # see demo_curvelinear_grid.py for details tr = Affine2D().scale(np.pi/180., 1.) + PolarAxes.PolarTransform() extreme_finder = angle_helper.ExtremeFinderCycle(20, 20, lon_cycle = 360, lat_cycle = None, lon_minmax = (0, 360), lat_minmax = (-np.inf, np.inf), #lat_minmax = (rmin, np.inf), ) grid_locator1 = angle_helper.LocatorDMS(12) tick_formatter1 = angle_helper.FormatterDMS() grid_helper = GridHelperCurveLinear(tr, extreme_finder=extreme_finder, grid_locator1=grid_locator1, tick_formatter1=tick_formatter1 ) ax1 = SubplotHost(fig, 1, 1, 1, grid_helper=grid_helper) fig.add_subplot(ax1) # make ticklabels of all axis visible. ax1.axis[:].major_ticklabels.set_visible(True) #ax1.axis[top].major_ticklabels.set_visible(True) #ax1.axis[left].major_ticklabels.set_visible(True) #ax1.axis[bottom].major_ticklabels.set_visible(True) # show angle (0) at right and top ax1.axis[right].get_helper().nth_coord_ticks=0 ax1.axis[top].get_helper().nth_coord_ticks=0 # show radius (1) at left and bottom ax1.axis[left].get_helper().nth_coord_ticks=1 ax1.axis[bottom].get_helper().nth_coord_ticks=1 # set labels ax1.axis[left].label.set_text(r'ylabel') ax1.axis[bottom].label.set_text(r'xlabel') ax1.axis[bottom].major_ticklabels.set_rotation(-30) ax1.set_aspect(1.) ax1.set_xlim(rLower, rUpper) ax1.set_ylim(rLower, rUpper) #ax1.rscale('log') # A parasite axes with given transform ax2 = ParasiteAxesAuxTrans(ax1, tr, equal) # note that ax2.transData == tr + ax1.transData # Anthing you draw in ax2 will match the ticks and grids of ax1. ax1.parasites.append(ax2) ax2.plot(lp_t, lp_r, 'o-') #ax2.semilogy(lp_t, lp_r, 'o-') #ax2.set_rscale('log') #ax1.set_xscale('log') #ax1.set_yscale('log') ax1.grid(True) if __name__ == __main__: fig = plt.figure(1, figsize=(5, 5)) fig.clf() rmin = 1e-1 rmax = 1e2 lp_t = np.linspace(0., 90., 5) lp_r = np.linspace(rmin, rmax/10, 5)*5 print lp_t: , lp_t print lp_r: , lp_r print log10(lp_r): , np.log10(lp_r) curvelinear_test2(fig, lp_t, lp_r, rmin, rmax) #curvelinear_test2(fig, lp_t, np.log10(lp_r), np.log10(rmin), np.log(rmax)) plt.show() [/Code] I'm using Enthought Python Distribution Version: 7.0-2 (32-bit) Python 2.7.1 on win32 and
Re: [Matplotlib-users] how to scale colorbar size to image size?
On Tue, Apr 12, 2011 at 3:31 AM, Jonathan Slavin jsla...@cfa.harvard.edu wrote: (Shouldn't the default behavior be to scale to height if the colorbar is vertical and width if its horizontal?) Because of the design of the matplotlib, this is not straight forward to implement. While there could be a few ways to do it, you may try axes_grid1 toolkit. http://matplotlib.sourceforge.net/mpl_toolkits/axes_grid/users/overview.html#colorbar-whose-height-or-width-in-sync-with-the-master-axes Regards, -JJ -- Benefiting from Server Virtualization: Beyond Initial Workload Consolidation -- Increasing the use of server virtualization is a top priority.Virtualization can reduce costs, simplify management, and improve application availability and disaster protection. Learn more about boosting the value of server virtualization. http://p.sf.net/sfu/vmware-sfdev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Different xtick pads for subplots within figure
This seems to be a bug in matplotlib. I just opened a bug track for it. https://github.com/matplotlib/matplotlib/issues/88 As a workaround, try ax3.tick_params(pad=20) Regards, -JJ On Tue, Mar 15, 2011 at 10:43 AM, NotBrianCox samwisehawk...@gmail.com wrote: 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 -- Benefiting from Server Virtualization: Beyond Initial Workload Consolidation -- Increasing the use of server virtualization is a top priority.Virtualization can reduce costs, simplify management, and improve application availability and disaster protection. Learn more about boosting the value of server virtualization. http://p.sf.net/sfu/vmware-sfdev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users