From pierre.haessig at crans.org Tue Dec 1 03:26:10 2015 From: pierre.haessig at crans.org (Pierre Haessig) Date: Tue, 1 Dec 2015 09:26:10 +0100 Subject: [Matplotlib-users] does anyone use the pdf documentation? In-Reply-To: References: Message-ID: <565D59A2.90605@crans.org> Hi, In the same context, I've used from time to time the zipped html doc of scipy (http://docs.scipy.org/doc/). Maybe this is even easier to build ? Pierre Le 01/12/2015 03:42, Jeff Blackburne a ?crit : > It is convenient in airgapped environments. Though the same purpose > could be served with an all-in-one html document. Would that be easier > to build? > > -Jeff > > > On Mon, Nov 30, 2015 at 5:51 PM, Thomas Caswell > wrote: > > Hey folks, > > Does anyone use the pdf version of the documentation? We are > thinking of not building it as part of releases going forward. > > Tom > -------------- next part -------------- An HTML attachment was scrubbed... URL: From mdroettboom at continuum.io Tue Dec 1 08:18:22 2015 From: mdroettboom at continuum.io (Michael Droettboom) Date: Tue, 1 Dec 2015 08:18:22 -0500 Subject: [Matplotlib-users] does anyone use the pdf documentation? In-Reply-To: References: Message-ID: It would be easy enough for us to provide a tarball of the html content. Certainly easier to keep working than the PDF version. Mike On Mon, Nov 30, 2015 at 9:42 PM, Jeff Blackburne wrote: > It is convenient in airgapped environments. Though the same purpose could > be served with an all-in-one html document. Would that be easier to build? > > -Jeff > > > On Mon, Nov 30, 2015 at 5:51 PM, Thomas Caswell > wrote: > >> Hey folks, >> >> Does anyone use the pdf version of the documentation? We are thinking of >> not building it as part of releases going forward. >> >> Tom >> >> _______________________________________________ >> 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 > > -- Michael Droettboom Continuum Analytics -------------- next part -------------- An HTML attachment was scrubbed... URL: From mdroettboom at continuum.io Tue Dec 1 08:20:51 2015 From: mdroettboom at continuum.io (Michael Droettboom) Date: Tue, 1 Dec 2015 08:20:51 -0500 Subject: [Matplotlib-users] New Programmer Looking for Places to Help In-Reply-To: <1447883948946-46448.post@n5.nabble.com> References: <1447883948946-46448.post@n5.nabble.com> Message-ID: We love gaining new contributors! Our github issue tracker has a "low hanging fruit" label that we've assigned to issues that we think might be easy to jump in on. But you are also welcome to find something you're particularly motivated by and submit a pull request. We have a "check list" of all the things we like to see in a pull request here: http://matplotlib.org/devel/coding_guide.html Mike On Wed, Nov 18, 2015 at 4:59 PM, Unprecedented Owl < nathanconroydev at gmail.com> wrote: > Hi matplotlib community, > > I'm a new programmer who is familiar with Python and uses GitHub. How do > you > suggest I can make myself useful in this open source project? > > > > -- > View this message in context: > http://matplotlib.1069221.n5.nabble.com/New-Programmer-Looking-for-Places-to-Help-tp46448.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 > -- Michael Droettboom Continuum Analytics -------------- next part -------------- An HTML attachment was scrubbed... URL: From mdroettboom at continuum.io Tue Dec 1 08:21:45 2015 From: mdroettboom at continuum.io (Michael Droettboom) Date: Tue, 1 Dec 2015 08:21:45 -0500 Subject: [Matplotlib-users] How to center axes intersecting at (0,0) In-Reply-To: <1447423314772-46427.post@n5.nabble.com> References: <1447423314772-46427.post@n5.nabble.com> Message-ID: This is actually the subject of Nicolas Rougier's great tutorial here: http://www.labri.fr/perso/nrougier/teaching/matplotlib/ Mike On Fri, Nov 13, 2015 at 9:01 AM, sh77 via Matplotlib-users < matplotlib-users at python.org> wrote: > Hi, > > I'm new to matplotlib. I would like to do something very simple. In the > figure created by the following code, I would like the axes to be centered > in the figure and intersecting at point (0,0): > > import matplotlib.pyplot as plt > plt.plot([1,2,3,4], [1,-4,9,-16], 'ro') > plt.axis([-6, 6, -20, 20]) > plt.title('Title') > plt.show() > > Can you please give me the simplest lines of code to achieve this? (the > hints to solutions that I have seen over the internet are amazingly complex > for such a simple task) > > Many thanks > > saikari > > > > -- > View this message in context: > http://matplotlib.1069221.n5.nabble.com/How-to-center-axes-intersecting-at-0-0-tp46427.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 > -- Michael Droettboom Continuum Analytics -------------- next part -------------- An HTML attachment was scrubbed... URL: From mdroettboom at continuum.io Tue Dec 1 08:24:22 2015 From: mdroettboom at continuum.io (Michael Droettboom) Date: Tue, 1 Dec 2015 08:24:22 -0500 Subject: [Matplotlib-users] Matplotlib, Python 3.5.0 and RHEL 5 In-Reply-To: References: Message-ID: Did they build from source? There error message suggests they took binaries built on one Linux distro and are running it on another, which wouldn't work. I see no reason why it wouldn't run on RHEL5 though, assuming they are already upgrading Python from the stock package, which is sounds like they are. If you can get info about how it was downloaded, built and installed, that might shed some more light. Mike On Fri, Nov 20, 2015 at 3:13 AM, Derek Wallace wrote: > Hi, > > IT are trying to install matplot lib (1.5.0) for Python 3.5.0. > > They have it working on RHEL6 machines and claim it doesn?t/cant/wont work > on RHEL 5 machines. > > > > I don?t have specific information from them why or what made them come to > that conclusion. > > However when I try running I get the following. > > > > $ /depot/Python-3.5.0/bin/python > > Python 3.5.0 (default, Oct 15 2015, 22:50:34) > > [GCC 4.1.2 20080704 (Red Hat 4.1.2-48)] on linux > > Type "help", "copyright", "credits" or "license" for more information. > > >>> import matplotlib > > >>> print(matplotlib.__version__) > > 1.5.0 > > >>> import matplotlib.pyplot as plt > > Traceback (most recent call last): > > File "", line 1, in > > File > "/depot/Python-3.5.0/lib/python3.5/site-packages/matplotlib/pyplot.py", > line 29, in > > import matplotlib.colorbar > > File > "/depot/Python-3.5.0/lib/python3.5/site-packages/matplotlib/colorbar.py", > line 32, in > > import matplotlib.artist as martist > > File > "/depot/Python-3.5.0/lib/python3.5/site-packages/matplotlib/artist.py", > line 14, in > > from .transforms import (Bbox, IdentityTransform, TransformedBbox, > > File > "/depot/Python-3.5.0/lib/python3.5/site-packages/matplotlib/transforms.py", > line 39, in > > from matplotlib._path import (affine_transform, > count_bboxes_overlapping_bbox, > > ImportError: /depot/Python-3.5.0/lib/python3.5/site-packages/matplotlib/_ > path.cpython-35m-x86_64-linux-gnu.so: ELF file OS ABI invalid > > > > > > Can anyone tell me if RHEL 5.x is supported or not? > > Can anyone throw any light on the above error message. > > > > Thx > Derek > > > > > > > > _______________________________________________ > Matplotlib-users mailing list > Matplotlib-users at python.org > https://mail.python.org/mailman/listinfo/matplotlib-users > > -- Michael Droettboom Continuum Analytics -------------- next part -------------- An HTML attachment was scrubbed... URL: From Derek.Wallace at synopsys.com Tue Dec 1 08:25:37 2015 From: Derek.Wallace at synopsys.com (Derek Wallace) Date: Tue, 1 Dec 2015 13:25:37 +0000 Subject: [Matplotlib-users] Matplotlib, Python 3.5.0 and RHEL 5 In-Reply-To: References: Message-ID: Hi Michael, They made a mess of it and its exactly as you suggest; mixed up binaries. Thx derek From: Michael Droettboom [mailto:mdroettboom at continuum.io] Sent: 01 December 2015 13:24 To: Derek Wallace Cc: matplotlib-users at python.org Subject: Re: [Matplotlib-users] Matplotlib, Python 3.5.0 and RHEL 5 Did they build from source? There error message suggests they took binaries built on one Linux distro and are running it on another, which wouldn't work. I see no reason why it wouldn't run on RHEL5 though, assuming they are already upgrading Python from the stock package, which is sounds like they are. If you can get info about how it was downloaded, built and installed, that might shed some more light. Mike On Fri, Nov 20, 2015 at 3:13 AM, Derek Wallace > wrote: Hi, IT are trying to install matplot lib (1.5.0) for Python 3.5.0. They have it working on RHEL6 machines and claim it doesn?t/cant/wont work on RHEL 5 machines. I don?t have specific information from them why or what made them come to that conclusion. However when I try running I get the following. $ /depot/Python-3.5.0/bin/python Python 3.5.0 (default, Oct 15 2015, 22:50:34) [GCC 4.1.2 20080704 (Red Hat 4.1.2-48)] on linux Type "help", "copyright", "credits" or "license" for more information. >>> import matplotlib >>> print(matplotlib.__version__) 1.5.0 >>> import matplotlib.pyplot as plt Traceback (most recent call last): File "", line 1, in File "/depot/Python-3.5.0/lib/python3.5/site-packages/matplotlib/pyplot.py", line 29, in import matplotlib.colorbar File "/depot/Python-3.5.0/lib/python3.5/site-packages/matplotlib/colorbar.py", line 32, in import matplotlib.artist as martist File "/depot/Python-3.5.0/lib/python3.5/site-packages/matplotlib/artist.py", line 14, in from .transforms import (Bbox, IdentityTransform, TransformedBbox, File "/depot/Python-3.5.0/lib/python3.5/site-packages/matplotlib/transforms.py", line 39, in from matplotlib._path import (affine_transform, count_bboxes_overlapping_bbox, ImportError: /depot/Python-3.5.0/lib/python3.5/site-packages/matplotlib/_path.cpython-35m-x86_64-linux-gnu.so: ELF file OS ABI invalid Can anyone tell me if RHEL 5.x is supported or not? Can anyone throw any light on the above error message. Thx Derek _______________________________________________ Matplotlib-users mailing list Matplotlib-users at python.org https://mail.python.org/mailman/listinfo/matplotlib-users -- Michael Droettboom Continuum Analytics -------------- next part -------------- An HTML attachment was scrubbed... URL: From ben.v.root at gmail.com Tue Dec 1 09:57:18 2015 From: ben.v.root at gmail.com (Benjamin Root) Date: Tue, 1 Dec 2015 09:57:18 -0500 Subject: [Matplotlib-users] How to center axes intersecting at (0,0) In-Reply-To: References: <1447423314772-46427.post@n5.nabble.com> Message-ID: Just for completeness for the thread, the proper term for what you want to modify is "spines". Some documentation is here: http://matplotlib.org/api/spines_api.html#matplotlib.spines Cheers! Ben Root On Tue, Dec 1, 2015 at 8:21 AM, Michael Droettboom wrote: > This is actually the subject of Nicolas Rougier's great tutorial here: > http://www.labri.fr/perso/nrougier/teaching/matplotlib/ > > Mike > > On Fri, Nov 13, 2015 at 9:01 AM, sh77 via Matplotlib-users < > matplotlib-users at python.org> wrote: > >> Hi, >> >> I'm new to matplotlib. I would like to do something very simple. In the >> figure created by the following code, I would like the axes to be centered >> in the figure and intersecting at point (0,0): >> >> import matplotlib.pyplot as plt >> plt.plot([1,2,3,4], [1,-4,9,-16], 'ro') >> plt.axis([-6, 6, -20, 20]) >> plt.title('Title') >> plt.show() >> >> Can you please give me the simplest lines of code to achieve this? (the >> hints to solutions that I have seen over the internet are amazingly >> complex >> for such a simple task) >> >> Many thanks >> >> saikari >> >> >> >> -- >> View this message in context: >> http://matplotlib.1069221.n5.nabble.com/How-to-center-axes-intersecting-at-0-0-tp46427.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 >> > > > > -- > Michael Droettboom > Continuum Analytics > > _______________________________________________ > 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 Dec 1 12:33:36 2015 From: ben.v.root at gmail.com (Benjamin Root) Date: Tue, 1 Dec 2015 12:33:36 -0500 Subject: [Matplotlib-users] Axis labels along y-axis In-Reply-To: <1447289436151-46417.post@n5.nabble.com> References: <1447289436151-46417.post@n5.nabble.com> Message-ID: ax.set_ylabel('This is the y label') On Wed, Nov 11, 2015 at 7:50 PM, pikachu wrote: > I would like to have the axis labels along the y-axis for this sample. How > can I do it? > > http://matplotlib.org/examples/pylab_examples/colorbar_tick_labelling_demo.html > > > > -- > View this message in context: > http://matplotlib.1069221.n5.nabble.com/Axis-labels-along-y-axis-tp46417.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 ben.v.root at gmail.com Tue Dec 1 12:38:36 2015 From: ben.v.root at gmail.com (Benjamin Root) Date: Tue, 1 Dec 2015 12:38:36 -0500 Subject: [Matplotlib-users] Embed LassoSelector and Quiver In-Reply-To: <1446915212728-46403.post@n5.nabble.com> References: <1446915212728-46403.post@n5.nabble.com> Message-ID: That's a bit tricky, but not impossible. Essentially, you can't really interact directly with the quiver object (at least, I don't think you can), but you can have a function that would remake the quiver using a masked version of the original input data. The mask would be created by finding out which points are outside the given lasso. Then you would have to remove the original quiver object (or set it to not be visible), and create a new quiver object in its place. I don't have much spare time to write up any psuedo-code to explain this further, but I hope my description sets you on the right path. If you can get it to work, it might make a fine addition to our examples gallery! Cheers! Ben Root On Sat, Nov 7, 2015 at 11:53 AM, Hypnus1803 wrote: > Hello everyone, I want to know if I could embed LassoSelector function > with > Quiver. > > More precise, I want to make a mask using LassoSelector selection. > > > Thanks. > > > > > > > -- > View this message in context: > http://matplotlib.1069221.n5.nabble.com/Embed-LassoSelector-and-Quiver-tp46403.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 ben.v.root at gmail.com Tue Dec 1 12:47:04 2015 From: ben.v.root at gmail.com (Benjamin Root) Date: Tue, 1 Dec 2015 12:47:04 -0500 Subject: [Matplotlib-users] Some beginner questions In-Reply-To: <41302A7145AC054FA7A96CFD03835A0A0B9FE702@EX10MBX02.EU.NEC.COM> References: <41302A7145AC054FA7A96CFD03835A0A0B9FE702@EX10MBX02.EU.NEC.COM> Message-ID: 1) Yes you are doing that right. It is the preferred way to do object oriented matplotlib. Avoid calling plt methods except for figure creation and figure showing. 2) No, you aren't removing it correctly. The line object should have a "remove()" method available that should do all the bookkeeping properly. So, that means storing the line object somewhere. Remember that ax.plot() returns a list of line objects. 3) I suspect it is because you are calling plt.draw() instead of canvas.draw(), but I am not certain. I hope this helps! Ben Root P.S., another approach is to simply modify the data in the Line2D object, rather than removing it and creating a new one. You can imitate the "blinking" effect by calling "set_visible(False)", draw the canvas, sleep for a second, and then "set_visible(True)" and update its data before drawing the canvas again. Remember, you would need to keep around the returned line objects from ax.plot() like I noted in (2). On Fri, Nov 13, 2015 at 7:52 AM, David Aldrich wrote: > Hi > > > > I?m new to Matplotlib and am struggling a bit. > > > > I?m using Matplotlib with the Kivy GUI framework, but that shouldn?t be > directly relevant. I want to show a single figure having 4 subplots, each > displaying one line. My code looks like this (simplified): > > > > class CMplGraph(): > > pass > > > > def __init__(self, **kwargs): > > self.create_plot() > > > > def create_plot(self): > > self.fig, ((self.ax0, self.ax1), (self.ax2, self.ax3)) = > plt.subplots(nrows=2, ncols=2) > > > > self.ax0.set_title("Title_0") > > self.ax1.set_title("Title_1") > > self.ax2.set_title("Title_2") > > self.ax3.set_title("Title_3") > > plt.show() > > > > def plot(self, plotType, xCoords, yCoords): > > > > if (plotType == "PLOT_0 "): > > ax = self.ax0 > > elif (plotType == " PLOT_1"): > > ax = self.ax1 > > elif (plotType == " PLOT_2"): > > ax = self.ax2 > > elif (plotType == " PLOT_3"): > > ax = self.ax3 > > else: > > raise BadPlotType(plotType) > > > > # remove previous line > > if len(ax.lines) > 0: > > ax.lines.pop(0) > > > > > > plt.draw() > > time.sleep(1) # Blink > > > > line = ax.plot(xCoords, yCoords, color='blue') > > > > canvas = self.fig.canvas > > canvas.draw() > > > > Then my main app can call create_plot() once, followed by plot() whenever > it wants to update the displayed data. > > > > This seems to work but I?m not sure I?m doing it correctly. Here are my > questions: > > > > 1) Is it ok that I created axis objects? > > > > 2) Am I removing the previous line correctly? > > > > 3) I would like display to ?blink? between successive calls to > plot(). So I put in a 1s sleep after removing the previous line. There > should therefore be a flash before the new data is displayed. But I don?t > see that blink ? the line updates instantaneously. Why is that? > > > > > > Best regards > > > > David > > > > _______________________________________________ > 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 joao.q.fonseca at gmail.com Tue Dec 1 12:54:26 2015 From: joao.q.fonseca at gmail.com (Joao Fonseca) Date: Tue, 1 Dec 2015 17:54:26 +0000 Subject: [Matplotlib-users] plotting positions with non-default markers Message-ID: To visualize a simulation, I would like to plot positions of two populations using the $\top$ and $\bot$ (similar to $\perp$ and rotated $\perp$) symbols as markers, but make the coordinates coincide with the line intersections in the symbols. In this way, if two points from different populations have the same coordinates they should create a cross with a long vertical line. I have tried using plt.text and $\perp$, with a 90 degree rotation to get $\bot$: text(x,y,r?$\bot$', va=?top',ha='center',color='w',rotation=180,fontsize=14) but this doesn?t really work or scale, and I would rather use plot or scatter instead of text. Is there a good way to do this in pyplot? Should I use something else? Thank you Jo?o From ben.v.root at gmail.com Tue Dec 1 13:26:33 2015 From: ben.v.root at gmail.com (Benjamin Root) Date: Tue, 1 Dec 2015 13:26:33 -0500 Subject: [Matplotlib-users] plotting positions with non-default markers In-Reply-To: References: Message-ID: I wonder if Ryan May's "scattertext()" work might be what you are looking for? https://github.com/matplotlib/matplotlib/pull/4063 Cheers! Ben Root On Tue, Dec 1, 2015 at 12:54 PM, Joao Fonseca wrote: > To visualize a simulation, I would like to plot positions of two > populations using the $\top$ and $\bot$ (similar to $\perp$ and rotated > $\perp$) symbols as markers, but make the coordinates coincide with the > line intersections in the symbols. In this way, if two points from > different populations have the same coordinates they should create a cross > with a long vertical line. > > I have tried using plt.text and $\perp$, with a 90 degree rotation to get > $\bot$: > > text(x,y,r?$\bot$', > va=?top',ha='center',color='w',rotation=180,fontsize=14) > > but this doesn?t really work or scale, and I would rather use plot or > scatter instead of text. > > Is there a good way to do this in pyplot? Should I use something else? > > Thank you > > Jo?o > _______________________________________________ > 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 efiring at hawaii.edu Tue Dec 1 14:04:29 2015 From: efiring at hawaii.edu (Eric Firing) Date: Tue, 1 Dec 2015 09:04:29 -1000 Subject: [Matplotlib-users] plotting positions with non-default markers In-Reply-To: References: Message-ID: <565DEF3D.3020601@hawaii.edu> On 2015/12/01 7:54 AM, Joao Fonseca wrote: > To visualize a simulation, I would like to plot positions of two > populations using the $\top$ and $\bot$ (similar to $\perp$ and > rotated $\perp$) symbols as markers, but make the coordinates > coincide with the line intersections in the symbols. In this way, if > two points from different populations have the same coordinates they > should create a cross with a long vertical line. > > I have tried using plt.text and $\perp$, with a 90 degree rotation > to get $\bot$: > > text(x,y,r?$\bot$', > va=?top',ha='center',color='w',rotation=180,fontsize=14) > > but this doesn?t really work or scale, and I would rather use plot or > scatter instead of text. > > Is there a good way to do this in pyplot? Should I use something > else? import matplotlib.pyplot as plt # Make your own marker by giving vertices like this: mbot = ((-7, 0), (0, 0), (0, 20), (0, 0), (7, 0)) fig, ax = plt.subplots() ax.plot([1, 2, 3], marker=mbot, ms=20, mew=1, mfc='none', linestyle='none') ax.margins(0.1) plt.show() Eric > > Thank you > > Jo?o > _______________________________________________ > Matplotlib-users mailing list > Matplotlib-users at python.org > https://mail.python.org/mailman/listinfo/matplotlib-users > From anshul6 at yahoo.com Tue Dec 1 15:29:52 2015 From: anshul6 at yahoo.com (anshul6) Date: Tue, 1 Dec 2015 13:29:52 -0700 (MST) Subject: [Matplotlib-users] Error on import matplotlib.pyplot (on Anaconda3 for Windows 10 Home 64-bit PC) In-Reply-To: <1448921898096-46484.post@n5.nabble.com> References: <1448832396233-46477.post@n5.nabble.com> <1448915908211-46481.post@n5.nabble.com> <1448921898096-46484.post@n5.nabble.com> Message-ID: <1449001792605-46504.post@n5.nabble.com> In case anyone else is facing this issue, "simonzack" wrote a simple patch on StackOverflow that fixed the problem for me! -- View this message in context: http://matplotlib.1069221.n5.nabble.com/Error-on-import-matplotlib-pyplot-on-Anaconda3-for-Windows-10-Home-64-bit-PC-tp46477p46504.html Sent from the matplotlib - users mailing list archive at Nabble.com. From ben.v.root at gmail.com Tue Dec 1 15:35:08 2015 From: ben.v.root at gmail.com (Benjamin Root) Date: Tue, 1 Dec 2015 15:35:08 -0500 Subject: [Matplotlib-users] Error on import matplotlib.pyplot (on Anaconda3 for Windows 10 Home 64-bit PC) In-Reply-To: <1449001792605-46504.post@n5.nabble.com> References: <1448832396233-46477.post@n5.nabble.com> <1448915908211-46481.post@n5.nabble.com> <1448921898096-46484.post@n5.nabble.com> <1449001792605-46504.post@n5.nabble.com> Message-ID: To defend against linkrot, here is that user's answer: This is a bug in python, not matplotlib. The issue is that winreg.EnumValue is not cutting string values at their length properly for some reason, and strings will include null characters which os.path.abspath is not able to process. The registry entry where this happens is at SOFTWARE\Microsoft\Windows NT\CurrentVersion\Fonts. Despite this not being matplotlib's fault we can still temporarily patch it so that it ends the string at '\0'. In font_manager.py, patch line 310 in the win32InstalledFonts() function to: key, direc, any = winreg.EnumValue( local, j)if not is_string_like(direc): continueif not os.path.dirname(direc): direc = os.path.join(directory, direc) direc = direc.split('\0', 1)[0] On Tue, Dec 1, 2015 at 3:29 PM, anshul6 via Matplotlib-users < matplotlib-users at python.org> wrote: > In case anyone else is facing this issue, "simonzack" wrote a simple patch > on StackOverflow that > fixed > the problem for me! > > > > -- > View this message in context: > http://matplotlib.1069221.n5.nabble.com/Error-on-import-matplotlib-pyplot-on-Anaconda3-for-Windows-10-Home-64-bit-PC-tp46477p46504.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 joao.q.fonseca at gmail.com Tue Dec 1 15:44:06 2015 From: joao.q.fonseca at gmail.com (Joao Fonseca) Date: Tue, 1 Dec 2015 20:44:06 +0000 Subject: [Matplotlib-users] plotting positions with non-default markers In-Reply-To: <565DEF3D.3020601@hawaii.edu> References: <565DEF3D.3020601@hawaii.edu> Message-ID: This is just what I was after, thanks! And scattertext() looks pretty handy as well. Jo?o > On 1 Dec 2015, at 19:04, Eric Firing wrote: > > On 2015/12/01 7:54 AM, Joao Fonseca wrote: >> To visualize a simulation, I would like to plot positions of two >> populations using the $\top$ and $\bot$ (similar to $\perp$ and >> rotated $\perp$) symbols as markers, but make the coordinates >> coincide with the line intersections in the symbols. In this way, if >> two points from different populations have the same coordinates they >> should create a cross with a long vertical line. >> >> I have tried using plt.text and $\perp$, with a 90 degree rotation >> to get $\bot$: >> >> text(x,y,r?$\bot$', >> va=?top',ha='center',color='w',rotation=180,fontsize=14) >> >> but this doesn?t really work or scale, and I would rather use plot or >> scatter instead of text. >> >> Is there a good way to do this in pyplot? Should I use something >> else? > > > import matplotlib.pyplot as plt > > # Make your own marker by giving vertices like this: > mbot = ((-7, 0), (0, 0), (0, 20), (0, 0), (7, 0)) > > fig, ax = plt.subplots() > ax.plot([1, 2, 3], marker=mbot, ms=20, mew=1, > mfc='none', linestyle='none') > ax.margins(0.1) > plt.show() > > > Eric > > > >> >> Thank you >> >> Jo?o >> _______________________________________________ >> 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 ekrem1982 at hotmail.com Tue Dec 1 12:00:10 2015 From: ekrem1982 at hotmail.com (Ekrem _) Date: Tue, 1 Dec 2015 17:00:10 +0000 Subject: [Matplotlib-users] about your matplotlib code suggestions Message-ID: Hi.My name is Ekrem,Geophysicist.I have a question that about matplotlib.What is your suggestion about matplotlib codes?I think that explanation as schematic is very understandable.That; [cid:d2eac852-e27c-4cd7-8e47-5f81ec66fe02] very thanks for your suggestion code -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: pastedImage.png Type: image/png Size: 81120 bytes Desc: pastedImage.png URL: From fchabouis at gmail.com Tue Dec 1 16:18:22 2015 From: fchabouis at gmail.com (Francis Chabouis) Date: Tue, 1 Dec 2015 22:18:22 +0100 Subject: [Matplotlib-users] exporting tricontour function results In-Reply-To: References: Message-ID: Thanks Ben for your answer. I didn't know about that should_simplify attribute. It was effectively the reason for the disappearing points. Thanks a lot. I still have a few questions if you don't mind : 1. [low importance] Isn't it weird to have this attribute set to True by default ? I would find it more natural if simplification had to be explicitly requested. 2. You say "The first element of that list is the external vertexes, and the rest of the elements are all vertex lists of the internal holes." I like this a lot, but are you sure it is true ? As it comes in contradiction with Ian Thomas explanation : "The returned geometries are purposefully not documented. They are an 'implementation detail' and not considered part of the public interface. and as such they could change at any time and hence should not be relied upon. Of course you can choose to access them if you wish, as I do myself sometimes, but we make no promises about what the order of the polygons is, or that it won't change tomorrow." http://matplotlib.1069221.n5.nabble.com/Structure-of-contour-object-returned-from-tricontourf-td44203.html 3. I have done a simple test and the output looks like this (2 rings): [image: Images int?gr?es 1] So I'm a bit confused as : cs = plt.tricontourf(t, v, levels) #cs.collections has 1 element (ok as there is only one level) for i,collection in enumerate(cs.collections): for path in collection.get_paths(): #collection.get_paths() has only 1 element, I would eventually have expected 2 (1 for each ring) polygons = path.to_polygons() # polygons has 4 elements : the 4 rings are stored at the same place # how can I recognise the exteriors from the interiors ? Thanks for your help, Francis 2015-11-30 19:37 GMT+01:00 Benjamin Root : > Francis, > > I bet you that the inconsistency in the number of vertexes is due to path > simplification. The list of Path objects you get when you call get_paths() > on the collection object each have an attribute "should_simplify" and that > defaults to True. Set it to False, and you will have all of the vertexes. > Also, what you want to call is to_polygons() on the Path object after > setting "should_simplify" to False. That will return a list of lists. The > first element of that list is the external vertexes, and the rest of the > elements are all vertex lists of the internal holes. > > I hope this description helps. I can't really give you more detailed > description due to the fact that I have developed software that does this > very thing for my employer, but what you want is certainly possible. > > Also, as for whether or not we would want a geojson export function > available for matplotlib, it isn't really correct to have it in matplotlib > because we are a graphing library. However, it would make sense to make the > process of extracting the polygon information a bit easier, which would > make it easier for another package to be made that would export that > information into various data formats, not just geojson. > > Cheers! > Ben Root > > > On Mon, Nov 30, 2015 at 12:46 PM, Francis Chabouis > wrote: > >> Hello, >> I'm having some difficulties with the results of the tricontour function. >> What I'm trying to achieve is fairly simple : I'd like to export the >> results of the tricontour function as a geoJson. (I think a function doing >> exactly this job would be nice to have in the library). >> >> I wrote this : >> >> cs = plt.tricontourf(t, v, levels) >> >> for i,collection in enumerate(cs.collections): >> for path in collection.get_paths(): >> >> >> Now I have this path object. >> >> My first problem : when I check the number of vertices (via >> len(path.vertices)) I get 732 vertices. >> If I try to access those vertices with iter_segments as recommended in >> the doc, I get only 125 vertices. >> seg = path.iter_segments() >> print len(list(seg)) >> ==> 125 >> >> Am I doing something wrong, or is it possibly a bug ? >> >> My second problem : geoJson works with interior and exterior rings. To >> describe a polygon with a hole in it, we first declare a closed line (that >> will be the exterior) and all the subsequent lines will be the "holes" >> (interiors). It seems that what I get from iter_segments and to_polygons is >> a bunch of lines, but there is no way to know which is an interior, which >> is an exterior. But I guess this must be stored somewhere as MPL is able to >> draw a graph from this information ! >> >> Any hints on how I should proceed ? >> Let me know if you need additional information. >> >> Thanks >> >> ps : I got some of my infos from this thread : >> http://matplotlib.1069221.n5.nabble.com/Structure-of-contour-object-returned-from-tricontourf-td44203.html >> >> ps2 : If I can write this function I would be happy to integrate it in >> the lib if you're interested. >> >> _______________________________________________ >> 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: image.png Type: image/png Size: 26890 bytes Desc: not available URL: From ben.v.root at gmail.com Tue Dec 1 16:33:43 2015 From: ben.v.root at gmail.com (Benjamin Root) Date: Tue, 1 Dec 2015 16:33:43 -0500 Subject: [Matplotlib-users] exporting tricontour function results In-Reply-To: References: Message-ID: Francis, 1. Keep in mind, matplotlib is a plotting library first. Path simplification takes into account the resolution of the output device when used for drawing and essentially simplifies out any unresolvable features, which greatly reduces drawing time for complex plots. Exporting data like this was never an intended use. 2. I will have to respectfully disagree with Ian on this point. to_polygons() is not a private method and it is perfectly reasonable to expect it to be used by people outside the matplotlib codebase. As a developer, I would reject any patches that changes the output semantics of to_polygons() without going through a lengthy deprecation cycle. Plus, the primary use of this method is for easy input to Polygon artist objects, which has a constructor that isn't going to change, so why should to_polygons() change? 3. Without the source example data, I am at a bit of a loss for what is happening here. I could come up with all sorts of guesses, but I can't tell you for sure without having something I can run myself. Cheers! Ben Root On Tue, Dec 1, 2015 at 4:18 PM, Francis Chabouis wrote: > Thanks Ben for your answer. > > I didn't know about that should_simplify attribute. It was effectively the > reason for the disappearing points. Thanks a lot. > I still have a few questions if you don't mind : > > 1. [low importance] Isn't it weird to have this attribute set to True by > default ? I would find it more natural if simplification had to be > explicitly requested. > > 2. You say "The first element of that list is the external vertexes, and > the rest of the elements are all vertex lists of the internal holes." I > like this a lot, but are you sure it is true ? As it comes in contradiction > with Ian Thomas explanation : > > "The returned geometries are purposefully not documented. They are an > 'implementation detail' and not considered part of the public interface. > and as such they could change at any time and hence should not be relied > upon. Of course you can choose to access them if you wish, as I do myself > sometimes, but we make no promises about what the order of the polygons is, > or that it won't change tomorrow." > > > http://matplotlib.1069221.n5.nabble.com/Structure-of-contour-object-returned-from-tricontourf-td44203.html > > 3. I have done a simple test and the output looks like this (2 rings): > > [image: Images int?gr?es 1] > > So I'm a bit confused as : > > cs = plt.tricontourf(t, v, levels) > #cs.collections has 1 element (ok as there is only one level) > > for i,collection in enumerate(cs.collections): > for path in collection.get_paths(): > #collection.get_paths() has only 1 element, I would eventually have > expected 2 (1 for each ring) > polygons = path.to_polygons() > # polygons has 4 elements : the 4 rings are stored at the same place > # how can I recognise the exteriors from the interiors ? > > Thanks for your help, > Francis > > > > 2015-11-30 19:37 GMT+01:00 Benjamin Root : > >> Francis, >> >> I bet you that the inconsistency in the number of vertexes is due to path >> simplification. The list of Path objects you get when you call get_paths() >> on the collection object each have an attribute "should_simplify" and that >> defaults to True. Set it to False, and you will have all of the vertexes. >> Also, what you want to call is to_polygons() on the Path object after >> setting "should_simplify" to False. That will return a list of lists. The >> first element of that list is the external vertexes, and the rest of the >> elements are all vertex lists of the internal holes. >> >> I hope this description helps. I can't really give you more detailed >> description due to the fact that I have developed software that does this >> very thing for my employer, but what you want is certainly possible. >> >> Also, as for whether or not we would want a geojson export function >> available for matplotlib, it isn't really correct to have it in matplotlib >> because we are a graphing library. However, it would make sense to make the >> process of extracting the polygon information a bit easier, which would >> make it easier for another package to be made that would export that >> information into various data formats, not just geojson. >> >> Cheers! >> Ben Root >> >> >> On Mon, Nov 30, 2015 at 12:46 PM, Francis Chabouis >> wrote: >> >>> Hello, >>> I'm having some difficulties with the results of the tricontour >>> function. What I'm trying to achieve is fairly simple : I'd like to export >>> the results of the tricontour function as a geoJson. (I think a function >>> doing exactly this job would be nice to have in the library). >>> >>> I wrote this : >>> >>> cs = plt.tricontourf(t, v, levels) >>> >>> for i,collection in enumerate(cs.collections): >>> for path in collection.get_paths(): >>> >>> >>> Now I have this path object. >>> >>> My first problem : when I check the number of vertices (via >>> len(path.vertices)) I get 732 vertices. >>> If I try to access those vertices with iter_segments as recommended in >>> the doc, I get only 125 vertices. >>> seg = path.iter_segments() >>> print len(list(seg)) >>> ==> 125 >>> >>> Am I doing something wrong, or is it possibly a bug ? >>> >>> My second problem : geoJson works with interior and exterior rings. To >>> describe a polygon with a hole in it, we first declare a closed line (that >>> will be the exterior) and all the subsequent lines will be the "holes" >>> (interiors). It seems that what I get from iter_segments and to_polygons is >>> a bunch of lines, but there is no way to know which is an interior, which >>> is an exterior. But I guess this must be stored somewhere as MPL is able to >>> draw a graph from this information ! >>> >>> Any hints on how I should proceed ? >>> Let me know if you need additional information. >>> >>> Thanks >>> >>> ps : I got some of my infos from this thread : >>> http://matplotlib.1069221.n5.nabble.com/Structure-of-contour-object-returned-from-tricontourf-td44203.html >>> >>> ps2 : If I can write this function I would be happy to integrate it in >>> the lib if you're interested. >>> >>> _______________________________________________ >>> 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: image.png Type: image/png Size: 26890 bytes Desc: not available URL: From fchabouis at gmail.com Tue Dec 1 16:57:41 2015 From: fchabouis at gmail.com (Francis Chabouis) Date: Tue, 1 Dec 2015 22:57:41 +0100 Subject: [Matplotlib-users] exporting tricontour function results In-Reply-To: References: Message-ID: Ben, 1. Exporting data like this was never an intended use => I understand your point. In fact if calling the underlying C++ code for tricontour had been easy I would happily have skipped the call to MPL. All I'm interested in is the polygons coordinates really. 2. good news :) 3. please find the script attached. thanks Francis 2015-12-01 22:33 GMT+01:00 Benjamin Root : > Francis, > > 1. Keep in mind, matplotlib is a plotting library first. Path > simplification takes into account the resolution of the output device when > used for drawing and essentially simplifies out any unresolvable features, > which greatly reduces drawing time for complex plots. Exporting data like > this was never an intended use. > > 2. I will have to respectfully disagree with Ian on this point. > to_polygons() is not a private method and it is perfectly reasonable to > expect it to be used by people outside the matplotlib codebase. As a > developer, I would reject any patches that changes the output semantics of > to_polygons() without going through a lengthy deprecation cycle. Plus, the > primary use of this method is for easy input to Polygon artist objects, > which has a constructor that isn't going to change, so why should > to_polygons() change? > > 3. Without the source example data, I am at a bit of a loss for what is > happening here. I could come up with all sorts of guesses, but I can't tell > you for sure without having something I can run myself. > > Cheers! > Ben Root > > > On Tue, Dec 1, 2015 at 4:18 PM, Francis Chabouis > wrote: > >> Thanks Ben for your answer. >> >> I didn't know about that should_simplify attribute. It was effectively >> the reason for the disappearing points. Thanks a lot. >> I still have a few questions if you don't mind : >> >> 1. [low importance] Isn't it weird to have this attribute set to True by >> default ? I would find it more natural if simplification had to be >> explicitly requested. >> >> 2. You say "The first element of that list is the external vertexes, and >> the rest of the elements are all vertex lists of the internal holes." I >> like this a lot, but are you sure it is true ? As it comes in contradiction >> with Ian Thomas explanation : >> >> "The returned geometries are purposefully not documented. They are an >> 'implementation detail' and not considered part of the public interface. >> and as such they could change at any time and hence should not be relied >> upon. Of course you can choose to access them if you wish, as I do myself >> sometimes, but we make no promises about what the order of the polygons is, >> or that it won't change tomorrow." >> >> >> http://matplotlib.1069221.n5.nabble.com/Structure-of-contour-object-returned-from-tricontourf-td44203.html >> >> 3. I have done a simple test and the output looks like this (2 rings): >> >> [image: Images int?gr?es 1] >> >> So I'm a bit confused as : >> >> cs = plt.tricontourf(t, v, levels) >> #cs.collections has 1 element (ok as there is only one level) >> >> for i,collection in enumerate(cs.collections): >> for path in collection.get_paths(): >> #collection.get_paths() has only 1 element, I would eventually have >> expected 2 (1 for each ring) >> polygons = path.to_polygons() >> # polygons has 4 elements : the 4 rings are stored at the same place >> # how can I recognise the exteriors from the interiors ? >> >> Thanks for your help, >> Francis >> >> >> >> 2015-11-30 19:37 GMT+01:00 Benjamin Root : >> >>> Francis, >>> >>> I bet you that the inconsistency in the number of vertexes is due to >>> path simplification. The list of Path objects you get when you call >>> get_paths() on the collection object each have an attribute >>> "should_simplify" and that defaults to True. Set it to False, and you will >>> have all of the vertexes. Also, what you want to call is to_polygons() on >>> the Path object after setting "should_simplify" to False. That will return >>> a list of lists. The first element of that list is the external vertexes, >>> and the rest of the elements are all vertex lists of the internal holes. >>> >>> I hope this description helps. I can't really give you more detailed >>> description due to the fact that I have developed software that does this >>> very thing for my employer, but what you want is certainly possible. >>> >>> Also, as for whether or not we would want a geojson export function >>> available for matplotlib, it isn't really correct to have it in matplotlib >>> because we are a graphing library. However, it would make sense to make the >>> process of extracting the polygon information a bit easier, which would >>> make it easier for another package to be made that would export that >>> information into various data formats, not just geojson. >>> >>> Cheers! >>> Ben Root >>> >>> >>> On Mon, Nov 30, 2015 at 12:46 PM, Francis Chabouis >>> wrote: >>> >>>> Hello, >>>> I'm having some difficulties with the results of the tricontour >>>> function. What I'm trying to achieve is fairly simple : I'd like to export >>>> the results of the tricontour function as a geoJson. (I think a function >>>> doing exactly this job would be nice to have in the library). >>>> >>>> I wrote this : >>>> >>>> cs = plt.tricontourf(t, v, levels) >>>> >>>> for i,collection in enumerate(cs.collections): >>>> for path in collection.get_paths(): >>>> >>>> >>>> Now I have this path object. >>>> >>>> My first problem : when I check the number of vertices (via >>>> len(path.vertices)) I get 732 vertices. >>>> If I try to access those vertices with iter_segments as recommended in >>>> the doc, I get only 125 vertices. >>>> seg = path.iter_segments() >>>> print len(list(seg)) >>>> ==> 125 >>>> >>>> Am I doing something wrong, or is it possibly a bug ? >>>> >>>> My second problem : geoJson works with interior and exterior rings. To >>>> describe a polygon with a hole in it, we first declare a closed line (that >>>> will be the exterior) and all the subsequent lines will be the "holes" >>>> (interiors). It seems that what I get from iter_segments and to_polygons is >>>> a bunch of lines, but there is no way to know which is an interior, which >>>> is an exterior. But I guess this must be stored somewhere as MPL is able to >>>> draw a graph from this information ! >>>> >>>> Any hints on how I should proceed ? >>>> Let me know if you need additional information. >>>> >>>> Thanks >>>> >>>> ps : I got some of my infos from this thread : >>>> http://matplotlib.1069221.n5.nabble.com/Structure-of-contour-object-returned-from-tricontourf-td44203.html >>>> >>>> ps2 : If I can write this function I would be happy to integrate it in >>>> the lib if you're interested. >>>> >>>> _______________________________________________ >>>> 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: image.png Type: image/png Size: 26890 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: testCase.py Type: text/x-python Size: 1688 bytes Desc: not available URL: From mdroettboom at continuum.io Wed Dec 2 09:09:20 2015 From: mdroettboom at continuum.io (Michael Droettboom) Date: Wed, 2 Dec 2015 09:09:20 -0500 Subject: [Matplotlib-users] plotting positions with non-default markers In-Reply-To: References: <565DEF3D.3020601@hawaii.edu> Message-ID: Just for completeness, I should mention you can also pass any math string as a marker as well: plt.plot([1,2,3], marker=r'$\bot$') Mike ? On Tue, Dec 1, 2015 at 3:44 PM, Joao Fonseca wrote: > This is just what I was after, thanks! And scattertext() looks pretty > handy as well. > > Jo?o > > > On 1 Dec 2015, at 19:04, Eric Firing wrote: > > > > On 2015/12/01 7:54 AM, Joao Fonseca wrote: > >> To visualize a simulation, I would like to plot positions of two > >> populations using the $\top$ and $\bot$ (similar to $\perp$ and > >> rotated $\perp$) symbols as markers, but make the coordinates > >> coincide with the line intersections in the symbols. In this way, if > >> two points from different populations have the same coordinates they > >> should create a cross with a long vertical line. > >> > >> I have tried using plt.text and $\perp$, with a 90 degree rotation > >> to get $\bot$: > >> > >> text(x,y,r?$\bot$', > >> va=?top',ha='center',color='w',rotation=180,fontsize=14) > >> > >> but this doesn?t really work or scale, and I would rather use plot or > >> scatter instead of text. > >> > >> Is there a good way to do this in pyplot? Should I use something > >> else? > > > > > > import matplotlib.pyplot as plt > > > > # Make your own marker by giving vertices like this: > > mbot = ((-7, 0), (0, 0), (0, 20), (0, 0), (7, 0)) > > > > fig, ax = plt.subplots() > > ax.plot([1, 2, 3], marker=mbot, ms=20, mew=1, > > mfc='none', linestyle='none') > > ax.margins(0.1) > > plt.show() > > > > > > Eric > > > > > > > >> > >> Thank you > >> > >> Jo?o > >> _______________________________________________ > >> 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 > -- Michael Droettboom Continuum Analytics -------------- next part -------------- An HTML attachment was scrubbed... URL: From efiring at hawaii.edu Wed Dec 2 12:49:30 2015 From: efiring at hawaii.edu (Eric Firing) Date: Wed, 2 Dec 2015 07:49:30 -1000 Subject: [Matplotlib-users] plotting positions with non-default markers In-Reply-To: References: <565DEF3D.3020601@hawaii.edu> Message-ID: <565F2F2A.7040702@hawaii.edu> On 2015/12/02 4:09 AM, Michael Droettboom wrote: > Just for completeness, I should mention you can also pass any math > string as a marker as well: > > |plt.plot([1,2,3], marker=r'$\bot$') | To complete the completeness, how will it be located? What part of the rendered string lands at the specified data location? Eric > > Mike > > ? > > On Tue, Dec 1, 2015 at 3:44 PM, Joao Fonseca > wrote: > > This is just what I was after, thanks! And scattertext() looks > pretty handy as well. > > Jo?o > > > On 1 Dec 2015, at 19:04, Eric Firing > wrote: > > > > On 2015/12/01 7:54 AM, Joao Fonseca wrote: > >> To visualize a simulation, I would like to plot positions of two > >> populations using the $\top$ and $\bot$ (similar to $\perp$ and > >> rotated $\perp$) symbols as markers, but make the coordinates > >> coincide with the line intersections in the symbols. In this way, if > >> two points from different populations have the same coordinates they > >> should create a cross with a long vertical line. > >> > >> I have tried using plt.text and $\perp$, with a 90 degree rotation > >> to get $\bot$: > >> > >> text(x,y,r?$\bot$', > >> va=?top',ha='center',color='w',rotation=180,fontsize=14) > >> > >> but this doesn?t really work or scale, and I would rather use > plot or > >> scatter instead of text. > >> > >> Is there a good way to do this in pyplot? Should I use something > >> else? > > > > > > import matplotlib.pyplot as plt > > > > # Make your own marker by giving vertices like this: > > mbot = ((-7, 0), (0, 0), (0, 20), (0, 0), (7, 0)) > > > > fig, ax = plt.subplots() > > ax.plot([1, 2, 3], marker=mbot, ms=20, mew=1, > > mfc='none', linestyle='none') > > ax.margins(0.1) > > plt.show() > > > > > > Eric > > > > > > > >> > >> Thank you > >> > >> Jo?o > >> _______________________________________________ > >> 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 > > > > > -- > Michael Droettboom > Continuum Analytics > > > _______________________________________________ > Matplotlib-users mailing list > Matplotlib-users at python.org > https://mail.python.org/mailman/listinfo/matplotlib-users > From ianthomas23 at gmail.com Wed Dec 2 15:00:00 2015 From: ianthomas23 at gmail.com (Ian Thomas) Date: Wed, 2 Dec 2015 20:00:00 +0000 Subject: [Matplotlib-users] exporting tricontour function results In-Reply-To: References: Message-ID: Francis, Your question about interior and exterior polygons is already answered in the thread you keep referring to. I'll repeat it here. tricontouf does not return any information about which interior polygons are located inside which exterior polygons. All you get is a collection of polygons, composed of one or more exteriors and zero or more interiors, and they can be in any order. The backends take these arbitrary collections of exterior and interior polygons and render them correctly. As all of the backends are capable of calculating the exterior/interior containment themselves, there is no need for tricontourf to do it as well. contourf produces different output, grouping each exterior polygon with its contained interior polygons. This is because it dates from before all the backends were capable of calculating polygon containment, so contourf had to do it. The recent rewrite of the contourf C++ code still does this so that it produces output consistent with the legacy code. If you want take the output of tricontourf and calculate the exterior/interior containment, you'll either have to find some other library to do it, or write the code yourself. I have not looked into libraries that do this as I do not need this functionality. Writing the code to do it yourself is pretty easy, but making it robust and efficient is much harder. Ben, I think you have misunderstood my comments from last year. When I was talking about what I consider private, I was referring to the segs and kinds that are passed from C++ to python to make up the various Path objects. I didn't refer to the function to_polygons() being private, in fact I didn't refer to it at all. Ian On 1 December 2015 at 21:57, Francis Chabouis wrote: > Ben, > > 1. Exporting data like this was never an intended use => I understand your > point. In fact if calling the underlying C++ code for tricontour had been > easy I would happily have skipped the call to MPL. All I'm interested in is > the polygons coordinates really. > > 2. good news :) > > 3. please find the script attached. > > thanks > Francis > > 2015-12-01 22:33 GMT+01:00 Benjamin Root : > >> Francis, >> >> 1. Keep in mind, matplotlib is a plotting library first. Path >> simplification takes into account the resolution of the output device when >> used for drawing and essentially simplifies out any unresolvable features, >> which greatly reduces drawing time for complex plots. Exporting data like >> this was never an intended use. >> >> 2. I will have to respectfully disagree with Ian on this point. >> to_polygons() is not a private method and it is perfectly reasonable to >> expect it to be used by people outside the matplotlib codebase. As a >> developer, I would reject any patches that changes the output semantics of >> to_polygons() without going through a lengthy deprecation cycle. Plus, the >> primary use of this method is for easy input to Polygon artist objects, >> which has a constructor that isn't going to change, so why should >> to_polygons() change? >> >> 3. Without the source example data, I am at a bit of a loss for what is >> happening here. I could come up with all sorts of guesses, but I can't tell >> you for sure without having something I can run myself. >> >> Cheers! >> Ben Root >> >> >> On Tue, Dec 1, 2015 at 4:18 PM, Francis Chabouis >> wrote: >> >>> Thanks Ben for your answer. >>> >>> I didn't know about that should_simplify attribute. It was effectively >>> the reason for the disappearing points. Thanks a lot. >>> I still have a few questions if you don't mind : >>> >>> 1. [low importance] Isn't it weird to have this attribute set to True by >>> default ? I would find it more natural if simplification had to be >>> explicitly requested. >>> >>> 2. You say "The first element of that list is the external vertexes, and >>> the rest of the elements are all vertex lists of the internal holes." I >>> like this a lot, but are you sure it is true ? As it comes in contradiction >>> with Ian Thomas explanation : >>> >>> "The returned geometries are purposefully not documented. They are an >>> 'implementation detail' and not considered part of the public interface. >>> and as such they could change at any time and hence should not be relied >>> upon. Of course you can choose to access them if you wish, as I do myself >>> sometimes, but we make no promises about what the order of the polygons is, >>> or that it won't change tomorrow." >>> >>> >>> http://matplotlib.1069221.n5.nabble.com/Structure-of-contour-object-returned-from-tricontourf-td44203.html >>> >>> 3. I have done a simple test and the output looks like this (2 rings): >>> >>> [image: Images int?gr?es 1] >>> >>> So I'm a bit confused as : >>> >>> cs = plt.tricontourf(t, v, levels) >>> #cs.collections has 1 element (ok as there is only one level) >>> >>> for i,collection in enumerate(cs.collections): >>> for path in collection.get_paths(): >>> #collection.get_paths() has only 1 element, I would eventually have >>> expected 2 (1 for each ring) >>> polygons = path.to_polygons() >>> # polygons has 4 elements : the 4 rings are stored at the same place >>> # how can I recognise the exteriors from the interiors ? >>> >>> Thanks for your help, >>> Francis >>> >>> >>> >>> 2015-11-30 19:37 GMT+01:00 Benjamin Root : >>> >>>> Francis, >>>> >>>> I bet you that the inconsistency in the number of vertexes is due to >>>> path simplification. The list of Path objects you get when you call >>>> get_paths() on the collection object each have an attribute >>>> "should_simplify" and that defaults to True. Set it to False, and you will >>>> have all of the vertexes. Also, what you want to call is to_polygons() on >>>> the Path object after setting "should_simplify" to False. That will return >>>> a list of lists. The first element of that list is the external vertexes, >>>> and the rest of the elements are all vertex lists of the internal holes. >>>> >>>> I hope this description helps. I can't really give you more detailed >>>> description due to the fact that I have developed software that does this >>>> very thing for my employer, but what you want is certainly possible. >>>> >>>> Also, as for whether or not we would want a geojson export function >>>> available for matplotlib, it isn't really correct to have it in matplotlib >>>> because we are a graphing library. However, it would make sense to make the >>>> process of extracting the polygon information a bit easier, which would >>>> make it easier for another package to be made that would export that >>>> information into various data formats, not just geojson. >>>> >>>> Cheers! >>>> Ben Root >>>> >>>> >>>> On Mon, Nov 30, 2015 at 12:46 PM, Francis Chabouis >>> > wrote: >>>> >>>>> Hello, >>>>> I'm having some difficulties with the results of the tricontour >>>>> function. What I'm trying to achieve is fairly simple : I'd like to export >>>>> the results of the tricontour function as a geoJson. (I think a function >>>>> doing exactly this job would be nice to have in the library). >>>>> >>>>> I wrote this : >>>>> >>>>> cs = plt.tricontourf(t, v, levels) >>>>> >>>>> for i,collection in enumerate(cs.collections): >>>>> for path in collection.get_paths(): >>>>> >>>>> >>>>> Now I have this path object. >>>>> >>>>> My first problem : when I check the number of vertices (via >>>>> len(path.vertices)) I get 732 vertices. >>>>> If I try to access those vertices with iter_segments as recommended in >>>>> the doc, I get only 125 vertices. >>>>> seg = path.iter_segments() >>>>> print len(list(seg)) >>>>> ==> 125 >>>>> >>>>> Am I doing something wrong, or is it possibly a bug ? >>>>> >>>>> My second problem : geoJson works with interior and exterior rings. To >>>>> describe a polygon with a hole in it, we first declare a closed line (that >>>>> will be the exterior) and all the subsequent lines will be the "holes" >>>>> (interiors). It seems that what I get from iter_segments and to_polygons is >>>>> a bunch of lines, but there is no way to know which is an interior, which >>>>> is an exterior. But I guess this must be stored somewhere as MPL is able to >>>>> draw a graph from this information ! >>>>> >>>>> Any hints on how I should proceed ? >>>>> Let me know if you need additional information. >>>>> >>>>> Thanks >>>>> >>>>> ps : I got some of my infos from this thread : >>>>> http://matplotlib.1069221.n5.nabble.com/Structure-of-contour-object-returned-from-tricontourf-td44203.html >>>>> >>>>> ps2 : If I can write this function I would be happy to integrate it in >>>>> the lib if you're interested. >>>>> >>>>> _______________________________________________ >>>>> 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: image.png Type: image/png Size: 26890 bytes Desc: not available URL: From ben.v.root at gmail.com Wed Dec 2 15:48:16 2015 From: ben.v.root at gmail.com (Benjamin Root) Date: Wed, 2 Dec 2015 15:48:16 -0500 Subject: [Matplotlib-users] exporting tricontour function results In-Reply-To: References: Message-ID: Ian, I see now how tricontourf()'s polygons are fundamentally different from contourf()'s polygons (and explains the discrepancy the user is seeing), and I see I misread your comments. That said, any sort of modification that would change the output of to_polygons() in a substantial way would certainly need major justification. The functions have been there for a long time and people have come to expect them to behave in a certain way. Ben Root On Wed, Dec 2, 2015 at 3:00 PM, Ian Thomas wrote: > Francis, > > Your question about interior and exterior polygons is already answered in > the thread you keep referring to. I'll repeat it here. tricontouf does > not return any information about which interior polygons are located inside > which exterior polygons. All you get is a collection of polygons, composed > of one or more exteriors and zero or more interiors, and they can be in any > order. The backends take these arbitrary collections of exterior and > interior polygons and render them correctly. As all of the backends are > capable of calculating the exterior/interior containment themselves, there > is no need for tricontourf to do it as well. > > contourf produces different output, grouping each exterior polygon with > its contained interior polygons. This is because it dates from before all > the backends were capable of calculating polygon containment, so contourf > had to do it. The recent rewrite of the contourf C++ code still does this > so that it produces output consistent with the legacy code. > > If you want take the output of tricontourf and calculate the > exterior/interior containment, you'll either have to find some other > library to do it, or write the code yourself. I have not looked into > libraries that do this as I do not need this functionality. Writing the > code to do it yourself is pretty easy, but making it robust and efficient > is much harder. > > Ben, > > I think you have misunderstood my comments from last year. When I was > talking about what I consider private, I was referring to the segs and > kinds that are passed from C++ to python to make up the various Path > objects. I didn't refer to the function to_polygons() being private, in > fact I didn't refer to it at all. > > Ian > > On 1 December 2015 at 21:57, Francis Chabouis wrote: > >> Ben, >> >> 1. Exporting data like this was never an intended use => I understand >> your point. In fact if calling the underlying C++ code for tricontour had >> been easy I would happily have skipped the call to MPL. All I'm interested >> in is the polygons coordinates really. >> >> 2. good news :) >> >> 3. please find the script attached. >> >> thanks >> Francis >> >> 2015-12-01 22:33 GMT+01:00 Benjamin Root : >> >>> Francis, >>> >>> 1. Keep in mind, matplotlib is a plotting library first. Path >>> simplification takes into account the resolution of the output device when >>> used for drawing and essentially simplifies out any unresolvable features, >>> which greatly reduces drawing time for complex plots. Exporting data like >>> this was never an intended use. >>> >>> 2. I will have to respectfully disagree with Ian on this point. >>> to_polygons() is not a private method and it is perfectly reasonable to >>> expect it to be used by people outside the matplotlib codebase. As a >>> developer, I would reject any patches that changes the output semantics of >>> to_polygons() without going through a lengthy deprecation cycle. Plus, the >>> primary use of this method is for easy input to Polygon artist objects, >>> which has a constructor that isn't going to change, so why should >>> to_polygons() change? >>> >>> 3. Without the source example data, I am at a bit of a loss for what is >>> happening here. I could come up with all sorts of guesses, but I can't tell >>> you for sure without having something I can run myself. >>> >>> Cheers! >>> Ben Root >>> >>> >>> On Tue, Dec 1, 2015 at 4:18 PM, Francis Chabouis >>> wrote: >>> >>>> Thanks Ben for your answer. >>>> >>>> I didn't know about that should_simplify attribute. It was effectively >>>> the reason for the disappearing points. Thanks a lot. >>>> I still have a few questions if you don't mind : >>>> >>>> 1. [low importance] Isn't it weird to have this attribute set to True >>>> by default ? I would find it more natural if simplification had to be >>>> explicitly requested. >>>> >>>> 2. You say "The first element of that list is the external vertexes, >>>> and the rest of the elements are all vertex lists of the internal holes." I >>>> like this a lot, but are you sure it is true ? As it comes in contradiction >>>> with Ian Thomas explanation : >>>> >>>> "The returned geometries are purposefully not documented. They are an >>>> 'implementation detail' and not considered part of the public interface. >>>> and as such they could change at any time and hence should not be relied >>>> upon. Of course you can choose to access them if you wish, as I do myself >>>> sometimes, but we make no promises about what the order of the polygons is, >>>> or that it won't change tomorrow." >>>> >>>> >>>> http://matplotlib.1069221.n5.nabble.com/Structure-of-contour-object-returned-from-tricontourf-td44203.html >>>> >>>> 3. I have done a simple test and the output looks like this (2 rings): >>>> >>>> [image: Images int?gr?es 1] >>>> >>>> So I'm a bit confused as : >>>> >>>> cs = plt.tricontourf(t, v, levels) >>>> #cs.collections has 1 element (ok as there is only one level) >>>> >>>> for i,collection in enumerate(cs.collections): >>>> for path in collection.get_paths(): >>>> #collection.get_paths() has only 1 element, I would eventually have >>>> expected 2 (1 for each ring) >>>> polygons = path.to_polygons() >>>> # polygons has 4 elements : the 4 rings are stored at the same place >>>> # how can I recognise the exteriors from the interiors ? >>>> >>>> Thanks for your help, >>>> Francis >>>> >>>> >>>> >>>> 2015-11-30 19:37 GMT+01:00 Benjamin Root : >>>> >>>>> Francis, >>>>> >>>>> I bet you that the inconsistency in the number of vertexes is due to >>>>> path simplification. The list of Path objects you get when you call >>>>> get_paths() on the collection object each have an attribute >>>>> "should_simplify" and that defaults to True. Set it to False, and you will >>>>> have all of the vertexes. Also, what you want to call is to_polygons() on >>>>> the Path object after setting "should_simplify" to False. That will return >>>>> a list of lists. The first element of that list is the external vertexes, >>>>> and the rest of the elements are all vertex lists of the internal holes. >>>>> >>>>> I hope this description helps. I can't really give you more detailed >>>>> description due to the fact that I have developed software that does this >>>>> very thing for my employer, but what you want is certainly possible. >>>>> >>>>> Also, as for whether or not we would want a geojson export function >>>>> available for matplotlib, it isn't really correct to have it in matplotlib >>>>> because we are a graphing library. However, it would make sense to make the >>>>> process of extracting the polygon information a bit easier, which would >>>>> make it easier for another package to be made that would export that >>>>> information into various data formats, not just geojson. >>>>> >>>>> Cheers! >>>>> Ben Root >>>>> >>>>> >>>>> On Mon, Nov 30, 2015 at 12:46 PM, Francis Chabouis < >>>>> fchabouis at gmail.com> wrote: >>>>> >>>>>> Hello, >>>>>> I'm having some difficulties with the results of the tricontour >>>>>> function. What I'm trying to achieve is fairly simple : I'd like to export >>>>>> the results of the tricontour function as a geoJson. (I think a function >>>>>> doing exactly this job would be nice to have in the library). >>>>>> >>>>>> I wrote this : >>>>>> >>>>>> cs = plt.tricontourf(t, v, levels) >>>>>> >>>>>> for i,collection in enumerate(cs.collections): >>>>>> for path in collection.get_paths(): >>>>>> >>>>>> >>>>>> Now I have this path object. >>>>>> >>>>>> My first problem : when I check the number of vertices (via >>>>>> len(path.vertices)) I get 732 vertices. >>>>>> If I try to access those vertices with iter_segments as recommended >>>>>> in the doc, I get only 125 vertices. >>>>>> seg = path.iter_segments() >>>>>> print len(list(seg)) >>>>>> ==> 125 >>>>>> >>>>>> Am I doing something wrong, or is it possibly a bug ? >>>>>> >>>>>> My second problem : geoJson works with interior and exterior rings. >>>>>> To describe a polygon with a hole in it, we first declare a closed line >>>>>> (that will be the exterior) and all the subsequent lines will be the >>>>>> "holes" (interiors). It seems that what I get from iter_segments and >>>>>> to_polygons is a bunch of lines, but there is no way to know which is an >>>>>> interior, which is an exterior. But I guess this must be stored somewhere >>>>>> as MPL is able to draw a graph from this information ! >>>>>> >>>>>> Any hints on how I should proceed ? >>>>>> Let me know if you need additional information. >>>>>> >>>>>> Thanks >>>>>> >>>>>> ps : I got some of my infos from this thread : >>>>>> http://matplotlib.1069221.n5.nabble.com/Structure-of-contour-object-returned-from-tricontourf-td44203.html >>>>>> >>>>>> ps2 : If I can write this function I would be happy to integrate it >>>>>> in the lib if you're interested. >>>>>> >>>>>> _______________________________________________ >>>>>> 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: image.png Type: image/png Size: 26890 bytes Desc: not available URL: From sameer.grover.1 at gmail.com Wed Dec 2 16:40:46 2015 From: sameer.grover.1 at gmail.com (Sameer Grover) Date: Thu, 3 Dec 2015 03:10:46 +0530 Subject: [Matplotlib-users] 2d arrays issues Message-ID: I was using matplotlib to plot 2d arrays (or equivalently images), getting the user to choose some points, getting the x and y coordinates of those points, and then doing calculations. Keeping track of indices proved to be a source of frustration. This is because, given a 2d array, two different interpretations are possible. In the first one, the first index is the (horizontal) x-axis and the second index is the (vertical) y-axis. And in the other one, the first index is the row (vertical axis) and the second one is the column (horizontal axis). Matplotlib has always veered towards the second interpretation, perhaps because it has been modelled on matlab, where everything is a 2d matrix (or higher dimensional). But in numpy, where 1d arrays are first class objects, this can get confusing. For example, if I were acquiring data as a function of two variables which go on the x-axis and y-axis for x in x_vals: for y in y_vals: result[x,y] = f(x,y) either I would have to use contourf(x_vals, y_vals, result.T) or use result[y,x] = f(x,y). Most programmers would probably be used to this, but it's easy to slip up with large programs. The situation becomes even more confusing with imshow and imread because the origin is placed on the upper left corner by default. I could use the keyword origin=lower to avoid this but this changes the image orientation as well. So the upshot is that if I load an image with imread(..) and want to display the image in the same orientation as imshow(origin=upper) would but with the origin placed on the lower left corner, I would have to go through various rot90 & flip(ud/rl) operations. (As an aside, IMHO it is imread that should have the origin option and not imshow) It would be nice if there could be a specialized 2d array class (possibly subclassing ndarray) with additional information on how the array is to be interpreted and routines to convert from one to the other. I wanted other opinions on whether this is desirable/feasible? Thanks. Sameer -------------- next part -------------- An HTML attachment was scrubbed... URL: From ben.v.root at gmail.com Wed Dec 2 16:47:27 2015 From: ben.v.root at gmail.com (Benjamin Root) Date: Wed, 2 Dec 2015 16:47:27 -0500 Subject: [Matplotlib-users] 2d arrays issues In-Reply-To: References: Message-ID: You might want to check out xray. On Wed, Dec 2, 2015 at 4:40 PM, Sameer Grover wrote: > I was using matplotlib to plot 2d arrays (or equivalently images), getting > the user to choose some points, getting the x and y coordinates of those > points, and then doing calculations. Keeping track of indices proved to be > a source of frustration. > > This is because, given a 2d array, two different interpretations are > possible. In the first one, the first index is the (horizontal) x-axis and > the second index is the (vertical) y-axis. And in the other one, the first > index is the row (vertical axis) and the second one is the column > (horizontal axis). > > Matplotlib has always veered towards the second interpretation, perhaps > because it has been modelled on matlab, where everything is a 2d matrix (or > higher dimensional). But in numpy, where 1d arrays are first class objects, > this can get confusing. > > For example, if I were acquiring data as a function of two variables which > go on the x-axis and y-axis > > for x in x_vals: > for y in y_vals: > result[x,y] = f(x,y) > > either I would have to use contourf(x_vals, y_vals, result.T) or use > result[y,x] = f(x,y). Most programmers would probably be used to this, but > it's easy to slip up with large programs. > > The situation becomes even more confusing with imshow and imread because > the origin is placed on the upper left corner by default. I could use the > keyword origin=lower to avoid this but this changes the image orientation > as well. So the upshot is that if I load an image with imread(..) and want > to display the image in the same orientation as imshow(origin=upper) would > but with the origin placed on the lower left corner, I would have to go > through various rot90 & flip(ud/rl) operations. (As an aside, IMHO it is > imread that should have the origin option and not imshow) > > It would be nice if there could be a specialized 2d array class (possibly > subclassing ndarray) with additional information on how the array is to be > interpreted and routines to convert from one to the other. > > I wanted other opinions on whether this is desirable/feasible? > > Thanks. > > 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 joferkington at gmail.com Wed Dec 2 21:32:45 2015 From: joferkington at gmail.com (Joe Kington) Date: Wed, 2 Dec 2015 20:32:45 -0600 Subject: [Matplotlib-users] about your matplotlib code suggestions In-Reply-To: References: Message-ID: Hi Ekrem, >From the sounds of it, you're creating a stratigraphic column. It sounds you already have numerical values that correspond to lithology (or something similar). There's more than one way to approach this problem. Which way is best will depend on what you're doing, but here's one example. import numpy as np import matplotlib.pyplot as plt from matplotlib.colors import from_levels_and_colors # Tops and base of section (7 values) tops = np.array([780, 820, 850, 900, 910, 1000]) # Lithology in each interval (6 values) lith = np.array([1, 3, 2, 3, 2, 1]) # Left and right x-location of strat column x = np.array([0, 20]) # Set up a colormap and normalization instance to tie the intervals: # [1, 2) -> lightblue # [2, 3) -> yellow # [3, 4) -> brown cmap, norm = from_levels_and_colors([1, 2, 3, 4], ['lightblue', 'yellow', 'saddlebrown']) # Set up the figure with one axes fig, ax = plt.subplots() # We'll need the x, y, and z arrays to be 2D to use them with pcolor/pcolormesh. # Currently, they're 1D. Therefore, we'll add an axis to each by slicing with # None. Also, we'll use the colormap and norm we created earlier. ax.pcolormesh(x[None,:], tops[:,None], lith[:,None], cmap=cmap, norm=norm) # Optional, but to approriate for this situation... ax.set(xticks=[], title='Stratigraphic Section', ylabel='Depth (m)', aspect=1) ax.invert_yaxis() ax.margins(0) plt.show() A key portion to understand is how matplotlib handles colormaps. Colormaps take a scaled, 0 to 1 range and convert it to a color. Scaling the "raw" data to a 0 to 1 range is handled by a `Normalize` instance (by default, it just scales from the min of the data to the max). Because we want to link specific values to specific colors, we'll need both a norm and a colormap. Fortunately, there's a function that creates both given a set of levels and colors: `matplotlib.colors.from_levels_and_colors`. I'm using `pcolormesh` to plot the individual rectangles that make up the stratigraphic section. If you need more flexibility (e.g. a different width for each lithology), you could iterate over each interval and plot an individual rectangle. However, for the example you described, `pcolormesh` is a good fit. The part of this that's the hardest to understand is converting the 1D arrays to 2D for pcolormesh. `pcolormesh` expects the input x, y, z arrays to be 2D. We could tile (repeat) the arrays, but in this case it's easiest to add an extra "singleton" dimension by slicing with `None`. This winds up having the same effect as tiling the arrays when the arrays are "broadcast" together. If you're having trouble understanding this part (and how it relates to the corners of the quadrilaterals that `pcolormesh` makes), I'd be happy to show some more examples. Hope that helps a bit, at any rate. -Joe ? On Tue, Dec 1, 2015 at 11:00 AM, Ekrem _ wrote: > Hi.My name is Ekrem,Geophysicist.I have a question that about > matplotlib.What is your suggestion about matplotlib codes?I think that > explanation as schematic is very understandable.That; > > > > > very thanks for your suggestion code > > > > > _______________________________________________ > 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: pastedImage.png Type: image/png Size: 81120 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: figure_1-1.png Type: image/png Size: 16325 bytes Desc: not available URL: From fchabouis at gmail.com Thu Dec 3 15:54:49 2015 From: fchabouis at gmail.com (Francis Chabouis) Date: Thu, 3 Dec 2015 21:54:49 +0100 Subject: [Matplotlib-users] exporting tricontour function results In-Reply-To: References: Message-ID: Thank you to both of you, it's getting clearer. I understand only now that tricontourf is not "hiding" some information about who is an exterior and who is an interior...it doesn't have this information in the first place (If I get it right). I have managed to sort all those polygons and group them correctly. Probably not robust nor efficient, but good enough for the moment ! Cheers Francis 2015-12-02 21:48 GMT+01:00 Benjamin Root : > Ian, > > I see now how tricontourf()'s polygons are fundamentally different from > contourf()'s polygons (and explains the discrepancy the user is seeing), > and I see I misread your comments. That said, any sort of modification that > would change the output of to_polygons() in a substantial way would > certainly need major justification. The functions have been there for a > long time and people have come to expect them to behave in a certain way. > > Ben Root > > > On Wed, Dec 2, 2015 at 3:00 PM, Ian Thomas wrote: > >> Francis, >> >> Your question about interior and exterior polygons is already answered in >> the thread you keep referring to. I'll repeat it here. tricontouf does >> not return any information about which interior polygons are located inside >> which exterior polygons. All you get is a collection of polygons, composed >> of one or more exteriors and zero or more interiors, and they can be in any >> order. The backends take these arbitrary collections of exterior and >> interior polygons and render them correctly. As all of the backends are >> capable of calculating the exterior/interior containment themselves, there >> is no need for tricontourf to do it as well. >> >> contourf produces different output, grouping each exterior polygon with >> its contained interior polygons. This is because it dates from before all >> the backends were capable of calculating polygon containment, so contourf >> had to do it. The recent rewrite of the contourf C++ code still does this >> so that it produces output consistent with the legacy code. >> >> If you want take the output of tricontourf and calculate the >> exterior/interior containment, you'll either have to find some other >> library to do it, or write the code yourself. I have not looked into >> libraries that do this as I do not need this functionality. Writing the >> code to do it yourself is pretty easy, but making it robust and efficient >> is much harder. >> >> Ben, >> >> I think you have misunderstood my comments from last year. When I was >> talking about what I consider private, I was referring to the segs and >> kinds that are passed from C++ to python to make up the various Path >> objects. I didn't refer to the function to_polygons() being private, in >> fact I didn't refer to it at all. >> >> Ian >> >> On 1 December 2015 at 21:57, Francis Chabouis >> wrote: >> >>> Ben, >>> >>> 1. Exporting data like this was never an intended use => I understand >>> your point. In fact if calling the underlying C++ code for tricontour had >>> been easy I would happily have skipped the call to MPL. All I'm interested >>> in is the polygons coordinates really. >>> >>> 2. good news :) >>> >>> 3. please find the script attached. >>> >>> thanks >>> Francis >>> >>> 2015-12-01 22:33 GMT+01:00 Benjamin Root : >>> >>>> Francis, >>>> >>>> 1. Keep in mind, matplotlib is a plotting library first. Path >>>> simplification takes into account the resolution of the output device when >>>> used for drawing and essentially simplifies out any unresolvable features, >>>> which greatly reduces drawing time for complex plots. Exporting data like >>>> this was never an intended use. >>>> >>>> 2. I will have to respectfully disagree with Ian on this point. >>>> to_polygons() is not a private method and it is perfectly reasonable to >>>> expect it to be used by people outside the matplotlib codebase. As a >>>> developer, I would reject any patches that changes the output semantics of >>>> to_polygons() without going through a lengthy deprecation cycle. Plus, the >>>> primary use of this method is for easy input to Polygon artist objects, >>>> which has a constructor that isn't going to change, so why should >>>> to_polygons() change? >>>> >>>> 3. Without the source example data, I am at a bit of a loss for what is >>>> happening here. I could come up with all sorts of guesses, but I can't tell >>>> you for sure without having something I can run myself. >>>> >>>> Cheers! >>>> Ben Root >>>> >>>> >>>> On Tue, Dec 1, 2015 at 4:18 PM, Francis Chabouis >>>> wrote: >>>> >>>>> Thanks Ben for your answer. >>>>> >>>>> I didn't know about that should_simplify attribute. It was effectively >>>>> the reason for the disappearing points. Thanks a lot. >>>>> I still have a few questions if you don't mind : >>>>> >>>>> 1. [low importance] Isn't it weird to have this attribute set to True >>>>> by default ? I would find it more natural if simplification had to be >>>>> explicitly requested. >>>>> >>>>> 2. You say "The first element of that list is the external vertexes, >>>>> and the rest of the elements are all vertex lists of the internal holes." I >>>>> like this a lot, but are you sure it is true ? As it comes in contradiction >>>>> with Ian Thomas explanation : >>>>> >>>>> "The returned geometries are purposefully not documented. They are an >>>>> 'implementation detail' and not considered part of the public interface. >>>>> and as such they could change at any time and hence should not be relied >>>>> upon. Of course you can choose to access them if you wish, as I do myself >>>>> sometimes, but we make no promises about what the order of the polygons is, >>>>> or that it won't change tomorrow." >>>>> >>>>> >>>>> http://matplotlib.1069221.n5.nabble.com/Structure-of-contour-object-returned-from-tricontourf-td44203.html >>>>> >>>>> 3. I have done a simple test and the output looks like this (2 rings): >>>>> >>>>> [image: Images int?gr?es 1] >>>>> >>>>> So I'm a bit confused as : >>>>> >>>>> cs = plt.tricontourf(t, v, levels) >>>>> #cs.collections has 1 element (ok as there is only one level) >>>>> >>>>> for i,collection in enumerate(cs.collections): >>>>> for path in collection.get_paths(): >>>>> #collection.get_paths() has only 1 element, I would eventually >>>>> have expected 2 (1 for each ring) >>>>> polygons = path.to_polygons() >>>>> # polygons has 4 elements : the 4 rings are stored at the same >>>>> place >>>>> # how can I recognise the exteriors from the interiors ? >>>>> >>>>> Thanks for your help, >>>>> Francis >>>>> >>>>> >>>>> >>>>> 2015-11-30 19:37 GMT+01:00 Benjamin Root : >>>>> >>>>>> Francis, >>>>>> >>>>>> I bet you that the inconsistency in the number of vertexes is due to >>>>>> path simplification. The list of Path objects you get when you call >>>>>> get_paths() on the collection object each have an attribute >>>>>> "should_simplify" and that defaults to True. Set it to False, and you will >>>>>> have all of the vertexes. Also, what you want to call is to_polygons() on >>>>>> the Path object after setting "should_simplify" to False. That will return >>>>>> a list of lists. The first element of that list is the external vertexes, >>>>>> and the rest of the elements are all vertex lists of the internal holes. >>>>>> >>>>>> I hope this description helps. I can't really give you more detailed >>>>>> description due to the fact that I have developed software that does this >>>>>> very thing for my employer, but what you want is certainly possible. >>>>>> >>>>>> Also, as for whether or not we would want a geojson export function >>>>>> available for matplotlib, it isn't really correct to have it in matplotlib >>>>>> because we are a graphing library. However, it would make sense to make the >>>>>> process of extracting the polygon information a bit easier, which would >>>>>> make it easier for another package to be made that would export that >>>>>> information into various data formats, not just geojson. >>>>>> >>>>>> Cheers! >>>>>> Ben Root >>>>>> >>>>>> >>>>>> On Mon, Nov 30, 2015 at 12:46 PM, Francis Chabouis < >>>>>> fchabouis at gmail.com> wrote: >>>>>> >>>>>>> Hello, >>>>>>> I'm having some difficulties with the results of the tricontour >>>>>>> function. What I'm trying to achieve is fairly simple : I'd like to export >>>>>>> the results of the tricontour function as a geoJson. (I think a function >>>>>>> doing exactly this job would be nice to have in the library). >>>>>>> >>>>>>> I wrote this : >>>>>>> >>>>>>> cs = plt.tricontourf(t, v, levels) >>>>>>> >>>>>>> for i,collection in enumerate(cs.collections): >>>>>>> for path in collection.get_paths(): >>>>>>> >>>>>>> >>>>>>> Now I have this path object. >>>>>>> >>>>>>> My first problem : when I check the number of vertices (via >>>>>>> len(path.vertices)) I get 732 vertices. >>>>>>> If I try to access those vertices with iter_segments as recommended >>>>>>> in the doc, I get only 125 vertices. >>>>>>> seg = path.iter_segments() >>>>>>> print len(list(seg)) >>>>>>> ==> 125 >>>>>>> >>>>>>> Am I doing something wrong, or is it possibly a bug ? >>>>>>> >>>>>>> My second problem : geoJson works with interior and exterior rings. >>>>>>> To describe a polygon with a hole in it, we first declare a closed line >>>>>>> (that will be the exterior) and all the subsequent lines will be the >>>>>>> "holes" (interiors). It seems that what I get from iter_segments and >>>>>>> to_polygons is a bunch of lines, but there is no way to know which is an >>>>>>> interior, which is an exterior. But I guess this must be stored somewhere >>>>>>> as MPL is able to draw a graph from this information ! >>>>>>> >>>>>>> Any hints on how I should proceed ? >>>>>>> Let me know if you need additional information. >>>>>>> >>>>>>> Thanks >>>>>>> >>>>>>> ps : I got some of my infos from this thread : >>>>>>> http://matplotlib.1069221.n5.nabble.com/Structure-of-contour-object-returned-from-tricontourf-td44203.html >>>>>>> >>>>>>> ps2 : If I can write this function I would be happy to integrate it >>>>>>> in the lib if you're interested. >>>>>>> >>>>>>> _______________________________________________ >>>>>>> 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: image.png Type: image/png Size: 26890 bytes Desc: not available URL: From anshul6 at yahoo.com Fri Dec 4 08:23:12 2015 From: anshul6 at yahoo.com (anshul6) Date: Fri, 4 Dec 2015 06:23:12 -0700 (MST) Subject: [Matplotlib-users] Error on import matplotlib.pyplot (on Anaconda3 for Windows 10 Home 64-bit PC) In-Reply-To: References: <1448832396233-46477.post@n5.nabble.com> <1448915908211-46481.post@n5.nabble.com> <1448921898096-46484.post@n5.nabble.com> <1449001792605-46504.post@n5.nabble.com> Message-ID: <1449235392901-46520.post@n5.nabble.com> Just FYI: I reported the problem on "Python bug tracker" and their Windows experts are trying to debug it: bugs.python.org/issue25778 -- View this message in context: http://matplotlib.1069221.n5.nabble.com/Error-on-import-matplotlib-pyplot-on-Anaconda3-for-Windows-10-Home-64-bit-PC-tp46477p46520.html Sent from the matplotlib - users mailing list archive at Nabble.com. From tcaswell at gmail.com Fri Dec 4 08:50:37 2015 From: tcaswell at gmail.com (Thomas Caswell) Date: Fri, 04 Dec 2015 13:50:37 +0000 Subject: [Matplotlib-users] Error on import matplotlib.pyplot (on Anaconda3 for Windows 10 Home 64-bit PC) In-Reply-To: <1449235392901-46520.post@n5.nabble.com> References: <1448832396233-46477.post@n5.nabble.com> <1448915908211-46481.post@n5.nabble.com> <1448921898096-46484.post@n5.nabble.com> <1449001792605-46504.post@n5.nabble.com> <1449235392901-46520.post@n5.nabble.com> Message-ID: Thanks for the heads up. Looks like we will need to include the patch on our end for now as well. On Fri, Dec 4, 2015, 08:23 anshul6 via Matplotlib-users < matplotlib-users at python.org> wrote: > Just FYI: I reported the problem on "Python bug tracker" and their Windows > experts are trying to debug it: bugs.python.org/issue25778 > > > > -- > View this message in context: > http://matplotlib.1069221.n5.nabble.com/Error-on-import-matplotlib-pyplot-on-Anaconda3-for-Windows-10-Home-64-bit-PC-tp46477p46520.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 anshul6 at yahoo.com Mon Dec 7 14:25:04 2015 From: anshul6 at yahoo.com (anshul6) Date: Mon, 7 Dec 2015 12:25:04 -0700 (MST) Subject: [Matplotlib-users] Warning message on "import seaborn" Message-ID: <1449516304557-46522.post@n5.nabble.com> Apologies if this is not the right forum to report such things (if not please advise). I get the following annoying message regardless of whether Python2 or Python3 is used: In Python 3.5.0: In Python 2.7.10: -- View this message in context: http://matplotlib.1069221.n5.nabble.com/Warning-message-on-import-seaborn-tp46522.html Sent from the matplotlib - users mailing list archive at Nabble.com. From pmhobson at gmail.com Mon Dec 7 15:57:18 2015 From: pmhobson at gmail.com (Paul Hobson) Date: Mon, 7 Dec 2015 12:57:18 -0800 Subject: [Matplotlib-users] Warning message on "import seaborn" In-Reply-To: <1449516304557-46522.post@n5.nabble.com> References: <1449516304557-46522.post@n5.nabble.com> Message-ID: Even though your message got garbled, I know that warning you're talking about. Seaborn hasn't caught up to matplotlib 1.5 yet. I've been mean to send Michael (seaborn's author) a PR to address this, but haven't had time (feel free to tackle it yourself if you have the bandwidth). I don't think Michael has much time to work on seaborn lately either. But, it's just a warning. Annoying? Yes. A big deal? Most certainly not. -paul On Mon, Dec 7, 2015 at 11:25 AM, anshul6 via Matplotlib-users < matplotlib-users at python.org> wrote: > Apologies if this is not the right forum to report such things (if not > please > advise). I get the following annoying message regardless of whether > Python2 > or Python3 is used: > > In Python 3.5.0: > > > > In Python 2.7.10: > > > > > > -- > View this message in context: > http://matplotlib.1069221.n5.nabble.com/Warning-message-on-import-seaborn-tp46522.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 mdroettboom at continuum.io Wed Dec 9 17:47:13 2015 From: mdroettboom at continuum.io (Michael Droettboom) Date: Wed, 9 Dec 2015 17:47:13 -0500 Subject: [Matplotlib-users] matplotlib.org DNS Message-ID: There was a glitch in our recent transfer of the matplotlib.org domain such that our DNS went down for some portion of yesterday and today. It should be resolved now, but it may be some time until the records propagate back out to everyone. Apologies for the inconvenience. Mike -- Michael Droettboom Continuum Analytics -------------- next part -------------- An HTML attachment was scrubbed... URL: From joao.q.fonseca at gmail.com Thu Dec 10 16:29:29 2015 From: joao.q.fonseca at gmail.com (Joao Fonseca) Date: Thu, 10 Dec 2015 21:29:29 +0000 Subject: [Matplotlib-users] Matplotlib version in Jupyter Message-ID: I don?t know if this is the place to ask but why is the matplotlib version in my Jupyter different from that in numpy? I have 1.5 installed but Jupyter imports 1.4.3. Thanks Jo?o From jenshnielsen at gmail.com Thu Dec 10 16:36:32 2015 From: jenshnielsen at gmail.com (Jens Nielsen) Date: Thu, 10 Dec 2015 21:36:32 +0000 Subject: [Matplotlib-users] Matplotlib version in Jupyter In-Reply-To: References: Message-ID: You probably have to supply some more details to figure out what is going on. I assume that you mean ipython and not numpy? Jupyter can run several different kernels with different versions of python so it could be a different version of python? The easies way to figure out where python imports a library from is to do something like import matplotlib print(matplotlib.__file__) that will tell you the part to the top level file of the installation. Can you try that and report back the result? best Jens On Thu, 10 Dec 2015 at 21:29 Joao Fonseca wrote: > I don?t know if this is the place to ask but why is the matplotlib version > in my Jupyter different from that in numpy? I have 1.5 installed but > Jupyter imports 1.4.3. > > Thanks > > Jo?o > _______________________________________________ > 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 jenshnielsen at gmail.com Fri Dec 11 04:14:40 2015 From: jenshnielsen at gmail.com (Jens Nielsen) Date: Fri, 11 Dec 2015 09:14:40 +0000 Subject: [Matplotlib-users] Matplotlib version in Jupyter In-Reply-To: <6038BD80-67A1-4EFB-A765-B600588EE0ED@gmail.com> References: <6038BD80-67A1-4EFB-A765-B600588EE0ED@gmail.com> Message-ID: Glad that you figured it out. For future reference the output of `jupyter --data-dir` and `jupyter --config-dir` may be helpful for figuring out where jupyter stores its config files and kernels. I guess that you had a Jupyter kernel which ran with your old canopy python installation best Jens On Thu, 10 Dec 2015 at 22:25 Joao Fonseca wrote: > Fixed it. I removed all canopy files, then had to reinstall the ipython > kernel, although just reinstalling the kernel would have probably done the > trick. Thanks for your help, anyway. > > On 10 Dec 2015, at 21:36, Jens Nielsen wrote: > > > > You probably have to supply some more details to figure out what is > going on. I assume that you mean ipython and not numpy? > > Jupyter can run several different kernels with different versions of > python so it could be a different version of python? > > > > The easies way to figure out where python imports a library from is to > do something like > > > > import matplotlib > > print(matplotlib.__file__) > > > > that will tell you the part to the top level file of the installation. > Can you try that and report back the result? > > > > best > > Jens > > > > > > On Thu, 10 Dec 2015 at 21:29 Joao Fonseca > wrote: > > I don?t know if this is the place to ask but why is the matplotlib > version in my Jupyter different from that in numpy? I have 1.5 installed > but Jupyter imports 1.4.3. > > > > Thanks > > > > Jo?o > > _______________________________________________ > > 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 ekrem1982 at hotmail.com Mon Dec 7 11:52:56 2015 From: ekrem1982 at hotmail.com (Ekrem _) Date: Mon, 7 Dec 2015 16:52:56 +0000 Subject: [Matplotlib-users] about code suggestion Message-ID: Hi.This question that about rotation of Radial Based Function Interpolation Plot.I have run my program but axis rotation is necessary.What is your rotation code suggestion as easy? [cid:c8724f77-9099-4573-92c8-e6e44fad5054] -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: pastedImage.png Type: image/png Size: 60982 bytes Desc: pastedImage.png URL: From denis.samuylov at gmail.com Mon Dec 7 15:36:33 2015 From: denis.samuylov at gmail.com (Denis Samuylov) Date: Mon, 7 Dec 2015 21:36:33 +0100 Subject: [Matplotlib-users] Visualization of 3D and 4D image data: problem with spacing between subplots in grid plot Message-ID: Dear matplotlib users, I have to visualize 3 and 4 dimensional images and overlay on top some data (e.g. masks, tracking results, etc). I need a solution to explore (e.g. visualize inline in IPython) and to present my results (e.g. insert pdf into slides). I wrote a few functions using matplotlib and I can plot a sequence of projections of 3-D volumes: [image: Inline image 1] However, as you can see there is a problem with spacing near projections which makes the plot look not so nice. In ideal case I would like to have the same spacing between x- and y-projections and corresponding z-projection. I spend quite a lot of time trying to figure out how to do that with matplotlib APIs, but I still haven't found a solution. I would highly appreciate if you could help. I also posted this question on stackoverflow: http://stackoverflow.com/questions/34124267/visualize-3d-and-4d-image-data-in-python My full code is also available on Github: https://github.com/DSamuylov/imagend Minimal code to reproduce the problem is bellow. Thank you for your help! Best regards, Denis import mathimport numpy as npimport matplotlib.cm as cmimport matplotlib.pyplot as pltimport matplotlib.gridspec as gridspec def project_image_stack(img, figwidth=3, axes=None): dim = len(img.shape) assert dim == 3 n_slices, n_h, n_w = img.shape figheight = (figwidth)*np.float64(n_h + n_slices)/(n_w + n_slices) z_proj = np.mean(img, axis=0) y_proj = np.mean(img, axis=1) x_proj = np.mean(img, axis=2).T if axes is None: # Create figure fig = plt.figure(figsize=(figwidth, figheight)) gs = gridspec.GridSpec(2, 2, width_ratios=[n_w, n_slices], height_ratios=[n_h, n_slices]) gs.update(wspace=0.05, hspace=0.05, bottom=0, top=1, left=0, right=1) # Create axes: ax_z = fig.add_subplot(gs[0, 0]) ax_y = fig.add_subplot(gs[1, 0], sharex=ax_z) ax_x = fig.add_subplot(gs[0, 1], sharey=ax_z) else: assert len(axes) == 3 fig = None ax_z, ax_y, ax_x = axes # z projection: ax_z.imshow(z_proj, interpolation='nearest', cmap=cm.gray, aspect=1) ax_z.set_xlim([-0.5, n_w - 0.5]) ax_z.set_ylim([n_h - 0.5, -0.5]) ax_z.axis('off') # y projection: ax_y.imshow(y_proj, interpolation='nearest', cmap=cm.gray, aspect=1) ax_y.set_xlim([-0.5, n_w-0.5]) ax_y.set_ylim([n_slices-0.5, -0.5]) ax_y.axis('off') # x projection: ax_x.imshow(x_proj, interpolation='nearest', cmap=cm.gray, aspect=1) ax_x.set_xlim([-0.5, n_slices-0.5]) ax_x.set_ylim([n_h-0.5, -0.5]) ax_x.axis('off') return fig, (ax_z, ax_y, ax_x) def project_image_sequence(img_sequence, subfigwidth=3, ncol=5): dim = len(img_sequence.shape) assert dim == 4 n_frames, n_slices, n_h, n_w = img_sequence.shape frames = range(0, n_frames) n_subfig = len(frames) # Initialize parameters nrow = int(math.ceil(float(n_subfig)/ncol)) height_subfig = (n_h + n_slices)*np.float64(subfigwidth)/(n_w + n_slices) # Initialize the figure fig = plt.figure(figsize=(subfigwidth*ncol, height_subfig*nrow)) # Initialize the layout gs_master = gridspec.GridSpec(nrow, ncol) gs_master.update(bottom=0, top=1, left=0, right=1) # Magic for every (sub-)gridspec: wspace = 0.05 # [in] hspace = wspace*float(n_w + n_slices)/(n_h + n_slices) axes = [] for i in range(nrow): for j in range(ncol): ind = i*ncol + j if ind >= n_subfig: break gs = gridspec.GridSpecFromSubplotSpec( 2, 2, width_ratios=[n_w, n_slices], height_ratios=[n_h, n_slices], subplot_spec=gs_master[i, j], wspace=wspace, hspace=hspace, ) ax_z = plt.Subplot(fig, gs[0, 0]) ax_z.set_title('frame={}'.format(frames[ind])) ax_y = plt.Subplot(fig, gs[1, 0], sharex=ax_z) ax_x = plt.Subplot(fig, gs[0, 1], sharey=ax_z) project_image_stack(img_sequence[frames[ind]], axes=[ax_z, ax_y, ax_x]) fig.add_subplot(ax_z) fig.add_subplot(ax_y) fig.add_subplot(ax_x) axes.append((ax_z, ax_y, ax_x)) return fig, axes if __name__ == "__main__": image_sequence = np.random.rand(5, 20, 30, 40) fig, axes = project_image_sequence(image_sequence) fig.savefig("min_example.png", bbox_inches='tight') -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: sequence_of_projections.png Type: image/png Size: 41734 bytes Desc: not available URL: From reaganf2 at gmail.com Tue Dec 8 07:08:45 2015 From: reaganf2 at gmail.com (ragnarok) Date: Tue, 8 Dec 2015 05:08:45 -0700 (MST) Subject: [Matplotlib-users] Libertine font in Matplotlib? In-Reply-To: <5A058FF5-D547-4F49-A4B6-0D748346470A@mit.edu> References: <1287425067.3200.3.camel@falconeer> <6402F527DECB4AAFAC4F0D0229BC5E37@nrl.navy.mil> <1287603160.12883.4.camel@zetkin> <5A058FF5-D547-4F49-A4B6-0D748346470A@mit.edu> Message-ID: <1449576525387-46524.post@n5.nabble.com> I use the following lines in my preamble to create beamer slides:\usepackage{libertine} % For the Biolinum sans-serif font\usepackage[libertine]{newtxmath} % For the Libertine-compatible math font\usepackage[T1]{fontenc} % To choose T1 font encondingWhen I place plots created using matplotlib in these slides, I would like to use the same fonts in the plots to maintain the same look and style. I'm however having trouble with the math font loaded using the newtxmath package used in matplotlib. The following code snippets illustrate the problem:import matplotlib.pyplot as pltplt.rcParams['font.size'] = 20plt.rcParams['text.usetex'] = Trueplt.rcParams['text.latex.preamble'] = '\usepackage{libertine},\usepackage[libertine]{newtxmath},\usepackage[T1]{fontenc}'plt.axes()plt.title(r'$Mathematical\ equation: \alpha x + \beta y + \gamma z = \theta$')plt.show()produces the following plot: Note the incorrect character spacing and serifs on the characters. If I slightly tweak the text.latex.preamble parameter to the following (sfmath included in addition):plt.rcParams['text.latex.preamble'] = '\usepackage{libertine},\usepackage[libertine]{newtxmath},\usepackage{sfmath},\usepackage[T1]{fontenc}'I get the expected result: Why is this happening? Why does sfmath need to be included to get the expected result? Regular pdflatex compilation of beamer slides produces the same result without including the sfmath package. -- View this message in context: http://matplotlib.1069221.n5.nabble.com/Libertine-font-in-Matplotlib-tp25347p46524.html Sent from the matplotlib - users mailing list archive at Nabble.com. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gael.grissonnanche1 at gmail.com Fri Dec 11 12:29:08 2015 From: gael.grissonnanche1 at gmail.com (Aston630) Date: Fri, 11 Dec 2015 10:29:08 -0700 (MST) Subject: [Matplotlib-users] New colormaps : Inferno, Viridis, ... Message-ID: <1449854948771-46530.post@n5.nabble.com> Hi, I wanted to try today the new exciting colormaps that come with the 1.5.0 version of Matplotlib. I quickly discovered I could not use them the same as the previous colormaps. Indeed, in the past I used to do: import matplotlib as mpl cmap = mpl.cm.get_cmap("jet", nb_curves) # where cmap is LinearSegmentedColormap and from there get the colors the following way in order to # handle them the way I wanted for a set of curves or points or arrows etc... : colors = cmap(np.arange(nb_curves)) Now with the new colormaps I do the same: import matplotlib as mpl cmap = mpl.cm.get_cmap("inferno", nb_curves) where cmap is now a ListedColormap and I cannot do what I used to do before. My first question would be : why this difference between old and new colormaps? Then, is there a way I could get a LinearSegmentedColormap from Inferno, Viridis, etc... ? This is really what I want. Thanks a lot for your time and considering this issue! -- View this message in context: http://matplotlib.1069221.n5.nabble.com/New-colormaps-Inferno-Viridis-tp46530.html Sent from the matplotlib - users mailing list archive at Nabble.com. From efiring at hawaii.edu Sun Dec 13 12:55:35 2015 From: efiring at hawaii.edu (Eric Firing) Date: Sun, 13 Dec 2015 07:55:35 -1000 Subject: [Matplotlib-users] New colormaps : Inferno, Viridis, ... In-Reply-To: <1449854948771-46530.post@n5.nabble.com> References: <1449854948771-46530.post@n5.nabble.com> Message-ID: <566DB117.8070408@hawaii.edu> On 2015/12/11 7:29 AM, Aston630 wrote: > Hi, > > I wanted to try today the new exciting colormaps that come with the 1.5.0 > version of Matplotlib. I quickly discovered I could not use them the same as > the previous colormaps. Indeed, in the past I used to do: > > import matplotlib as mpl > cmap = mpl.cm.get_cmap("jet", nb_curves) > > # where cmap is LinearSegmentedColormap and from there get the colors the > following way in order to > # handle them the way I wanted for a set of curves or points or arrows > etc... : > colors = cmap(np.arange(nb_curves)) > > Now with the new colormaps I do the same: > > import matplotlib as mpl > cmap = mpl.cm.get_cmap("inferno", nb_curves) > > where cmap is now a ListedColormap and I cannot do what I used to do before. > > My first question would be : why this difference between old and new > colormaps? The LinearSegmentedColormap has quite a bit of machinery that is not needed when colormaps can be supplied as a long list of smoothly varying colors, for which ListedColormap is a natural fit. What we missed, however, is a bug that you have found: the _resample() method of ListedColormap is not doing what it should do. > Then, is there a way I could get a LinearSegmentedColormap from Inferno, > Viridis, etc... ? This is really what I want. Fixing _resample() would solve your problem; the only difference in usage between LinearSegmentedColormap and ListedColormap is in the inputs used to initialize them. Once properly initialized, the color lookup mechanism is the same for both because it is inherited from the common base class. Would you mind opening an issue on github for this? Eric > > Thanks a lot for your time and considering this issue! > > > > -- > View this message in context: http://matplotlib.1069221.n5.nabble.com/New-colormaps-Inferno-Viridis-tp46530.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 > From ben.v.root at gmail.com Mon Dec 14 15:47:30 2015 From: ben.v.root at gmail.com (Benjamin Root) Date: Mon, 14 Dec 2015 15:47:30 -0500 Subject: [Matplotlib-users] about code suggestion In-Reply-To: References: Message-ID: Without seeing your code, I am assuming that you are using pcolor() or pcolormesh(). If so, I would transpose the image data and switch the x and y coordinate array arguments. For example, if your code looked something like this: plt.pcolormesh(x, y, data) Just do: plt.pcolormesh(y, x, data.T) You would also need to modify the calls to scatter() that you are using to plot those circles so that you switch the x and y arguments around. I hope that helps. Ben Root On Mon, Dec 7, 2015 at 11:52 AM, Ekrem _ wrote: > Hi.This question that about rotation of Radial Based Function > Interpolation * Plot*.I have run my program but axis rotation is > necessary.What is your rotation code suggestion as easy? > > > > > > > _______________________________________________ > 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: pastedImage.png Type: image/png Size: 60982 bytes Desc: not available URL: From japow75 at gmail.com Mon Dec 14 15:09:42 2015 From: japow75 at gmail.com (JP) Date: Mon, 14 Dec 2015 15:09:42 -0500 Subject: [Matplotlib-users] Possible gallery code. Message-ID: The first example, three_by_three.py, is an example of the complete bipartite graph of K3,3 minimally connected using a bezier curve to connect the 3rd node. The second example, ten_by_ten.py, is a graph of a minimally connected K10,10 graph as conjectured by Zarankiewicz. -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: ten_by_ten.png Type: image/png Size: 131292 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: ten_by_ten.py Type: text/x-python Size: 2251 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: three_by_three.png Type: image/png Size: 35535 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: three_by_three.py Type: text/x-python Size: 1429 bytes Desc: not available URL: From edwardlrichards at gmail.com Mon Dec 14 17:23:57 2015 From: edwardlrichards at gmail.com (Edward Richards) Date: Mon, 14 Dec 2015 14:23:57 -0800 Subject: [Matplotlib-users] SpanSelector span_stays does not work for me In-Reply-To: References: Message-ID: <566F417D.8020700@gmail.com> I sent the original message to the source forge mailing list. Woops. Thanks for the response anyways. The span stays highlighted when I set useblit=False. The performance hit isn't too bad, and I will stay with this option for the moment. *** Response *** Have you tried setting "useblit=False"? If that works, I wonder if we accidentally broke something in the recent widget interactivity work... Ben Root *** Original Message *** I am selecting a region of a color plot with span selector, and I would like the selected region to stay highlighted. I found the span_stays flag, but the selection rectangle still disappears after I release the mouse. Any help is appreciated. Thanks, Ned My backend is 'TkAgg' I am running the script from python3.4 at the command line, my version is: Python 3.4.3 (default, Jun 19 2015, 05:46:30) [GCC 4.8.3 20140911 (Red Hat 4.8.3-9)] on linux Type "help", "copyright", "credits" or "license" for more information. print(matplotlib.__version__) 1.5.0 code example: import numpy as np import matplotlib.pyplot as plt from matplotlib.widgets import SpanSelector test_data = np.random.randn(1000, 1000) fig, ax = plt.subplots() ax.imshow(test_data) def selection(x1, x2): """This function isn't the point""" pass span = SpanSelector(ax, selection, 'horizontal', useblit=True, rectprops=dict(alpha=0.5, facecolor='red'), span_stays=True) plt.show() From ben.v.root at gmail.com Mon Dec 14 17:51:17 2015 From: ben.v.root at gmail.com (Benjamin Root) Date: Mon, 14 Dec 2015 17:51:17 -0500 Subject: [Matplotlib-users] SpanSelector span_stays does not work for me In-Reply-To: <566F417D.8020700@gmail.com> References: <566F417D.8020700@gmail.com> Message-ID: Good to know that you have a work-around. Do you mind filing a bug report on this? On Mon, Dec 14, 2015 at 5:23 PM, Edward Richards wrote: > I sent the original message to the source forge mailing list. Woops. > Thanks for the response anyways. > > The span stays highlighted when I set useblit=False. The performance hit > isn't too bad, and I will stay with this option for the moment. > > *** Response *** > > Have you tried setting "useblit=False"? If that works, I wonder if we > accidentally broke something in the recent widget interactivity work... > > > Ben Root > > *** Original Message *** > > I am selecting a region of a color plot with span selector, and I would > like the selected region to stay highlighted. I found the span_stays flag, > but the selection rectangle still disappears after I release the mouse. > > Any help is appreciated. > Thanks, > Ned > > My backend is 'TkAgg' > > I am running the script from python3.4 at the command line, my version is: > > Python 3.4.3 (default, Jun 19 2015, 05:46:30) > [GCC 4.8.3 20140911 (Red Hat 4.8.3-9)] on linux > Type "help", "copyright", "credits" or "license" for more information. > > print(matplotlib.__version__) > 1.5.0 > > code example: > > import numpy as np > import matplotlib.pyplot as plt > from matplotlib.widgets import SpanSelector > > test_data = np.random.randn(1000, 1000) > fig, ax = plt.subplots() > ax.imshow(test_data) > > def selection(x1, x2): > """This function isn't the point""" > pass > > span = SpanSelector(ax, selection, 'horizontal', useblit=True, > rectprops=dict(alpha=0.5, facecolor='red'), > span_stays=True) > 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 ndbecker2 at gmail.com Thu Dec 17 07:33:59 2015 From: ndbecker2 at gmail.com (Neal Becker) Date: Thu, 17 Dec 2015 07:33:59 -0500 Subject: [Matplotlib-users] truetype font is missing table Message-ID: I reported this before, but now have new info. This is matplotlib-1.5.0 on fedora 23. Now I have installed anaconda, and am trying to use it. Unfortunately, although anaconda has it's own version of stix, it seems mpl is still preferring the fedora versions which seem to cause this problem. I believe it's because fedora uses otf fonts - anaconda has ttf fonts that might work. How can I tell mpl to prefer the anaconda ones? ... [finds fedora versions] findfont: Matching :family=stix:style=normal:variant=normal:weight=400:stretch=normal:size=medium to STIX ('/usr/share/fonts/stix/STIX-Regular.otf') with score of 0.000000 ... [finds anaconda versions] findfont: Matching :family=STIXNonUnicode:style=normal:variant=normal:weight=700:stretch=normal:size=12.0 to STIXNonUnicode ('/home/nbecker/.local/lib/python3.4/site- packages/matplotlib/mpl-data/fonts/ttf/STIXNonUniBol.ttf') with score of 0.000000 findfont: Matching :family=STIXGeneral:style=normal:variant=normal:weight=normal:stretch=normal:size=12.0 to STIXGeneral ('/home/nbecker/.local/lib/python3.4/site- packages/matplotlib/mpl-data/fonts/ttf/STIXGeneral.ttf') with score of 0.000000 ... [seems to pick fedora version] Assigning font /b'F1' = '/usr/share/fonts/stix/STIX-Regular.otf' findfont: Matching :family=stix:style=normal:variant=normal:weight=400:stretch=normal:size=large to STIX ('/usr/share/fonts/stix/STIX-Regular.otf') with score of 0.000000 Embedding font /usr/share/fonts/stix/STIX-Regular.otf ... Embedding font /usr/share/fonts/stix/STIX-Regular.otf Writing TrueType font Traceback (most recent call last): File "linear_awgn_ascma_vs_scma.py", line 28, in plt.savefig ('test.pdf') File "/home/nbecker/anaconda3/lib/python3.5/site- packages/matplotlib/pyplot.py", line 688, in savefig res = fig.savefig(*args, **kwargs) File "/home/nbecker/anaconda3/lib/python3.5/site- packages/matplotlib/figure.py", line 1539, in savefig self.canvas.print_figure(*args, **kwargs) File "/home/nbecker/anaconda3/lib/python3.5/site- packages/matplotlib/backends/backend_qt5agg.py", line 196, in print_figure FigureCanvasAgg.print_figure(self, *args, **kwargs) File "/home/nbecker/anaconda3/lib/python3.5/site- packages/matplotlib/backend_bases.py", line 2230, in print_figure **kwargs) File "/home/nbecker/anaconda3/lib/python3.5/site- packages/matplotlib/backends/backend_pdf.py", line 2542, in print_pdf file.close() File "/home/nbecker/anaconda3/lib/python3.5/site- packages/matplotlib/backends/backend_pdf.py", line 547, in close self.writeFonts() File "/home/nbecker/anaconda3/lib/python3.5/site- packages/matplotlib/backends/backend_pdf.py", line 650, in writeFonts fonts[Fx] = self.embedTTF(realpath, chars[1]) File "/home/nbecker/anaconda3/lib/python3.5/site- packages/matplotlib/backends/backend_pdf.py", line 1125, in embedTTF return embedTTFType3(font, characters, descriptor) File "/home/nbecker/anaconda3/lib/python3.5/site- packages/matplotlib/backends/backend_pdf.py", line 911, in embedTTFType3 filename.encode(sys.getfilesystemencoding()), glyph_ids) RuntimeError: TrueType font is missing table From efiring at hawaii.edu Sat Dec 19 01:41:50 2015 From: efiring at hawaii.edu (Eric Firing) Date: Fri, 18 Dec 2015 20:41:50 -1000 Subject: [Matplotlib-users] Possible gallery code. In-Reply-To: References: Message-ID: <5674FC2E.9090207@hawaii.edu> On 2015/12/14 10:09 AM, JP wrote: > The first example, three_by_three.py, is an example of the complete > bipartite graph of K3,3 minimally connected using a bezier curve to > connect the 3rd node. > > The second example, ten_by_ten.py, is a graph of a minimally connected > K10,10 graph as conjectured by Zarankiewicz. The examples are nice, and there should be a place for them somewhere, but I don't think we want to have any external dependencies like networkx in the gallery. Does networkx have a gallery? If so, that might be the proper home. Eric From adlinds3 at ncsu.edu Mon Dec 21 15:01:14 2015 From: adlinds3 at ncsu.edu (Alexander Lindsay) Date: Mon, 21 Dec 2015 15:01:14 -0500 Subject: [Matplotlib-users] Creating side by side graphs with different scales Message-ID: <56785A8A.5080302@ncsu.edu> Hi all, Attached is a figure showing what I hope to achieve. I have two domains that are connected but which have dramatically different scaling on either side of their interface. I would like the x axis to be in micrometers on one side of the interface and nanometers on the other side. I also want to be able to use a different y-axis on both sides (e.g. range 0 - 1e19 on one side and and range 0 - 1e23 on the other side). Yet I would like to juxtapose the two plots together as shown in the attached figure. Is this possible with matplotlib? If so, what's the best way to go about doing this? Alex -------------- next part -------------- A non-text attachment was scrubbed... Name: Plasma-water interface e_conc n E field.jpg Type: image/jpeg Size: 172781 bytes Desc: not available URL: From ben.v.root at gmail.com Mon Dec 21 15:20:18 2015 From: ben.v.root at gmail.com (Benjamin Root) Date: Mon, 21 Dec 2015 15:20:18 -0500 Subject: [Matplotlib-users] Creating side by side graphs with different scales In-Reply-To: <56785A8A.5080302@ncsu.edu> References: <56785A8A.5080302@ncsu.edu> Message-ID: Yes, it is possible. We call them "ganged plots". Here is an example where it was done in the y-axis: http://matplotlib.org/examples/pylab_examples/ganged_plots.html There are also other examples that show how to put the axis labels in different places than usual. Another way to go about this is to use twinx() to get the y-axis labeling to be easy, but then have a specially crafted scale for the x-axis. In the end, that might be more straight-forward, but probably a bit harder to code up at first if you haven't played around with axis locators and formatters. I hope that helps. Let us know if you have any questions. Cheers! Ben Root On Mon, Dec 21, 2015 at 3:01 PM, Alexander Lindsay wrote: > Hi all, > > Attached is a figure showing what I hope to achieve. I have two domains > that are connected but which have dramatically different scaling on either > side of their interface. I would like the x axis to be in micrometers on > one side of the interface and nanometers on the other side. I also want to > be able to use a different y-axis on both sides (e.g. range 0 - 1e19 on one > side and and range 0 - 1e23 on the other side). Yet I would like to > juxtapose the two plots together as shown in the attached figure. Is this > possible with matplotlib? If so, what's the best way to go about doing this? > > Alex > > _______________________________________________ > 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 fabien.maussion at gmail.com Tue Dec 22 10:35:16 2015 From: fabien.maussion at gmail.com (Fabien) Date: Tue, 22 Dec 2015 16:35:16 +0100 Subject: [Matplotlib-users] matplotlib.tests in mpl 1.5 conda builds Message-ID: Hi, I am using matplotlib's testing framework for my own project (mostly the image_comparison decorator). With the latest 1.5 builds on conda (not the pip install and not with 1.4.3), I get the following error when running: >>> from matplotlib.testing.decorators import image_comparison Traceback (most recent call last): File "", line 1, in File "/home/mowglie/.bin/conda/envs/oggm/lib/python3.4/site-packages/matplotlib/testing/decorators.py", line 19, in import matplotlib.tests ImportError: No module named 'matplotlib.tests' Any idea on why this happens? Thanks! Fabien From tcaswell at gmail.com Tue Dec 22 10:44:35 2015 From: tcaswell at gmail.com (Thomas Caswell) Date: Tue, 22 Dec 2015 15:44:35 +0000 Subject: [Matplotlib-users] matplotlib.tests in mpl 1.5 conda builds In-Reply-To: References: Message-ID: The 1.5.0 conda package does not ship with our test images (making the image _way_ smaller). This was reported https://github.com/matplotlib/matplotlib/issues/5487 and is fixed upstream (but not released yet). The tests should be packaged by continuum as a separate package, but that does not seem to be the case yet. There is an (I assume) unofficial build of matplotlib-tests you can install via conda install -c msarahan matplotlib-tests Tom On Tue, Dec 22, 2015 at 10:35 AM Fabien wrote: > Hi, > > I am using matplotlib's testing framework for my own project (mostly the > image_comparison decorator). > > With the latest 1.5 builds on conda (not the pip install and not with > 1.4.3), I get the following error when running: > > >>> from matplotlib.testing.decorators import image_comparison > Traceback (most recent call last): > File "", line 1, in > File > > "/home/mowglie/.bin/conda/envs/oggm/lib/python3.4/site-packages/matplotlib/testing/decorators.py", > line 19, in > import matplotlib.tests > ImportError: No module named 'matplotlib.tests' > > Any idea on why this happens? > > Thanks! > > Fabien > > > _______________________________________________ > 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 fabien.maussion at gmail.com Tue Dec 22 11:37:59 2015 From: fabien.maussion at gmail.com (Fabien) Date: Tue, 22 Dec 2015 17:37:59 +0100 Subject: [Matplotlib-users] matplotlib.tests in mpl 1.5 conda builds In-Reply-To: References: Message-ID: On 12/22/2015 04:44 PM, Thomas Caswell wrote: > This was reported https://github.com/matplotlib/matplotlib/issues/5487 > and is fixed upstream (but not released yet). Thanks Thomas, sorry for not finding this one. Cheers, Fabien From info at raoulcollenteur.nl Wed Dec 23 06:33:49 2015 From: info at raoulcollenteur.nl (Raoul Collenteur) Date: Wed, 23 Dec 2015 12:33:49 +0100 Subject: [Matplotlib-users] table border line color Message-ID: Hello, I have been looking around for an answer to this question, but I have not come around anything yet. the matplotlib table feature works fine, but I need some help with the details. I want to change the border color of the table, but can?t figure out how to do this. My code looks like this: ax5 = plt.subplot() ax5.xaxis.set_visible(False) ax5.yaxis.set_visible(False) text = 'Example' colLabels='B' ytable = ax5.table(cellText=text, colLabels=colLabels, loc='center') ytable.scale(1,0.6) Anyone knows how to change the border color of the table (cells)? Cheers, Raoul From brooklinen at gmail.com Sat Dec 26 18:51:34 2015 From: brooklinen at gmail.com (BK Linen) Date: Sat, 26 Dec 2015 18:51:34 -0500 Subject: [Matplotlib-users] Question re: installing basemap in ipython Message-ID: Hi, I would like to install basemap to use with ipython to map lat,long points on a map. I have downloaded the following basemap master folder ( https://github.com/matplotlib/basemap) and issued the install command, !python setup.py install, in ipython while the working directory was set to the main basemap folder. However, I get an error which appears to be related to a missing file associated with visual studio: "error: Unable to find vcvarsall.bat" To my knowledge, visual studio has not been installed on this machine. I'm wondering if I need to install visual studio in order to install basemap for python or if there is a work around. If you could point me in the right direction, I would greatly appreciate it. Many thanks in advance. -------------- next part -------------- An HTML attachment was scrubbed... URL: From gael.grissonnanche1 at gmail.com Sun Dec 27 08:46:07 2015 From: gael.grissonnanche1 at gmail.com (Aston630) Date: Sun, 27 Dec 2015 06:46:07 -0700 (MST) Subject: [Matplotlib-users] New colormaps : Inferno, Viridis, ... In-Reply-To: <566DB117.8070408@hawaii.edu> References: <1449854948771-46530.post@n5.nabble.com> <566DB117.8070408@hawaii.edu> Message-ID: <1451223967197-46558.post@n5.nabble.com> Thank you very much for your answer, I really appreciate your help! I would not mind opening an issue on github, but I never did it and I am not sure how to go forward with the procedure...could somebody else do it for me? I am sorry about that. Thanks again for everything! -- View this message in context: http://matplotlib.1069221.n5.nabble.com/New-colormaps-Inferno-Viridis-tp46530p46558.html Sent from the matplotlib - users mailing list archive at Nabble.com. From chaochinyang at icloud.com Mon Dec 28 04:26:40 2015 From: chaochinyang at icloud.com (Chao-Chin Yang) Date: Mon, 28 Dec 2015 10:26:40 +0100 Subject: [Matplotlib-users] em-dash not correctly displayed in saved pdf when using tex Message-ID: Hi, I am having issues with producing an em-dash in pdf when using tex. A sample script is as below: #!/usr/bin/env python3 import matplotlib.pyplot as plt import math import numpy as np x = np.linspace(0, 2 * math.pi) y = np.cos(x) plt.plot(x, y) plt.suptitle(r"abc --- def") plt.savefig("test.pdf") plt.show() I have customized rc parameters: backend = ?TkAgg? font.family = ?serif? text.usetex = True image.cmap = ?CMRmap" The plot rendered on screen looks fine. However, there are some weird characters showing up right before the em-dash in the saved pdf, as attached here. -------------- next part -------------- A non-text attachment was scrubbed... Name: test.pdf Type: application/pdf Size: 148357 bytes Desc: not available URL: -------------- next part -------------- I am using Linux Mint 17.3, and uname -a gives Linux Eridanus 3.19.0-32-generic #37~14.04.1-Ubuntu SMP Thu Oct 22 09:41:40 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux I am using python 3.4.3 + matplotlib 1.3.1, the latter of which is kind of old, but still remains the latest in the Ubuntu LTS repository. On the other had, I have installed the texlive-full package, which should include all the tex related packages. My dvipng is 1.14, and my ghostscript is 9.10. I have also tried different backends like Agg or PDF, but it makes no difference. I have tried googling around for similar issues, but had no luck. It would be very much appreciated If anyone had some idea how this comes about. Sincerely, Chao-Chin