From sameer.grover.1 at gmail.com Thu Jan 5 19:40:05 2017 From: sameer.grover.1 at gmail.com (Sameer Grover) Date: Fri, 6 Jan 2017 06:10:05 +0530 Subject: [Matplotlib-users] Pcolormesh vs contourf Message-ID: Hello, I'd like to know about the difference between contourf and pcolormesh and their intended uses. So far, I've been using contourf with a large number of levels (150 - 200) to plot two dimensional data. Are their any disadvantages of this and is pcolormesh better suited for this task? As far as I can make out, contourf displays a "smoothened-out" image and pcolormesh is more "boxy". Thanks. Sameer -------------- next part -------------- An HTML attachment was scrubbed... URL: From efiring at hawaii.edu Thu Jan 5 20:20:15 2017 From: efiring at hawaii.edu (Eric Firing) Date: Thu, 5 Jan 2017 15:20:15 -1000 Subject: [Matplotlib-users] Pcolormesh vs contourf In-Reply-To: References: Message-ID: <39b2afdd-95d2-af85-2b95-443ea0654dec@hawaii.edu> Sameer, They are fundamentally different in what they do; this is most clear if you experiment with using both methods on a low-resolution field (say 10 by 12 points), and with a small number of contours (5 or 10). Contouring is most typically done with a moderate number of contours, maybe 30 or fewer. It is most immediately appropriate for data values at discrete points, since it is interpolating. pcolormesh does not interpolate, but shows the value in each quadrilateral as a block of solid color, so it is more like an image. There are data sets and situations for which either of the two methods can be appropriate, and other cases where one is clearly better than the other. For a somewhat noisy field, pcolormesh is usually better; it allows one to see the signal and the noise, and let one's eye pick out the former. Isolated extreme values are represented better with pcolormesh. For smoother fields and for seeing large-scale structure, contourf may be more appropriate. What kind of data are you plotting? Eric On 2017/01/05 2:40 PM, Sameer Grover wrote: > Hello, > > I'd like to know about the difference between contourf and pcolormesh > and their intended uses. So far, I've been using contourf with a large > number of levels (150 - 200) to plot two dimensional data. Are their any > disadvantages of this and is pcolormesh better suited for this task? > > As far as I can make out, contourf displays a "smoothened-out" image and > pcolormesh is more "boxy". > > Thanks. > > Sameer > > > > _______________________________________________ > Matplotlib-users mailing list > Matplotlib-users at python.org > https://mail.python.org/mailman/listinfo/matplotlib-users > From skip.montanaro at gmail.com Sat Jan 7 07:01:21 2017 From: skip.montanaro at gmail.com (Skip Montanaro) Date: Sat, 7 Jan 2017 06:01:21 -0600 Subject: [Matplotlib-users] Slightly larger markers? In-Reply-To: References: Message-ID: Matplotlib seems to support two sizes of default markers, "much too small" or "much too big." Nothing I tried from the table on this page http://matplotlib.org/api/markers_api.html was in the Goldilocks zone. :-) This example: http://matplotlib.org/examples/lines_bars_and_markers/marker_reference.html suggests the "." marker should be more reasonably sized, but it's still pretty darn big. By my crude estimates, the comma marker is a single pixel, while the dot marker is a circle with diameter five pixels. Am I missing something predefined which has a size in between the comma and dot markers, maybe just a square marker with side length two pixels? I see that you can create custom markers. I suspect this will work (though be a bit clunky). I'm not finding many examples, however, so far just this marker_path example: http://matplotlib.org/examples/pylab_examples/marker_path.html The target is a command line plotting tool, so I'll probably have to provide a way for users to map between marker characters and pickled markers. Thx, Skip Montanaro From flyamer at gmail.com Sat Jan 7 07:08:33 2017 From: flyamer at gmail.com (Ilya Flyamer) Date: Sat, 7 Jan 2017 15:08:33 +0300 Subject: [Matplotlib-users] Slightly larger markers? In-Reply-To: References: Message-ID: Why not just provide your own size? http://stackoverflow.com/questions/14827650/pyplot-scatter-plot-marker-size 2017-01-07 15:01 GMT+03:00 Skip Montanaro : > Matplotlib seems to support two sizes of default markers, "much too > small" or "much too big." Nothing I tried from the table on this page > > http://matplotlib.org/api/markers_api.html > > was in the Goldilocks zone. :-) > > This example: > > http://matplotlib.org/examples/lines_bars_and_ > markers/marker_reference.html > > suggests the "." marker should be more reasonably sized, but it's > still pretty darn big. By my crude estimates, the comma marker is a > single pixel, while the dot marker is a circle with diameter five > pixels. Am I missing something predefined which has a size in between > the comma and dot markers, maybe just a square marker with side length > two pixels? > > I see that you can create custom markers. I suspect this will work > (though be a bit clunky). I'm not finding many examples, however, so > far just this marker_path example: > > http://matplotlib.org/examples/pylab_examples/marker_path.html > > The target is a command line plotting tool, so I'll probably have to > provide a way for users to map between marker characters and pickled > markers. > > Thx, > > Skip Montanaro > _______________________________________________ > Matplotlib-users mailing list > Matplotlib-users at python.org > https://mail.python.org/mailman/listinfo/matplotlib-users > -------------- next part -------------- An HTML attachment was scrubbed... URL: From skip.montanaro at gmail.com Sat Jan 7 09:10:34 2017 From: skip.montanaro at gmail.com (Skip Montanaro) Date: Sat, 7 Jan 2017 08:10:34 -0600 Subject: [Matplotlib-users] Slightly larger markers? In-Reply-To: References: Message-ID: On Sat, Jan 7, 2017 at 6:08 AM, Ilya Flyamer wrote: > Why not just provide your own size? > http://stackoverflow.com/questions/14827650/pyplot- > scatter-plot-marker-size > Thanks. Didn't see it in the documentation. Skip -------------- next part -------------- An HTML attachment was scrubbed... URL: From sameer.grover.1 at gmail.com Sat Jan 7 14:24:41 2017 From: sameer.grover.1 at gmail.com (Sameer Grover) Date: Sun, 8 Jan 2017 00:54:41 +0530 Subject: [Matplotlib-users] Pcolormesh vs contourf In-Reply-To: <39b2afdd-95d2-af85-2b95-443ea0654dec@hawaii.edu> References: <39b2afdd-95d2-af85-2b95-443ea0654dec@hawaii.edu> Message-ID: On 6 January 2017 at 06:50, Eric Firing wrote: > Sameer, > > They are fundamentally different in what they do; this is most clear if > you experiment with using both methods on a low-resolution field (say 10 by > 12 points), and with a small number of contours (5 or 10). Contouring is > most typically done with a moderate number of contours, maybe 30 or fewer. > It is most immediately appropriate for data values at discrete points, > since it is interpolating. pcolormesh does not interpolate, but shows the > value in each quadrilateral as a block of solid color, so it is more like > an image. > > There are data sets and situations for which either of the two methods can > be appropriate, and other cases where one is clearly better than the > other. For a somewhat noisy field, pcolormesh is usually better; it allows > one to see the signal and the noise, and let one's eye pick out the > former. Isolated extreme values are represented better with pcolormesh. > For smoother fields and for seeing large-scale structure, contourf may be > more appropriate. > > What kind of data are you plotting? > > Eric > > > > On 2017/01/05 2:40 PM, Sameer Grover wrote: > >> Hello, >> >> I'd like to know about the difference between contourf and pcolormesh >> and their intended uses. So far, I've been using contourf with a large >> number of levels (150 - 200) to plot two dimensional data. Are their any >> disadvantages of this and is pcolormesh better suited for this task? >> >> As far as I can make out, contourf displays a "smoothened-out" image and >> pcolormesh is more "boxy". >> >> Thanks. >> >> Sameer >> >> >> >> _______________________________________________ >> Matplotlib-users mailing list >> Matplotlib-users at python.org >> https://mail.python.org/mailman/listinfo/matplotlib-users >> >> > _______________________________________________ > Matplotlib-users mailing list > Matplotlib-users at python.org > https://mail.python.org/mailman/listinfo/matplotlib-users > Hi Eric, The data is usually around 1000 X 1000 large or smaller, mainly experimental or theoretical data obtained by varying two independent parameters. With a large number of contours, the visual output from them doesn't look too different, especially if pcolormesh is used with gouraud shading. But I realize they do things differently. Thank you for the clarification. My only comment is that contourf(x,y,z) expects z of shape(size(y), size(x)) whereas pcolormesh (x,y,z) expects z of shape (size(y)+1, size(x)+1), for obvious reasons. It would be nice if pcolormesh could adjust x and y so that the centres of each quadrilateral is at the value of x and y, so that both functions could be called in the same way. It's not hard to do but something that could be considered if there are enough use cases. Sameer -------------- next part -------------- An HTML attachment was scrubbed... URL: From efiring at hawaii.edu Sat Jan 7 14:57:28 2017 From: efiring at hawaii.edu (Eric Firing) Date: Sat, 7 Jan 2017 09:57:28 -1000 Subject: [Matplotlib-users] Pcolormesh vs contourf In-Reply-To: References: <39b2afdd-95d2-af85-2b95-443ea0654dec@hawaii.edu> Message-ID: <386bc608-e0ce-d373-b441-78f0e4484a67@hawaii.edu> On 2017/01/07 9:24 AM, Sameer Grover wrote: > > > On 6 January 2017 at 06:50, Eric Firing > wrote: > > Sameer, > > They are fundamentally different in what they do; this is most clear > if you experiment with using both methods on a low-resolution field > (say 10 by 12 points), and with a small number of contours (5 or > 10). Contouring is most typically done with a moderate number of > contours, maybe 30 or fewer. It is most immediately appropriate for > data values at discrete points, since it is interpolating. > pcolormesh does not interpolate, but shows the value in each > quadrilateral as a block of solid color, so it is more like an image. > > There are data sets and situations for which either of the two > methods can be appropriate, and other cases where one is clearly > better than the other. For a somewhat noisy field, pcolormesh is > usually better; it allows one to see the signal and the noise, and > let one's eye pick out the former. Isolated extreme values are > represented better with pcolormesh. For smoother fields and for > seeing large-scale structure, contourf may be more appropriate. > > What kind of data are you plotting? > > Eric > > > > On 2017/01/05 2:40 PM, Sameer Grover wrote: > > Hello, > > I'd like to know about the difference between contourf and > pcolormesh > and their intended uses. So far, I've been using contourf with a > large > number of levels (150 - 200) to plot two dimensional data. Are > their any > disadvantages of this and is pcolormesh better suited for this task? > > As far as I can make out, contourf displays a "smoothened-out" > image and > pcolormesh is more "boxy". > > Thanks. > > Sameer > > > > _______________________________________________ > Matplotlib-users mailing list > Matplotlib-users at python.org > https://mail.python.org/mailman/listinfo/matplotlib-users > > > > _______________________________________________ > Matplotlib-users mailing list > Matplotlib-users at python.org > https://mail.python.org/mailman/listinfo/matplotlib-users > > > > > Hi Eric, > > The data is usually around 1000 X 1000 large or smaller, mainly > experimental or theoretical data obtained by varying two independent > parameters. With a large number of contours, the visual output from them > doesn't look too different, especially if pcolormesh is used with > gouraud shading. But I realize they do things differently. Thank you > for the clarification. > > My only comment is that contourf(x,y,z) expects z of shape(size(y), > size(x)) whereas pcolormesh (x,y,z) expects z of shape (size(y)+1, > size(x)+1), for obvious reasons. > > It would be nice if pcolormesh could adjust x and y so that the centres > of each quadrilateral is at the value of x and y, so that both functions > could be called in the same way. If x and y are uniformly spaced, then imshow does that (and much faster), with suitable specification of extent, aspect, and interpolation. I view the way pcolormesh handles x and y as fundamental, so I am reluctant to add an option to interpolate/extrapolate a pixel-centered grid to the the edge grid that pcolormesh absolutely requires. In the simplest cases, such as a uniform rectangular grid, such a transformation is straightforward, but in the more general cases that pcolormesh handles, it is not; there is no single algorithm that would "do the right thing" in all cases. There is scope for making it easier to do common things, but rather than fold it into functions like pcolormesh, I think it is better to break it out into standalone grid manipulation functions. We also have a NonuniformImage class that handles irregular (and regular) rectangular pixel-centered grids, and can be used directly. That class needs an Axes method and a pyplot function. Eric > > It's not hard to do but something that could be considered if there are > enough use cases. > > Sameer > From efiring at hawaii.edu Sat Jan 7 15:03:27 2017 From: efiring at hawaii.edu (Eric Firing) Date: Sat, 7 Jan 2017 10:03:27 -1000 Subject: [Matplotlib-users] Pcolormesh vs contourf In-Reply-To: References: <39b2afdd-95d2-af85-2b95-443ea0654dec@hawaii.edu> Message-ID: <8dd24cb2-60ab-3ce7-183c-7f9fb208f8b7@hawaii.edu> I added a related issue: https://github.com/matplotlib/matplotlib/issues/7763. Eric From jklymak at uvic.ca Sat Jan 7 15:31:28 2017 From: jklymak at uvic.ca (Jody Klymak) Date: Sat, 7 Jan 2017 12:31:28 -0800 Subject: [Matplotlib-users] Pcolormesh vs contourf In-Reply-To: <386bc608-e0ce-d373-b441-78f0e4484a67@hawaii.edu> References: <39b2afdd-95d2-af85-2b95-443ea0654dec@hawaii.edu> <386bc608-e0ce-d373-b441-78f0e4484a67@hawaii.edu> Message-ID: Hi Eric, Sameer > I view the way pcolormesh handles x and y as fundamental, so I am reluctant to add an option to interpolate/extrapolate a pixel-centered grid to the the edge grid that pcolormesh absolutely requires. In the simplest cases, such as a uniform rectangular grid, such a transformation is straightforward, but in the more general cases that pcolormesh handles, it is not; there is no single algorithm that would "do the right thing" in all cases. Maybe I?ve misunderstood, but in 1.5.x, if I run pcolormesh with len(x) = m, len(y) = n and size(z) = m,n then it works just fine (like matlab?s implimentation). its great that it also does m+1 and n+1, but I think it does the ?easy? thing. Maybe in 2.0 this has changed? To the original question: pcolormesh(x,y,z,rasterized=True) is your friend if m and n are large and you want to print things. Cheers, Jody > There is scope for making it easier to do common things, but rather than fold it into functions like pcolormesh, I think it is better to break it out into standalone grid manipulation functions. > > We also have a NonuniformImage class that handles irregular (and regular) rectangular pixel-centered grids, and can be used directly. That class needs an Axes method and a pyplot function. > > Eric > >> >> It's not hard to do but something that could be considered if there are >> enough use cases. >> >> Sameer >> > > _______________________________________________ > Matplotlib-users mailing list > Matplotlib-users at python.org > https://mail.python.org/mailman/listinfo/matplotlib-users -------------- next part -------------- An HTML attachment was scrubbed... URL: From sameer.grover.1 at gmail.com Sat Jan 7 16:38:41 2017 From: sameer.grover.1 at gmail.com (Sameer Grover) Date: Sun, 8 Jan 2017 03:08:41 +0530 Subject: [Matplotlib-users] Pcolormesh vs contourf In-Reply-To: References: <39b2afdd-95d2-af85-2b95-443ea0654dec@hawaii.edu> <386bc608-e0ce-d373-b441-78f0e4484a67@hawaii.edu> Message-ID: Hi Jody, Eric, On 8 January 2017 at 02:01, Jody Klymak wrote: > Hi Eric, Sameer > > I view the way pcolormesh handles x and y as fundamental, so I am > reluctant to add an option to interpolate/extrapolate a pixel-centered grid > to the the edge grid that pcolormesh absolutely requires. In the simplest > cases, such as a uniform rectangular grid, such a transformation is > straightforward, but in the more general cases that pcolormesh handles, it > is not; there is no single algorithm that would "do the right thing" in all > cases. > > > Maybe I?ve misunderstood, but in 1.5.x, if I run pcolormesh with len(x) = > m, len(y) = n and size(z) = m,n then it works just fine (like matlab?s > implimentation). its great that it also does m+1 and n+1, but I think it > does the ?easy? thing. Maybe in 2.0 this has changed? > > To the original question: pcolormesh(x,y,z,rasterized=True) is your > friend if m and n are large and you want to print things. > > Cheers, Jody > > What I meant was that pcolormesh(z) gives an identical output to pcolormesh(range(m),range(n),z), only when z.shape is (n-1,m-1). It does work when z.shape=(m,n) by omitting the last quadrilateral. I thought it more correct (for my use case) that the number of quadrilaterals should be the number of elements in x or y. > There is scope for making it easier to do common things, but rather than > fold it into functions like pcolormesh, I think it is better to break it > out into standalone grid manipulation functions. > > We also have a NonuniformImage class that handles irregular (and regular) > rectangular pixel-centered grids, and can be used directly. That class > needs an Axes method and a pyplot function. > > Eric > > Thanks for the information about the nonuniformimage class. > It's not hard to do but something that could be considered if there are > enough use cases. > > Sameer > > > _______________________________________________ > Matplotlib-users mailing list > Matplotlib-users at python.org > https://mail.python.org/mailman/listinfo/matplotlib-users > > > Sameer -------------- next part -------------- An HTML attachment was scrubbed... URL: From efiring at hawaii.edu Sat Jan 7 18:43:08 2017 From: efiring at hawaii.edu (Eric Firing) Date: Sat, 7 Jan 2017 13:43:08 -1000 Subject: [Matplotlib-users] Pcolormesh vs contourf In-Reply-To: References: <39b2afdd-95d2-af85-2b95-443ea0654dec@hawaii.edu> <386bc608-e0ce-d373-b441-78f0e4484a67@hawaii.edu> Message-ID: <28f498f3-7f05-e724-0b9c-12da51d98633@hawaii.edu> On 2017/01/07 10:31 AM, Jody Klymak wrote: > Maybe I?ve misunderstood, but in 1.5.x, if I run pcolormesh with len(x) > = m, len(y) = n and size(z) = m,n then it works just fine (like matlab?s > implimentation). its great that it also does m+1 and n+1, but I think > it does the ?easy? thing. Maybe in 2.0 this has changed? Yes, it works like matlab's implementation, for the sake of convenience and compatibility, but matlab's implementation is wrong, and is not the behavior that Sameer is understandably asking for. From brian.mcfee at nyu.edu Sun Jan 8 19:44:25 2017 From: brian.mcfee at nyu.edu (Brian McFee) Date: Mon, 09 Jan 2017 00:44:25 +0000 Subject: [Matplotlib-users] MaxNLocator and steps [2.0.0rc0] Message-ID: Hi everyone [long-time user, first-time poster], I recently ran aground of a change in MaxNLocator introduced in 2.0.0rc0 by this PR: https://github.com/matplotlib/matplotlib/pull/7586. This change warns if the steps parameter has values outside the range [1, 10], and is justified in the issue https://github.com/matplotlib/matplotlib/issues/7578 by compliance with the docstring. I have been using MaxNLocator with steps=[1, 5, 10, 15, 60] (or thereabouts) to label time-axis plots with units in seconds, and position ticks at "nice" fractions of minutes. Apparently, I've been doing it wrong! Does anyone have advice about how to recover the previous behavior without doing-it-wrong? Thanks! -------------- next part -------------- An HTML attachment was scrubbed... URL: From efiring at hawaii.edu Sun Jan 8 20:09:23 2017 From: efiring at hawaii.edu (Eric Firing) Date: Sun, 8 Jan 2017 15:09:23 -1000 Subject: [Matplotlib-users] MaxNLocator and steps [2.0.0rc0] In-Reply-To: References: Message-ID: <0f16b296-c6ee-5fb3-a7a9-004f3ed37b44@hawaii.edu> On 2017/01/08 2:44 PM, Brian McFee wrote: > Hi everyone [long-time user, first-time poster], > > I recently ran aground of a change in MaxNLocator introduced in 2.0.0rc0 > by this PR: https://github.com/matplotlib/matplotlib/pull/7586. This > change warns if the steps parameter has values outside the range [1, > 10], and is justified in the > issue https://github.com/matplotlib/matplotlib/issues/7578 by compliance > with the docstring. > > I have been using MaxNLocator with steps=[1, 5, 10, 15, 60] (or > thereabouts) to label time-axis plots with units in seconds, and > position ticks at "nice" fractions of minutes. Apparently, I've been > doing it wrong! Does anyone have advice about how to recover the > previous behavior without doing-it-wrong? Try [1, 1.5, 5, 6, 10]. There might be cases where this will not do what you want; if so, give me some examples to work with. I have a suspicion that what is really needed here is a different algorithm--to cover cases that perhaps the old algorithm handled by accident. Is it the case that you want a locator that would use *only* your specified set of steps as the intervals between ticks? I think what is needed for that is an extension of MultipleLocator that works with a list of bases rather than with a single base. There might be a simple modification of the MaxNLocator with integer=True, that would suffice in practice, though. Eric > > > Thanks! > > > _______________________________________________ > Matplotlib-users mailing list > Matplotlib-users at python.org > https://mail.python.org/mailman/listinfo/matplotlib-users > From efiring at hawaii.edu Sun Jan 8 22:10:02 2017 From: efiring at hawaii.edu (Eric Firing) Date: Sun, 8 Jan 2017 17:10:02 -1000 Subject: [Matplotlib-users] MaxNLocator and steps [2.0.0rc0] In-Reply-To: References: Message-ID: <133b0046-1c51-ea71-91e6-0a24595c4706@hawaii.edu> Brian, See https://github.com/matplotlib/matplotlib/pull/7770. This is what I had in mind to get MaxNLocator behavior closer to what you want. I think the problem that would remain is that sometimes you would get 6-second intervals, which you probably don't want. I'm not sure whether the way to get exactly what you want (assuming I understand it correctly) is via an additional kwarg to MaxNLocator, or whether it would be better to make a different locator for this purpose. Eric On 2017/01/08 2:44 PM, Brian McFee wrote: > Hi everyone [long-time user, first-time poster], > > I recently ran aground of a change in MaxNLocator introduced in 2.0.0rc0 > by this PR: https://github.com/matplotlib/matplotlib/pull/7586. This > change warns if the steps parameter has values outside the range [1, > 10], and is justified in the > issue https://github.com/matplotlib/matplotlib/issues/7578 by compliance > with the docstring. > > I have been using MaxNLocator with steps=[1, 5, 10, 15, 60] (or > thereabouts) to label time-axis plots with units in seconds, and > position ticks at "nice" fractions of minutes. Apparently, I've been > doing it wrong! Does anyone have advice about how to recover the > previous behavior without doing-it-wrong? > > > Thanks! > > > _______________________________________________ > Matplotlib-users mailing list > Matplotlib-users at python.org > https://mail.python.org/mailman/listinfo/matplotlib-users > From ndbecker2 at gmail.com Mon Jan 9 09:07:02 2017 From: ndbecker2 at gmail.com (Neal Becker) Date: Mon, 09 Jan 2017 09:07:02 -0500 Subject: [Matplotlib-users] legend(loc='best') a bit off Message-ID: In the attached, the legend box slightly covers the graph, but there is no need to, it could just be moved a bit lower and then would cover nothing. My questions: 1) can I fix it? 2) is this a bug? -------------- next part -------------- A non-text attachment was scrubbed... Name: saturated_ascma_paper_rot.pdf Type: application/pdf Size: 30071 bytes Desc: not available URL: From tcaswell at gmail.com Mon Jan 9 09:15:15 2017 From: tcaswell at gmail.com (Thomas Caswell) Date: Mon, 09 Jan 2017 14:15:15 +0000 Subject: [Matplotlib-users] legend(loc='best') a bit off In-Reply-To: References: Message-ID: I am pretty sure that 'best' is picking from one of the 9 positions [(top, middle, bottom)X(left, center, right)] not picking a continuous position. Fixing this would be useful and a pretty major new feature. It is not clear to me what the best algorithm for this would be. The obvious thing is to run N more refinements around each point, but hopefully there is some computational geometry that I do not know. Tom On Mon, Jan 9, 2017, 09:07 Neal Becker wrote: > In the attached, the legend box slightly covers the graph, but there is no > need to, it could just be moved a bit lower and then would cover nothing. > > My questions: > 1) can I fix it? > 2) is this a bug?_______________________________________________ > Matplotlib-users mailing list > Matplotlib-users at python.org > https://mail.python.org/mailman/listinfo/matplotlib-users > -------------- next part -------------- An HTML attachment was scrubbed... URL: From flyamer at gmail.com Mon Jan 9 14:40:10 2017 From: flyamer at gmail.com (Ilya Flyamer) Date: Mon, 9 Jan 2017 19:40:10 +0000 Subject: [Matplotlib-users] legend(loc='best') a bit off In-Reply-To: References: Message-ID: Would an approach similar to adjustText be something you could consider for mpl? I was already thinking of adding this to the library. 9 ??? 2017 ?. 15:15 ???????????? "Thomas Caswell" ???????: > I am pretty sure that 'best' is picking from one of the 9 positions [(top, > middle, bottom)X(left, center, right)] not picking a continuous position. > > Fixing this would be useful and a pretty major new feature. It is not > clear to me what the best algorithm for this would be. The obvious thing > is to run N more refinements around each point, but hopefully there is some > computational geometry that I do not know. > > Tom > > On Mon, Jan 9, 2017, 09:07 Neal Becker wrote: > >> In the attached, the legend box slightly covers the graph, but there is no >> need to, it could just be moved a bit lower and then would cover nothing. >> >> My questions: >> 1) can I fix it? >> 2) is this a bug?_______________________________________________ >> Matplotlib-users mailing list >> Matplotlib-users at python.org >> https://mail.python.org/mailman/listinfo/matplotlib-users >> > > _______________________________________________ > Matplotlib-users mailing list > Matplotlib-users at python.org > https://mail.python.org/mailman/listinfo/matplotlib-users > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jni.soma at gmail.com Mon Jan 9 22:06:01 2017 From: jni.soma at gmail.com (Juan Nunez-Iglesias) Date: Tue, 10 Jan 2017 14:06:01 +1100 Subject: [Matplotlib-users] Event connect error when using Tk and scrolling Message-ID: <311451d4-699b-47cf-9183-b7858302f6e9@Spark> Hi all, I?m trying to play with the `basic_mpl_connect.py` example from Ben Root?s ?Interactive Applications Using Matplotlib? book, reproduced below in its entirety. (With the addition of selecting TkAgg as the backend. I need to do this because I?m aiming to embed into a Tk app *and* the MacOSX backend doesn?t capture my keystrokes.) Everything works fine, but when I try to use the scroll wheel on my mouse, or two-finger scrolling on my Macbook trackpad, everything dies with the following message: Traceback (most recent call last): ? File "basic_mpl_connect.py", line 20, in ? ? plt.show() ? File "/Users/jni/conda/envs/ana/lib/python3.5/site-packages/matplotlib/pyplot.py", line 252, in show ? ? return _show(*args, **kw) ? File "/Users/jni/conda/envs/ana/lib/python3.5/site-packages/matplotlib/backend_bases.py", line 192, in __call__ ? ? self.mainloop() ? File "/Users/jni/conda/envs/ana/lib/python3.5/site-packages/matplotlib/backends/backend_tkagg.py", line 74, in mainloop ? ? Tk.mainloop() ? File "/Users/jni/conda/envs/ana/lib/python3.5/tkinter/__init__.py", line 405, in mainloop ? ? _default_root.tk.mainloop(n) UnicodeDecodeError: 'utf-8' codec can't decode byte 0xff in position 0: invalid start byte This is true even if I explicitly connect the ?scroll_event? (below). Any ideas? Thanks, Juan. =================================== import matplotlib matplotlib.use('TkAgg') matplotlib.verbose.level = 'debug' import matplotlib.pyplot as plt def process_key(event): ? ? print("Key:", event.key) def process_button(event): ? ? print("Button:", event.x, event.y, event.xdata, event.ydata, event.button) def process_scroll(event): ? ? print("Scroll") fig, ax = plt.subplots(1, 1) fig.canvas.mpl_connect('key_press_event', process_key) fig.canvas.mpl_connect('button_press_event', process_button) fig.canvas.mpl_connect('scroll_event', process_scroll) plt.show() -------------- next part -------------- An HTML attachment was scrubbed... URL: From tcaswell at gmail.com Mon Jan 9 23:40:28 2017 From: tcaswell at gmail.com (Thomas Caswell) Date: Tue, 10 Jan 2017 04:40:28 +0000 Subject: [Matplotlib-users] Event connect error when using Tk and scrolling In-Reply-To: <311451d4-699b-47cf-9183-b7858302f6e9@Spark> References: <311451d4-699b-47cf-9183-b7858302f6e9@Spark> Message-ID: I can not reproduce this on linux :/ This looks like it is coming out of Tk's handling of the scroll event before it is handed off to mpl. Tom On Mon, Jan 9, 2017 at 10:28 PM Juan Nunez-Iglesias wrote: > Hi all, > > I?m trying to play with the `basic_mpl_connect.py` example from Ben Root?s > ?Interactive Applications Using Matplotlib? book, reproduced below in its > entirety. (With the addition of selecting TkAgg as the backend. I need to > do this because I?m aiming to embed into a Tk app *and* the MacOSX backend > doesn?t capture my keystrokes.) > > Everything works fine, but when I try to use the scroll wheel on my mouse, > or two-finger scrolling on my Macbook trackpad, everything dies with the > following message: > > Traceback (most recent call last): > File "basic_mpl_connect.py", line 20, in > plt.show() > File > "/Users/jni/conda/envs/ana/lib/python3.5/site-packages/matplotlib/pyplot.py", > line 252, in show > return _show(*args, **kw) > File > "/Users/jni/conda/envs/ana/lib/python3.5/site-packages/matplotlib/backend_bases.py", > line 192, in __call__ > self.mainloop() > File > "/Users/jni/conda/envs/ana/lib/python3.5/site-packages/matplotlib/backends/backend_tkagg.py", > line 74, in mainloop > Tk.mainloop() > File "/Users/jni/conda/envs/ana/lib/python3.5/tkinter/__init__.py", line > 405, in mainloop > _default_root.tk.mainloop(n) > UnicodeDecodeError: 'utf-8' codec can't decode byte 0xff in position 0: > invalid start byte > > This is true even if I explicitly connect the ?scroll_event? (below). > > Any ideas? > > Thanks, > > Juan. > > =================================== > > import matplotlib > matplotlib.use('TkAgg') > matplotlib.verbose.level = 'debug' > import matplotlib.pyplot as plt > > def process_key(event): > print("Key:", event.key) > > def process_button(event): > print("Button:", event.x, event.y, event.xdata, event.ydata, > event.button) > > def process_scroll(event): > print("Scroll") > > fig, ax = plt.subplots(1, 1) > fig.canvas.mpl_connect('key_press_event', process_key) > fig.canvas.mpl_connect('button_press_event', process_button) > fig.canvas.mpl_connect('scroll_event', process_scroll) > plt.show() > _______________________________________________ > Matplotlib-users mailing list > Matplotlib-users at python.org > https://mail.python.org/mailman/listinfo/matplotlib-users > -------------- next part -------------- An HTML attachment was scrubbed... URL: From selasley at icloud.com Tue Jan 10 02:48:47 2017 From: selasley at icloud.com (Scott Lasley) Date: Tue, 10 Jan 2017 02:48:47 -0500 Subject: [Matplotlib-users] Event connect error when using Tk and scrolling In-Reply-To: References: <311451d4-699b-47cf-9183-b7858302f6e9@Spark> Message-ID: I get the error when running under python3.6 and scrolling with the trackpad. OS X 10.12.2 with the system installed Tk version 8.5, python 3.6.0, matplotlib 2.0.0rc2+2939.g109251f Traceback (most recent call last): File "", line 1, in File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/matplotlib/pyplot.py", line 252, in show return _show(*args, **kw) File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/matplotlib/backend_bases.py", line 188, in __call__ self.mainloop() File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/matplotlib/backends/backend_tkagg.py", line 71, in mainloop Tk.mainloop() File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/tkinter/__init__.py", line 557, in mainloop _default_root.tk.mainloop(n) UnicodeDecodeError: 'utf-8' codec can't decode byte 0xff in position 0: invalid start byte >>> UnicodeDecodeError: 'utf-8' codec can't decode byte 0xff in position 0: invalid start byte The script works when run under python 2.7.13 and scrolling with the trackpad. > On Jan 9, 2017, at 23:40, Thomas Caswell wrote: > > I can not reproduce this on linux :/ > > This looks like it is coming out of Tk's handling of the scroll event before it is handed off to mpl. > > Tom > > On Mon, Jan 9, 2017 at 10:28 PM Juan Nunez-Iglesias wrote: > Hi all, > > I?m trying to play with the `basic_mpl_connect.py` example from Ben Root?s ?Interactive Applications Using Matplotlib? book, reproduced below in its entirety. (With the addition of selecting TkAgg as the backend. I need to do this because I?m aiming to embed into a Tk app *and* the MacOSX backend doesn?t capture my keystrokes.) > > Everything works fine, but when I try to use the scroll wheel on my mouse, or two-finger scrolling on my Macbook trackpad, everything dies with the following message: > > Traceback (most recent call last): > File "basic_mpl_connect.py", line 20, in > plt.show() > File "/Users/jni/conda/envs/ana/lib/python3.5/site-packages/matplotlib/pyplot.py", line 252, in show > return _show(*args, **kw) > File "/Users/jni/conda/envs/ana/lib/python3.5/site-packages/matplotlib/backend_bases.py", line 192, in __call__ > self.mainloop() > File "/Users/jni/conda/envs/ana/lib/python3.5/site-packages/matplotlib/backends/backend_tkagg.py", line 74, in mainloop > Tk.mainloop() > File "/Users/jni/conda/envs/ana/lib/python3.5/tkinter/__init__.py", line 405, in mainloop > _default_root.tk.mainloop(n) > UnicodeDecodeError: 'utf-8' codec can't decode byte 0xff in position 0: invalid start byte > > This is true even if I explicitly connect the ?scroll_event? (below). > > Any ideas? > > Thanks, > > Juan. > > =================================== > > import matplotlib > matplotlib.use('TkAgg') > matplotlib.verbose.level = 'debug' > import matplotlib.pyplot as plt > > def process_key(event): > print("Key:", event.key) > > def process_button(event): > print("Button:", event.x, event.y, event.xdata, event.ydata, event.button) > > def process_scroll(event): > print("Scroll") > > fig, ax = plt.subplots(1, 1) > fig.canvas.mpl_connect('key_press_event', process_key) > fig.canvas.mpl_connect('button_press_event', process_button) > fig.canvas.mpl_connect('scroll_event', process_scroll) > plt.show() > _______________________________________________ > Matplotlib-users mailing list > Matplotlib-users at python.org > https://mail.python.org/mailman/listinfo/matplotlib-users > _______________________________________________ > Matplotlib-users mailing list > Matplotlib-users at python.org > https://mail.python.org/mailman/listinfo/matplotlib-users From rmay31 at gmail.com Tue Jan 10 11:33:38 2017 From: rmay31 at gmail.com (Ryan May) Date: Tue, 10 Jan 2017 09:33:38 -0700 Subject: [Matplotlib-users] Event connect error when using Tk and scrolling In-Reply-To: References: <311451d4-699b-47cf-9183-b7858302f6e9@Spark> Message-ID: Works for me on macOS 10.12.2, Python 3.5.2 (conda-forge) and matplotlib 2.0rc2. Ryan On Tue, Jan 10, 2017 at 12:48 AM, Scott Lasley wrote: > I get the error when running under python3.6 and scrolling with the > trackpad. > OS X 10.12.2 with the system installed Tk version 8.5, python 3.6.0, > matplotlib 2.0.0rc2+2939.g109251f > > Traceback (most recent call last): > File "", line 1, in > File "/Library/Frameworks/Python.framework/Versions/3.6/lib/ > python3.6/site-packages/matplotlib/pyplot.py", line 252, in show > return _show(*args, **kw) > File "/Library/Frameworks/Python.framework/Versions/3.6/lib/ > python3.6/site-packages/matplotlib/backend_bases.py", line 188, in > __call__ > self.mainloop() > File "/Library/Frameworks/Python.framework/Versions/3.6/lib/ > python3.6/site-packages/matplotlib/backends/backend_tkagg.py", line 71, > in mainloop > Tk.mainloop() > File "/Library/Frameworks/Python.framework/Versions/3.6/lib/ > python3.6/tkinter/__init__.py", line 557, in mainloop > _default_root.tk.mainloop(n) > UnicodeDecodeError: 'utf-8' codec can't decode byte 0xff in position 0: > invalid start byte > >>> UnicodeDecodeError: 'utf-8' codec can't decode byte 0xff in position > 0: invalid start byte > > > The script works when run under python 2.7.13 and scrolling with the > trackpad. > > > > On Jan 9, 2017, at 23:40, Thomas Caswell wrote: > > > > I can not reproduce this on linux :/ > > > > This looks like it is coming out of Tk's handling of the scroll event > before it is handed off to mpl. > > > > Tom > > > > On Mon, Jan 9, 2017 at 10:28 PM Juan Nunez-Iglesias > wrote: > > Hi all, > > > > I?m trying to play with the `basic_mpl_connect.py` example from Ben > Root?s ?Interactive Applications Using Matplotlib? book, reproduced below > in its entirety. (With the addition of selecting TkAgg as the backend. I > need to do this because I?m aiming to embed into a Tk app *and* the MacOSX > backend doesn?t capture my keystrokes.) > > > > Everything works fine, but when I try to use the scroll wheel on my > mouse, or two-finger scrolling on my Macbook trackpad, everything dies with > the following message: > > > > Traceback (most recent call last): > > File "basic_mpl_connect.py", line 20, in > > plt.show() > > File "/Users/jni/conda/envs/ana/lib/python3.5/site-packages/matplotlib/pyplot.py", > line 252, in show > > return _show(*args, **kw) > > File "/Users/jni/conda/envs/ana/lib/python3.5/site-packages/matplotlib/backend_bases.py", > line 192, in __call__ > > self.mainloop() > > File "/Users/jni/conda/envs/ana/lib/python3.5/site-packages/ > matplotlib/backends/backend_tkagg.py", line 74, in mainloop > > Tk.mainloop() > > File "/Users/jni/conda/envs/ana/lib/python3.5/tkinter/__init__.py", > line 405, in mainloop > > _default_root.tk.mainloop(n) > > UnicodeDecodeError: 'utf-8' codec can't decode byte 0xff in position 0: > invalid start byte > > > > This is true even if I explicitly connect the ?scroll_event? (below). > > > > Any ideas? > > > > Thanks, > > > > Juan. > > > > =================================== > > > > import matplotlib > > matplotlib.use('TkAgg') > > matplotlib.verbose.level = 'debug' > > import matplotlib.pyplot as plt > > > > def process_key(event): > > print("Key:", event.key) > > > > def process_button(event): > > print("Button:", event.x, event.y, event.xdata, event.ydata, > event.button) > > > > def process_scroll(event): > > print("Scroll") > > > > fig, ax = plt.subplots(1, 1) > > fig.canvas.mpl_connect('key_press_event', process_key) > > fig.canvas.mpl_connect('button_press_event', process_button) > > fig.canvas.mpl_connect('scroll_event', process_scroll) > > plt.show() > > _______________________________________________ > > Matplotlib-users mailing list > > Matplotlib-users at python.org > > https://mail.python.org/mailman/listinfo/matplotlib-users > > _______________________________________________ > > Matplotlib-users mailing list > > Matplotlib-users at python.org > > https://mail.python.org/mailman/listinfo/matplotlib-users > > _______________________________________________ > Matplotlib-users mailing list > Matplotlib-users at python.org > https://mail.python.org/mailman/listinfo/matplotlib-users > -- Ryan May -------------- next part -------------- An HTML attachment was scrubbed... URL: From kaufmanmc at ornl.gov Tue Jan 10 12:57:07 2017 From: kaufmanmc at ornl.gov (Michael Kaufman) Date: Tue, 10 Jan 2017 12:57:07 -0500 Subject: [Matplotlib-users] easily accessing the default color cycle list Message-ID: Hi All, With the new color cycle, it's no longer super easy for me to manually set plotting colors (that still conform to the new default colors) without a cheat sheet. Recently I've been doing: cols = rcParams['axes.prop_cycle'].by_key()['color'] to get the list. This is something that I cannot remember and have search through old code to find every time. Is there an easier way to access this list? Something like: from matplotlib.colors import color_cycle cols = color_cycle('default') would be quite nice. Maybe something like this already exists? M From flyamer at gmail.com Tue Jan 10 13:01:22 2017 From: flyamer at gmail.com (Ilya Flyamer) Date: Tue, 10 Jan 2017 18:01:22 +0000 Subject: [Matplotlib-users] easily accessing the default color cycle list In-Reply-To: References: Message-ID: Hi Michael, I think the new colours can be used as 'C0', 'C1', etc, if that helps? Ilya 2017-01-10 17:57 GMT+00:00 Michael Kaufman : > Hi All, > > With the new color cycle, it's no longer super easy for me to manually set > plotting colors (that still conform to the new default colors) without a > cheat sheet. > > Recently I've been doing: > > cols = rcParams['axes.prop_cycle'].by_key()['color'] > > to get the list. This is something that I cannot remember and have search > through old code to find every time. > > Is there an easier way to access this list? Something like: > > from matplotlib.colors import color_cycle > cols = color_cycle('default') > > would be quite nice. Maybe something like this already exists? > > > M > _______________________________________________ > Matplotlib-users mailing list > Matplotlib-users at python.org > https://mail.python.org/mailman/listinfo/matplotlib-users > -------------- next part -------------- An HTML attachment was scrubbed... URL: From kaufmanmc at ornl.gov Tue Jan 10 13:04:49 2017 From: kaufmanmc at ornl.gov (Michael Kaufman) Date: Tue, 10 Jan 2017 13:04:49 -0500 Subject: [Matplotlib-users] easily accessing the default color cycle list In-Reply-To: References: Message-ID: <71ed6041-ba22-e509-975f-80d48e1b1da3@ornl.gov> That helps very much actually. Thanks. Is this documented somewhere? It's not in plot() help. M On 1/10/17 1:01 PM, Ilya Flyamer wrote: > Hi Michael, > > I think the new colours can be used as 'C0', 'C1', etc, if that helps? > > Ilya > > 2017-01-10 17:57 GMT+00:00 Michael Kaufman >: > > Hi All, > > With the new color cycle, it's no longer super easy for me to > manually set plotting colors (that still conform to the new default > colors) without a cheat sheet. > > Recently I've been doing: > > cols = rcParams['axes.prop_cycle'].by_key()['color'] > > to get the list. This is something that I cannot remember and have > search through old code to find every time. > > Is there an easier way to access this list? Something like: > > from matplotlib.colors import color_cycle > cols = color_cycle('default') > > would be quite nice. Maybe something like this already exists? > > > M > _______________________________________________ > Matplotlib-users mailing list > Matplotlib-users at python.org > https://mail.python.org/mailman/listinfo/matplotlib-users > > > From flyamer at gmail.com Tue Jan 10 13:06:06 2017 From: flyamer at gmail.com (Ilya Flyamer) Date: Tue, 10 Jan 2017 18:06:06 +0000 Subject: [Matplotlib-users] easily accessing the default color cycle list In-Reply-To: <71ed6041-ba22-e509-975f-80d48e1b1da3@ornl.gov> References: <71ed6041-ba22-e509-975f-80d48e1b1da3@ornl.gov> Message-ID: I only saw it here http://matplotlib.org/2.0.0rc2/users/dflt_style_changes.html 2017-01-10 18:04 GMT+00:00 Michael Kaufman : > That helps very much actually. Thanks. > > Is this documented somewhere? It's not in plot() help. > > M > > On 1/10/17 1:01 PM, Ilya Flyamer wrote: > >> Hi Michael, >> >> I think the new colours can be used as 'C0', 'C1', etc, if that helps? >> >> Ilya >> >> 2017-01-10 17:57 GMT+00:00 Michael Kaufman > >: >> >> Hi All, >> >> With the new color cycle, it's no longer super easy for me to >> manually set plotting colors (that still conform to the new default >> colors) without a cheat sheet. >> >> Recently I've been doing: >> >> cols = rcParams['axes.prop_cycle'].by_key()['color'] >> >> to get the list. This is something that I cannot remember and have >> search through old code to find every time. >> >> Is there an easier way to access this list? Something like: >> >> from matplotlib.colors import color_cycle >> cols = color_cycle('default') >> >> would be quite nice. Maybe something like this already exists? >> >> >> M >> _______________________________________________ >> Matplotlib-users mailing list >> Matplotlib-users at python.org >> https://mail.python.org/mailman/listinfo/matplotlib-users >> >> >> >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: From ben.v.root at gmail.com Tue Jan 10 13:10:32 2017 From: ben.v.root at gmail.com (Benjamin Root) Date: Tue, 10 Jan 2017 13:10:32 -0500 Subject: [Matplotlib-users] easily accessing the default color cycle list In-Reply-To: References: Message-ID: This feature will be in the upcoming 2.0 release. It isn't in the 1.5.x series. On Tue, Jan 10, 2017 at 1:01 PM, Ilya Flyamer wrote: > Hi Michael, > > I think the new colours can be used as 'C0', 'C1', etc, if that helps? > > Ilya > > 2017-01-10 17:57 GMT+00:00 Michael Kaufman : > >> Hi All, >> >> With the new color cycle, it's no longer super easy for me to manually >> set plotting colors (that still conform to the new default colors) without >> a cheat sheet. >> >> Recently I've been doing: >> >> cols = rcParams['axes.prop_cycle'].by_key()['color'] >> >> to get the list. This is something that I cannot remember and have search >> through old code to find every time. >> >> Is there an easier way to access this list? Something like: >> >> from matplotlib.colors import color_cycle >> cols = color_cycle('default') >> >> would be quite nice. Maybe something like this already exists? >> >> >> M >> _______________________________________________ >> Matplotlib-users mailing list >> Matplotlib-users at python.org >> https://mail.python.org/mailman/listinfo/matplotlib-users >> > > > _______________________________________________ > Matplotlib-users mailing list > Matplotlib-users at python.org > https://mail.python.org/mailman/listinfo/matplotlib-users > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From kaufmanmc at ornl.gov Tue Jan 10 13:14:00 2017 From: kaufmanmc at ornl.gov (Michael Kaufman) Date: Tue, 10 Jan 2017 13:14:00 -0500 Subject: [Matplotlib-users] easily accessing the default color cycle list In-Reply-To: References: Message-ID: <72b90f52-b986-6676-03c9-cccf459980ea@ornl.gov> Sure, but since I'm using a version of mpl that supports 'CN' color designations, it ought to at least be in documentation that's accessible via help(). M On 1/10/17 1:10 PM, Benjamin Root wrote: > This feature will be in the upcoming 2.0 release. It isn't in the 1.5.x > series. > > On Tue, Jan 10, 2017 at 1:01 PM, Ilya Flyamer > wrote: > > Hi Michael, > > I think the new colours can be used as 'C0', 'C1', etc, if that helps? > > Ilya > > 2017-01-10 17:57 GMT+00:00 Michael Kaufman >: > > Hi All, > > With the new color cycle, it's no longer super easy for me to > manually set plotting colors (that still conform to the new > default colors) without a cheat sheet. > > Recently I've been doing: > > cols = rcParams['axes.prop_cycle'].by_key()['color'] > > to get the list. This is something that I cannot remember and > have search through old code to find every time. > > Is there an easier way to access this list? Something like: > > from matplotlib.colors import color_cycle > cols = color_cycle('default') > > would be quite nice. Maybe something like this already exists? > > > M > _______________________________________________ > Matplotlib-users mailing list > Matplotlib-users at python.org > https://mail.python.org/mailman/listinfo/matplotlib-users > > > > > _______________________________________________ > Matplotlib-users mailing list > Matplotlib-users at python.org > https://mail.python.org/mailman/listinfo/matplotlib-users > > > From tcaswell at gmail.com Tue Jan 10 13:18:10 2017 From: tcaswell at gmail.com (Thomas Caswell) Date: Tue, 10 Jan 2017 18:18:10 +0000 Subject: [Matplotlib-users] easily accessing the default color cycle list In-Reply-To: <72b90f52-b986-6676-03c9-cccf459980ea@ornl.gov> References: <72b90f52-b986-6676-03c9-cccf459980ea@ornl.gov> Message-ID: It is also documented at http://matplotlib.org/2.0.0rc2/users/colors.html which is too verbose to put into the docstring of every method (almost all of them) that takes in a color-like input. Additionally, we will be adding alias to access the color by name for 2.0 final (see https://github.com/matplotlib/matplotlib/pull/7639 ) Tom On Tue, Jan 10, 2017 at 1:14 PM Michael Kaufman wrote: > Sure, but since I'm using a version of mpl that supports 'CN' color > designations, it ought to at least be in documentation that's accessible > via help(). > > M > > On 1/10/17 1:10 PM, Benjamin Root wrote: > > This feature will be in the upcoming 2.0 release. It isn't in the 1.5.x > > series. > > > > On Tue, Jan 10, 2017 at 1:01 PM, Ilya Flyamer > > wrote: > > > > Hi Michael, > > > > I think the new colours can be used as 'C0', 'C1', etc, if that > helps? > > > > Ilya > > > > 2017-01-10 17:57 GMT+00:00 Michael Kaufman > >: > > > > Hi All, > > > > With the new color cycle, it's no longer super easy for me to > > manually set plotting colors (that still conform to the new > > default colors) without a cheat sheet. > > > > Recently I've been doing: > > > > cols = rcParams['axes.prop_cycle'].by_key()['color'] > > > > to get the list. This is something that I cannot remember and > > have search through old code to find every time. > > > > Is there an easier way to access this list? Something like: > > > > from matplotlib.colors import color_cycle > > cols = color_cycle('default') > > > > would be quite nice. Maybe something like this already exists? > > > > > > M > > _______________________________________________ > > Matplotlib-users mailing list > > Matplotlib-users at python.org > > https://mail.python.org/mailman/listinfo/matplotlib-users > > > > > > > > > > _______________________________________________ > > Matplotlib-users mailing list > > Matplotlib-users at python.org > > https://mail.python.org/mailman/listinfo/matplotlib-users > > > > > > > > _______________________________________________ > Matplotlib-users mailing list > Matplotlib-users at python.org > https://mail.python.org/mailman/listinfo/matplotlib-users > -------------- next part -------------- An HTML attachment was scrubbed... URL: From tcaswell at gmail.com Tue Jan 10 13:22:57 2017 From: tcaswell at gmail.com (Thomas Caswell) Date: Tue, 10 Jan 2017 18:22:57 +0000 Subject: [Matplotlib-users] legend(loc='best') a bit off In-Reply-To: References: Message-ID: In principle yes, but I think it would depend on how general / reliable the algorithm is vs how complex and invasive the algorithm ends up being. Tom On Mon, Jan 9, 2017 at 2:40 PM Ilya Flyamer wrote: > Would an approach similar to adjustText be something you could consider > for mpl? I was already thinking of adding this to the library. > > 9 ??? 2017 ?. 15:15 ???????????? "Thomas Caswell" > ???????: > > I am pretty sure that 'best' is picking from one of the 9 positions [(top, > middle, bottom)X(left, center, right)] not picking a continuous position. > > Fixing this would be useful and a pretty major new feature. It is not > clear to me what the best algorithm for this would be. The obvious thing > is to run N more refinements around each point, but hopefully there is some > computational geometry that I do not know. > > Tom > > On Mon, Jan 9, 2017, 09:07 Neal Becker wrote: > > In the attached, the legend box slightly covers the graph, but there is no > need to, it could just be moved a bit lower and then would cover nothing. > > My questions: > 1) can I fix it? > 2) is this a bug?_______________________________________________ > Matplotlib-users mailing list > Matplotlib-users at python.org > https://mail.python.org/mailman/listinfo/matplotlib-users > > > _______________________________________________ > Matplotlib-users mailing list > Matplotlib-users at python.org > https://mail.python.org/mailman/listinfo/matplotlib-users > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From kaufmanmc at ornl.gov Tue Jan 10 13:38:38 2017 From: kaufmanmc at ornl.gov (Michael Kaufman) Date: Tue, 10 Jan 2017 13:38:38 -0500 Subject: [Matplotlib-users] easily accessing the default color cycle list In-Reply-To: References: <72b90f52-b986-6676-03c9-cccf459980ea@ornl.gov> Message-ID: On 1/10/17 1:18 PM, Thomas Caswell wrote: > It is also documented > at http://matplotlib.org/2.0.0rc2/users/colors.html which is too verbose > to put into the docstring of every method (almost all of them) that > takes in a color-like input. > Ok, but we've already got a nice paragraph: In addition, you can specify colors in many weird and wonderful ways, including full names (``'green'``), hex strings (``'#008000'``), RGB or RGBA tuples (``(0,1,0,1)``) or grayscale intensities as a string (``'0.8'``). Of these, the string specifications can be used in place of a ``fmt`` group, but the tuple forms can be used only as ``kwargs``. in help(plot) that has just about everything except the new stuff anyway. Besides, help(plot) is the go-to method that (I at least) use if I want to look up the usage a kwarg. If it's there, then I can use (say the marker symbol) in scatter without needing the extensive extra documentation in help(scatter). So having help(plot) extra-documented makes plenty of sense for me. M > Additionally, we will be adding alias to access the color by name for > 2.0 final (see https://github.com/matplotlib/matplotlib/pull/7639 ) > > Tom From flyamer at gmail.com Tue Jan 10 13:47:12 2017 From: flyamer at gmail.com (Ilya Flyamer) Date: Tue, 10 Jan 2017 18:47:12 +0000 Subject: [Matplotlib-users] legend(loc='best') a bit off In-Reply-To: References: Message-ID: OK, when I find the time to add it to adjustText, I'll get back to you to discuss this. 2017-01-10 18:22 GMT+00:00 Thomas Caswell : > In principle yes, but I think it would depend on how general / reliable > the algorithm is vs how complex and invasive the algorithm ends up being. > > Tom > > On Mon, Jan 9, 2017 at 2:40 PM Ilya Flyamer wrote: > >> Would an approach similar to adjustText be something you could consider >> for mpl? I was already thinking of adding this to the library. >> >> 9 ??? 2017 ?. 15:15 ???????????? "Thomas Caswell" >> ???????: >> >> I am pretty sure that 'best' is picking from one of the 9 positions >> [(top, middle, bottom)X(left, center, right)] not picking a continuous >> position. >> >> Fixing this would be useful and a pretty major new feature. It is not >> clear to me what the best algorithm for this would be. The obvious thing >> is to run N more refinements around each point, but hopefully there is some >> computational geometry that I do not know. >> >> Tom >> >> On Mon, Jan 9, 2017, 09:07 Neal Becker wrote: >> >> In the attached, the legend box slightly covers the graph, but there is no >> need to, it could just be moved a bit lower and then would cover nothing. >> >> My questions: >> 1) can I fix it? >> 2) is this a bug?_______________________________________________ >> Matplotlib-users mailing list >> Matplotlib-users at python.org >> https://mail.python.org/mailman/listinfo/matplotlib-users >> >> >> _______________________________________________ >> Matplotlib-users mailing list >> Matplotlib-users at python.org >> https://mail.python.org/mailman/listinfo/matplotlib-users >> >> -------------- next part -------------- An HTML attachment was scrubbed... URL: From tcaswell at gmail.com Tue Jan 10 13:57:42 2017 From: tcaswell at gmail.com (Thomas Caswell) Date: Tue, 10 Jan 2017 18:57:42 +0000 Subject: [Matplotlib-users] easily accessing the default color cycle list In-Reply-To: References: <72b90f52-b986-6676-03c9-cccf459980ea@ornl.gov> Message-ID: Pull requests to improve the documentation are always welcome :) You seem to have a clear idea of what would be helpful to include in that docstring, could you please add it? Tom On Tue, Jan 10, 2017 at 1:38 PM Michael Kaufman wrote: > On 1/10/17 1:18 PM, Thomas Caswell wrote: > > It is also documented > > at http://matplotlib.org/2.0.0rc2/users/colors.html which is too verbose > > to put into the docstring of every method (almost all of them) that > > takes in a color-like input. > > > > Ok, but we've already got a nice paragraph: > > In addition, you can specify colors in many weird and > wonderful ways, including full names (``'green'``), hex > strings (``'#008000'``), RGB or RGBA tuples (``(0,1,0,1)``) or > grayscale intensities as a string (``'0.8'``). Of these, the > string specifications can be used in place of a ``fmt`` group, > but the tuple forms can be used only as ``kwargs``. > > in help(plot) that has just about everything except the new stuff anyway. > > Besides, help(plot) is the go-to method that (I at least) use if I want > to look up the usage a kwarg. If it's there, then I can use (say the > marker symbol) in scatter without needing the extensive extra > documentation in help(scatter). > > So having help(plot) extra-documented makes plenty of sense for me. > > M > > > Additionally, we will be adding alias to access the color by name for > > 2.0 final (see https://github.com/matplotlib/matplotlib/pull/7639 ) > > > > Tom > -------------- next part -------------- An HTML attachment was scrubbed... URL: From selasley at icloud.com Tue Jan 10 16:56:55 2017 From: selasley at icloud.com (Scott Lasley) Date: Tue, 10 Jan 2017 16:56:55 -0500 Subject: [Matplotlib-users] Event connect error when using Tk and scrolling In-Reply-To: References: <311451d4-699b-47cf-9183-b7858302f6e9@Spark> Message-ID: <48E9DEF0-7849-4C8A-BB57-373DB9A6B62A@icloud.com> Juan, I installed ActiveTCL8.5.18 as described on python.org's Tcl/Tk page for macOS and now the script runs under python3.6 without errors when scrolling with the trackpad. If your usage allows, you should consider installing a newer version of Tcl/Tk if you are using python.org's python or switch to Anaconda's python. Scott > On Jan 10, 2017, at 11:33 AM, Ryan May wrote: > > Works for me on macOS 10.12.2, Python 3.5.2 (conda-forge) and matplotlib 2.0rc2. > > Ryan > > On Tue, Jan 10, 2017 at 12:48 AM, Scott Lasley wrote: > I get the error when running under python3.6 and scrolling with the trackpad. > OS X 10.12.2 with the system installed Tk version 8.5, python 3.6.0, matplotlib 2.0.0rc2+2939.g109251f > > Traceback (most recent call last): > File "", line 1, in > File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/matplotlib/pyplot.py", line 252, in show > return _show(*args, **kw) > File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/matplotlib/backend_bases.py", line 188, in __call__ > self.mainloop() > File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/matplotlib/backends/backend_tkagg.py", line 71, in mainloop > Tk.mainloop() > File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/tkinter/__init__.py", line 557, in mainloop > _default_root.tk.mainloop(n) > UnicodeDecodeError: 'utf-8' codec can't decode byte 0xff in position 0: invalid start byte > >>> UnicodeDecodeError: 'utf-8' codec can't decode byte 0xff in position 0: invalid start byte > > > The script works when run under python 2.7.13 and scrolling with the trackpad. > > > > On Jan 9, 2017, at 23:40, Thomas Caswell wrote: > > > > I can not reproduce this on linux :/ > > > > This looks like it is coming out of Tk's handling of the scroll event before it is handed off to mpl. > > > > Tom > > > > On Mon, Jan 9, 2017 at 10:28 PM Juan Nunez-Iglesias wrote: > > Hi all, > > > > I?m trying to play with the `basic_mpl_connect.py` example from Ben Root?s ?Interactive Applications Using Matplotlib? book, reproduced below in its entirety. (With the addition of selecting TkAgg as the backend. I need to do this because I?m aiming to embed into a Tk app *and* the MacOSX backend doesn?t capture my keystrokes.) > > > > Everything works fine, but when I try to use the scroll wheel on my mouse, or two-finger scrolling on my Macbook trackpad, everything dies with the following message: > > > > Traceback (most recent call last): > > File "basic_mpl_connect.py", line 20, in > > plt.show() > > File "/Users/jni/conda/envs/ana/lib/python3.5/site-packages/matplotlib/pyplot.py", line 252, in show > > return _show(*args, **kw) > > File "/Users/jni/conda/envs/ana/lib/python3.5/site-packages/matplotlib/backend_bases.py", line 192, in __call__ > > self.mainloop() > > File "/Users/jni/conda/envs/ana/lib/python3.5/site-packages/matplotlib/backends/backend_tkagg.py", line 74, in mainloop > > Tk.mainloop() > > File "/Users/jni/conda/envs/ana/lib/python3.5/tkinter/__init__.py", line 405, in mainloop > > _default_root.tk.mainloop(n) > > UnicodeDecodeError: 'utf-8' codec can't decode byte 0xff in position 0: invalid start byte > > > > This is true even if I explicitly connect the ?scroll_event? (below). > > > > Any ideas? > > > > Thanks, > > > > Juan. > > > > =================================== > > > > import matplotlib > > matplotlib.use('TkAgg') > > matplotlib.verbose.level = 'debug' > > import matplotlib.pyplot as plt > > > > def process_key(event): > > print("Key:", event.key) > > > > def process_button(event): > > print("Button:", event.x, event.y, event.xdata, event.ydata, event.button) > > > > def process_scroll(event): > > print("Scroll") > > > > fig, ax = plt.subplots(1, 1) > > fig.canvas.mpl_connect('key_press_event', process_key) > > fig.canvas.mpl_connect('button_press_event', process_button) > > fig.canvas.mpl_connect('scroll_event', process_scroll) > > plt.show() > > _______________________________________________ > > Matplotlib-users mailing list > > Matplotlib-users at python.org > > https://mail.python.org/mailman/listinfo/matplotlib-users > > -- > Ryan May > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jni.soma at gmail.com Wed Jan 11 06:44:40 2017 From: jni.soma at gmail.com (Juan Nunez-Iglesias) Date: Wed, 11 Jan 2017 22:44:40 +1100 Subject: [Matplotlib-users] Event connect error when using Tk and scrolling In-Reply-To: <48E9DEF0-7849-4C8A-BB57-373DB9A6B62A@icloud.com> References: <311451d4-699b-47cf-9183-b7858302f6e9@Spark> <48E9DEF0-7849-4C8A-BB57-373DB9A6B62A@icloud.com> Message-ID: <5e22932d-c101-4ae3-b26e-62faa4ec743e@Spark> Hi all, Thanks for taking a look. Unfortunately I don?t have time right now to test with a new version of Anaconda Python, but I should mention that the original error reported was using Anaconda + Python 3.5, mpl 1.5. Will give it another go tomorrow with an updated anaconda distro, and maybe check out the latest ActiveTCL if relevant. Thanks! Juan. On 11 Jan 2017, 8:56 AM +1100, Scott Lasley , wrote: > Juan, > > I installed ActiveTCL8.5.18 as described on?python.org's Tcl/Tk page for macOS?and now the script runs under python3.6 without errors when scrolling with the trackpad. ?If your usage allows, you should consider installing a newer version of Tcl/Tk if you are using python.org's python or switch to Anaconda's python. > > Scott > > > > On Jan 10, 2017, at 11:33 AM, Ryan May wrote: > > > > Works for me on macOS 10.12.2, Python 3.5.2 (conda-forge) and matplotlib 2.0rc2. > > > > Ryan > > > > On Tue, Jan 10, 2017 at 12:48 AM, Scott Lasley??wrote: > > I get the error when running under python3.6 and scrolling with the trackpad. > > OS X 10.12.2 with the system installed Tk version 8.5, python 3.6.0, matplotlib 2.0.0rc2+2939.g109251f > > > > Traceback (most recent call last): > > ? File "", line 1, in > > ? File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/matplotlib/pyplot.py", line 252, in show > > ? ? return _show(*args, **kw) > > ? File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/matplotlib/backend_bases.py", line 188, in __call__ > > ? ? self.mainloop() > > ? File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/matplotlib/backends/backend_tkagg.py", line 71, in mainloop > > ? ? Tk.mainloop() > > ? File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/tkinter/__init__.py", line 557, in mainloop > > ? ? _default_root.tk.mainloop(n) > > UnicodeDecodeError: 'utf-8' codec can't decode byte 0xff in position 0: invalid start byte > > >>> UnicodeDecodeError: 'utf-8' codec can't decode byte 0xff in position 0: invalid start byte > > > > > > The script works when run under python 2.7.13 and scrolling with the trackpad. > > > > > > > On Jan 9, 2017, at 23:40, Thomas Caswell wrote: > > > > > > I can not reproduce this on linux :/ > > > > > > This looks like it is coming out of Tk's handling of the scroll event before it is handed off to mpl. > > > > > > Tom > > > > > > On Mon, Jan 9, 2017 at 10:28 PM Juan Nunez-Iglesias wrote: > > > Hi all, > > > > > > I?m trying to play with the `basic_mpl_connect.py` example from Ben Root?s ?Interactive Applications Using Matplotlib? book, reproduced below in its entirety. (With?the addition of selecting TkAgg as the backend. I need to do this because I?m aiming to embed into a Tk app *and* the MacOSX backend doesn?t capture my keystrokes.) > > > > > > Everything works fine, but when I try to use the scroll wheel on my mouse, or two-finger scrolling on my Macbook trackpad, everything dies with the following?message: > > > > > > Traceback (most recent call last): > > > ? File "basic_mpl_connect.py", line 20, in > > > ? ? plt.show() > > > ? File "/Users/jni/conda/envs/ana/lib/python3.5/site-packages/matplotlib/pyplot.py", line 252, in show > > > ? ? return _show(*args, **kw) > > > ? File "/Users/jni/conda/envs/ana/lib/python3.5/site-packages/matplotlib/backend_bases.py", line 192, in __call__ > > > ? ? self.mainloop() > > > ? File "/Users/jni/conda/envs/ana/lib/python3.5/site-packages/matplotlib/backends/backend_tkagg.py", line 74, in mainloop > > > ? ? Tk.mainloop() > > > ? File "/Users/jni/conda/envs/ana/lib/python3.5/tkinter/__init__.py", line 405, in mainloop > > > ? ? _default_root.tk.mainloop(n) > > > UnicodeDecodeError: 'utf-8' codec can't decode byte 0xff in position 0: invalid start byte > > > > > > This is true even if I explicitly connect the ?scroll_event? (below). > > > > > > Any ideas? > > > > > > Thanks, > > > > > > Juan. > > > > > > =================================== > > > > > > import matplotlib > > > matplotlib.use('TkAgg') > > > matplotlib.verbose.level = 'debug' > > > import matplotlib.pyplot as plt > > > > > > def process_key(event): > > > ? ? print("Key:", event.key) > > > > > > def process_button(event): > > > ? ? print("Button:", event.x, event.y, event.xdata, event.ydata, event.button) > > > > > > def process_scroll(event): > > > ? ? print("Scroll") > > > > > > fig, ax = plt.subplots(1, 1) > > > fig.canvas.mpl_connect('key_press_event', process_key) > > > fig.canvas.mpl_connect('button_press_event', process_button) > > > fig.canvas.mpl_connect('scroll_event', process_scroll) > > > plt.show() > > > _______________________________________________ > > > Matplotlib-users mailing list > > >?Matplotlib-users at python.org > > >?https://mail.python.org/mailman/listinfo/matplotlib-users > > > > -- > > Ryan May > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From mikem at oceanweather.com Thu Jan 12 18:03:59 2017 From: mikem at oceanweather.com (Michael Morrone) Date: Thu, 12 Jan 2017 18:03:59 -0500 Subject: [Matplotlib-users] Converting dates into a suitable format for MatPlotLib Message-ID: <031a01d26d28$2b620810$82261830$@oceanweather.com> Hello, I have a series of dates of the form (YYYY, mm, dd, (hh/24)) as output from the module jd2gcal. hh/24 = the fractional part of a day represented as a decimal, i.e. 12/24 = 0.5 so my data would look like this for December 21, 2015 at 12:00 UTC: (2015, 12, 21, 0.5) Is there a way to convert the above string into a date format suitable for plotting in MatPlotLib? There doesn't seem to be a format representation for a fractional day in Python as far as I can tell. I'm a newbie, so type slowly. J Many thanks for any assistance! Regards, Mike Michael Morrone Meteorologist Oceanweather, Inc. mikem at oceanweather.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From pmhobson at gmail.com Thu Jan 12 18:24:52 2017 From: pmhobson at gmail.com (Paul Hobson) Date: Thu, 12 Jan 2017 15:24:52 -0800 Subject: [Matplotlib-users] Converting dates into a suitable format for MatPlotLib In-Reply-To: <031a01d26d28$2b620810$82261830$@oceanweather.com> References: <031a01d26d28$2b620810$82261830$@oceanweather.com> Message-ID: You'll need to write your own parser. Something like: from datetime import datetime def parse_date_tuple(dt): year, month, day, _day_fraction = dt # unpack the tuple hour = _day_fraction * 24 return datetime(year, month, day, hour) So you could apply that to a list of your date-tuples like this: dates = numpy.array([parse_date_tuple(dt) for dt in date_tuple_list]) I didn't test any of this, so caveat emptor and whatnot. On Thu, Jan 12, 2017 at 3:03 PM, Michael Morrone wrote: > Hello, > > > > I have a series of dates of the form (YYYY, mm, dd, (hh/24)) as output > from the module jd2gcal. hh/24 = the fractional part of a day represented > as a decimal, i.e. 12/24 = 0.5 so my data would look like this for December > 21, 2015 at 12:00 UTC: > > > > (2015, 12, 21, 0.5) > > > > Is there a way to convert the above string into a date format suitable for > plotting in MatPlotLib? There doesn?t seem to be a format representation > for a fractional day in Python as far as I can tell. I?m a newbie, so type > slowly. J > > > > Many thanks for any assistance! > > > > Regards, > > Mike > > > > Michael Morrone > > Meteorologist > > Oceanweather, Inc. > > mikem at oceanweather.com > > > > _______________________________________________ > Matplotlib-users mailing list > Matplotlib-users at python.org > https://mail.python.org/mailman/listinfo/matplotlib-users > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jni.soma at gmail.com Tue Jan 17 01:09:14 2017 From: jni.soma at gmail.com (Juan Nunez-Iglesias) Date: Tue, 17 Jan 2017 17:09:14 +1100 Subject: [Matplotlib-users] Event connect error when using Tk and scrolling In-Reply-To: <48E9DEF0-7849-4C8A-BB57-373DB9A6B62A@icloud.com> References: <311451d4-699b-47cf-9183-b7858302f6e9@Spark> <48E9DEF0-7849-4C8A-BB57-373DB9A6B62A@icloud.com> Message-ID: Hmm, installing ActiveTCL didn't help when using Anaconda Python. Which makes sense, but it was worth a shot. =) On 11 Jan 2017, 8:56 AM +1100, Scott Lasley , wrote: > Juan, > > I installed ActiveTCL8.5.18 as described on?python.org's Tcl/Tk page for macOS?and now the script runs under python3.6 without errors when scrolling with the trackpad. ?If your usage allows, you should consider installing a newer version of Tcl/Tk if you are using python.org's python or switch to Anaconda's python. > > Scott > > > > On Jan 10, 2017, at 11:33 AM, Ryan May wrote: > > > > Works for me on macOS 10.12.2, Python 3.5.2 (conda-forge) and matplotlib 2.0rc2. > > > > Ryan > > > > On Tue, Jan 10, 2017 at 12:48 AM, Scott Lasley??wrote: > > I get the error when running under python3.6 and scrolling with the trackpad. > > OS X 10.12.2 with the system installed Tk version 8.5, python 3.6.0, matplotlib 2.0.0rc2+2939.g109251f > > > > Traceback (most recent call last): > > ? File "", line 1, in > > ? File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/matplotlib/pyplot.py", line 252, in show > > ? ? return _show(*args, **kw) > > ? File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/matplotlib/backend_bases.py", line 188, in __call__ > > ? ? self.mainloop() > > ? File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/matplotlib/backends/backend_tkagg.py", line 71, in mainloop > > ? ? Tk.mainloop() > > ? File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/tkinter/__init__.py", line 557, in mainloop > > ? ? _default_root.tk.mainloop(n) > > UnicodeDecodeError: 'utf-8' codec can't decode byte 0xff in position 0: invalid start byte > > >>> UnicodeDecodeError: 'utf-8' codec can't decode byte 0xff in position 0: invalid start byte > > > > > > The script works when run under python 2.7.13 and scrolling with the trackpad. > > > > > > > On Jan 9, 2017, at 23:40, Thomas Caswell wrote: > > > > > > I can not reproduce this on linux :/ > > > > > > This looks like it is coming out of Tk's handling of the scroll event before it is handed off to mpl. > > > > > > Tom > > > > > > On Mon, Jan 9, 2017 at 10:28 PM Juan Nunez-Iglesias wrote: > > > Hi all, > > > > > > I?m trying to play with the `basic_mpl_connect.py` example from Ben Root?s ?Interactive Applications Using Matplotlib? book, reproduced below in its entirety. (With?the addition of selecting TkAgg as the backend. I need to do this because I?m aiming to embed into a Tk app *and* the MacOSX backend doesn?t capture my keystrokes.) > > > > > > Everything works fine, but when I try to use the scroll wheel on my mouse, or two-finger scrolling on my Macbook trackpad, everything dies with the following?message: > > > > > > Traceback (most recent call last): > > > ? File "basic_mpl_connect.py", line 20, in > > > ? ? plt.show() > > > ? File "/Users/jni/conda/envs/ana/lib/python3.5/site-packages/matplotlib/pyplot.py", line 252, in show > > > ? ? return _show(*args, **kw) > > > ? File "/Users/jni/conda/envs/ana/lib/python3.5/site-packages/matplotlib/backend_bases.py", line 192, in __call__ > > > ? ? self.mainloop() > > > ? File "/Users/jni/conda/envs/ana/lib/python3.5/site-packages/matplotlib/backends/backend_tkagg.py", line 74, in mainloop > > > ? ? Tk.mainloop() > > > ? File "/Users/jni/conda/envs/ana/lib/python3.5/tkinter/__init__.py", line 405, in mainloop > > > ? ? _default_root.tk.mainloop(n) > > > UnicodeDecodeError: 'utf-8' codec can't decode byte 0xff in position 0: invalid start byte > > > > > > This is true even if I explicitly connect the ?scroll_event? (below). > > > > > > Any ideas? > > > > > > Thanks, > > > > > > Juan. > > > > > > =================================== > > > > > > import matplotlib > > > matplotlib.use('TkAgg') > > > matplotlib.verbose.level = 'debug' > > > import matplotlib.pyplot as plt > > > > > > def process_key(event): > > > ? ? print("Key:", event.key) > > > > > > def process_button(event): > > > ? ? print("Button:", event.x, event.y, event.xdata, event.ydata, event.button) > > > > > > def process_scroll(event): > > > ? ? print("Scroll") > > > > > > fig, ax = plt.subplots(1, 1) > > > fig.canvas.mpl_connect('key_press_event', process_key) > > > fig.canvas.mpl_connect('button_press_event', process_button) > > > fig.canvas.mpl_connect('scroll_event', process_scroll) > > > plt.show() > > > _______________________________________________ > > > Matplotlib-users mailing list > > >?Matplotlib-users at python.org > > >?https://mail.python.org/mailman/listinfo/matplotlib-users > > > > -- > > Ryan May > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From selasley at icloud.com Tue Jan 17 05:11:32 2017 From: selasley at icloud.com (Scott Lasley) Date: Tue, 17 Jan 2017 05:11:32 -0500 Subject: [Matplotlib-users] Event connect error when using Tk and scrolling In-Reply-To: References: <311451d4-699b-47cf-9183-b7858302f6e9@Spark> <48E9DEF0-7849-4C8A-BB57-373DB9A6B62A@icloud.com> Message-ID: I installed the python 3.5 version of anaconda 4.2.0. The conda list command shows tk 8.5.18 installed, but tkinter.Tk().eval('info patchlevel') returns 8.5.9. It looks like tkinter is hard coded to use the system installed Tk and Tcl libraries as shown by the output of otool -L anaconda/lib/python3.5/lib-dynload/_tkinter.so otool -L anaconda/pkgs/python-3.5.2-0/lib/python3.5/lib-dynload/_tkinter.so This stackoverflow answer lead me to a possible solution - http://stackoverflow.com/questions/35593602/tk-framework-double-implementation-issue/37222391 After using the commands below in Terminal to change the path to libtk8 and libtcl8 that tkinter uses, tkinter.Tk().eval('info patchlevel') returns 8.5.18 and your script runs without errors when scrolling. It does output a couple of deprecation warnings when it first runs. Mucking with library paths like this is not a great solution. Your best bet might be to contact support at contimuum or ask about this problem on their anaconda mailing list. Here are the commands I ran to update the tkinter paths (you may need to have the command line developer tools installed): install_name_tool -change \ "/System/Library/Frameworks/Tk.framework/Versions/8.5/Tk" \ "@loader_path/../../libtk8.5.dylib" \ anaconda/lib/python3.5/lib-dynload/_tkinter.so install_name_tool -change \ "/System/Library/Frameworks/Tcl.framework/Versions/8.5/Tcl" \ "@loader_path/../../libtcl8.5.dylib" \ anaconda/lib/python3.5/lib-dynload/_tkinter.so install_name_tool -change \ "/System/Library/Frameworks/Tk.framework/Versions/8.5/Tk" \ "@loader_path/../../libtk8.5.dylib" \ anaconda/pkgs/python-3.5.2-0/lib/python3.5/lib-dynload/_tkinter.so install_name_tool -change \ "/System/Library/Frameworks/Tcl.framework/Versions/8.5/Tcl" \ "@loader_path/../../libtcl8.5.dylib" \ anaconda/pkgs/python-3.5.2-0/lib/python3.5/lib-dynload/_tkinter.so hth, Scott > On Jan 17, 2017, at 01:09, Juan Nunez-Iglesias wrote: > > Hmm, installing ActiveTCL didn't help when using Anaconda Python. Which makes sense, but it was worth a shot. =) > > On 11 Jan 2017, 8:56 AM +1100, Scott Lasley , wrote: >> Juan, >> >> I installed ActiveTCL8.5.18 as described on python.org's Tcl/Tk page for macOS and now the script runs under python3.6 without errors when scrolling with the trackpad. If your usage allows, you should consider installing a newer version of Tcl/Tk if you are using python.org's python or switch to Anaconda's python. >> >> Scott >> >> >>> On Jan 10, 2017, at 11:33 AM, Ryan May wrote: >>> >>> Works for me on macOS 10.12.2, Python 3.5.2 (conda-forge) and matplotlib 2.0rc2. >>> >>> Ryan >>> >>> On Tue, Jan 10, 2017 at 12:48 AM, Scott Lasley wrote: >>> I get the error when running under python3.6 and scrolling with the trackpad. >>> OS X 10.12.2 with the system installed Tk version 8.5, python 3.6.0, matplotlib 2.0.0rc2+2939.g109251f >>> >>> Traceback (most recent call last): >>> File "", line 1, in >>> File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/matplotlib/pyplot.py", line 252, in show >>> return _show(*args, **kw) >>> File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/matplotlib/backend_bases.py", line 188, in __call__ >>> self.mainloop() >>> File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/matplotlib/backends/backend_tkagg.py", line 71, in mainloop >>> Tk.mainloop() >>> File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/tkinter/__init__.py", line 557, in mainloop >>> _default_root.tk.mainloop(n) >>> UnicodeDecodeError: 'utf-8' codec can't decode byte 0xff in position 0: invalid start byte >>> >>> UnicodeDecodeError: 'utf-8' codec can't decode byte 0xff in position 0: invalid start byte >>> >>> >>> The script works when run under python 2.7.13 and scrolling with the trackpad. >>> >>> >>> > On Jan 9, 2017, at 23:40, Thomas Caswell wrote: >>> > >>> > I can not reproduce this on linux :/ >>> > >>> > This looks like it is coming out of Tk's handling of the scroll event before it is handed off to mpl. >>> > >>> > Tom >>> > >>> > On Mon, Jan 9, 2017 at 10:28 PM Juan Nunez-Iglesias wrote: >>> > Hi all, >>> > >>> > I?m trying to play with the `basic_mpl_connect.py` example from Ben Root?s ?Interactive Applications Using Matplotlib? book, reproduced below in its entirety. (With the addition of selecting TkAgg as the backend. I need to do this because I?m aiming to embed into a Tk app *and* the MacOSX backend doesn?t capture my keystrokes.) >>> > >>> > Everything works fine, but when I try to use the scroll wheel on my mouse, or two-finger scrolling on my Macbook trackpad, everything dies with the following message: >>> > >>> > Traceback (most recent call last): >>> > File "basic_mpl_connect.py", line 20, in >>> > plt.show() >>> > File "/Users/jni/conda/envs/ana/lib/python3.5/site-packages/matplotlib/pyplot.py", line 252, in show >>> > return _show(*args, **kw) >>> > File "/Users/jni/conda/envs/ana/lib/python3.5/site-packages/matplotlib/backend_bases.py", line 192, in __call__ >>> > self.mainloop() >>> > File "/Users/jni/conda/envs/ana/lib/python3.5/site-packages/matplotlib/backends/backend_tkagg.py", line 74, in mainloop >>> > Tk.mainloop() >>> > File "/Users/jni/conda/envs/ana/lib/python3.5/tkinter/__init__.py", line 405, in mainloop >>> > _default_root.tk.mainloop(n) >>> > UnicodeDecodeError: 'utf-8' codec can't decode byte 0xff in position 0: invalid start byte >>> > >>> > This is true even if I explicitly connect the ?scroll_event? (below). >>> > >>> > Any ideas? >>> > >>> > Thanks, >>> > >>> > Juan. >>> > >>> > =================================== >>> > >>> > import matplotlib >>> > matplotlib.use('TkAgg') >>> > matplotlib.verbose.level = 'debug' >>> > import matplotlib.pyplot as plt >>> > >>> > def process_key(event): >>> > print("Key:", event.key) >>> > >>> > def process_button(event): >>> > print("Button:", event.x, event.y, event.xdata, event.ydata, event.button) >>> > >>> > def process_scroll(event): >>> > print("Scroll") >>> > >>> > fig, ax = plt.subplots(1, 1) >>> > fig.canvas.mpl_connect('key_press_event', process_key) >>> > fig.canvas.mpl_connect('button_press_event', process_button) >>> > fig.canvas.mpl_connect('scroll_event', process_scroll) >>> > plt.show() >>> > _______________________________________________ >>> > Matplotlib-users mailing list >>> > Matplotlib-users at python.org >>> > https://mail.python.org/mailman/listinfo/matplotlib-users >>> >>> -- >>> Ryan May >>> >> From tcaswell at gmail.com Tue Jan 17 11:55:12 2017 From: tcaswell at gmail.com (Thomas Caswell) Date: Tue, 17 Jan 2017 16:55:12 +0000 Subject: [Matplotlib-users] [REL] matplotlib v2.0.0 Message-ID: Folks, We are happy to announce the release of (long delayed) matplotlib 2.0! This release completely overhauls the default style of the plots. The source tarball and wheels for Mac, Win, and manylinux for python 2.7, 3.4-3.6 are available on pypi pip install --upgrade matplotlib and conda packages for Mac, Win, linux for python 2.7, 3.4-3.6 are available from conda-forge conda install matplotlib -c conda-forge Highlights include: - 'viridis' is default color map instead of jet. - Modernized the default color cycle. - Many more functions respect the color cycle. - Line dash patterns scale with linewidth. - Change default font to DejaVu, now supports most Western alphabets (including Greek, Cyrillic and Latin with diacritics), math symbols and emoji out of the box. - Faster text rendering. - Improved auto-limits. - Ticks out and only on the right and bottom spines by default. - Improved auto-ticking, particularly for log scales and dates. - Improved image support (imshow respects scales and eliminated a class of artifacts). For a full list of the default changes (along with how to revert them) please see http://matplotlib.org/users/dflt_style_changes.html and http://matplotlib.org/users/whats_new.html#new-in-matplotlib-2-0. There were a number of small API changes documented at http://matplotlib.org/api/api_changes.html#api-changes-in-2-0-0 I would like to thank everyone who helped on this release in anyway. The people at 2015 scipy BOF where this got started, users who provided feedback and suggestions along the way, the beta-testers, Nathaniel, Stefan and Eric for the new color maps, and all of the documentation and code contributors. Please report any issues to matplotlib-users at python.org (will have to join to post un-moderated) or https://github.com/matplotlib/matplotlib/issues . Tom -------------- next part -------------- An HTML attachment was scrubbed... URL: From jni.soma at gmail.com Wed Jan 18 01:44:44 2017 From: jni.soma at gmail.com (Juan Nunez-Iglesias) Date: Wed, 18 Jan 2017 17:44:44 +1100 Subject: [Matplotlib-users] [Numpy-discussion] [REL] matplotlib v2.0.0 In-Reply-To: References: Message-ID: <4b12144d-d16a-4962-bda1-8ad7c2e7400b@Spark> ???? A momentous occasion!!! =D Thank you for the years of hard work! On 18 Jan 2017, 3:55 AM +1100, Thomas Caswell , wrote: > Folks, > > We are happy to announce the release of (long delayed) matplotlib 2.0! This release completely overhauls the default style of the plots. > > The source tarball and wheels for Mac, Win, and manylinux for python 2.7, 3.4-3.6 are available on pypi > > pip install --upgrade matplotlib > > and conda packages for Mac, Win, linux for python 2.7, 3.4-3.6 are available from conda-forge > > conda install matplotlib -c conda-forge > > > Highlights include: > > - 'viridis' is default color map instead of jet. > - Modernized the default color cycle. > - Many more functions respect the color cycle. > - Line dash patterns scale with linewidth. > - Change default font to DejaVu, now supports most Western alphabets (including Greek, Cyrillic and Latin with diacritics), math symbols and emoji out of the box. > - Faster text rendering. > - Improved auto-limits. > - Ticks out and only on the right and bottom spines by default. > - Improved auto-ticking, particularly for log scales and dates. > - Improved image support (imshow respects scales and eliminated a class of artifacts). > > > For a full list of the default changes (along with how to revert them) please see http://matplotlib.org/users/dflt_style_changes.html and http://matplotlib.org/users/whats_new.html#new-in-matplotlib-2-0. > > There were a number of small API changes documented at > http://matplotlib.org/api/api_changes.html#api-changes-in-2-0-0 > > I would like to thank everyone who helped on this release in anyway. The people at 2015 scipy BOF where this got started, users who provided feedback and suggestions along the way, the beta-testers, Nathaniel, Stefan and Eric for the new color maps, and all of the documentation and code contributors. > > Please report any issues to matplotlib-users at python.org (mailto:matplotlib-users at python.org) (will have to join to post un-moderated) or https://github.com/matplotlib/matplotlib/issues . > > Tom _______________________________________________ > NumPy-Discussion mailing list > NumPy-Discussion at scipy.org > https://mail.scipy.org/mailman/listinfo/numpy-discussion -------------- next part -------------- An HTML attachment was scrubbed... URL: From jslavin at cfa.harvard.edu Thu Jan 19 16:05:53 2017 From: jslavin at cfa.harvard.edu (Slavin, Jonathan) Date: Thu, 19 Jan 2017 16:05:53 -0500 Subject: [Matplotlib-users] default cmap in ver. 2.0 Message-ID: Hi all, I just installed matplotlib 2.0. I was surprised that when I created an image plot using imshow I had the same old jet colormap instead of viridis. I looked in my ~/.confg/matplotlib/matplotlibrc file and the image.cmap line was commented out, so that didn't seem to be the problem. Just to be sure, I moved that one aside and copied the new one under the matplotlib distribution to its place (which also has that line commented out). I still get the same result. Obviously I can fix this either by uncommenting that line or by specifying the cmap in calls to imshow. But I'm curious, where are those defaults stored? Regards, Jon -- ________________________________________________________ Jonathan D. Slavin Harvard-Smithsonian CfA jslavin at cfa.harvard.edu 60 Garden Street, MS 83 phone: (617) 496-7981 Cambridge, MA 02138-1516 cell: (781) 363-0035 USA ________________________________________________________ -------------- next part -------------- An HTML attachment was scrubbed... URL: From ben.v.root at gmail.com Thu Jan 19 16:09:21 2017 From: ben.v.root at gmail.com (Benjamin Root) Date: Thu, 19 Jan 2017 16:09:21 -0500 Subject: [Matplotlib-users] default cmap in ver. 2.0 In-Reply-To: References: Message-ID: in situations like this, the most common reason is that you aren't actually loading the matplotlib you think you are running. I would double-check by doing: import matplotlib print(matplotlib.__version__) Another trick I use is to type: "pydoc matplotlib" and see what it picked up. Ben Root On Thu, Jan 19, 2017 at 4:05 PM, Slavin, Jonathan wrote: > Hi all, > > I just installed matplotlib 2.0. I was surprised that when I created an > image plot using imshow I had the same old jet colormap instead of > viridis. I looked in my ~/.confg/matplotlib/matplotlibrc file and the > image.cmap line was commented out, so that didn't seem to be the problem. > Just to be sure, I moved that one aside and copied the new one under the > matplotlib distribution to its place (which also has that line commented > out). I still get the same result. Obviously I can fix this either by > uncommenting that line or by specifying the cmap in calls to imshow. But > I'm curious, where are those defaults stored? > > Regards, > Jon > > -- > ________________________________________________________ > Jonathan D. Slavin Harvard-Smithsonian CfA > jslavin at cfa.harvard.edu 60 Garden Street, MS 83 > phone: (617) 496-7981 Cambridge, MA 02138-1516 > cell: (781) 363-0035 USA > ________________________________________________________ > > > _______________________________________________ > Matplotlib-users mailing list > Matplotlib-users at python.org > https://mail.python.org/mailman/listinfo/matplotlib-users > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jslavin at cfa.harvard.edu Thu Jan 19 16:19:32 2017 From: jslavin at cfa.harvard.edu (Slavin, Jonathan) Date: Thu, 19 Jan 2017 16:19:32 -0500 Subject: [Matplotlib-users] default cmap in ver. 2.0 In-Reply-To: References: Message-ID: Hi Ben, It's definitely picking up the new matplotlib since many defaults for plotting, e.g. the line color cycle, tick direction, are changed. It's really just the default colormap that's apparently unchanged. Jon On Thu, Jan 19, 2017 at 4:09 PM, Benjamin Root wrote: > in situations like this, the most common reason is that you aren't > actually loading the matplotlib you think you are running. I would > double-check by doing: > > import matplotlib > print(matplotlib.__version__) > > Another trick I use is to type: "pydoc matplotlib" and see what it picked > up. > > Ben Root > > On Thu, Jan 19, 2017 at 4:05 PM, Slavin, Jonathan > wrote: > >> Hi all, >> >> I just installed matplotlib 2.0. I was surprised that when I created an >> image plot using imshow I had the same old jet colormap instead of >> viridis. I looked in my ~/.confg/matplotlib/matplotlibrc file and the >> image.cmap line was commented out, so that didn't seem to be the problem. >> Just to be sure, I moved that one aside and copied the new one under the >> matplotlib distribution to its place (which also has that line commented >> out). I still get the same result. Obviously I can fix this either by >> uncommenting that line or by specifying the cmap in calls to imshow. But >> I'm curious, where are those defaults stored? >> >> Regards, >> Jon >> >> -- >> ________________________________________________________ >> Jonathan D. Slavin Harvard-Smithsonian CfA >> jslavin at cfa.harvard.edu 60 Garden Street, MS 83 >> phone: (617) 496-7981 Cambridge, MA 02138-1516 >> cell: (781) 363-0035 USA >> ________________________________________________________ >> >> >> _______________________________________________ >> Matplotlib-users mailing list >> Matplotlib-users at python.org >> https://mail.python.org/mailman/listinfo/matplotlib-users >> >> > -- ________________________________________________________ Jonathan D. Slavin Harvard-Smithsonian CfA jslavin at cfa.harvard.edu 60 Garden Street, MS 83 phone: (617) 496-7981 Cambridge, MA 02138-1516 cell: (781) 363-0035 USA ________________________________________________________ -------------- next part -------------- An HTML attachment was scrubbed... URL: From ben.v.root at gmail.com Thu Jan 19 16:32:02 2017 From: ben.v.root at gmail.com (Benjamin Root) Date: Thu, 19 Jan 2017 16:32:02 -0500 Subject: [Matplotlib-users] default cmap in ver. 2.0 In-Reply-To: References: Message-ID: Ok, then try this to find out what config file is being used: import matplotlib print(matplotlib.matplotlib_fname()) Ben Root On Thu, Jan 19, 2017 at 4:19 PM, Slavin, Jonathan wrote: > Hi Ben, > > It's definitely picking up the new matplotlib since many defaults for > plotting, e.g. the line color cycle, tick direction, are changed. It's > really just the default colormap that's apparently unchanged. > > Jon > > On Thu, Jan 19, 2017 at 4:09 PM, Benjamin Root > wrote: > >> in situations like this, the most common reason is that you aren't >> actually loading the matplotlib you think you are running. I would >> double-check by doing: >> >> import matplotlib >> print(matplotlib.__version__) >> >> Another trick I use is to type: "pydoc matplotlib" and see what it picked >> up. >> >> Ben Root >> >> On Thu, Jan 19, 2017 at 4:05 PM, Slavin, Jonathan < >> jslavin at cfa.harvard.edu> wrote: >> >>> Hi all, >>> >>> I just installed matplotlib 2.0. I was surprised that when I created an >>> image plot using imshow I had the same old jet colormap instead of >>> viridis. I looked in my ~/.confg/matplotlib/matplotlibrc file and the >>> image.cmap line was commented out, so that didn't seem to be the problem. >>> Just to be sure, I moved that one aside and copied the new one under the >>> matplotlib distribution to its place (which also has that line commented >>> out). I still get the same result. Obviously I can fix this either by >>> uncommenting that line or by specifying the cmap in calls to imshow. But >>> I'm curious, where are those defaults stored? >>> >>> Regards, >>> Jon >>> >>> -- >>> ________________________________________________________ >>> Jonathan D. Slavin Harvard-Smithsonian CfA >>> jslavin at cfa.harvard.edu 60 Garden Street, MS 83 >>> phone: (617) 496-7981 Cambridge, MA 02138-1516 >>> cell: (781) 363-0035 USA >>> ________________________________________________________ >>> >>> >>> _______________________________________________ >>> Matplotlib-users mailing list >>> Matplotlib-users at python.org >>> https://mail.python.org/mailman/listinfo/matplotlib-users >>> >>> >> > > > -- > ________________________________________________________ > Jonathan D. Slavin Harvard-Smithsonian CfA > jslavin at cfa.harvard.edu 60 Garden Street, MS 83 > phone: (617) 496-7981 Cambridge, MA 02138-1516 > cell: (781) 363-0035 USA > ________________________________________________________ > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jslavin at cfa.harvard.edu Thu Jan 19 16:47:34 2017 From: jslavin at cfa.harvard.edu (Slavin, Jonathan) Date: Thu, 19 Jan 2017 16:47:34 -0500 Subject: [Matplotlib-users] default cmap in ver. 2.0 In-Reply-To: References: Message-ID: It's showing ~/.config/matplotlib/matplotlibrc But as I said, the line with image.cmap on it was commented out. So how are the defaults set for things that are not changed by the matplotlibrc? Jon On Thu, Jan 19, 2017 at 4:32 PM, Benjamin Root wrote: > Ok, then try this to find out what config file is being used: > > import matplotlib > print(matplotlib.matplotlib_fname()) > > Ben Root > > > On Thu, Jan 19, 2017 at 4:19 PM, Slavin, Jonathan > wrote: > >> Hi Ben, >> >> It's definitely picking up the new matplotlib since many defaults for >> plotting, e.g. the line color cycle, tick direction, are changed. It's >> really just the default colormap that's apparently unchanged. >> >> Jon >> >> On Thu, Jan 19, 2017 at 4:09 PM, Benjamin Root >> wrote: >> >>> in situations like this, the most common reason is that you aren't >>> actually loading the matplotlib you think you are running. I would >>> double-check by doing: >>> >>> import matplotlib >>> print(matplotlib.__version__) >>> >>> Another trick I use is to type: "pydoc matplotlib" and see what it >>> picked up. >>> >>> Ben Root >>> >>> On Thu, Jan 19, 2017 at 4:05 PM, Slavin, Jonathan < >>> jslavin at cfa.harvard.edu> wrote: >>> >>>> Hi all, >>>> >>>> I just installed matplotlib 2.0. I was surprised that when I created >>>> an image plot using imshow I had the same old jet colormap instead of >>>> viridis. I looked in my ~/.confg/matplotlib/matplotlibrc file and the >>>> image.cmap line was commented out, so that didn't seem to be the problem. >>>> Just to be sure, I moved that one aside and copied the new one under the >>>> matplotlib distribution to its place (which also has that line commented >>>> out). I still get the same result. Obviously I can fix this either by >>>> uncommenting that line or by specifying the cmap in calls to imshow. But >>>> I'm curious, where are those defaults stored? >>>> >>>> Regards, >>>> Jon >>>> >>>> -- >>>> ________________________________________________________ >>>> Jonathan D. Slavin Harvard-Smithsonian CfA >>>> jslavin at cfa.harvard.edu 60 Garden Street, MS 83 >>>> phone: (617) 496-7981 Cambridge, MA 02138-1516 >>>> cell: (781) 363-0035 USA >>>> ________________________________________________________ >>>> >>>> >>>> _______________________________________________ >>>> Matplotlib-users mailing list >>>> Matplotlib-users at python.org >>>> https://mail.python.org/mailman/listinfo/matplotlib-users >>>> >>>> >>> >> >> >> -- >> ________________________________________________________ >> Jonathan D. Slavin Harvard-Smithsonian CfA >> jslavin at cfa.harvard.edu 60 Garden Street, MS 83 >> phone: (617) 496-7981 Cambridge, MA 02138-1516 >> cell: (781) 363-0035 USA >> ________________________________________________________ >> >> > -- ________________________________________________________ Jonathan D. Slavin Harvard-Smithsonian CfA jslavin at cfa.harvard.edu 60 Garden Street, MS 83 phone: (617) 496-7981 Cambridge, MA 02138-1516 cell: (781) 363-0035 USA ________________________________________________________ -------------- next part -------------- An HTML attachment was scrubbed... URL: From rmay31 at gmail.com Thu Jan 19 17:14:09 2017 From: rmay31 at gmail.com (Ryan May) Date: Thu, 19 Jan 2017 15:14:09 -0700 Subject: [Matplotlib-users] default cmap in ver. 2.0 In-Reply-To: References: Message-ID: My next step would be to prove that the config isn't affecting things by moving it elsewhere and seeing what happens. Ryan On Thu, Jan 19, 2017 at 2:47 PM, Slavin, Jonathan wrote: > It's showing ~/.config/matplotlib/matplotlibrc But as I said, the line > with image.cmap on it was commented out. So how are the defaults set for > things that are not changed by the matplotlibrc? > > Jon > > On Thu, Jan 19, 2017 at 4:32 PM, Benjamin Root > wrote: > >> Ok, then try this to find out what config file is being used: >> >> import matplotlib >> print(matplotlib.matplotlib_fname()) >> >> Ben Root >> >> >> On Thu, Jan 19, 2017 at 4:19 PM, Slavin, Jonathan < >> jslavin at cfa.harvard.edu> wrote: >> >>> Hi Ben, >>> >>> It's definitely picking up the new matplotlib since many defaults for >>> plotting, e.g. the line color cycle, tick direction, are changed. It's >>> really just the default colormap that's apparently unchanged. >>> >>> Jon >>> >>> On Thu, Jan 19, 2017 at 4:09 PM, Benjamin Root >>> wrote: >>> >>>> in situations like this, the most common reason is that you aren't >>>> actually loading the matplotlib you think you are running. I would >>>> double-check by doing: >>>> >>>> import matplotlib >>>> print(matplotlib.__version__) >>>> >>>> Another trick I use is to type: "pydoc matplotlib" and see what it >>>> picked up. >>>> >>>> Ben Root >>>> >>>> On Thu, Jan 19, 2017 at 4:05 PM, Slavin, Jonathan < >>>> jslavin at cfa.harvard.edu> wrote: >>>> >>>>> Hi all, >>>>> >>>>> I just installed matplotlib 2.0. I was surprised that when I created >>>>> an image plot using imshow I had the same old jet colormap instead of >>>>> viridis. I looked in my ~/.confg/matplotlib/matplotlibrc file and >>>>> the image.cmap line was commented out, so that didn't seem to be the >>>>> problem. Just to be sure, I moved that one aside and copied the new one >>>>> under the matplotlib distribution to its place (which also has that line >>>>> commented out). I still get the same result. Obviously I can fix this >>>>> either by uncommenting that line or by specifying the cmap in calls to >>>>> imshow. But I'm curious, where are those defaults stored? >>>>> >>>>> Regards, >>>>> Jon >>>>> >>>>> -- >>>>> ________________________________________________________ >>>>> Jonathan D. Slavin Harvard-Smithsonian CfA >>>>> jslavin at cfa.harvard.edu 60 Garden Street, MS 83 >>>>> phone: (617) 496-7981 Cambridge, MA 02138-1516 >>>>> cell: (781) 363-0035 USA >>>>> ________________________________________________________ >>>>> >>>>> >>>>> _______________________________________________ >>>>> Matplotlib-users mailing list >>>>> Matplotlib-users at python.org >>>>> https://mail.python.org/mailman/listinfo/matplotlib-users >>>>> >>>>> >>>> >>> >>> >>> -- >>> ________________________________________________________ >>> Jonathan D. Slavin Harvard-Smithsonian CfA >>> jslavin at cfa.harvard.edu 60 Garden Street, MS 83 >>> phone: (617) 496-7981 Cambridge, MA 02138-1516 >>> cell: (781) 363-0035 USA >>> ________________________________________________________ >>> >>> >> > > > -- > ________________________________________________________ > Jonathan D. Slavin Harvard-Smithsonian CfA > jslavin at cfa.harvard.edu 60 Garden Street, MS 83 > phone: (617) 496-7981 Cambridge, MA 02138-1516 > cell: (781) 363-0035 USA > ________________________________________________________ > > > _______________________________________________ > Matplotlib-users mailing list > Matplotlib-users at python.org > https://mail.python.org/mailman/listinfo/matplotlib-users > > -- Ryan May -------------- next part -------------- An HTML attachment was scrubbed... URL: From ben.v.root at gmail.com Thu Jan 19 17:20:36 2017 From: ben.v.root at gmail.com (Benjamin Root) Date: Thu, 19 Jan 2017 17:20:36 -0500 Subject: [Matplotlib-users] default cmap in ver. 2.0 In-Reply-To: References: Message-ID: well, that would be matplotlib.defaultParams. It is hard-coded. It serves as the base config, and the rc file simply updates that dictionary. Your situation seems very weird. Can you confirm that rc['image.cmap'] is 'viridis'? Ben Root On Thu, Jan 19, 2017 at 4:47 PM, Slavin, Jonathan wrote: > It's showing ~/.config/matplotlib/matplotlibrc But as I said, the line > with image.cmap on it was commented out. So how are the defaults set for > things that are not changed by the matplotlibrc? > > Jon > > On Thu, Jan 19, 2017 at 4:32 PM, Benjamin Root > wrote: > >> Ok, then try this to find out what config file is being used: >> >> import matplotlib >> print(matplotlib.matplotlib_fname()) >> >> Ben Root >> >> >> On Thu, Jan 19, 2017 at 4:19 PM, Slavin, Jonathan < >> jslavin at cfa.harvard.edu> wrote: >> >>> Hi Ben, >>> >>> It's definitely picking up the new matplotlib since many defaults for >>> plotting, e.g. the line color cycle, tick direction, are changed. It's >>> really just the default colormap that's apparently unchanged. >>> >>> Jon >>> >>> On Thu, Jan 19, 2017 at 4:09 PM, Benjamin Root >>> wrote: >>> >>>> in situations like this, the most common reason is that you aren't >>>> actually loading the matplotlib you think you are running. I would >>>> double-check by doing: >>>> >>>> import matplotlib >>>> print(matplotlib.__version__) >>>> >>>> Another trick I use is to type: "pydoc matplotlib" and see what it >>>> picked up. >>>> >>>> Ben Root >>>> >>>> On Thu, Jan 19, 2017 at 4:05 PM, Slavin, Jonathan < >>>> jslavin at cfa.harvard.edu> wrote: >>>> >>>>> Hi all, >>>>> >>>>> I just installed matplotlib 2.0. I was surprised that when I created >>>>> an image plot using imshow I had the same old jet colormap instead of >>>>> viridis. I looked in my ~/.confg/matplotlib/matplotlibrc file and >>>>> the image.cmap line was commented out, so that didn't seem to be the >>>>> problem. Just to be sure, I moved that one aside and copied the new one >>>>> under the matplotlib distribution to its place (which also has that line >>>>> commented out). I still get the same result. Obviously I can fix this >>>>> either by uncommenting that line or by specifying the cmap in calls to >>>>> imshow. But I'm curious, where are those defaults stored? >>>>> >>>>> Regards, >>>>> Jon >>>>> >>>>> -- >>>>> ________________________________________________________ >>>>> Jonathan D. Slavin Harvard-Smithsonian CfA >>>>> jslavin at cfa.harvard.edu 60 Garden Street, MS 83 >>>>> phone: (617) 496-7981 Cambridge, MA 02138-1516 >>>>> cell: (781) 363-0035 USA >>>>> ________________________________________________________ >>>>> >>>>> >>>>> _______________________________________________ >>>>> Matplotlib-users mailing list >>>>> Matplotlib-users at python.org >>>>> https://mail.python.org/mailman/listinfo/matplotlib-users >>>>> >>>>> >>>> >>> >>> >>> -- >>> ________________________________________________________ >>> Jonathan D. Slavin Harvard-Smithsonian CfA >>> jslavin at cfa.harvard.edu 60 Garden Street, MS 83 >>> phone: (617) 496-7981 Cambridge, MA 02138-1516 >>> cell: (781) 363-0035 USA >>> ________________________________________________________ >>> >>> >> > > > -- > ________________________________________________________ > Jonathan D. Slavin Harvard-Smithsonian CfA > jslavin at cfa.harvard.edu 60 Garden Street, MS 83 > phone: (617) 496-7981 Cambridge, MA 02138-1516 > cell: (781) 363-0035 USA > ________________________________________________________ > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From wn.duan at gmail.com Fri Jan 20 08:04:44 2017 From: wn.duan at gmail.com (Weining Duan) Date: Fri, 20 Jan 2017 21:04:44 +0800 Subject: [Matplotlib-users] default cmap in ver. 2.0 In-Reply-To: References: Message-ID: <0a6d7886-0878-4d78-a8de-fa61f71ad9a6@Spark> Hi, I?ve read your talk and decided to make some test case on my computer. Just expecting to offer some more test case and information. As for now, I find everything works fine, including the colormap for `imshow()` function. I?ve checked the rc file, that line is commented out. So its really weird of Jon's situation. I?m using anaconda + matplotlib 2.0 on MacOS. Weining Duan On 2017?1?20? +0800 06:21, Benjamin Root , wrote: > well, that would be matplotlib.defaultParams. It is hard-coded. It serves as the base config, and the rc file simply updates that dictionary. Your situation seems very weird. Can you confirm that rc['image.cmap'] is 'viridis'? > > Ben Root > > > On Thu, Jan 19, 2017 at 4:47 PM, Slavin, Jonathan wrote: > > > It's showing ~/.config/matplotlib/matplotlibrc ?But as I said, the line with image.cmap on it was commented out.? So how are the defaults set for things that are not changed by the matplotlibrc? > > > > > > Jon > > > > > > > On Thu, Jan 19, 2017 at 4:32 PM, Benjamin Root wrote: > > > > > Ok, then try this to find out what config file is being used: > > > > > > > > > > import matplotlib > > > > > print(matplotlib.matplotlib_fname()) > > > > > > > > > > Ben Root > > > > > > > > > > > > > > > > On Thu, Jan 19, 2017 at 4:19 PM, Slavin, Jonathan wrote: > > > > > > > Hi Ben, > > > > > > > > > > > > > > It's definitely picking up the new matplotlib since many defaults for plotting, e.g. the line color cycle, tick direction, are changed.? It's really just the default colormap that's apparently unchanged. > > > > > > > > > > > > > > Jon > > > > > > > > > > > > > > > On Thu, Jan 19, 2017 at 4:09 PM, Benjamin Root wrote: > > > > > > > > > in situations like this, the most common reason is that you aren't actually loading the matplotlib you think you are running. I would double-check by doing: > > > > > > > > > > > > > > > > > > import matplotlib > > > > > > > > > print(matplotlib.__version__) > > > > > > > > > > > > > > > > > > Another trick I use is to type: "pydoc matplotlib" and see what it picked up. > > > > > > > > > > > > > > > > > > Ben Root > > > > > > > > > > > > > > > > > > > On Thu, Jan 19, 2017 at 4:05 PM, Slavin, Jonathan wrote: > > > > > > > > > > > Hi all, > > > > > > > > > > > > > > > > > > > > > > I just installed matplotlib 2.0.? I was surprised that when I created an image plot using imshow I had the same old jet colormap instead of viridis.? I looked in my ~/.confg/matplotlib/matplotlibrc file and the image.cmap line was commented out, so that didn't seem to be the problem.? Just to be sure, I moved that one aside and copied the new one under the matplotlib distribution to its place (which also has that line commented out).? I still get the same result.? Obviously I can fix this either by uncommenting that line or by specifying the cmap in calls to imshow.? But I'm curious, where are those defaults stored? > > > > > > > > > > > > > > > > > > > > > > Regards, > > > > > > > > > > > Jon > > > > > > > > > > > > > > > > > > > > > > -- > > > > > > > > > > > ________________________________________________________ > > > > > > > > > > > Jonathan D. Slavin???????????????? Harvard-Smithsonian CfA > > > > > > > > > > > jslavin at cfa.harvard.edu??? ?? 60 Garden Street, MS 83 > > > > > > > > > > > phone: (617) 496-7981??? ?? Cambridge, MA 02138-1516 > > > > > > > > > > > cell: (781) 363-0035 ? ? ? ? ? ? USA > > > > > > > > > > > ________________________________________________________ > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > _______________________________________________ > > > > > > > > > > > Matplotlib-users mailing list > > > > > > > > > > > Matplotlib-users at python.org > > > > > > > > > > > https://mail.python.org/mailman/listinfo/matplotlib-users > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > -- > > > > > > > ________________________________________________________ > > > > > > > Jonathan D. Slavin???????????????? Harvard-Smithsonian CfA > > > > > > > jslavin at cfa.harvard.edu??? ?? 60 Garden Street, MS 83 > > > > > > > phone: (617) 496-7981??? ?? Cambridge, MA 02138-1516 > > > > > > > cell: (781) 363-0035 ? ? ? ? ? ? USA > > > > > > > ________________________________________________________ > > > > > > > > > > > > > > > > > > > > > > > > -- > > > ________________________________________________________ > > > Jonathan D. Slavin???????????????? Harvard-Smithsonian CfA > > > jslavin at cfa.harvard.edu??? ?? 60 Garden Street, MS 83 > > > phone: (617) 496-7981??? ?? Cambridge, MA 02138-1516 > > > cell: (781) 363-0035 ? ? ? ? ? ? USA > > > ________________________________________________________ > > > > > _______________________________________________ > Matplotlib-users mailing list > Matplotlib-users at python.org > https://mail.python.org/mailman/listinfo/matplotlib-user -------------- next part -------------- An HTML attachment was scrubbed... URL: From jslavin at cfa.harvard.edu Fri Jan 20 08:30:00 2017 From: jslavin at cfa.harvard.edu (Slavin, Jonathan) Date: Fri, 20 Jan 2017 08:30:00 -0500 Subject: [Matplotlib-users] default cmap in ver. 2.0 In-Reply-To: <0a6d7886-0878-4d78-a8de-fa61f71ad9a6@Spark> References: <0a6d7886-0878-4d78-a8de-fa61f71ad9a6@Spark> Message-ID: Not quite sure what happened, but now it appears that the default cmap is viridis. I wonder if there's some sort of cache for the rcparams. In any case in the words of Emily Litella, "never mind"! Jon On Fri, Jan 20, 2017 at 8:04 AM, Weining Duan wrote: > Hi, > > I?ve read your talk and decided to make some test case on my computer. > Just expecting to offer some more test case and information. > > As for now, I find everything works fine, including the colormap for > `imshow()` function. I?ve checked the rc file, that line is commented out. > So its really weird of Jon's situation. > > I?m using anaconda + matplotlib 2.0 on MacOS. > > Weining Duan > > On 2017?1?20? +0800 06:21, Benjamin Root , wrote: > > well, that would be matplotlib.defaultParams. It is hard-coded. It serves > as the base config, and the rc file simply updates that dictionary. Your > situation seems very weird. Can you confirm that rc['image.cmap'] is > 'viridis'? > > Ben Root > > On Thu, Jan 19, 2017 at 4:47 PM, Slavin, Jonathan > wrote: > >> It's showing ~/.config/matplotlib/matplotlibrc But as I said, the line >> with image.cmap on it was commented out. So how are the defaults set for >> things that are not changed by the matplotlibrc? >> >> Jon >> >> On Thu, Jan 19, 2017 at 4:32 PM, Benjamin Root >> wrote: >> >>> Ok, then try this to find out what config file is being used: >>> >>> import matplotlib >>> print(matplotlib.matplotlib_fname()) >>> >>> Ben Root >>> >>> >>> On Thu, Jan 19, 2017 at 4:19 PM, Slavin, Jonathan < >>> jslavin at cfa.harvard.edu> wrote: >>> >>>> Hi Ben, >>>> >>>> It's definitely picking up the new matplotlib since many defaults for >>>> plotting, e.g. the line color cycle, tick direction, are changed. It's >>>> really just the default colormap that's apparently unchanged. >>>> >>>> Jon >>>> >>>> On Thu, Jan 19, 2017 at 4:09 PM, Benjamin Root >>>> wrote: >>>> >>>>> in situations like this, the most common reason is that you aren't >>>>> actually loading the matplotlib you think you are running. I would >>>>> double-check by doing: >>>>> >>>>> import matplotlib >>>>> print(matplotlib.__version__) >>>>> >>>>> Another trick I use is to type: "pydoc matplotlib" and see what it >>>>> picked up. >>>>> >>>>> Ben Root >>>>> >>>>> On Thu, Jan 19, 2017 at 4:05 PM, Slavin, Jonathan < >>>>> jslavin at cfa.harvard.edu> wrote: >>>>> >>>>>> Hi all, >>>>>> >>>>>> I just installed matplotlib 2.0. I was surprised that when I created >>>>>> an image plot using imshow I had the same old jet colormap instead of >>>>>> viridis. I looked in my ~/.confg/matplotlib/matplotlibrc file and >>>>>> the image.cmap line was commented out, so that didn't seem to be the >>>>>> problem. Just to be sure, I moved that one aside and copied the new one >>>>>> under the matplotlib distribution to its place (which also has that line >>>>>> commented out). I still get the same result. Obviously I can fix this >>>>>> either by uncommenting that line or by specifying the cmap in calls to >>>>>> imshow. But I'm curious, where are those defaults stored? >>>>>> >>>>>> Regards, >>>>>> Jon >>>>>> >>>>>> -- >>>>>> ________________________________________________________ >>>>>> Jonathan D. Slavin Harvard-Smithsonian CfA >>>>>> jslavin at cfa.harvard.edu 60 Garden Street, MS 83 >>>>>> phone: (617) 496-7981 Cambridge, MA 02138-1516 >>>>>> cell: (781) 363-0035 USA >>>>>> ________________________________________________________ >>>>>> >>>>>> >>>>>> _______________________________________________ >>>>>> Matplotlib-users mailing list >>>>>> Matplotlib-users at python.org >>>>>> https://mail.python.org/mailman/listinfo/matplotlib-users >>>>>> >>>>>> >>>>> >>>> >>>> >>>> -- >>>> ________________________________________________________ >>>> Jonathan D. Slavin Harvard-Smithsonian CfA >>>> jslavin at cfa.harvard.edu 60 Garden Street, MS 83 >>>> phone: (617) 496-7981 Cambridge, MA 02138-1516 >>>> cell: (781) 363-0035 USA >>>> ________________________________________________________ >>>> >>>> >>> >> >> >> -- >> ________________________________________________________ >> Jonathan D. Slavin Harvard-Smithsonian CfA >> jslavin at cfa.harvard.edu 60 Garden Street, MS 83 >> phone: (617) 496-7981 Cambridge, MA 02138-1516 >> cell: (781) 363-0035 USA >> ________________________________________________________ >> >> > _______________________________________________ > Matplotlib-users mailing list > Matplotlib-users at python.org > https://mail.python.org/mailman/listinfo/matplotlib-user > > -- ________________________________________________________ Jonathan D. Slavin Harvard-Smithsonian CfA jslavin at cfa.harvard.edu 60 Garden Street, MS 83 phone: (617) 496-7981 Cambridge, MA 02138-1516 cell: (781) 363-0035 USA ________________________________________________________ -------------- next part -------------- An HTML attachment was scrubbed... URL: From jmssnyder at ucdavis.edu Tue Jan 24 20:11:34 2017 From: jmssnyder at ucdavis.edu (Jason Snyder) Date: Wed, 25 Jan 2017 01:11:34 +0000 Subject: [Matplotlib-users] plotting multiple plots with string for x label Message-ID: I am trying to plot multiple plots where for the labels of the x axis I use strings. I the below script in which I am attempting to do this. data = np.loadtxt(sys.argv[1], dtype='str',delimiter=',', skiprows=1, usecols=(0,1,2,3,4,5)) x = data[:,0] date = data[:,1] value1 = data[:,2] value2 = data[:,3] my_xticks = data[:,1] plt.xticks(x.astype(float), my_xticks) fig, (ax1,ax2) = plt.subplots(nrows=2) my_xticks = data[:,1] ax1.set_xticks(x.astype(float), my_xticks) ax1=plt.plot(x, value1) plt.tick_params(axis='both',which='major', labelsize=7) plt.title('Value1',fontsize=10) plt.grid() ax2=plt.plot(x, value2) plt.tick_params(axis='both',which='major', labelsize=7) plt.title('Value2',fontsize=10) plt.grid() What can I do to tweak this program to get desired results? -------------- next part -------------- An HTML attachment was scrubbed... URL: From pmhobson at gmail.com Wed Jan 25 01:18:23 2017 From: pmhobson at gmail.com (Paul Hobson) Date: Tue, 24 Jan 2017 22:18:23 -0800 Subject: [Matplotlib-users] plotting multiple plots with string for x label In-Reply-To: References: Message-ID: It's going to be really hard to know what your desired output is without a runnable script. Rather than reading from a file that only you have, it's better to hardcode some representative values for your arrays. It looks like your trying to plot a time series. Matplotlib handles that pretty well without having to resort to using strings: http://matplotlib.org/examples/pylab_examples/date_demo_convert.html On Tue, Jan 24, 2017 at 5:11 PM, Jason Snyder wrote: > > I am trying to plot multiple plots where for the labels of the x axis I > use strings. I the below script in which I am attempting to do this. > > > data = np.loadtxt(sys.argv[1], dtype='str',delimiter=',', > skiprows=1, usecols=(0,1,2,3,4,5)) > x = data[:,0] > date = data[:,1] > value1 = data[:,2] > value2 = data[:,3] > > my_xticks = data[:,1] > plt.xticks(x.astype(float), my_xticks) > > fig, (ax1,ax2) = plt.subplots(nrows=2) > my_xticks = data[:,1] > ax1.set_xticks(x.astype(float), my_xticks) > ax1=plt.plot(x, value1) > plt.tick_params(axis='both',which='major', labelsize=7) > plt.title('Value1',fontsize=10) > plt.grid() > > ax2=plt.plot(x, value2) > plt.tick_params(axis='both',which='major', labelsize=7) > plt.title('Value2',fontsize=10) > plt.grid() > > What can I do to tweak this program to get desired results? > > > _______________________________________________ > Matplotlib-users mailing list > Matplotlib-users at python.org > https://mail.python.org/mailman/listinfo/matplotlib-users > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From tripytrev at hotmail.com Wed Jan 25 02:00:03 2017 From: tripytrev at hotmail.com (Trevor H) Date: Wed, 25 Jan 2017 07:00:03 +0000 Subject: [Matplotlib-users] Python script Graph to webpage Message-ID: Hi all, I am going to attempt to move my current python script (most seen here:http://stackoverflow.com/questions/41697966/python-pie-chart-not-presented-in-order To a web application so every time the page is refreshed the python script will run and display the latest graph & pie chart. Would anyone have any examples I could follow to get some idea of how I could create something like this? Thanks TJ -------------- next part -------------- An HTML attachment was scrubbed... URL: From ljetibo at gmail.com Wed Jan 25 11:17:05 2017 From: ljetibo at gmail.com (=?UTF-8?B?RGlubyBCZWt0ZcWhZXZpxIc=?=) Date: Wed, 25 Jan 2017 17:17:05 +0100 Subject: [Matplotlib-users] Orthogonal projection of 3D point set onto an xy plane Message-ID: Well basically title is what I'm trying to do except I would also like to sum up (integrate) the projected values in bins. In other words it could be described as a 2D heatmap of a 3D point set. In another other words, imagine a normal distribution projected from the z axis to the xy plane. What you see is basically a 2D normal distribution. Moving an azimuthal angle theta (like in spherical coordinates) away from the z axis when you project the same normal distribution what you would get is not the "normal" normal dist but a skewed normal distribution. I thought I can get the same results by rotating the normal distribution, projecting it on xy plane and then doing a heatmap, hexbin, histogram or something similar. Here's the rotation an projection via the contourf method, but I can't reproduce the projections myself. I create an x, y and z as 2D arrays (xy meshgird of coordinates, and z as a Cartesian product of 1D normal dist.). I rotate them by multiplying the rotation matrix with the column vector of every point on the grid just like in basic lin alg. No issues. Rotation matrix is created in the rotation_matrix_weave but for the people that have too modern scipy's/mpl's the rotation_matrix_numpy does the same thing it just takes more time. The points are rotated in the RotateFunc (where the meshgrid and Cartesian product is done too). I plot the rotated normal dist. and use the contourf functions to show the projections on xy and yz planes. The kind of projection that is visible in the xy plane is the one I'd like to get. In all fairness because these are projections of points if you would just rotate an empty xy plane what you would get as a projection back on to the xy plane is a gradient. So I rotate an "empty" plane and subtract it from the rotated normal projection to get rid of the gradient and just keep the skewed gaussian. But this is where all the problems start. I can't figure out how to get that projection. I tried finding where the countourf functions are defined, so I could try to figure out how it does it but couldn't make out the code (it's fairly big) and it doesn't really do what I need it to. Easier approach is to just construct the projections over pcolor or pcolormesh (much faster) as I've added at the bottom of the script. But the online wisdom on how to reconstruct the arrays won't work because pcolormesh/pcolor understands that "indices aren't coordinates". That is to say, pcolormesh doesn't simply just plot rz, but it plots the value rz[i,j] at the coordinates ( rx[i,j], ry[i,j] ) in this new 2D array that is the final image. I've been fishing for help online and in IRC for 2-3 days now and I've been lost for over a week, by this point honestly, whatever works. I've resorted to saving the graph as an image and reading that in with OpenCv. But the problem is they are all "aspected" so from the original (N, N) array you end up with a (1000, 800) image and I really don't like the possibility that the original data can change like that. I mean contourf, pcolor and pcolormesh can do it, there's got to be a way to extract the 2D array or at least some kind of bin-value pairs or something from them. So to reiterate: 1) can someone show me how to get the end graph shown by pcolormesh as an array? 2) if that's not possible is pcolor any different? 3) if it's not, does anyone have insight on how pcolormesh/pcolor can end up drawing the graph correctly and can I get pointers on how to do what they do myself? 4) is there perhaps some other method/function I'm not looking at (i.e hexbin) that can be used to get the result? 5) if that's not possible at all, could it be possible to change from the current representation to i.e. [ [x, y, z]....] of the points and use that to get a histogram/hexbin? Those are the xyz coordinates of points, that is [ [ rx[0,0] , ry[0,0] , rz[0,0] ], ...... [ rx[i,j] , ry[i,j] , rz[i,j] ], ..... [ rx[-1,-1] , ry[-1,-1] , rz[-1,-1] ] ]. 6) am I stupid? Sorry for the long mail, thanks for all the help. import numpy as np import matplotlib.pyplot as plt from mpl_toolkits.mplot3d import Axes3D from scipy import stats from matplotlib import cm from math import cos, sin, sqrt from scipy import weave def rotation_matrix_numpy(axis, theta): mat = np.eye(3,3) axis = axis/sqrt(np.dot(axis, axis)) a = cos(theta/2.) b, c, d = -axis*sin(theta/2.) return np.array([[a*a+b*b-c*c-d*d, 2*(b*c-a*d), 2*(b*d+a*c)], [2*(b*c+a*d), a*a+c*c-b*b-d*d, 2*(c*d-a*b)], [2*(b*d-a*c), 2*(c*d+a*b), a*a+d*d-b*b-c*c]]) def rotation_matrix_weave(theta, axiss, mat = [1., 0., 0., 0., 1., 0., 0., 0., 1.]): support = "#include " code = """ double axis [3] = {axiss[0], axiss[1], axiss[2]}; double x = sqrt(axis[0] * axis[0] + axis[1] * axis[1] + axis[2] * axis[2]); double a = cos(theta / 2.0); double b = -(axis[0] / x) * sin(theta / 2.0); double c = -(axis[1] / x) * sin(theta / 2.0); double d = -(axis[2] / x) * sin(theta / 2.0); mat[0] = a*a + b*b - c*c - d*d; mat[1] = 2 * (b*c - a*d); mat[2] = 2 * (b*d + a*c); mat[3*1 + 0] = 2*(b*c+a*d); mat[3*1 + 1] = a*a+c*c-b*b-d*d; mat[3*1 + 2] = 2*(c*d-a*b); mat[3*2 + 0] = 2*(b*d-a*c); mat[3*2 + 1] = 2*(c*d+a*b); mat[3*2 + 2] = a*a+d*d-b*b-c*c; """ weave.inline(code, arg_names=["mat", "axiss", "theta"], support_code = support) return np.reshape(mat, (3,3)) def RotateFunc(X, Y, Z, theta, axis=[1.0, 0.0, 0.0]): x, y = np.meshgrid(X, Y) z = np.outer(Z, Z) R = rotation_matrix_weave(theta, axis) rx, ry, rz = np.zeros(x.shape), np.zeros(y.shape), np.zeros(z.shape) for i in range(x.shape[0]): for j in range(x.shape[1]): tmpx, tmpy, tmpz = np.matmul(R, [x[i, j], y[i, j], z[i, j]]) rx[i,j]+=tmpx ry[i,j]+=tmpy rz[i,j]+=tmpz return rx, ry, rz ############################################### ### The plot ############################################### fig = plt.figure() ax = fig.add_subplot(111, projection='3d') xmin, xmax = -5, 5 ymin, ymax = -5, 5 theta = 0.3 N = 1000 x = np.linspace(xmin, xmax, N) y = np.linspace(ymin, ymax, N) z = 5.*stats.multivariate_normal().pdf(x) xp = np.linspace(xmin, xmax, N) yp = np.linspace(xmin, xmax, N) zp = np.zeros(x.shape) rx, ry, rz = RotateFunc(x, y, z, theta) rx2, ry2, rz2 = RotateFunc(xp, yp, zp, theta) ax.plot_surface(rx, ry, rz, color='red',alpha=0.65, linewidth=1) #cset = ax.contourf(rx[:500], ry[:500], rz[:500], zdir='x', offset=-4, cmap=cm.coolwarm) cset = ax.contourf(rx, ry-ry2, rz, zdir='y', offset=-4, cmap=cm.coolwarm) cset = ax.contourf(rx, ry, rz-rz2, zdir='z', offset=-4, cmap=cm.coolwarm) plt.show() plt.pcolormesh(rx, ry, rz-rz2) plt.show() plt.pcolormesh(rx, rz, ry-ry2) plt.show() -------------- next part -------------- An HTML attachment was scrubbed... URL: From pmhobson at gmail.com Wed Jan 25 11:38:47 2017 From: pmhobson at gmail.com (Paul Hobson) Date: Wed, 25 Jan 2017 08:38:47 -0800 Subject: [Matplotlib-users] Python script Graph to webpage In-Reply-To: References: Message-ID: TJ, There's an example of embedding matplotlib using the webagg backend in the official documentation here: http://matplotlib.org/examples/user_interfaces/embedding_webagg.html I don't have much experience with it, but I hope it helps. -p On Tue, Jan 24, 2017 at 11:00 PM, Trevor H wrote: > Hi all, > > I am going to attempt to move my current python script (most seen here: > http://stackoverflow.com/questions/41697966/python-pie- > chart-not-presented-in-order > To a web application so every time the page is refreshed the python script > will run and display the latest graph & pie chart. > > Would anyone have any examples I could follow to get some idea of how I > could create something like this? > > Thanks > TJ > > > _______________________________________________ > Matplotlib-users mailing list > Matplotlib-users at python.org > https://mail.python.org/mailman/listinfo/matplotlib-users > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jslavin at cfa.harvard.edu Wed Jan 25 14:06:09 2017 From: jslavin at cfa.harvard.edu (Slavin, Jonathan) Date: Wed, 25 Jan 2017 14:06:09 -0500 Subject: [Matplotlib-users] odd ticking in ImageGrid Message-ID: Hi, Since upgrading to matplotlib 2.0.0 I've found that one of the plots I made before has odd behavior in ticking. Sample code to reproduce the problem is as follows: import matplotlib.pyplot as plt import numpy as np from matplotlib.colors import LogNorm,Normalize from mpl_toolkits.axes_grid1 import ImageGrid fig = plt.figure() grid = ImageGrid(fig, 111, nrows_ncols = (2,2), share_all = True, add_all=True, label_mode = 'L', cbar_mode = 'single') for g in grid: image = (10.**(3.*np.random.rand(100))).reshape((10,10)) im = g.imshow(image, origin='lower', norm=LogNorm(), interpolation='none', extent=(0., 29.9, 0., 29.9), cmap='viridis', vmin=1.,vmax=1.E3) grid.cbar_axes[0].colorbar(im) grid.cbar_axes[0].set_yticks([1.,10.,100.,1.E3]) grid.cbar_axes[0].set_yticklabels([r'$1.0$', r'$10$',r'$10^{2}$', r'$10^{3}$']) plt.show() ?The result I get is shown in the attached image. The issue is the "2 x 10^0" in the lower right. It seems that it's associated with the colorbar, but doing things like grid.cbar_axes[0].set_xticks([]) has no effect. If I don't include the colorbar that annotation doesn't get created. It also seems to be associated with using norm=LogNorm(). In fact if I don't include setting the yticks and yticklabels on the colorbar, I get that "2 x10^0" label and "None" at the upper right. So, this certainly seems like some sort of bug. It doesn't to that using version 1.5. I can submit a bug report if desired. Jon? -- ________________________________________________________ Jonathan D. Slavin Harvard-Smithsonian CfA jslavin at cfa.harvard.edu 60 Garden Street, MS 83 phone: (617) 496-7981 Cambridge, MA 02138-1516 cell: (781) 363-0035 USA ________________________________________________________ -------------- next part -------------- An HTML attachment was scrubbed... URL: From jslavin at cfa.harvard.edu Wed Jan 25 14:13:49 2017 From: jslavin at cfa.harvard.edu (Slavin, Jonathan) Date: Wed, 25 Jan 2017 14:13:49 -0500 Subject: [Matplotlib-users] odd ticking in ImageGrid In-Reply-To: References: Message-ID: Oops. Forgot to attach the image. Here it is. On Wed, Jan 25, 2017 at 2:06 PM, Slavin, Jonathan wrote: > Hi, > > Since upgrading to matplotlib 2.0.0 I've found that one of the plots I > made before has odd behavior in ticking. Sample code to reproduce the > problem is as follows: > > import matplotlib.pyplot as plt > import numpy as np > from matplotlib.colors import LogNorm,Normalize > from mpl_toolkits.axes_grid1 import ImageGrid > > fig = plt.figure() > grid = ImageGrid(fig, 111, nrows_ncols = (2,2), share_all = > True, add_all=True, label_mode = 'L', cbar_mode = 'single') > > for g in grid: > image = (10.**(3.*np.random.rand(100))).reshape((10,10)) > im = g.imshow(image, origin='lower', norm=LogNorm(), > interpolation='none', extent=(0., 29.9, 0., 29.9), > cmap='viridis', vmin=1.,vmax=1.E3) > > grid.cbar_axes[0].colorbar(im) > grid.cbar_axes[0].set_yticks([1.,10.,100.,1.E3]) > grid.cbar_axes[0].set_yticklabels([r'$1.0$', r'$10$',r'$10^{2}$', > r'$10^{3}$']) > > plt.show() > > ?The result I get is shown in the attached image. The issue is the "2 x > 10^0" in the lower right. It seems that it's associated with the colorbar, > but doing things like grid.cbar_axes[0].set_xticks([]) has no effect. If > I don't include the colorbar that annotation doesn't get created. It also > seems to be associated with using norm=LogNorm(). In fact if I don't > include setting the yticks and yticklabels on the colorbar, I get that "2 > x10^0" label and "None" at the upper right. So, this certainly seems like > some sort of bug. It doesn't to that using version 1.5. I can submit a > bug report if desired. > > Jon? > > -- > ________________________________________________________ > Jonathan D. Slavin Harvard-Smithsonian CfA > jslavin at cfa.harvard.edu 60 Garden Street, MS 83 > phone: (617) 496-7981 Cambridge, MA 02138-1516 > cell: (781) 363-0035 USA > ________________________________________________________ > > -- ________________________________________________________ Jonathan D. Slavin Harvard-Smithsonian CfA jslavin at cfa.harvard.edu 60 Garden Street, MS 83 phone: (617) 496-7981 Cambridge, MA 02138-1516 cell: (781) 363-0035 USA ________________________________________________________ -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: prob_demo_mpl2.0.png Type: image/png Size: 17032 bytes Desc: not available URL: From tcaswell at gmail.com Wed Jan 25 14:42:35 2017 From: tcaswell at gmail.com (Thomas Caswell) Date: Wed, 25 Jan 2017 19:42:35 +0000 Subject: [Matplotlib-users] odd ticking in ImageGrid In-Reply-To: References: Message-ID: That is a tick label from the x-axis of the color bar. grid.cbar_axes[0].xaxis.set_major_locator(NullLocator()) grid.cbar_axes[0].xaxis.set_minor_locator(NullLocator()) should fix it. This looks like it is a bug (or two) in axis_grid, can you please create an issue? Using fig.colorbar(im, cax=grid.cbar_axes[0]) to create the colorbar also works (and does not require manually tweaking the ticks on the colorbar). Tom On Wed, Jan 25, 2017 at 2:14 PM Slavin, Jonathan wrote: > Oops. Forgot to attach the image. Here it is. > > On Wed, Jan 25, 2017 at 2:06 PM, Slavin, Jonathan > wrote: > > Hi, > > Since upgrading to matplotlib 2.0.0 I've found that one of the plots I > made before has odd behavior in ticking. Sample code to reproduce the > problem is as follows: > > import matplotlib.pyplot as plt > import numpy as np > from matplotlib.colors import LogNorm,Normalize > from mpl_toolkits.axes_grid1 import ImageGrid > > fig = plt.figure() > grid = ImageGrid(fig, 111, nrows_ncols = (2,2), share_all = > True, add_all=True, label_mode = 'L', cbar_mode = 'single') > > for g in grid: > image = (10.**(3.*np.random.rand(100))).reshape((10,10)) > im = g.imshow(image, origin='lower', norm=LogNorm(), > interpolation='none', extent=(0., 29.9, 0., 29.9), > cmap='viridis', vmin=1.,vmax=1.E3) > > grid.cbar_axes[0].colorbar(im) > grid.cbar_axes[0].set_yticks([1.,10.,100.,1.E3]) > grid.cbar_axes[0].set_yticklabels([r'$1.0$', r'$10$',r'$10^{2}$', > r'$10^{3}$']) > > plt.show() > > ?The result I get is shown in the attached image. The issue is the "2 x > 10^0" in the lower right. It seems that it's associated with the colorbar, > but doing things like grid.cbar_axes[0].set_xticks([]) has no effect. If I > don't include the colorbar that annotation doesn't get created. It also > seems to be associated with using norm=LogNorm(). In fact if I don't > include setting the yticks and yticklabels on the colorbar, I get that "2 > x10^0" label and "None" at the upper right. So, this certainly seems like > some sort of bug. It doesn't to that using version 1.5. I can submit a > bug report if desired. > > Jon? > > -- > ________________________________________________________ > Jonathan D. Slavin Harvard-Smithsonian CfA > jslavin at cfa.harvard.edu 60 Garden Street, MS 83 > phone: (617) 496-7981 Cambridge, MA 02138-1516 > cell: (781) 363-0035 USA > ________________________________________________________ > > > > > -- > ________________________________________________________ > Jonathan D. Slavin Harvard-Smithsonian CfA > jslavin at cfa.harvard.edu 60 Garden Street, MS 83 > phone: (617) 496-7981 Cambridge, MA 02138-1516 > cell: (781) 363-0035 USA > ________________________________________________________ > > _______________________________________________ > Matplotlib-users mailing list > Matplotlib-users at python.org > https://mail.python.org/mailman/listinfo/matplotlib-users > -------------- next part -------------- An HTML attachment was scrubbed... URL: From tcaswell at gmail.com Wed Jan 25 15:17:27 2017 From: tcaswell at gmail.com (Thomas Caswell) Date: Wed, 25 Jan 2017 20:17:27 +0000 Subject: [Matplotlib-users] Python script Graph to webpage In-Reply-To: References: Message-ID: You can also do this via one of the web frame works (ex flask, django,...) and just serve the png. The webbackend will provide an interactive figure. Something like: https://gist.github.com/wilsaj/862153 (py3 version attached). Documenting how to use mpl within the web-frameworks is something that should definitely be in the main docs. Tom On Wed, Jan 25, 2017, 11:39 Paul Hobson wrote: TJ, There's an example of embedding matplotlib using the webagg backend in the official documentation here: http://matplotlib.org/examples/user_interfaces/embedding_webagg.html I don't have much experience with it, but I hope it helps. -p On Tue, Jan 24, 2017 at 11:00 PM, Trevor H wrote: Hi all, I am going to attempt to move my current python script (most seen here: http://stackoverflow.com/questions/41697966/python-pie-chart-not-presented-in-order To a web application so every time the page is refreshed the python script will run and display the latest graph & pie chart. Would anyone have any examples I could follow to get some idea of how I could create something like this? Thanks TJ _______________________________________________ Matplotlib-users mailing list Matplotlib-users at python.org https://mail.python.org/mailman/listinfo/matplotlib-users _______________________________________________ Matplotlib-users mailing list Matplotlib-users at python.org https://mail.python.org/mailman/listinfo/matplotlib-users -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: fa.py Type: text/x-python Size: 942 bytes Desc: not available URL: From kitecamguy at gmail.com Wed Jan 25 17:49:11 2017 From: kitecamguy at gmail.com (Glenn Nelson) Date: Wed, 25 Jan 2017 14:49:11 -0800 Subject: [Matplotlib-users] Python script Graph to webpage In-Reply-To: References: Message-ID: Here's my brief outline of a really basic approach. You will create a simple program, let's call it *myplot.py*. import sys import matplotlib matplotlib.use('Agg') # backend that is used for web graphics import matplotlib.pyplot as plt # create your plot here, using 'plt' print 'Content-Type: image/png\n' plt.savefig( sys.stdout, format='png' ) And then in your web page, you have HTML IMG tag with *SRC="<**website* *>/myplot.py"* That's all there is to it. When I first got into this, I don't think the suggested *webagg *backend was available to me. Web browsers will normally cache the image, so you probably want to set expiration headers, either Cache-Control or Expires. Another way to force browser to make a new request is to add a parameter with random value: *SRC="<**website**>/myplot.py?x=<**random number**>"* This would be especially helpful in testing, because the browser would never think it had already cached the image (unless the random number repeats). ---- Glenn Nelson in Santa Cruz social: http://google.com/+GlennNelson see my Kite Aerial Photos at http://www.glenn-nelson.us/kap On Tue, Jan 24, 2017 at 11:00 PM, Trevor H wrote: > Hi all, > > I am going to attempt to move my current python script (most seen here: > http://stackoverflow.com/questions/41697966/python-pie- > chart-not-presented-in-order > To a web application so every time the page is refreshed the python script > will run and display the latest graph & pie chart. > > Would anyone have any examples I could follow to get some idea of how I > could create something like this? > > Thanks > TJ > > > _______________________________________________ > Matplotlib-users mailing list > Matplotlib-users at python.org > https://mail.python.org/mailman/listinfo/matplotlib-users > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From solisgb at gmail.com Wed Jan 4 07:24:32 2017 From: solisgb at gmail.com (solisgbmpl) Date: Wed, 04 Jan 2017 12:24:32 -0000 Subject: [Matplotlib-users] Formating unexpected number when autoscaling Y axis Message-ID: <1483531550984-47684.post@n5.nabble.com> I'm using matplotlib to get a large amount of plots saved as png files. In some of them the Y axis autoscales in a different way and a new origin of the Y axis appears in the top left corner of the frame (2.163e2 in the image attached) I don't know how I can have a reference to this number to change the fontsize and even their position. -- View this message in context: http://matplotlib.1069221.n5.nabble.com/Formating-unexpected-number-when-autoscaling-Y-axis-tp47684.html Sent from the matplotlib - users mailing list archive at Nabble.com. From annix at uw.edu Thu Jan 5 03:40:26 2017 From: annix at uw.edu (A397nn) Date: Thu, 05 Jan 2017 08:40:26 -0000 Subject: [Matplotlib-users] problem using Linecollection Message-ID: <1483605619242-47687.post@n5.nabble.com> I'm simply trying to draw a couple of lines using line collection, not sure why it doesn't work import matplotlib.pyplot as plt from matplotlib import collections as mc import numpy as np import pylab as pl segments = [ [(1,2),(3,4)], [(5,6),(7,8)] ] lc = mc.LineCollection(segments, linestyles='solid', pickradius=5, zorder=2) fig, ax = pl.subplots() ax.add_collection(lc) ax.autoscale() -- View this message in context: http://matplotlib.1069221.n5.nabble.com/problem-using-Linecollection-tp47687.html Sent from the matplotlib - users mailing list archive at Nabble.com. From davidparks21 at gmail.com Fri Jan 6 20:31:18 2017 From: davidparks21 at gmail.com (davidparks21) Date: Sat, 07 Jan 2017 01:31:18 -0000 Subject: [Matplotlib-users] segfault in _backend_agg.so Message-ID: <1483752677105-47691.post@n5.nabble.com> I've been using matplotlib with the AGG backend to generate ~10,000 plot files using PdfPages. I run this over 30 cores using python multiprocessing. This worked until a recent change.If I run with 30 cores I have a memory issue after my recent updates (60GB of ram is exhausted and I see thrashing). If I cut that down to 24 cores I do not run into a memory issue (~45GB max usage), but I produce the segfault below at exactly 997 plots generated. I can get to about 1500 plots if I cut that down to 6 cores, and with 1 core I got that to ~3500 plots before I manually stopped it for lack of patience.There doesn't seem to be a specific problem with any one plot, but I encounter the segfault seen below at a seemingly reproducible point depending on how many cores I run on (the more cores the sooner I encounter the issue). Memory issues seem like a likely culprit.*I recently added these constructs to my script:* inset_axes(...) # and some plots using the inset_axes, I use this within subplot ax.twiny() # to plot xticks along the top and bottom*The dmesg error seen in CentOS:*[1387989.122585] python[24780]: segfault at 7f34a7233bd0 ip 00007f3739fa8ec3 sp 00007ffedcb0aad0 error 6 in _backend_agg.so[7f3739f97000+5a000]I'm also generating the following warning that seems to be benign:/soe/davidparks21/anaconda2/lib/python2.7/site-packages/matplotlib/figure.py:1742: UserWarning: This figure includes Axes that are not compatible with tight_layout, so its results might be incorrect. warnings.warn("This figure includes Axes that are not " -- View this message in context: http://matplotlib.1069221.n5.nabble.com/segfault-in-backend-agg-so-tp47691.html Sent from the matplotlib - users mailing list archive at Nabble.com. -------------- next part -------------- An HTML attachment was scrubbed... URL: From davidparks21 at gmail.com Sun Jan 8 00:24:57 2017 From: davidparks21 at gmail.com (davidparks21) Date: Sun, 08 Jan 2017 05:24:57 -0000 Subject: [Matplotlib-users] segfault in _backend_agg.so In-Reply-To: <1483752677105-47691.post@n5.nabble.com> References: <1483752677105-47691.post@n5.nabble.com> Message-ID: <1483852111575-47707.post@n5.nabble.com> Problem solved. On plt.subplots I had dpi=900. Removing this resolved the problem. This line causes the segfault fig, ax = plt.subplots(n_plots_offset, figsize=(20,3.75), sharex=False, dpi=900) This line does not: fig, ax = plt.subplots(n_plots_offset, figsize=(20,3.75), sharex=False) -- View this message in context: http://matplotlib.1069221.n5.nabble.com/segfault-in-backend-agg-so-tp47691p47707.html Sent from the matplotlib - users mailing list archive at Nabble.com. From tcaswell at gmail.com Sat Jan 28 11:29:20 2017 From: tcaswell at gmail.com (Thomas Caswell) Date: Sat, 28 Jan 2017 16:29:20 +0000 Subject: [Matplotlib-users] How to apply ax.margins to current axes limits? In-Reply-To: References: Message-ID: The margins are only used when Matplotlib auto-selects the limits for you. Once you have used `set_xlim` or `set_ylim` we take those as explicit user-intent and will not automatically change the limits again. Tom On Sat, Jan 28, 2017 at 11:00 AM Jack Yu wrote: > Is there a way to use ax.margins to adjust the axes limits, after the > axes limits have already been adjusted using ax.set_ylim? It appears that > ax.margins has effect only if ax.set_ylim has not been used. > > This notebook > > http://nbviewer.jupyter.org/github/qap/python_examples/blob/matplotlib/matplotlib/matplotlib_axmargins.ipynb > > describes a situation in which this need may arise. > > Note: the y-axis is just an example, the same also applies to the x-axis ( > ax.set_xlim). > _______________________________________________ > Matplotlib-users mailing list > Matplotlib-users at python.org > https://mail.python.org/mailman/listinfo/matplotlib-users > -------------- next part -------------- An HTML attachment was scrubbed... URL: From tcaswell at gmail.com Sat Jan 28 11:33:14 2017 From: tcaswell at gmail.com (Thomas Caswell) Date: Sat, 28 Jan 2017 16:33:14 +0000 Subject: [Matplotlib-users] problem using Linecollection In-Reply-To: <1483605619242-47687.post@n5.nabble.com> References: <1483605619242-47687.post@n5.nabble.com> Message-ID: Anni, Please subscribe to the list so that your emails will post un-moderated ( https://mail.python.org/mailman/listinfo/matplotlib-users) What is not working? import matplotlib.pyplot as plt from matplotlib import collections as mc import numpy as np segments = [ [(1,2),(3,4)], [(5,6),(7,8)] ] lc = mc.LineCollection(segments, linestyles='solid', pickradius=5, zorder=2) fig, ax = pl.subplots() ax.add_collection(lc) ax.autoscale() plt.show() # added this line to get window fig.save('so.png') # to save as png gives me the attached figure. [image: so.png]Tom On Sat, Jan 28, 2017 at 10:59 AM A397nn wrote: > I'm simply trying to draw a couple of lines using line collection, not sure > why it doesn't work > > import matplotlib.pyplot as plt > from matplotlib import collections as mc > import numpy as np > import pylab as pl > > segments = [ [(1,2),(3,4)], > [(5,6),(7,8)] ] > lc = mc.LineCollection(segments, linestyles='solid', pickradius=5, > zorder=2) > fig, ax = pl.subplots() > > ax.add_collection(lc) > ax.autoscale() > > > > > -- > View this message in context: > http://matplotlib.1069221.n5.nabble.com/problem-using-Linecollection-tp47687.html > Sent from the matplotlib - users mailing list archive at Nabble.com. > _______________________________________________ > Matplotlib-users mailing list > Matplotlib-users at python.org > https://mail.python.org/mailman/listinfo/matplotlib-users > -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: so.png Type: image/png Size: 12772 bytes Desc: not available URL: From tcaswell at gmail.com Sat Jan 28 11:42:25 2017 From: tcaswell at gmail.com (Thomas Caswell) Date: Sat, 28 Jan 2017 16:42:25 +0000 Subject: [Matplotlib-users] Formating unexpected number when autoscaling Y axis In-Reply-To: <1483531550984-47684.post@n5.nabble.com> References: <1483531550984-47684.post@n5.nabble.com> Message-ID: Please subscribe to the mailing list so you can post un-moderated ( https://mail.python.org/mailman/listinfo/matplotlib-users) The default formatter identifies when the data is over a small range on a large base and formats the ticks with an offset, see http://matplotlib.org/api/ticker_api.html#default-formatter The location is set by the internals of `Axis`, a quick glance at the code suggests that manually tweaking the location may not be reliable. You can get a reference to the text object via the `get_offset_text` method on the `ax.xaxis` or `ax.yaxis` instances ( http://matplotlib.org/api/_as_gen/matplotlib.axis.Axis.get_offset_text.html#matplotlib.axis.Axis.get_offset_text) to tweak the font properties. Tom On Sat, Jan 28, 2017 at 10:59 AM solisgbmpl wrote: > I'm using matplotlib to get a large amount of plots saved as png files. In > some of them the Y axis autoscales in a different way and a new origin of > the Y axis appears in the top left corner of the frame (2.163e2 in the > image > attached) > > I don't know how I can have a reference to this number to change the > fontsize and even their position. > < > http://matplotlib.1069221.n5.nabble.com/file/n47684/040_Sierra_Espu%C3%B1a_263660009.png > > > > > > -- > View this message in context: > http://matplotlib.1069221.n5.nabble.com/Formating-unexpected-number-when-autoscaling-Y-axis-tp47684.html > Sent from the matplotlib - users mailing list archive at Nabble.com. > _______________________________________________ > Matplotlib-users mailing list > Matplotlib-users at python.org > https://mail.python.org/mailman/listinfo/matplotlib-users > -------------- next part -------------- An HTML attachment was scrubbed... URL: From tcaswell at gmail.com Sat Jan 28 11:45:11 2017 From: tcaswell at gmail.com (Thomas Caswell) Date: Sat, 28 Jan 2017 16:45:11 +0000 Subject: [Matplotlib-users] Plotting boundaries of segmented data In-Reply-To: <1481129994931-47655.post@n5.nabble.com> References: <1481129994931-47655.post@n5.nabble.com> Message-ID: Please subscribe to the mailing list so you can post un-moderated ( https://mail.python.org/mailman/listinfo/matplotlib-users ) I think you are looking for the contour family of methods, see http://matplotlib.org/examples/pylab_examples/contour_demo.html Tom On Sat, Jan 28, 2017 at 10:58 AM rwleo wrote: > Hello, > > I am trying to plot a 2-D array with segmentation data from a fluid flow. > The data structure is continuous which means that the segments are > connected > regions, like in the picture below: > > I use > plt.imshow(seg, cmap="Greys") > which returns a black area on a white background. What I would like to > achieve instead is to plot only the boundary as a black curve, like when > plotting a shape with pylab setting edgecolor=black and facecolor=white. > Unfortunately, having the data in matrix format I am not sure whether this > can easily be achieved without writing a separate function that detects > whether a pixel belongs to the border or the interior. Is there an > alternative to the imshow function which does this simply by setting some > keywords? > > Secondly I would like to smoothen the boundary curve which looks quite > "rectangular" due to the coarse segmentation algorithm that has been > applied > to the fluid flow data. Can this be done with interp2d, if the segments are > not based on an analytical expression? > > Many thanks in advance! > > > > -- > View this message in context: > http://matplotlib.1069221.n5.nabble.com/Plotting-boundaries-of-segmented-data-tp47655.html > Sent from the matplotlib - users mailing list archive at Nabble.com. > _______________________________________________ > Matplotlib-users mailing list > Matplotlib-users at python.org > https://mail.python.org/mailman/listinfo/matplotlib-users > -------------- next part -------------- An HTML attachment was scrubbed... URL: From tcaswell at gmail.com Sat Jan 28 11:49:11 2017 From: tcaswell at gmail.com (Thomas Caswell) Date: Sat, 28 Jan 2017 16:49:11 +0000 Subject: [Matplotlib-users] How to increase space between labels ( x or Y) In-Reply-To: <1479448985635-47626.post@n5.nabble.com> References: <1479448985635-47626.post@n5.nabble.com> Message-ID: Iara, Please subscribe to the mailing list so you can post un-moderated ( https://mail.python.org/mailman/listinfo/matplotlib-users ). I think your options are to make the font smaller or to make the figure bigger. See the discussion in gitter around https://gitter.im/matplotlib/matplotlib?at=5887cf54e836bf701088dbf3 for what I think is the same issue. Tom On Sat, Jan 28, 2017 at 10:57 AM lara wrote: > My y labels are variables ( eg. name1, nam2, nam3,...) > How to increase space between name1 and name2 in yaxis since name1 and > name2 > are overlaping with each other > > note I have already 25 labels so assigned each 1 space for 25 variables in > the yaxis , I dont want to alter anyting in the scale but want to make more > space between labels so it wont overlap > > thanks in advance > > > > -- > View this message in context: > http://matplotlib.1069221.n5.nabble.com/How-to-increase-space-between-labels-x-or-Y-tp47626.html > Sent from the matplotlib - users mailing list archive at Nabble.com. > _______________________________________________ > Matplotlib-users mailing list > Matplotlib-users at python.org > https://mail.python.org/mailman/listinfo/matplotlib-users > -------------- next part -------------- An HTML attachment was scrubbed... URL: From tcaswell at gmail.com Sat Jan 28 11:53:02 2017 From: tcaswell at gmail.com (Thomas Caswell) Date: Sat, 28 Jan 2017 16:53:02 +0000 Subject: [Matplotlib-users] ImportError: cannot import name '_tkagg' In-Reply-To: <1478729595515-47619.post@n5.nabble.com> References: <1478729595515-47619.post@n5.nabble.com> Message-ID: James, Please subscribe to the mailing list so you can post un-moderated ( https://mail.python.org/mailman/listinfo/matplotlib-users ). What version of Matplotlib are you using and how did you install it? If you built Matplotlib from source (prior to 1.5.3), we would only build the `_tkagg` extension if we could find the tinker libraries and headers at build time. I suspect re-building Matplotlib will fix your problem. Tom On Sat, Jan 28, 2017 at 10:57 AM jcb0026 wrote: > Greetings, > I'm trying to run a Python script that uses tkinter to create a GUI and > matplotlib to display a graph onto the GUI. Our System Administrators > installed Python 3.5, tkinter, and matplotlib onto a Redhat Linux 7.2 > machine. Within the code of our script, to import all necessary matplotlib > functions and modules, we call: > > from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg, > NavigationToolbar2TkAgg > from matplotlib.figure import Figure > import matplotlib > matplotlib.use('TkAgg') > > However, when the script is ran, this is the result: > > File "ourScript.py", line 17, in > from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg, > NavigationToolbar2TkAgg > File > > "/opt/rh/rh-python35/root/usr/lib64/python3.5/site-packages/matplotlib/backends/backend_tkagg.py", > line 11, in > import matplotlib.backends.tkagg as tkagg > File > > "/opt/rh/rh-python35/root/usr/lib64/python3.5/site-packages/matplotlib/backends/tkagg.py", > line 2, in > from matplotlib.backends import _tkagg > ImportError: cannot import name '_tkagg' > > After doing some research, it seems that this could be due to matplotlib > being installed before tkinter. Is this likely the case? > > Thanks, > James > > > > > > > > > > > -- > View this message in context: > http://matplotlib.1069221.n5.nabble.com/ImportError-cannot-import-name-tkagg-tp47619.html > Sent from the matplotlib - users mailing list archive at Nabble.com. > _______________________________________________ > Matplotlib-users mailing list > Matplotlib-users at python.org > https://mail.python.org/mailman/listinfo/matplotlib-users > -------------- next part -------------- An HTML attachment was scrubbed... URL: From tcaswell at gmail.com Sat Jan 28 14:38:48 2017 From: tcaswell at gmail.com (Thomas Caswell) Date: Sat, 28 Jan 2017 19:38:48 +0000 Subject: [Matplotlib-users] Plotting boundaries of segmented data In-Reply-To: References: <1481129994931-47655.post@n5.nabble.com> Message-ID: You might also be interested in http://scikit-image.org/docs/dev/auto_examples/edges/plot_contours.html which may be more efficient at finding the edge. Tom On Sat, Jan 28, 2017 at 2:36 PM Peter Leitner wrote: > Indeed, plotting a single contour of binary data is an option I have not > considered yet. Thank you for the suggestion! For the time being I solved > the issue by looping through the arrays marking only boundary cells and > displaying the boundary as a scatter plot which worked quite well, but I > will revisit your suggestion to effortlessly display the boundary as a > contour. Many thanks again! > > Peter > > On 01/28/2017 05:45 PM, Thomas Caswell wrote: > > Please subscribe to the mailing list so you can post un-moderated ( > https://mail.python.org/mailman/listinfo/matplotlib-users ) > > I think you are looking for the contour family of methods, see > http://matplotlib.org/examples/pylab_examples/contour_demo.html > > Tom > > On Sat, Jan 28, 2017 at 10:58 AM rwleo wrote: > > Hello, > > I am trying to plot a 2-D array with segmentation data from a fluid flow. > The data structure is continuous which means that the segments are > connected > regions, like in the picture below: > > I use > plt.imshow(seg, cmap="Greys") > which returns a black area on a white background. What I would like to > achieve instead is to plot only the boundary as a black curve, like when > plotting a shape with pylab setting edgecolor=black and facecolor=white. > Unfortunately, having the data in matrix format I am not sure whether this > can easily be achieved without writing a separate function that detects > whether a pixel belongs to the border or the interior. Is there an > alternative to the imshow function which does this simply by setting some > keywords? > > Secondly I would like to smoothen the boundary curve which looks quite > "rectangular" due to the coarse segmentation algorithm that has been > applied > to the fluid flow data. Can this be done with interp2d, if the segments are > not based on an analytical expression? > > Many thanks in advance! > > > > -- > View this message in context: > http://matplotlib.1069221.n5.nabble.com/Plotting-boundaries-of-segmented-data-tp47655.html > Sent from the matplotlib - users mailing list archive at Nabble.com. > _______________________________________________ > Matplotlib-users mailing list > Matplotlib-users at python.org > https://mail.python.org/mailman/listinfo/matplotlib-users > > > -- > Dr. Peter Leitner > Institute of Physics, University of Graz > Universit?tsplatz 5, 8010 Graz Austria > > Mobile: +43-316-699-17-115-726 > Skype: live:p.leitner_7 > Mail: peter.leitner at alumni.uni-graz.at > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From pmhobson at gmail.com Sat Jan 28 20:46:04 2017 From: pmhobson at gmail.com (Paul Hobson) Date: Sat, 28 Jan 2017 17:46:04 -0800 Subject: [Matplotlib-users] Version issue In-Reply-To: References: Message-ID: perhaps `pip3 install matplotlib` ? On Mon, Oct 31, 2016 at 5:58 AM, Rohan Bhojannawar wrote: > I'm using OpenCV with Ubuntu 16.04 > My matplotlib is installed only in python 2.7. What do you suggest I do > for me to use the same library with another version of python viz. python > 3.5 installed in my system ? > > My .py files run if properly using matplotlib if I type python2.7 instead > of python3 in terminal. Kindly suggest. > > _______________________________________________ > Matplotlib-users mailing list > Matplotlib-users at python.org > https://mail.python.org/mailman/listinfo/matplotlib-users > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From kitecamguy at gmail.com Sun Jan 29 13:25:35 2017 From: kitecamguy at gmail.com (Glenn Nelson) Date: Sun, 29 Jan 2017 10:25:35 -0800 Subject: [Matplotlib-users] From Python to Numpy In-Reply-To: References: Message-ID: I spent some time reading your book and give it 4 out of 4 stars! I use numpy often in my work, but have not delved into it enough to understand it at the level that you present. I will definitely spend more time with your book and I expect it will alter the way I use numpy. Your English is excellent, too. Thank you for sharing this. ---- Glenn Nelson in Santa Cruz social: http://google.com/+GlennNelson see my Kite Aerial Photos at http://www.glenn-nelson.us/kap On Thu, Dec 22, 2016 at 8:44 AM, Nicolas P. Rougier < Nicolas.Rougier at inria.fr> wrote: > > Dear all, > > I've just put online a (kind of) book on Numpy and more specifically about > vectorization methods. It's not yet finished, has not been reviewed and > it's a bit rough around the edges. But I think there are some material that > can be interesting. I'm specifically happy with the boids example that show > a nice combination of numpy and matplotlib strengths. > > Book is online at: http://www.labri.fr/perso/ > nrougier/from-python-to-numpy/ > Sources are available at: https://github.com/rougier/from-python-to-numpy > > > Comments/questions/fixes/ideas are of course welcome. > > > Nicolas > _______________________________________________ > Matplotlib-users mailing list > Matplotlib-users at python.org > https://mail.python.org/mailman/listinfo/matplotlib-users > -------------- next part -------------- An HTML attachment was scrubbed... URL: From Nicolas.Rougier at inria.fr Sun Jan 29 13:27:18 2017 From: Nicolas.Rougier at inria.fr (Nicolas P. Rougier) Date: Sun, 29 Jan 2017 19:27:18 +0100 Subject: [Matplotlib-users] From Python to Numpy In-Reply-To: References: Message-ID: > On 29 Jan 2017, at 19:25, Glenn Nelson wrote: > > I spent some time reading your book and give it 4 out of 4 stars! I use numpy often in my work, but have not delved into it enough to understand it at the level that you present. I will definitely spend more time with your book and I expect it will alter the way I use numpy. Thank you. > Your English is excellent, too. Oh many thanks. Didn't expect this one :) Nicolas > > Thank you for sharing this. > > ---- > Glenn Nelson in Santa Cruz > social: http://google.com/+GlennNelson > see my Kite Aerial Photos at http://www.glenn-nelson.us/kap > > On Thu, Dec 22, 2016 at 8:44 AM, Nicolas P. Rougier wrote: > > Dear all, > > I've just put online a (kind of) book on Numpy and more specifically about vectorization methods. It's not yet finished, has not been reviewed and it's a bit rough around the edges. But I think there are some material that can be interesting. I'm specifically happy with the boids example that show a nice combination of numpy and matplotlib strengths. > > Book is online at: http://www.labri.fr/perso/nrougier/from-python-to-numpy/ > Sources are available at: https://github.com/rougier/from-python-to-numpy > > > Comments/questions/fixes/ideas are of course welcome. > > > Nicolas > _______________________________________________ > Matplotlib-users mailing list > Matplotlib-users at python.org > https://mail.python.org/mailman/listinfo/matplotlib-users > From mailinglists at xgm.de Mon Jan 30 05:06:31 2017 From: mailinglists at xgm.de (Florian Lindner) Date: Mon, 30 Jan 2017 11:06:31 +0100 Subject: [Matplotlib-users] Share second y-axis Message-ID: Hello, I create a 2x2 grid of subplots: f, sp = plt.subplots(2, 2, sharex='col', sharey='row') sp_lin = [ sp[0][0], sp[0][1], sp[1][0], sp[1][1] ] with two y-axis each ax1 = sp_lin[i] ax1.semilogy(...) ax1.set_ylabel("RMSE") ax2 = ax1.twinx() ax2.semilogy(...) ax2.set_ylabel("Condition") ax1.set_xlabel("m") The x-axis (m) is shared just nicely, as well as the first y-axis (RMSE). But the second y-axis (Condition) is not shared. How can I make it being shared as well? 1 2 3 4 Only plots 1 and 3 have the RMSE axis on their left. I want that only plots 2 and 4 have the Condition axis on the right. Thanks! Florian From jfoxrabinovitz at gmail.com Mon Jan 30 10:05:57 2017 From: jfoxrabinovitz at gmail.com (Joseph Fox-Rabinovitz) Date: Mon, 30 Jan 2017 10:05:57 -0500 Subject: [Matplotlib-users] Share second y-axis In-Reply-To: References: Message-ID: Florian, twinx restricts the parameters you can pass to the Axes constructor in return for setting up the new axis properly. If you are willing to execute most of that setup code "manually", you can replace `ax2 = ax1.twinx()` with the following, keeping everything else the same: ax2 = f.add_axes(ax1.get_position(True), sharex=ax1, sharey=ax4) ax2.yaxis.tick_right() ax2.yaxis.set_label_position('right') ax2.yaxis.set_offset_position('right') ax2.set_autoscalex_on(ax1.get_autoscalex_on()) ax1.yaxis.tick_left() ax2.xaxis.set_visible(False) ax2.patch.set_visible(False) This code is basically a copy of `Axes.twinx` with the modifications you wanted. You may not actually need all of the setup steps. I have not tested this code, but it should at least start you in the right direction. -Joe On Mon, Jan 30, 2017 at 5:06 AM, Florian Lindner wrote: > Hello, > > I create a 2x2 grid of subplots: > > f, sp = plt.subplots(2, 2, sharex='col', sharey='row') > sp_lin = [ sp[0][0], sp[0][1], sp[1][0], sp[1][1] ] > > with two y-axis each > > ax1 = sp_lin[i] > ax1.semilogy(...) > ax1.set_ylabel("RMSE") > > ax2 = ax1.twinx() > ax2.semilogy(...) > ax2.set_ylabel("Condition") > > ax1.set_xlabel("m") > > > The x-axis (m) is shared just nicely, as well as the first y-axis (RMSE). > But the second y-axis (Condition) is not shared. > > How can I make it being shared as well? > > 1 2 > 3 4 > > Only plots 1 and 3 have the RMSE axis on their left. I want that only > plots 2 and 4 have the Condition axis on the right. > > Thanks! > Florian > > _______________________________________________ > Matplotlib-users mailing list > Matplotlib-users at python.org > https://mail.python.org/mailman/listinfo/matplotlib-users > -------------- next part -------------- An HTML attachment was scrubbed... URL: From ben.v.root at gmail.com Mon Jan 30 11:50:19 2017 From: ben.v.root at gmail.com (Benjamin Root) Date: Mon, 30 Jan 2017 11:50:19 -0500 Subject: [Matplotlib-users] Stacked 2D plots with interconnections in Matplotlib In-Reply-To: References: Message-ID: Perhaps glueviz (built on top of matplotlib) might be a step in the right direction for you? http:/./glueviz.org Don't know if it'll do the 3d aspect that you are looking for, but it does provide a lot of good interactivity tools for examining interconnections in multidimensional data. Cheers! Ben Root On Sun, Dec 18, 2016 at 9:40 AM, Maurizio De Pitt? < mauriziodepitta at gmail.com> wrote: > Fedora 20; Python 2.7.5; Matplotlib 1.4.3 (installed by yum/pip) > > I need to visualize some complex multivariate datasets and the preferred > way is to use a modification of parallel axis visualization, using stacked > 2D plots, where each plot maps a degree of freedom/model parameter and data > points belonging to the same data sets should be interconnected across > different plots. I am attaching a conceptual sketch. > > I put emphasis that each plane should be a plot itself with its own axes > with their own scales. More specifically, all plots have the same x-axis, > but the y-axis represents something different. > Any idea of how to implement it by matplotlib? > > Cheers, > > M > > _______________________________________________ > Matplotlib-users mailing list > Matplotlib-users at python.org > https://mail.python.org/mailman/listinfo/matplotlib-users > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From joy.merwin at gmail.com Mon Jan 30 11:52:14 2017 From: joy.merwin at gmail.com (Joy merwin monteiro) Date: Mon, 30 Jan 2017 17:52:14 +0100 Subject: [Matplotlib-users] From Python to Numpy In-Reply-To: References: Message-ID: Hello Nicolas, the following code snippet from your game of life section birth = (N==3) & (Z[1:-1,1:-1]==0)survive = ((N==2) | (N==3)) & (Z[1:-1,1:-1]==1)Z[...] = 0Z[1:-1,1:-1][birth | survive] = 1 is incorrect. You need to add a [1:-1,1:-1] to both the places where you are comparing N to a number to ensure the shapes are correct. Joy On Sun, Jan 29, 2017 at 7:27 PM, Nicolas P. Rougier < Nicolas.Rougier at inria.fr> wrote: > > > On 29 Jan 2017, at 19:25, Glenn Nelson wrote: > > > > I spent some time reading your book and give it 4 out of 4 stars! I use > numpy often in my work, but have not delved into it enough to understand it > at the level that you present. I will definitely spend more time with your > book and I expect it will alter the way I use numpy. > > Thank you. > > > Your English is excellent, too. > > Oh many thanks. Didn't expect this one :) > > Nicolas > > > > > Thank you for sharing this. > > > > ---- > > Glenn Nelson in Santa Cruz > > social: http://google.com/+GlennNelson > > see my Kite Aerial Photos at http://www.glenn-nelson.us/kap > > > > On Thu, Dec 22, 2016 at 8:44 AM, Nicolas P. Rougier < > Nicolas.Rougier at inria.fr> wrote: > > > > Dear all, > > > > I've just put online a (kind of) book on Numpy and more specifically > about vectorization methods. It's not yet finished, has not been reviewed > and it's a bit rough around the edges. But I think there are some material > that can be interesting. I'm specifically happy with the boids example that > show a nice combination of numpy and matplotlib strengths. > > > > Book is online at: http://www.labri.fr/perso/ > nrougier/from-python-to-numpy/ > > Sources are available at: https://github.com/rougier/ > from-python-to-numpy > > > > > > Comments/questions/fixes/ideas are of course welcome. > > > > > > Nicolas > > _______________________________________________ > > Matplotlib-users mailing list > > Matplotlib-users at python.org > > https://mail.python.org/mailman/listinfo/matplotlib-users > > > > _______________________________________________ > Matplotlib-users mailing list > Matplotlib-users at python.org > https://mail.python.org/mailman/listinfo/matplotlib-users > -- The best ruler, when he finishes his tasks and completes his affairs, the people say ?It all happened naturally? - Te Tao Ch'ing -------------- next part -------------- An HTML attachment was scrubbed... URL: From ben.v.root at gmail.com Mon Jan 30 11:57:11 2017 From: ben.v.root at gmail.com (Benjamin Root) Date: Mon, 30 Jan 2017 11:57:11 -0500 Subject: [Matplotlib-users] About 3 dimensional slices In-Reply-To: References: Message-ID: matplotlib can not do this task. You may want to look into using glumpy: https://glumpy.github.io/ I hope that helps! Ben Root On Wed, Dec 7, 2016 at 8:08 PM, ?? <39256912 at qq.com> wrote: > Hello, I want to ask the Matplotlib how to slice the 3D data. > > > for example(matlab)? slice(x,y,z,v,xslice,yslice,zslice) > > _______________________________________________ > Matplotlib-users mailing list > Matplotlib-users at python.org > https://mail.python.org/mailman/listinfo/matplotlib-users > > -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: 8DA9BC0F at EFD15B51.8FB24858.jpg Type: image/jpeg Size: 66501 bytes Desc: not available URL: From ben.v.root at gmail.com Mon Jan 30 12:08:40 2017 From: ben.v.root at gmail.com (Benjamin Root) Date: Mon, 30 Jan 2017 12:08:40 -0500 Subject: [Matplotlib-users] python connect points between different 3d plots In-Reply-To: References: Message-ID: Unfortunately, that is not really possible at this moment. The 3d plots do not integrate into the transform system properly, so artists such as ConnectionPatch that depend heavily on the transforms framework to accomplish their job won't work all that well. That's not to say that you couldn't use the artists, but you'll have to compute all of the projected coordinates yourself, and if the user interacted with the plot, then the connection points would have to be recomputed. Ben Root On Wed, Dec 21, 2016 at 3:56 PM, Maurizio De Pitt? < mauriziodepitta at gmail.com> wrote: > Hi folks, > is there a way akin of patches.ConnectionPatch that also work in 3D plots: > namely I would like to connect points of different 3D plots. How can I do > that? > > Cheers, > > M > > _______________________________________________ > Matplotlib-users mailing list > Matplotlib-users at python.org > https://mail.python.org/mailman/listinfo/matplotlib-users > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From ben.v.root at gmail.com Mon Jan 30 12:13:02 2017 From: ben.v.root at gmail.com (Benjamin Root) Date: Mon, 30 Jan 2017 12:13:02 -0500 Subject: [Matplotlib-users] Create custom Plot In-Reply-To: References: Message-ID: Which aspects of that plot are you having difficulties with? At a quick glance, it seems like you want arrow heads on the spines, and a dashed "hline" (horizontal line), along with a line plot. The gallery has some examples of how to modify the axis spines. Let us know what else you are having difficulty with. Ben Root On Sun, Dec 11, 2016 at 4:34 AM, A.S. Khangura wrote: > I want to create custom plot using Matplotlib. > > Here is image:https://www.dropbox.com/s/vabbluhkhwflg8k/mat.png > > Please let me know what kind of approach I should go for to generate such > plot? > -- > Thanks > Arshpreet Singh > Python Developer > Web Development/Data Science/Systems Integration > Mobile: (91)987 6458 387 > https://www.linkedin.com/in/arsh840 > > Doing what you like Freedom, Liking what you do is happiness. > _______________________________________________ > Matplotlib-users mailing list > Matplotlib-users at python.org > https://mail.python.org/mailman/listinfo/matplotlib-users > -------------- next part -------------- An HTML attachment was scrubbed... URL: From gregk3172 at outlook.com Tue Jan 31 16:05:22 2017 From: gregk3172 at outlook.com (Gregory Key) Date: Tue, 31 Jan 2017 21:05:22 +0000 Subject: [Matplotlib-users] Key Press and Key Release Events in TkInter Message-ID: I am running Python 3.5.2 and MatPlotLib 2.0.0 on Ubuntu 16.10. I am developing a program that uses matplotlib embedded in tkinter to plot vibration data in a bode plot, phase and amplitude versus rotor speed. I adapted the data browser given in the matplotlib documentation as example 91.2 data_browser.py to browse the data. The browser worked but I wanted to modify it so that holding down the next or previous key would scroll through the data instead of having to continously press and release the keys. My plan was to use the key_press_event to start a timer which would call a scroll method and then use the key_release event to stop the timer and stop scrolling. I couldn't make this scheme work so I did some investigating on the key_press_event and key_release_event in tkinter. I used example 91.5 keypress_demo.py given in the matplotlib documentation but I added a key_release_event method to it. What I found was that the key events don't work the way I would expect them to work. If you press and release a key things work as expected. When a key is pressed the key_press_event fires and when it is released the key_release_event fires. If a key is pressed and held however the key_press_event fires followed immediately by a key_release_event even though the key has not been released. As long as the key is held down it will continue to fire key_press_event followed by key_release_event. Is this the way it is supposed to work? Thanks Greg Key