Re: [Matplotlib-users] Legend frame edgecolor and linewidth
Hello, after looking at the code I found that there are two settings that are not documented (they are not in the template matplotlibrc) that control the legend frame: "legend.edgecolor" and "legend.facecolor". The first is enough for my needs, however I think it would be nice to add the possibility to control the frame linewidth. I have a small patch that add a "legend.linewidth" setting that defaults to "inherit", meaning that the legend frame has the same width of the axes. The setting name is not the most intuitive, but it is coherent with the existing "legend.edgecolor" and "legend.facecolor". It would be better to replace "legend.frmaeon" with a boolean setting "legend.frame and control the frame with "legend.frame.edgecolor", "legend.frame.facecolor" and "legend.frame.linewidth". But this would require deprecating the old settings. I can prepare a patch if this is desired. Cheers, Daniele On 13/11/15 17:08, Benjamin Root wrote: > Indeed, it looks like there isn't a very good way to control all of the > properties of the frame portion of a legend. This could certainly use > some improvements, partly in allowing a dictionary of property values to > be passed in `plt.legend()` (there is already a dictionary of font > properties), but also to have some rcParams that could be made > available, too. Such improvements are always welcome! > > Cheers! > Ben Root > > On Fri, Nov 13, 2015 at 7:57 AM, Daniele Nicolodi <dani...@grinta.net > <mailto:dani...@grinta.net>> wrote: > > Hello, > > there is a way to control the edgecolor and the linewidth of the frame > drawn around the legend? I set the axes linewidth to 0.5 but the legend > frame linewidth is set to 1.0 and it does not look nice. Also, most of > the time I don't want the frame edge to be drawn at all. > > Always doing: > > l = plt.legend() > l.get_frame().set_edgecolor('none') > > is boring. > > If the setting are not there, would a patch adding a setting to style > the legend frame be considered? Additionally, would it make sense to > default the legend frame linewidth to the axes linewidth? > > Cheers, > Daniele > > > -- > ___ > Matplotlib-users mailing list > Matplotlib-users@lists.sourceforge.net > <mailto:Matplotlib-users@lists.sourceforge.net> > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > > -- ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] TkAfgg window handling bug on MaxOSX
Hello, I use matplotlib 1.5.0 via macports on MacOSX 10.10.5 and I'm testing the TkAgg backend (the MacOSX backend has some annoying bugs). I notice the following strange behavior in a IPython 4.0.0 console: 1. run the following lines: In [1]: %matplotlib tk In [2]: import matplotlib.pyplot as plt In [3]: plt.figure() 2. focus the figure window (with command-tab, for example) 3. press command-w to close the window, the window closes 4. focus the terminal window (with command-tab, for example) 5. focus the Python app which still exist (with command-tab, for example), the figure window re-appears (!!) but it is not functional 6. cycle the focus between the windows of the Python app (with command-`), the figure window will be interactive again 7. try again to close the window (clicking the 'x' or again with command-w), the window disappears 8. back to 4 I haven't found a way to get rid of the window. The MacOSX backe works correctly in this respect. Can someone else on MacOSX confirm the bug? Where should I start debugging? Thanks. Best, Daniele -- ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] Legend frame edgecolor and linewidth
Hello, there is a way to control the edgecolor and the linewidth of the frame drawn around the legend? I set the axes linewidth to 0.5 but the legend frame linewidth is set to 1.0 and it does not look nice. Also, most of the time I don't want the frame edge to be drawn at all. Always doing: l = plt.legend() l.get_frame().set_edgecolor('none') is boring. If the setting are not there, would a patch adding a setting to style the legend frame be considered? Additionally, would it make sense to default the legend frame linewidth to the axes linewidth? Cheers, Daniele -- ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] TypeError: can't multiply sequence by non-int of type 'float'
On 28/09/15 22:25, Jerzy Karczmarczuk wrote: > > Le 28/09/2015 21:03, Benjamin Root a écrit : >> Where does he multiply a list by a float? The traceback shows the >> multiplication happening much further down in the draw stack. > > Look, Benjamin Root, I don't know, and I will not "investigate" where > this operation happens. The diagnosis is a standard Python message. > Thus, I took the program of Shakhti Kannan, and in a few seconds I changed > > > x = [1.0, 2.0, 3.0] into x = np.array([1.0, 2.0, 3.0]) > > and in update_line: x.append(1.0) into x=np.concatenate((x,[1.0])) > > And the program began to run without error messages. So, please, these > are FACTS: somewhere the lists x,y,z get down in this draw stack. No one is doubting that. >> That shouldn't matter. ax.plot() accepts lists as valid inputs and it >> should be converting them into numpy arrays under the hood. > > There are two different issues, accepting any sequences/iterators is > one, converting them into arrays - another one. This second operation > visibly doesn't take place. And this is a bug in matplotlib that needs to be fixed. Your solution is just a workaround to an existing problem in matplotlib. Cheers, Daniele -- ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] Inconsistent font handling in axis labels
Hello, I would like to create PDFs of plot using the Helvetica font in the Light variant. In my old Mac OS X installation I somehow achieved this, I don't remember exactly how, but probably with an ugly hack that involved making matplotlib aware only of this variant of the font. In my new Mac OS X install I would like to solve this more properly. I have Mac OS X 10.9 and I installed matplotlib 1.3.1 via Mac Ports. I also installed fondu to and I converted the Helvetica.dfont bundle into TTF fonts that I places into the mpl-data folder. I deleted the matplotlib font cache file and modified my matplotlibrc configuration file like this: font.family: sans-serif font.sans-serif: Helvetica font.weight: light The effect is that the plot title, legend, and tick mark labels are correctly rendered in Helvetica Light, while axis labels are rendered in Helvetica Regular. I'm I missing something or there is a problem in matplotlib for which the weight font attribute is not respected for axis labels? Thanks. Cheers, Daniele -- Meet PCI DSS 3.0 Compliance Requirements with EventLog Analyzer Achieve PCI DSS 3.0 Compliant Status with Out-of-the-box PCI DSS Reports Are you Audit-Ready for PCI DSS 3.0 Compliance? Download White paper Comply to PCI DSS 3.0 Requirement 10 and 11.5 with EventLog Analyzer http://pubads.g.doubleclick.net/gampad/clk?id=154622311iu=/4140/ostg.clktrk ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Inconsistent font handling in axis labels
On 23/09/14 13:51, Daniele Nicolodi wrote: The effect is that the plot title, legend, and tick mark labels are correctly rendered in Helvetica Light, while axis labels are rendered in Helvetica Regular. I'm I missing something or there is a problem in matplotlib for which the weight font attribute is not respected for axis labels? I was indeed missing a couple of options in matplotlibrc: axes.labelweight : light axes.titleweight : light however, it is quite confusing that tick labels and legend are affected by the text.weight setting while other parts of the plot are not. I'm wondering if something could be done about it... Cheers, Daniele -- Meet PCI DSS 3.0 Compliance Requirements with EventLog Analyzer Achieve PCI DSS 3.0 Compliant Status with Out-of-the-box PCI DSS Reports Are you Audit-Ready for PCI DSS 3.0 Compliance? Download White paper Comply to PCI DSS 3.0 Requirement 10 and 11.5 with EventLog Analyzer http://pubads.g.doubleclick.net/gampad/clk?id=154622311iu=/4140/ostg.clktrk ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Millions of data points saved to pdf
On 01/05/2014 19:50, nertskull wrote: Is there anyway to have reasonable pdf sizes as well as this improved performance for keeping them in vector format? As others tried to explain to you, plotting that many points in a plot does not make any sense. The only thing that makes sense is to down-sample your data to a manageable size. Depending on which features of your data you are interested in, there are different methods for doing that. PS: which viewer are you using to render the PDF? I believe different renders may have substantially different performances in rendering such PDFs... Cheers, Daniele -- Accelerate Dev Cycles with Automated Cross-Browser Testing - For FREE Instantly run your Selenium tests across 300+ browser/OS combos. Get unparalleled scalability from the best Selenium testing platform available. Simple to use. Nothing to install. Get started now for free. http://p.sf.net/sfu/SauceLabs ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] pick event for images
On 02/11/2013 19:07, Joe Kington wrote: Hi Daniele, First off, the FSF uses and endorses a number of non GPL licenses. They reccomend the Apache license over MIT-style licenses for permissive cases due to patent issues, but they don't require it. In fact, even the GNU project has several X11 (the FSF's name for the MIT license) licensed projects (e.g. Off the top of my head, I know ncurses is both an official GNU project and is X11-licensed.). Thank for the info. I knew that the FSF endorses a number of different licenses, but I was under the impression that the only projects for which copyright transfer was in place were under the GPL or LGPL license. I don't know if it makes much sense for other, more permissive, licenses. However, I'm glad you brought this up. I haven't actually filled out a copyright transfer form to the FSF. I intended to at one point, but never did and didn't think about the copyright assignment in the license header very much. Not doing so, and leaving copyright in the name of any potential contributors actually makes things quite a bit simpler. Indeed. I believe going the burden of copyright transfer makes sense only for major projects under copyleft licenses. Cheers, Daniele -- Android is increasing in popularity, but the open development platform that developers love is also attractive to malware creators. Download this white paper to learn more about secure code signing practices that can help keep Android apps secure. http://pubads.g.doubleclick.net/gampad/clk?id=65839951iu=/4140/ostg.clktrk ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Setting the tick label font size
On 29/10/2013 21:39, Ryan Nelson wrote: Daniele, I agree this is perhaps a little overly complicated. (However, once you figure it out, it does give you a ton of flexibility.) The main point is not that it is overly complicated, it is that is is severely under documented... I played around with this a bit (thanks IPython!), and I may have figured out what you wanted to do. I rewrote the example you linked from the MPL website. I couldn't simplify it much, but it does change the size, location and labels of the floating y axis. Thanks! I didn't have the resources to investigate this further. par2.axis[right].major_ticklabels.set_fontsize(14) Well, this makes sense... Cheers, Daniele -- Android is increasing in popularity, but the open development platform that developers love is also attractive to malware creators. Download this white paper to learn more about secure code signing practices that can help keep Android apps secure. http://pubads.g.doubleclick.net/gampad/clk?id=65839951iu=/4140/ostg.clktrk ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Setting the tick label font size
On 29/10/2013 03:11, Ryan Nelson wrote: Daniele, I noticed the same problem with the Qt backend. However, I was looking at the documentation on the AxesGrid webpage here: http://matplotlib.org/mpl_toolkits/axes_grid/users/overview.html And I see the following warning: axes_grid and axisartist (but not axes_grid1) uses a custom Axes class (derived from the mpl’s original Axes class). As a side effect, some commands (mostly tick-related) do not work. Use axes_grid1 to avoid this, or see how things are different in axes_grid and axisartist (LINK needed) Unfortunately, no link. But perhaps there is a way to avoid using the Axes class from axisartist in your use case. For example, could you import the Axes class as follows: from matplotlib.axes import Axes That seems to work with the Qt and PDF backends on Windows 7 (Anaconda Python). Hello Ryan, thanks for confirming the problem. I've also seen that note, but I thought do not work means that the methods raise an exception, not that they arbitrarily ignore arguments :( While the standard Axis class works for the cut-down example I posted, it does not for what I'm trying to achieve (having a second x axis below the main one). I came up with that solution following the matplotlib documentation: http://matplotlib.org/mpl_toolkits/axes_grid/users/overview.html#axisartist-with-parasiteaxes however I don't really understand why some of the contortions there are necessary (they are not explained in the documentation). Cheers, Daniele -- Android is increasing in popularity, but the open development platform that developers love is also attractive to malware creators. Download this white paper to learn more about secure code signing practices that can help keep Android apps secure. http://pubads.g.doubleclick.net/gampad/clk?id=65839951iu=/4140/ostg.clktrk ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Setting the tick label font size
On 28/10/2013 23:30, Oliver wrote: Hi Daniele, not sure, but it seems to work for me. Did you do a plt.draw() or plt.show() to reflect the changes? Hello, it investigated this a bit further and the problem presents itself only when I use `mpl_toolkits.axisartist.Axes`. Here is a minimum example that demonstrates the problem: import numpy as np import matplotlib.pyplot as plt from mpl_toolkits.axes_grid1 import host_subplot from mpl_toolkits.axisartist import Axes x = np.linspace(0, 2*np.pi) y = np.sin(x) f = plt.figure() BUG = True if BUG: ax1 = host_subplot(111, axes_class=Axes) else: ax1 = host_subplot(111, axes_class=Axes) ax1.plot(x, y) ax1.set_xlim(0, 2*np.pi) ax1.set_xticks(np.linspace(0, 2*np.pi, 5)) ax1.set_xticklabels(['%.2f' % x for x in np.linspace(0, 2*np.pi, 5)], fontsize=8) plt.draw() plt.show() Cheers, Daniele -- Android is increasing in popularity, but the open development platform that developers love is also attractive to malware creators. Download this white paper to learn more about secure code signing practices that can help keep Android apps secure. http://pubads.g.doubleclick.net/gampad/clk?id=65839951iu=/4140/ostg.clktrk ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Setting the tick label font size
On 29/10/2013 00:17, Sterling Smith wrote: While your example tries to be self contained, which is great!, there is no difference between these two conditions... if BUG: ax1 = host_subplot(111, axes_class=Axes) else: ax1 = host_subplot(111, axes_class=Axes) Ops, obvious mistake. It should read: BUG = True if BUG: ax1 = host_subplot(111 , axes_class=Axes) else: ax1 = host_subplot(111) Cheers, Daniele -- Android is increasing in popularity, but the open development platform that developers love is also attractive to malware creators. Download this white paper to learn more about secure code signing practices that can help keep Android apps secure. http://pubads.g.doubleclick.net/gampad/clk?id=65839951iu=/4140/ostg.clktrk ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Matplotlib eating memory
On 10/10/2013 15:05, Martin MOKREJŠ wrote: Hi, rendering some of my charts takes almost 50GB of RAM. I believe below is a stracktrace of one such situation when it already took 15GB. Would somebody comments on what is matplotlib doing at the very moment? Why the recursion? The charts had to have 262422 data points in a 2D scatter plot, each point has assigned its own color. They are in batches so that there are 153 distinct colors but nevertheless, I assigned to each data point a color value. There are 153 legend items also (one color won't be used). Hello Martin, can I ask what is the meaning of plotting a scatter plot with 200 thousands points in it? Either you visualize it on a screen much larger than mine, or you are not going to be able to distinguish the single data points. Maybe you should rethink the visualization tool you are using. Nevertheless, I'm perfectly able to plot a scatter plot with 262422 data points each with its own color just fine, and the python process consumes a few hundred Mb of ram (having quite a few other datasets loaded in memory):: import numpy as np import matplotlib.pyplot as plt n = 262422 x = np.random.rand(n) y = np.random.rand(n) c = np.random.rand(n) f = plt.figure() a = f.add_subplot(111) a.scatter(x, y, c=c, s=50) plt.show() and a possible solution using exactly 153 different colors, but again, I don't see how you can distinguish between hundreds different shades of colors:: n = 262422 #22 ncolors = 153 x = np.random.rand(n) y = np.random.rand(n) c = np.random.rand(ncolors) f = plt.figure() a = f.add_subplot(111) for i in xrange(n // ncolors): a.scatter(x[i*ncolors:(i+1)*ncolors], y[i*ncolors:(i+1)*ncolors], c=c, s=50) plt.show() Unfortunately the code you provide is too contrived to be useful to understand the root cause of your problem. Cheers, Daniele -- October Webinars: Code for Performance Free Intel webinars can help you accelerate application performance. Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from the latest Intel processors and coprocessors. See abstracts and register http://pubads.g.doubleclick.net/gampad/clk?id=60135031iu=/4140/ostg.clktrk ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] Text positioning anchored to its bounding box
Hello, I use matplotlib.pyplot.text() to annotate my plots. When annotating reference lines on simple x,y plots I find it quite annoying to have to manually compute an offset in data coordinates to have some spacing between the line I'm labeling and the label itself. With the bbox={'pad': padding} argument it is possible to have some padding between the text and its container, however the annotation position is still computed accordingly to the text content and not accordingly to the bounding box. Does exist a way to have the text position computed accordingly to the bounding box, or, alternatively, to have some padding inserted between the annotation coordinates and the actual placement of the text label? Thank you in advance. Best, Daniele -- Master Java SE, Java EE, Eclipse, Spring, Hibernate, JavaScript, jQuery and much more. Keep your Java skills current with LearnJavaNow - 200+ hours of step-by-step video tutorials by Java experts. SALE $49.99 this month only -- learn more at: http://p.sf.net/sfu/learnmore_122612 ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] pdf file output name too restrictive?
On 12/03/12 13:40, Neal Becker wrote: Using this code: self.pdf = PdfPages('%s.%s.pdf' % (name, str(date.today( Trying to output a pdf with the name results.abs_aci=[10.0, nan, 10.0].rate=['2/3', '4/5', '2/3'].2012-03-12.pdf produces this error IOError: [Errno 2] No such file or directory: results.abs_aci=[10.0, nan, 10.0].rate=['2/3', '4/5', '2/3'].2012-03-12.pdf Changing the file name to just 'test1.pdf' produces no error. On Unix platforms the / character is invalid in file names, being the path separator, along with the \0 character, for obvious reasons. On Windows the allowed set of valid characters is further reduced, depending on the filesystem. Cheers, -- Daniele -- 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] unicode minus sign glyph missing with serif fonts in macosx backend
On 18/09/10 02:57, Joey Richards wrote: When I plot with the MacOSX backend using a serif font, the negative signs on the axis labels show up as the missing glyph open squares rather than minus signs. Hello, I have the same problem on MacOsX 10.4 and matplotlib 1.0, but also with the default sans-serif font. I would guess that the default fonts available with MacOSX do not have a glyph for the unicode character used by matplotlib, but if you see it with different backends (i do not have compiled them because i was to lazy to install the required libraries) I suspect something is wrong with the macosx backend... Cheers, -- Daniele -- Start uncovering the many advantages of virtual appliances and start using them to simplify application deployment and accelerate your shift to cloud computing. http://p.sf.net/sfu/novell-sfdev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] Disappearing time series spikes
Hello. I'm observing a quite annoying behavior of matplotlib generated plots. I plot signal time series with continuous lines. When in those time series I have single points laying far from the median, those are not represented on the plot. I think this must be due to the anti aliasing algorithm, because if I add + markers to the plot, those are correctly placed. There is a way to avoid this behavior? Thanks. Cheers, -- Daniele -- ThinkGeek and WIRED's GeekDad team up for the Ultimate GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the lucky parental unit. See the prize list and enter to win: http://p.sf.net/sfu/thinkgeek-promo ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Disappearing time series spikes
On 04/06/10 20:08, Michael Droettboom wrote: Set rc.Params['path.simplify'] to False, or upgrade to 0.99.3. Setting path.simplify = False solved my issue. Has been the issue solved in another way on 0.99.3 or path.simplify = False is simply the new default? Thanks. Cheers, -- Daniele -- ThinkGeek and WIRED's GeekDad team up for the Ultimate GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the lucky parental unit. See the prize list and enter to win: http://p.sf.net/sfu/thinkgeek-promo ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users