From Oliver.Holmes at smtonline.de Tue Mar 1 09:21:18 2016 From: Oliver.Holmes at smtonline.de (Holmes, Oliver) Date: Tue, 1 Mar 2016 14:21:18 +0000 Subject: [Matplotlib-users] Need help to solve performance problems Message-ID: <7D0055CD-FD39-4E77-A7BE-1E4F96FCB2DA@smtonline.de> Hey all, I?m trying to use matplotlib on a Raspberry Pi to visualize data the Pi receives via serial port - and of course I?m new to Python and matplotlib. The visualization need not be online, rather in form of a PDF once no more data is received. Then however as quick as possible. Please refer to my SO question for more details: http://stackoverflow.com/questions/35629471/need-help-to-solve-performance-problems-of-matplotlib-on-a-raspberry-pi Nevertheless here is a brief summary: During the better part of an hour my program does nothing but wait for input on the serial port, which is received once a second. During this waiting time it could already begin rendering the chart, and then just save it to file, once it?s done. I have not found out how to do this however. Whats more, I have read quite discouraging posts concerning the need to recalculate the axes and so forth. As an alternative to rendering the entire grid in the program, I guess it would be an improvement (speedwise) if I could just use an image of the grid and repeat it (as in tiling). But I have not quite found the means to do that either. Concerning the grid layout please refer to my other SO question http://stackoverflow.com/questions/35551080/is-it-possible-to-generate-a-chart-with-this-very-specific-background. Thanks a lot for reading?and perhaps answering :) Kind regards, Oliver Holmes -------------- next part -------------- An HTML attachment was scrubbed... URL: From ben.v.root at gmail.com Tue Mar 1 11:22:35 2016 From: ben.v.root at gmail.com (Benjamin Root) Date: Tue, 1 Mar 2016 11:22:35 -0500 Subject: [Matplotlib-users] Need help to solve performance problems In-Reply-To: <7D0055CD-FD39-4E77-A7BE-1E4F96FCB2DA@smtonline.de> References: <7D0055CD-FD39-4E77-A7BE-1E4F96FCB2DA@smtonline.de> Message-ID: Sounds like you are describing the need for blitting, which most of the backends support in one way or another. The blitting pathways were designed with animations in mind, but I don't see why it couldn't be hijacked for your use as well. Note, you will have to do manual calls to copy_from_bbox() and such, but it should be doable. Ben Root On Tue, Mar 1, 2016 at 9:21 AM, Holmes, Oliver wrote: > Hey all, > > I?m trying to use matplotlib on a Raspberry Pi to visualize data the Pi > receives via serial port - and of course I?m new to Python and matplotlib. > The visualization need not be online, rather in form of a PDF once no more > data is received. Then however as quick as possible. Please refer to my SO > question for more details: > http://stackoverflow.com/questions/35629471/need-help-to-solve-performance-problems-of-matplotlib-on-a-raspberry-pi > Nevertheless here is a brief summary: During the better part of an hour my > program does nothing but wait for input on the serial port, which is > received once a second. During this waiting time it could already begin > rendering the chart, and then just save it to file, once it?s done. I have > not found out how to do this however. Whats more, I have read quite > discouraging posts concerning the need to recalculate the axes and so > forth. As an alternative to rendering the entire grid in the program, I > guess it would be an improvement (speedwise) if I could just use an image > of the grid and repeat it (as in tiling). But I have not quite found the > means to do that either. Concerning the grid layout please refer to my > other SO question > http://stackoverflow.com/questions/35551080/is-it-possible-to-generate-a-chart-with-this-very-specific-background > . > > Thanks a lot for reading?and perhaps answering :) > > Kind regards, > Oliver Holmes > > _______________________________________________ > 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 spam+matplotlib at phyks.me Tue Mar 1 11:59:23 2016 From: spam+matplotlib at phyks.me (Phyks) Date: Tue, 1 Mar 2016 17:59:23 +0100 Subject: [Matplotlib-users] Closing figures in nbagg mode Message-ID: <56D5CA6B.7090608@phyks.me> Hi, I have a jupyter notebook (using "%matplotlib notebook") which is drawing a lot of figures using matplotlib. When I run all the cells, I have more than 20 figures and then get the following warning: /home/phyks/.local/share/virtualenvs/physique/lib/python3.5/site-packages/matplotlib/pyplot.py:516: RuntimeWarning: More than 20 figures have been opened. Figures created through the pyplot interface (`matplotlib.pyplot.figure`) are retained until explicitly closed and may consume too much memory. (To control this warning, see the rcParam `figure.max_open_warning`). max_open_warning, RuntimeWarning) I was wondering what is the correct workflow for handling it. I mean, should I close the figures regularly, or can I just leave them open (at the expense of memory and CPU usage)? Moreover, I am not sure to fully understand how to close them. https://github.com/matplotlib/matplotlib/issues/4281 tends to make me think it is not enough to just click the top right X to close them, contrary to what I would have thought. Thanks! -- Phyks From jenshnielsen at gmail.com Wed Mar 2 09:12:33 2016 From: jenshnielsen at gmail.com (Jens Nielsen) Date: Wed, 02 Mar 2016 14:12:33 +0000 Subject: [Matplotlib-users] Closing figures in nbagg mode In-Reply-To: <56D5CA6B.7090608@phyks.me> References: <56D5CA6B.7090608@phyks.me> Message-ID: Hi Phyks You don't supply any information about which version of matplotlib you are using (since you are talking about a cross in the upper right i guess you are using 1.4.x as we changed that icon in 1.5) so this is a bit of a guess work. #4281 is a closed issue because this has been fixed and the fix is in matplotlib 1.5.0 and 1.5.1. If you are running 1.4.x there is a bug that prevents figures from being closed correctly when the cell is being rerun and the number of figures rapidly exceeds 20 if you rerun the same cells multiple times. In 1.5.x and forwards a figure will be correctly. If you are using the notebook backend with matplotlib 1.4.x I strongly urge you to upgrade. If you really have a notebook with more than 20 individual figures you are likely to suffer from degraded performance and should perhaps consider if splitting the notebook into multiple makes sense. best Jens On Tue, 1 Mar 2016 at 16:59 Phyks wrote: > Hi, > > I have a jupyter notebook (using "%matplotlib notebook") which is > drawing a lot of figures using matplotlib. When I run all the cells, I > have more than 20 figures and then get the following warning: > > > /home/phyks/.local/share/virtualenvs/physique/lib/python3.5/site-packages/matplotlib/pyplot.py:516: > RuntimeWarning: More than 20 figures have been opened. Figures created > through the pyplot interface (`matplotlib.pyplot.figure`) are retained > until explicitly closed and may consume too much memory. (To control > this warning, see the rcParam `figure.max_open_warning`). > max_open_warning, RuntimeWarning) > > > I was wondering what is the correct workflow for handling it. I mean, > should I close the figures regularly, or can I just leave them open (at > the expense of memory and CPU usage)? > > Moreover, I am not sure to fully understand how to close them. > https://github.com/matplotlib/matplotlib/issues/4281 tends to make me > think it is not enough to just click the top right X to close them, > contrary to what I would have thought. > > Thanks! > -- > Phyks > _______________________________________________ > 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 spam+matplotlib at phyks.me Wed Mar 2 09:49:13 2016 From: spam+matplotlib at phyks.me (Phyks) Date: Wed, 2 Mar 2016 15:49:13 +0100 Subject: [Matplotlib-users] Closing figures in nbagg mode In-Reply-To: References: <56D5CA6B.7090608@phyks.me> Message-ID: <56D6FD69.1070904@phyks.me> Hi, Sorry, I missed the infos about matplotlib version. I use the up-to-date version (1.5.1). And indeed, it is not a cross, but a "shutdown" button, got confused by the old version I saw on another computer. Thanks for the infos about the state of the issue, closing the figures in the notebook should then be fine! Le 02/03/2016 15:12, Jens Nielsen a ?crit : > Hi Phyks > > You don't supply any information about which version of matplotlib you are > using (since you are talking about a cross in the upper right i guess you > are using 1.4.x as we changed that icon in 1.5) so this is a bit of a guess > work. > > #4281 is a closed issue because this has been fixed and the fix is in > matplotlib 1.5.0 and 1.5.1. If you are running 1.4.x there is a bug that > prevents figures from being closed correctly when the cell is being rerun > and the number of figures rapidly exceeds 20 if you rerun the same cells > multiple times. In 1.5.x and forwards a figure will be correctly. If you > are using the notebook backend with matplotlib 1.4.x I strongly urge you to > upgrade. > > If you really have a notebook with more than 20 individual figures you are > likely to suffer from degraded performance and should perhaps consider if > splitting the notebook into multiple makes sense. > > best > Jens > > On Tue, 1 Mar 2016 at 16:59 Phyks wrote: > >> Hi, >> >> I have a jupyter notebook (using "%matplotlib notebook") which is >> drawing a lot of figures using matplotlib. When I run all the cells, I >> have more than 20 figures and then get the following warning: >> >> >> /home/phyks/.local/share/virtualenvs/physique/lib/python3.5/site-packages/matplotlib/pyplot.py:516: >> RuntimeWarning: More than 20 figures have been opened. Figures created >> through the pyplot interface (`matplotlib.pyplot.figure`) are retained >> until explicitly closed and may consume too much memory. (To control >> this warning, see the rcParam `figure.max_open_warning`). >> max_open_warning, RuntimeWarning) >> >> >> I was wondering what is the correct workflow for handling it. I mean, >> should I close the figures regularly, or can I just leave them open (at >> the expense of memory and CPU usage)? >> >> Moreover, I am not sure to fully understand how to close them. >> https://github.com/matplotlib/matplotlib/issues/4281 tends to make me >> think it is not enough to just click the top right X to close them, >> contrary to what I would have thought. >> >> Thanks! >> -- >> Phyks >> _______________________________________________ >> Matplotlib-users mailing list >> Matplotlib-users at python.org >> https://mail.python.org/mailman/listinfo/matplotlib-users >> > From oliver.willekens at gmail.com Thu Mar 3 06:31:16 2016 From: oliver.willekens at gmail.com (Oliver Willekens) Date: Thu, 3 Mar 2016 12:31:16 +0100 Subject: [Matplotlib-users] possible regression in plt.draw (mpl 1.4.3 -> 1.5.0) when using fig.text using transformations Message-ID: Dear matplotlib users and developers, I?m using plt.draw() to force the rendering of all artists and then, based on their newly calculated positions, place a text label on the figure window in figure coordinates. The goal is to add a text label near the conventional y-axis, at the top, right-aligned. Example code that demonstrates the problem: #!/usr/bin/env python # -*- coding: utf-8 -*- import numpy as np import matplotlib.pyplot as plt import matplotlib as mpl print(mpl.__version__) x = np.linspace(0, 50) y = 4*np.sin(x) + 5 fig = plt.figure(figsize=(18,9.8)) ax = fig.add_axes((0.1, 0.1, 0.8, 0.8), frameon=True, aspect='equal', adjustable='box', xlim=(x.min(), x.max()), ylim=(0, 10), xticks=[x.min(), x.max()], yticks=[0, 10], xlabel='dimension (unit)') ax.plot(x, y) plt.draw() # force redraw ylabel_pos = fig.transFigure.inverted().transform_point(ax.transAxes.transform_point((0,1))) label1 = fig.text(ylabel_pos[0], ylabel_pos[1], "label1", ha="right", va="bottom") plt.savefig('/tmp/test_pre_mpl_v_{}.png'.format(mpl.__version__)) ylabel_pos = fig.transFigure.inverted().transform_point(ax.transAxes.transform_point((0,1))) label2 = fig.text(ylabel_pos[0], ylabel_pos[1], "label2", ha="right", va="bottom") plt.savefig('/tmp/test_post_mpl_v_{}.png'.format(mpl.__version__)) The code shows that in mpl 1.4.3 both label1 and label2 end up at the same (desired) position. However, mpl 1.5.0 and 1.5.1 (just installed to check) show that label1 is at a height of 0.9 in the figure coordinates. After the first call to savefig, the figure is rendered with the axes getting a new height and width (due to the call to aspect='equal', adjustable='box') and so the subsequent call to savefig renders label2 in the correct position. Using ax.text(x=0, y=1, s='label', transform=ax.transAxes, ha="right", va="bottom") gets the job done alright (both in 1.4.3, as well as 1.5.0), but the call to fig.text using the subsequent transforms should have worked, I believe, and so this seems to indicate something has changed in the rendering of a rescaled axes using plt.draw. Kind regards, Oliver P.S. I posted this to the older sourceforge mailing list as well, by accident. Hadn?t changed the send-to address yet, even though Thomas Caswell had pointed it out to me already in August 2015. My apologies. ? -------------- next part -------------- An HTML attachment was scrubbed... URL: From tcaswell at gmail.com Thu Mar 3 08:54:05 2016 From: tcaswell at gmail.com (Thomas Caswell) Date: Thu, 03 Mar 2016 13:54:05 +0000 Subject: [Matplotlib-users] possible regression in plt.draw (mpl 1.4.3 -> 1.5.0) when using fig.text using transformations In-Reply-To: References: Message-ID: If you want to _really_ force a redraw, you will need to to `fig.canvas.draw()`. In https://github.com/matplotlib/matplotlib/pull/5150 we change `plt.draw()` to use the `canvas.draw_idle` method. The draw_idle effectively asks the GUI framework to please re-draw the next time it is convenient. The main benefit of this is if you request multiple draw_idle before giving the GUI a chance to re-paint there will only be one actual call to `canvas.draw`. Using `ax.text` is much simpler you should just use that ;) In general going through screen coordinates in user code is not advised. In this particular case you are going right back to 'normalized' unit so you will not have DPI / figure size issues, but in general those will come up because the Transforms close over many values that can (and do!) change from user input or as part of the draw process. In almost all cases, it is better to pass a transfrom into the artists and let mpl internals sort of exactly when to evaluate them. Tom On Thu, Mar 3, 2016 at 6:31 AM Oliver Willekens wrote: > Dear matplotlib users and developers, > > I?m using plt.draw() to force the rendering of all artists and then, > based on their newly calculated positions, place a text label on the figure > window in figure coordinates. > > The goal is to add a text label near the conventional y-axis, at the top, > right-aligned. Example code that demonstrates the problem: > > #!/usr/bin/env python > # -*- coding: utf-8 -*- > import numpy as np > import matplotlib.pyplot as plt > import matplotlib as mpl > print(mpl.__version__) > > x = np.linspace(0, 50) > y = 4*np.sin(x) + 5 > > fig = plt.figure(figsize=(18,9.8)) > ax = fig.add_axes((0.1, 0.1, 0.8, 0.8), > frameon=True, > aspect='equal', > adjustable='box', > xlim=(x.min(), x.max()), > ylim=(0, 10), > xticks=[x.min(), x.max()], > yticks=[0, 10], > xlabel='dimension (unit)') > ax.plot(x, y) > plt.draw() # force redraw > > ylabel_pos = fig.transFigure.inverted().transform_point(ax.transAxes.transform_point((0,1))) > label1 = fig.text(ylabel_pos[0], ylabel_pos[1], "label1", ha="right", va="bottom") > plt.savefig('/tmp/test_pre_mpl_v_{}.png'.format(mpl.__version__)) > ylabel_pos = fig.transFigure.inverted().transform_point(ax.transAxes.transform_point((0,1))) > label2 = fig.text(ylabel_pos[0], ylabel_pos[1], "label2", ha="right", va="bottom") > plt.savefig('/tmp/test_post_mpl_v_{}.png'.format(mpl.__version__)) > > The code shows that in mpl 1.4.3 both label1 and label2 end up at the same > (desired) position. However, mpl 1.5.0 and 1.5.1 (just installed to check) > show that label1 is at a height of 0.9 in the figure coordinates. After the > first call to savefig, the figure is rendered with the axes getting a new > height and width (due to the call to aspect='equal', adjustable='box') > and so the subsequent call to savefig renders label2 in the correct > position. > > Using ax.text(x=0, y=1, s='label', transform=ax.transAxes, ha="right", > va="bottom") gets the job done alright (both in 1.4.3, as well as 1.5.0), > but the call to fig.text using the subsequent transforms should have > worked, I believe, and so this seems to indicate something has changed in > the rendering of a rescaled axes using plt.draw. > > Kind regards, > Oliver > > P.S. I posted this to the older sourceforge mailing list as well, by > accident. Hadn?t changed the send-to address yet, even though Thomas > Caswell had pointed it out to me already in August 2015. My apologies. > ? > _______________________________________________ > 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 gustavo.goretkin at gmail.com Thu Mar 3 16:53:45 2016 From: gustavo.goretkin at gmail.com (Gustavo Goretkin) Date: Thu, 3 Mar 2016 16:53:45 -0500 Subject: [Matplotlib-users] build matplotlib in anaconda environment, wrong png version Message-ID: I just tried to build v1.5.1 from source, with `python setup.py develop`, where `python` is a python within an anaconda distribution. It builds fine, and I can do many things with the library. But when saving, I see the warning libpng warning: Application built with libpng-1.6.17 but running with 1.5.23 > and eventually /Users/goretkin/repos/matplotlib/lib/matplotlib/backends/backend_pdf.py in _writePng(self, data) 1283 1284 buffer = BytesIO() -> 1285 _png.write_png(data, buffer) 1286 buffer.seek(8) 1287 written = 0 RuntimeError: Could not create write struct Indeed, the build script shows BUILDING MATPLOTLIB matplotlib: yes [1.5.1] python: yes [3.5.1 |Continuum Analytics, Inc.| (default, Dec 7 2015, 11:24:55) [GCC 4.2.1 (Apple Inc. build 5577)]] platform: yes [darwin] REQUIRED DEPENDENCIES AND EXTENSIONS numpy: yes [version 1.10.4] dateutil: yes [using dateutil version 2.4.2] pytz: yes [using pytz version 2015.7] cycler: yes [using cycler version 0.10.0] tornado: yes [using tornado version 4.3] pyparsing: yes [using pyparsing version 2.0.3] libagg: yes [pkg-config information for 'libagg' could not be found. Using local copy.] freetype: yes [version 2.5.5] png: yes [version 1.6.17] qhull: yes [pkg-config information for 'qhull' could not be found. Using local copy.] Is this a problem with anaconda reporting the wrong paths? Indeed the version of libpng in this anaconda environment is libpng16, so its right to build against it. At run time, someone's to blame for loading the wrong dynamic library. goretkin-mbp:lib goretkin$ ls -la ~/anaconda2/envs/py3_601/lib/ | grep png > lrwxr-xr-x 1 goretkin staff 10 Jan 23 14:14 libpng.a -> > libpng16.a > lrwxr-xr-x 1 goretkin staff 17 Jan 23 14:14 libpng.dylib -> > libpng16.16.dylib > lrwxr-xr-x 1 goretkin staff 11 Jan 23 14:14 libpng.la -> > libpng16.la > -rwxr-xr-x 7 goretkin staff 271336 May 26 2015 libpng16.16.dylib > -rw-r--r-- 7 goretkin staff 360224 May 26 2015 libpng16.a > lrwxr-xr-x 1 goretkin staff 17 Jan 23 14:14 libpng16.dylib -> > libpng16.16.dylib > -rwxr-xr-x 1 goretkin staff 951 Jan 23 14:14 libpng16.la > $ otool -L ~/anaconda2/envs/py3_601/lib/libpng.dylib /Users/goretkin/anaconda2/envs/py3_601/lib/libpng.dylib: libpng16.16.dylib (compatibility version 34.0.0, current version 34.0.0) /usr/lib/libz.1.dylib (compatibility version 1.0.0, current version 1.2.3) /usr/lib/libgcc_s.1.dylib (compatibility version 1.0.0, current version 1.0.0) /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 111.0.0) Thanks, Gustavo -------------- next part -------------- An HTML attachment was scrubbed... URL: From jni.soma at gmail.com Fri Mar 4 02:32:52 2016 From: jni.soma at gmail.com (Juan Nunez-Iglesias) Date: Fri, 4 Mar 2016 18:32:52 +1100 Subject: [Matplotlib-users] Scatterplot with legend Message-ID: All of the scatterplot legend examples that I can find on the web use multiple calls to plt.scatter to then obtain a legend for each color, e.g. here: http://matplotlib.org/examples/lines_bars_and_markers/scatter_with_legend.html#lines-bars-and-markers-scatter-with-legend However, I'm trying to make a single call to scatter, using a ListedColorMap with three colors and passing c=(array of 0, 1, or 2) to the plt.scatter call. Unfortunately, when I try to add a legend to this I get a single point/value. I tried to follow the proxy patch instructions here: http://matplotlib.org/users/legend_guide.html#plotting-guide-legend but couldn't get a circle when using patches.Circle() as the proxy object: I still get a rectangular fill patch as in the examples above. For completeness, two alternative examples: ======================== import numpy as np from matplotib import pyplot as plt, patches, color x = np.random.rand(50) y = np.random.rand(50) color = np.random.randint(3, size=50) colormap = colors.ListedColormap([(1, 0, 0), (0, 0, 1), (0, 1, 0)]) pointtypes = np.array(['type 0', 'type 1', 'type 2']) plt.figure() plt.scatter(x, y, c=color, cmap=colormap) plt.legend(pointtypes) plt.figure() plt.scatter(x, y, c=color, cmap=colormap) proxy_artists = [patches.Circle((0, 1), color=colormap(i), label=pointtypes[i] for i in range(3)] plt.legend(proxy_artists, pointtypes) ======================== Can anyone suggest a simple modification to obtain the above plot with the right legend? Thanks! Juan. -------------- next part -------------- An HTML attachment was scrubbed... URL: From oliver.willekens at gmail.com Fri Mar 4 08:39:33 2016 From: oliver.willekens at gmail.com (Oliver Willekens) Date: Fri, 4 Mar 2016 14:39:33 +0100 Subject: [Matplotlib-users] possible regression in plt.draw (mpl 1.4.3 -> 1.5.0) when using fig.text using transformations In-Reply-To: References: Message-ID: >[...] in general [DPI/figure issues] will come up because the Transforms close over many values that can (and do!) change from user input or as part of the draw process. Thought I had the transformations all figured out, but it looks like I should definitely play some more with it. Thank you, Tom, for referring me to the git pull request and explaining the cause of this. Oliver 2016-03-03 14:54 GMT+01:00 Thomas Caswell : > If you want to _really_ force a redraw, you will need to to > `fig.canvas.draw()`. > > In https://github.com/matplotlib/matplotlib/pull/5150 we change > `plt.draw()` to use the `canvas.draw_idle` method. The draw_idle > effectively asks the GUI framework to please re-draw the next time it is > convenient. The main benefit of this is if you request multiple draw_idle > before giving the GUI a chance to re-paint there will only be one actual > call to `canvas.draw`. > > Using `ax.text` is much simpler you should just use that ;) > > In general going through screen coordinates in user code is not advised. > In this particular case you are going right back to 'normalized' unit so > you will not have DPI / figure size issues, but in general those will come > up because the Transforms close over many values that can (and do!) change > from user input or as part of the draw process. In almost all cases, it is > better to pass a transfrom into the artists and let mpl internals sort of > exactly when to evaluate them. > > Tom > > On Thu, Mar 3, 2016 at 6:31 AM Oliver Willekens < > oliver.willekens at gmail.com> wrote: > >> Dear matplotlib users and developers, >> >> I?m using plt.draw() to force the rendering of all artists and then, >> based on their newly calculated positions, place a text label on the figure >> window in figure coordinates. >> >> The goal is to add a text label near the conventional y-axis, at the top, >> right-aligned. Example code that demonstrates the problem: >> >> #!/usr/bin/env python >> # -*- coding: utf-8 -*- >> import numpy as np >> import matplotlib.pyplot as plt >> import matplotlib as mpl >> print(mpl.__version__) >> >> x = np.linspace(0, 50) >> y = 4*np.sin(x) + 5 >> >> fig = plt.figure(figsize=(18,9.8)) >> ax = fig.add_axes((0.1, 0.1, 0.8, 0.8), >> frameon=True, >> aspect='equal', >> adjustable='box', >> xlim=(x.min(), x.max()), >> ylim=(0, 10), >> xticks=[x.min(), x.max()], >> yticks=[0, 10], >> xlabel='dimension (unit)') >> ax.plot(x, y) >> plt.draw() # force redraw >> >> ylabel_pos = fig.transFigure.inverted().transform_point(ax.transAxes.transform_point((0,1))) >> label1 = fig.text(ylabel_pos[0], ylabel_pos[1], "label1", ha="right", va="bottom") >> plt.savefig('/tmp/test_pre_mpl_v_{}.png'.format(mpl.__version__)) >> ylabel_pos = fig.transFigure.inverted().transform_point(ax.transAxes.transform_point((0,1))) >> label2 = fig.text(ylabel_pos[0], ylabel_pos[1], "label2", ha="right", va="bottom") >> plt.savefig('/tmp/test_post_mpl_v_{}.png'.format(mpl.__version__)) >> >> The code shows that in mpl 1.4.3 both label1 and label2 end up at the >> same (desired) position. However, mpl 1.5.0 and 1.5.1 (just installed to >> check) show that label1 is at a height of 0.9 in the figure coordinates. >> After the first call to savefig, the figure is rendered with the axes >> getting a new height and width (due to the call to aspect='equal', >> adjustable='box') and so the subsequent call to savefig renders label2 >> in the correct position. >> >> Using ax.text(x=0, y=1, s='label', transform=ax.transAxes, ha="right", >> va="bottom") gets the job done alright (both in 1.4.3, as well as >> 1.5.0), but the call to fig.text using the subsequent transforms should >> have worked, I believe, and so this seems to indicate something has changed >> in the rendering of a rescaled axes using plt.draw. >> >> Kind regards, >> Oliver >> >> P.S. I posted this to the older sourceforge mailing list as well, by >> accident. Hadn?t changed the send-to address yet, even though Thomas >> Caswell had pointed it out to me already in August 2015. My apologies. >> ? >> _______________________________________________ >> Matplotlib-users mailing list >> Matplotlib-users at python.org >> https://mail.python.org/mailman/listinfo/matplotlib-users >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: From tcaswell at gmail.com Fri Mar 4 08:59:53 2016 From: tcaswell at gmail.com (Thomas Caswell) Date: Fri, 04 Mar 2016 13:59:53 +0000 Subject: [Matplotlib-users] possible regression in plt.draw (mpl 1.4.3 -> 1.5.0) when using fig.text using transformations In-Reply-To: References: Message-ID: Sorry this caused grief for you. There is definitely a tension when working on a library as big, old, and widely used as mpl, we want to make things better, but we are almost always going to break something for someone (even bug fixes break people who have work-arounds to the bug-fixes!). Tom On Fri, Mar 4, 2016 at 8:39 AM Oliver Willekens wrote: > >[...] in general [DPI/figure issues] will come up because the Transforms > close over many values that can (and do!) change from user input or as part > of the draw process. > > Thought I had the transformations all figured out, but it looks like I > should definitely play some more with it. > > Thank you, Tom, for referring me to the git pull request and explaining > the cause of this. > > Oliver > > > > 2016-03-03 14:54 GMT+01:00 Thomas Caswell : > >> If you want to _really_ force a redraw, you will need to to >> `fig.canvas.draw()`. >> >> In https://github.com/matplotlib/matplotlib/pull/5150 we change >> `plt.draw()` to use the `canvas.draw_idle` method. The draw_idle >> effectively asks the GUI framework to please re-draw the next time it is >> convenient. The main benefit of this is if you request multiple draw_idle >> before giving the GUI a chance to re-paint there will only be one actual >> call to `canvas.draw`. >> >> Using `ax.text` is much simpler you should just use that ;) >> >> In general going through screen coordinates in user code is not advised. >> In this particular case you are going right back to 'normalized' unit so >> you will not have DPI / figure size issues, but in general those will come >> up because the Transforms close over many values that can (and do!) change >> from user input or as part of the draw process. In almost all cases, it is >> better to pass a transfrom into the artists and let mpl internals sort of >> exactly when to evaluate them. >> >> Tom >> >> On Thu, Mar 3, 2016 at 6:31 AM Oliver Willekens < >> oliver.willekens at gmail.com> wrote: >> >>> Dear matplotlib users and developers, >>> >>> I?m using plt.draw() to force the rendering of all artists and then, >>> based on their newly calculated positions, place a text label on the figure >>> window in figure coordinates. >>> >>> The goal is to add a text label near the conventional y-axis, at the >>> top, right-aligned. Example code that demonstrates the problem: >>> >>> #!/usr/bin/env python >>> # -*- coding: utf-8 -*- >>> import numpy as np >>> import matplotlib.pyplot as plt >>> import matplotlib as mpl >>> print(mpl.__version__) >>> >>> x = np.linspace(0, 50) >>> y = 4*np.sin(x) + 5 >>> >>> fig = plt.figure(figsize=(18,9.8)) >>> ax = fig.add_axes((0.1, 0.1, 0.8, 0.8), >>> frameon=True, >>> aspect='equal', >>> adjustable='box', >>> xlim=(x.min(), x.max()), >>> ylim=(0, 10), >>> xticks=[x.min(), x.max()], >>> yticks=[0, 10], >>> xlabel='dimension (unit)') >>> ax.plot(x, y) >>> plt.draw() # force redraw >>> >>> ylabel_pos = fig.transFigure.inverted().transform_point(ax.transAxes.transform_point((0,1))) >>> label1 = fig.text(ylabel_pos[0], ylabel_pos[1], "label1", ha="right", va="bottom") >>> plt.savefig('/tmp/test_pre_mpl_v_{}.png'.format(mpl.__version__)) >>> ylabel_pos = fig.transFigure.inverted().transform_point(ax.transAxes.transform_point((0,1))) >>> label2 = fig.text(ylabel_pos[0], ylabel_pos[1], "label2", ha="right", va="bottom") >>> plt.savefig('/tmp/test_post_mpl_v_{}.png'.format(mpl.__version__)) >>> >>> The code shows that in mpl 1.4.3 both label1 and label2 end up at the >>> same (desired) position. However, mpl 1.5.0 and 1.5.1 (just installed to >>> check) show that label1 is at a height of 0.9 in the figure coordinates. >>> After the first call to savefig, the figure is rendered with the axes >>> getting a new height and width (due to the call to aspect='equal', >>> adjustable='box') and so the subsequent call to savefig renders label2 >>> in the correct position. >>> >>> Using ax.text(x=0, y=1, s='label', transform=ax.transAxes, ha="right", >>> va="bottom") gets the job done alright (both in 1.4.3, as well as >>> 1.5.0), but the call to fig.text using the subsequent transforms should >>> have worked, I believe, and so this seems to indicate something has changed >>> in the rendering of a rescaled axes using plt.draw. >>> >>> Kind regards, >>> Oliver >>> >>> P.S. I posted this to the older sourceforge mailing list as well, by >>> accident. Hadn?t changed the send-to address yet, even though Thomas >>> Caswell had pointed it out to me already in August 2015. My apologies. >>> ? >>> _______________________________________________ >>> 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 gustavo.goretkin at gmail.com Fri Mar 4 09:41:40 2016 From: gustavo.goretkin at gmail.com (Gustavo Goretkin) Date: Fri, 4 Mar 2016 09:41:40 -0500 Subject: [Matplotlib-users] build matplotlib in anaconda environment, wrong png version In-Reply-To: References: Message-ID: I have a small script that saves a figure as png sudo dtruss -t open python mintest_libpng.py 2> trace.txt I see open syscalls to the following open("/usr/local/opt/libpng/lib/libpng16.16.dylib\0", 0x0, 0x0) = 4 0 open("/opt/X11/lib/libpng15.15.dylib\0", 0x0, 0x0) = 4 0 I repeated that with the conda-installed version of matplotlib, and I don't see any open syscalls that open libpng (?) Any ideas for building matplotlib from source and installing in a conda environment? On Thu, Mar 3, 2016 at 4:53 PM, Gustavo Goretkin wrote: > I just tried to build v1.5.1 from source, with `python setup.py develop`, > where `python` is a python within an anaconda distribution. > > It builds fine, and I can do many things with the library. But when > saving, I see the warning > > > > libpng warning: Application built with libpng-1.6.17 but running with >> 1.5.23 >> > > and eventually > > /Users/goretkin/repos/matplotlib/lib/matplotlib/backends/backend_pdf.py in > _writePng(self, data) > 1283 > 1284 buffer = BytesIO() > -> 1285 _png.write_png(data, buffer) > 1286 buffer.seek(8) > 1287 written = 0 > > RuntimeError: Could not create write struct > > > Indeed, the build script shows > > BUILDING MATPLOTLIB > matplotlib: yes [1.5.1] > python: yes [3.5.1 |Continuum Analytics, Inc.| (default, > Dec > 7 2015, 11:24:55) [GCC 4.2.1 (Apple Inc. build > 5577)]] > platform: yes [darwin] > > REQUIRED DEPENDENCIES AND EXTENSIONS > numpy: yes [version 1.10.4] > dateutil: yes [using dateutil version 2.4.2] > pytz: yes [using pytz version 2015.7] > cycler: yes [using cycler version 0.10.0] > tornado: yes [using tornado version 4.3] > pyparsing: yes [using pyparsing version 2.0.3] > libagg: yes [pkg-config information for 'libagg' could not > be found. Using local copy.] > freetype: yes [version 2.5.5] > png: yes [version 1.6.17] > qhull: yes [pkg-config information for 'qhull' could not > be > found. Using local copy.] > > Is this a problem with anaconda reporting the wrong paths? Indeed the > version of libpng in this anaconda environment is libpng16, so its right to > build against it. At run time, someone's to blame for loading the wrong > dynamic library. > > goretkin-mbp:lib goretkin$ ls -la ~/anaconda2/envs/py3_601/lib/ | grep png >> lrwxr-xr-x 1 goretkin staff 10 Jan 23 14:14 libpng.a -> >> libpng16.a >> lrwxr-xr-x 1 goretkin staff 17 Jan 23 14:14 libpng.dylib -> >> libpng16.16.dylib >> lrwxr-xr-x 1 goretkin staff 11 Jan 23 14:14 libpng.la -> >> libpng16.la >> -rwxr-xr-x 7 goretkin staff 271336 May 26 2015 libpng16.16.dylib >> -rw-r--r-- 7 goretkin staff 360224 May 26 2015 libpng16.a >> lrwxr-xr-x 1 goretkin staff 17 Jan 23 14:14 libpng16.dylib -> >> libpng16.16.dylib >> -rwxr-xr-x 1 goretkin staff 951 Jan 23 14:14 libpng16.la >> > > > $ otool -L ~/anaconda2/envs/py3_601/lib/libpng.dylib > /Users/goretkin/anaconda2/envs/py3_601/lib/libpng.dylib: > libpng16.16.dylib (compatibility version 34.0.0, current version > 34.0.0) > /usr/lib/libz.1.dylib (compatibility version 1.0.0, current version > 1.2.3) > /usr/lib/libgcc_s.1.dylib (compatibility version 1.0.0, current > version 1.0.0) > /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current > version 111.0.0) > > > > Thanks, > Gustavo > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From tcaswell at gmail.com Fri Mar 4 10:36:06 2016 From: tcaswell at gmail.com (Thomas Caswell) Date: Fri, 04 Mar 2016 15:36:06 +0000 Subject: [Matplotlib-users] build matplotlib in anaconda environment, wrong png version In-Reply-To: References: Message-ID: What does the mac equivalent of 10:34 $ ldd _png.cpython-35m-x86_64-linux-gnu.so linux-vdso.so.1 (0x00007ffc905e3000) libpng16.so.16 => /home/tcaswell/.virtualenvs/dd35/lib/libpng16.so.16 (0x00007f6cd496d000) libpython3.5m.so.1.0 => /home/tcaswell/.virtualenvs/dd35/lib/libpython3.5m.so.1.0 (0x00007f6cd447e000) libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0x00007f6cd40c4000) libm.so.6 => /usr/lib/libm.so.6 (0x00007f6cd3dbe000) libgcc_s.so.1 => /usr/lib/libgcc_s.so.1 (0x00007f6cd3ba8000) libpthread.so.0 => /usr/lib/libpthread.so.0 (0x00007f6cd398b000) libc.so.6 => /usr/lib/libc.so.6 (0x00007f6cd35e9000) libz.so.1 => /home/tcaswell/.virtualenvs/dd35/lib/./libz.so.1 (0x00007f6cd33d3000) libdl.so.2 => /usr/lib/libdl.so.2 (0x00007f6cd31cf000) libutil.so.1 => /usr/lib/libutil.so.1 (0x00007f6cd2fcb000) librt.so.1 => /usr/lib/librt.so.1 (0x00007f6cd2dc3000) /usr/lib64/ld-linux-x86-64.so.2 (0x0000560627d6d000) give? On Fri, Mar 4, 2016 at 10:11 AM Gustavo Goretkin wrote: > I have a small script that saves a figure as png > > sudo dtruss -t open python mintest_libpng.py 2> trace.txt > > I see open syscalls to the following > > open("/usr/local/opt/libpng/lib/libpng16.16.dylib\0", 0x0, 0x0) = > 4 0 > open("/opt/X11/lib/libpng15.15.dylib\0", 0x0, 0x0) = 4 0 > > > I repeated that with the conda-installed version of matplotlib, and I > don't see any open syscalls that open libpng (?) Any ideas for building > matplotlib from source and installing in a conda environment? > > On Thu, Mar 3, 2016 at 4:53 PM, Gustavo Goretkin < > gustavo.goretkin at gmail.com> wrote: > >> I just tried to build v1.5.1 from source, with `python setup.py develop`, >> where `python` is a python within an anaconda distribution. >> >> It builds fine, and I can do many things with the library. But when >> saving, I see the warning >> >> >> >> libpng warning: Application built with libpng-1.6.17 but running with >>> 1.5.23 >>> >> >> and eventually >> >> /Users/goretkin/repos/matplotlib/lib/matplotlib/backends/backend_pdf.py >> in _writePng(self, data) >> 1283 >> 1284 buffer = BytesIO() >> -> 1285 _png.write_png(data, buffer) >> 1286 buffer.seek(8) >> 1287 written = 0 >> >> RuntimeError: Could not create write struct >> >> >> Indeed, the build script shows >> >> BUILDING MATPLOTLIB >> matplotlib: yes [1.5.1] >> python: yes [3.5.1 |Continuum Analytics, Inc.| (default, >> Dec >> 7 2015, 11:24:55) [GCC 4.2.1 (Apple Inc. build >> 5577)]] >> platform: yes [darwin] >> >> REQUIRED DEPENDENCIES AND EXTENSIONS >> numpy: yes [version 1.10.4] >> dateutil: yes [using dateutil version 2.4.2] >> pytz: yes [using pytz version 2015.7] >> cycler: yes [using cycler version 0.10.0] >> tornado: yes [using tornado version 4.3] >> pyparsing: yes [using pyparsing version 2.0.3] >> libagg: yes [pkg-config information for 'libagg' could not >> be found. Using local copy.] >> freetype: yes [version 2.5.5] >> png: yes [version 1.6.17] >> qhull: yes [pkg-config information for 'qhull' could not >> be >> found. Using local copy.] >> >> Is this a problem with anaconda reporting the wrong paths? Indeed the >> version of libpng in this anaconda environment is libpng16, so its right to >> build against it. At run time, someone's to blame for loading the wrong >> dynamic library. >> >> goretkin-mbp:lib goretkin$ ls -la ~/anaconda2/envs/py3_601/lib/ | grep png >>> lrwxr-xr-x 1 goretkin staff 10 Jan 23 14:14 libpng.a -> >>> libpng16.a >>> lrwxr-xr-x 1 goretkin staff 17 Jan 23 14:14 libpng.dylib -> >>> libpng16.16.dylib >>> lrwxr-xr-x 1 goretkin staff 11 Jan 23 14:14 libpng.la -> >>> libpng16.la >>> -rwxr-xr-x 7 goretkin staff 271336 May 26 2015 libpng16.16.dylib >>> -rw-r--r-- 7 goretkin staff 360224 May 26 2015 libpng16.a >>> lrwxr-xr-x 1 goretkin staff 17 Jan 23 14:14 libpng16.dylib -> >>> libpng16.16.dylib >>> -rwxr-xr-x 1 goretkin staff 951 Jan 23 14:14 libpng16.la >>> >> >> >> $ otool -L ~/anaconda2/envs/py3_601/lib/libpng.dylib >> /Users/goretkin/anaconda2/envs/py3_601/lib/libpng.dylib: >> libpng16.16.dylib (compatibility version 34.0.0, current version >> 34.0.0) >> /usr/lib/libz.1.dylib (compatibility version 1.0.0, current version >> 1.2.3) >> /usr/lib/libgcc_s.1.dylib (compatibility version 1.0.0, current >> version 1.0.0) >> /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current >> version 111.0.0) >> >> >> >> Thanks, >> Gustavo >> >> >> > _______________________________________________ > 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 gustavo.goretkin at gmail.com Fri Mar 4 10:47:33 2016 From: gustavo.goretkin at gmail.com (Gustavo Goretkin) Date: Fri, 4 Mar 2016 10:47:33 -0500 Subject: [Matplotlib-users] build matplotlib in anaconda environment, wrong png version In-Reply-To: References: Message-ID: If I understood correctly: $ ldd ~/anaconda2/envs/py3_601/lib/python3.5/site-packages/matplotlib-1.5.1+0.gbe91fac.dirty-py3.5-macosx-10.5-x86_64.egg/matplotlib/_ png.cpython-35m-darwin.so /Users/goretkin/anaconda2/envs/py3_601/lib/python3.5/site-packages/matplotlib-1.5.1+0.gbe91fac.dirty-py3.5-macosx-10.5-x86_64.egg/matplotlib/_ png.cpython-35m-darwin.so: libpng16.16.dylib (compatibility version 34.0.0, current version 34.0.0) /usr/lib/libstdc++.6.dylib (compatibility version 7.0.0, current version 60.0.0) /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1197.1.1) /usr/lib/libgcc_s.1.dylib (compatibility version 1.0.0, current version 2577.0.0) On Fri, Mar 4, 2016 at 10:36 AM, Thomas Caswell wrote: > What does the mac equivalent of > > 10:34 $ ldd _png.cpython-35m-x86_64-linux-gnu.so > linux-vdso.so.1 (0x00007ffc905e3000) > libpng16.so.16 => > /home/tcaswell/.virtualenvs/dd35/lib/libpng16.so.16 (0x00007f6cd496d000) > libpython3.5m.so.1.0 => > /home/tcaswell/.virtualenvs/dd35/lib/libpython3.5m.so.1.0 > (0x00007f6cd447e000) > libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0x00007f6cd40c4000) > libm.so.6 => /usr/lib/libm.so.6 (0x00007f6cd3dbe000) > libgcc_s.so.1 => /usr/lib/libgcc_s.so.1 (0x00007f6cd3ba8000) > libpthread.so.0 => /usr/lib/libpthread.so.0 (0x00007f6cd398b000) > libc.so.6 => /usr/lib/libc.so.6 (0x00007f6cd35e9000) > libz.so.1 => /home/tcaswell/.virtualenvs/dd35/lib/./libz.so.1 > (0x00007f6cd33d3000) > libdl.so.2 => /usr/lib/libdl.so.2 (0x00007f6cd31cf000) > libutil.so.1 => /usr/lib/libutil.so.1 (0x00007f6cd2fcb000) > librt.so.1 => /usr/lib/librt.so.1 (0x00007f6cd2dc3000) > /usr/lib64/ld-linux-x86-64.so.2 (0x0000560627d6d000) > > give? > > On Fri, Mar 4, 2016 at 10:11 AM Gustavo Goretkin < > gustavo.goretkin at gmail.com> wrote: > >> I have a small script that saves a figure as png >> >> sudo dtruss -t open python mintest_libpng.py 2> trace.txt >> >> I see open syscalls to the following >> >> open("/usr/local/opt/libpng/lib/libpng16.16.dylib\0", 0x0, 0x0) = >> 4 0 >> open("/opt/X11/lib/libpng15.15.dylib\0", 0x0, 0x0) = 4 0 >> >> >> I repeated that with the conda-installed version of matplotlib, and I >> don't see any open syscalls that open libpng (?) Any ideas for building >> matplotlib from source and installing in a conda environment? >> >> On Thu, Mar 3, 2016 at 4:53 PM, Gustavo Goretkin < >> gustavo.goretkin at gmail.com> wrote: >> >>> I just tried to build v1.5.1 from source, with `python setup.py >>> develop`, where `python` is a python within an anaconda distribution. >>> >>> It builds fine, and I can do many things with the library. But when >>> saving, I see the warning >>> >>> >>> >>> libpng warning: Application built with libpng-1.6.17 but running with >>>> 1.5.23 >>>> >>> >>> and eventually >>> >>> /Users/goretkin/repos/matplotlib/lib/matplotlib/backends/backend_pdf.py >>> in _writePng(self, data) >>> 1283 >>> 1284 buffer = BytesIO() >>> -> 1285 _png.write_png(data, buffer) >>> 1286 buffer.seek(8) >>> 1287 written = 0 >>> >>> RuntimeError: Could not create write struct >>> >>> >>> Indeed, the build script shows >>> >>> BUILDING MATPLOTLIB >>> matplotlib: yes [1.5.1] >>> python: yes [3.5.1 |Continuum Analytics, Inc.| (default, >>> Dec >>> 7 2015, 11:24:55) [GCC 4.2.1 (Apple Inc. build >>> 5577)]] >>> platform: yes [darwin] >>> >>> REQUIRED DEPENDENCIES AND EXTENSIONS >>> numpy: yes [version 1.10.4] >>> dateutil: yes [using dateutil version 2.4.2] >>> pytz: yes [using pytz version 2015.7] >>> cycler: yes [using cycler version 0.10.0] >>> tornado: yes [using tornado version 4.3] >>> pyparsing: yes [using pyparsing version 2.0.3] >>> libagg: yes [pkg-config information for 'libagg' could >>> not >>> be found. Using local copy.] >>> freetype: yes [version 2.5.5] >>> png: yes [version 1.6.17] >>> qhull: yes [pkg-config information for 'qhull' could >>> not be >>> found. Using local copy.] >>> >>> Is this a problem with anaconda reporting the wrong paths? Indeed the >>> version of libpng in this anaconda environment is libpng16, so its right to >>> build against it. At run time, someone's to blame for loading the wrong >>> dynamic library. >>> >>> goretkin-mbp:lib goretkin$ ls -la ~/anaconda2/envs/py3_601/lib/ | grep >>>> png >>>> lrwxr-xr-x 1 goretkin staff 10 Jan 23 14:14 libpng.a -> >>>> libpng16.a >>>> lrwxr-xr-x 1 goretkin staff 17 Jan 23 14:14 libpng.dylib -> >>>> libpng16.16.dylib >>>> lrwxr-xr-x 1 goretkin staff 11 Jan 23 14:14 libpng.la -> >>>> libpng16.la >>>> -rwxr-xr-x 7 goretkin staff 271336 May 26 2015 libpng16.16.dylib >>>> -rw-r--r-- 7 goretkin staff 360224 May 26 2015 libpng16.a >>>> lrwxr-xr-x 1 goretkin staff 17 Jan 23 14:14 libpng16.dylib >>>> -> libpng16.16.dylib >>>> -rwxr-xr-x 1 goretkin staff 951 Jan 23 14:14 libpng16.la >>>> >>> >>> >>> $ otool -L ~/anaconda2/envs/py3_601/lib/libpng.dylib >>> /Users/goretkin/anaconda2/envs/py3_601/lib/libpng.dylib: >>> libpng16.16.dylib (compatibility version 34.0.0, current version >>> 34.0.0) >>> /usr/lib/libz.1.dylib (compatibility version 1.0.0, current version >>> 1.2.3) >>> /usr/lib/libgcc_s.1.dylib (compatibility version 1.0.0, current >>> version 1.0.0) >>> /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current >>> version 111.0.0) >>> >>> >>> >>> Thanks, >>> Gustavo >>> >>> >>> >> _______________________________________________ >> 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 elvstone at gmail.com Mon Mar 7 08:41:20 2016 From: elvstone at gmail.com (Elvis Stansvik) Date: Mon, 7 Mar 2016 14:41:20 +0100 Subject: [Matplotlib-users] Make font rendering match Qt 5 Message-ID: Hi all, I'm trying to get the font rendering of matplotlib match the look of Qt 5 as much as possible. My target system is Kubuntu 15.10, with Qt 5.5.1 and matplotlib 1.5.1. What I've done is (not completely robust, but still): from matplotlib import rcParams ... # Make matplotlib use system font. font = QFontDatabase.systemFont(QFontDatabase.GeneralFont) rcParams['font.family'] = 'sans-serif' rcParams['font.sans-serif'] = font.family() rcParams['font.size'] = font.pointSize() rcParams['font.weight'] = 100 + font.weight() * 8 # 0-99 -> 100-900 This gets me quite close. See the attached screenshot, and compare the font rendering in the matplotlib figure compared to surrounding Qt stuff. Is there something that can get me even closer to 100% the same look? I'm guessing it's down to how Qt does hinting / gamma? I've experimented with the text.hinting and text.hinting_factor RC parameters, but with no luck. The looks is still slightly different. When used in a UI like this, it would be very nice if matplotlib could default to using the system font, and take care to render it the same way as the UI framework (Qt, Gtk, ...). Thanks in advance for any advice. Elvis -------------- next part -------------- A non-text attachment was scrubbed... Name: mpl_font_vs_qt5_font.png Type: image/png Size: 10657 bytes Desc: not available URL: From mdroettboom at continuum.io Tue Mar 8 09:58:18 2016 From: mdroettboom at continuum.io (Michael Droettboom) Date: Tue, 8 Mar 2016 09:58:18 -0500 Subject: [Matplotlib-users] Help matplotlib with Google Summer of Code! (March 14 Applications Due) Message-ID: matplotlib is participating in Google Summer of Code this year under the Numfocus organization. If you're currently an active student and wish to participate, see some of the project ideas here: https://github.com/numfocus/gsoc/blob/master/2016/ideas-list-matplotlib.md And the application instructions are here: https://github.com/numfocus/gsoc/blob/master/CONTRIBUTING-students.md We'd love to work with you this summer! Cheers, Michael Droettboom -- Michael Droettboom Continuum Analytics -------------- next part -------------- An HTML attachment was scrubbed... URL: From Oliver.Holmes at smtonline.de Tue Mar 8 10:21:10 2016 From: Oliver.Holmes at smtonline.de (Holmes, Oliver) Date: Tue, 8 Mar 2016 15:21:10 +0000 Subject: [Matplotlib-users] Need help to solve performance problems In-Reply-To: References: <7D0055CD-FD39-4E77-A7BE-1E4F96FCB2DA@smtonline.de> Message-ID: Ah, turns out the Raspberry Pi is more powerful than I thought. It?s just being held down by web2py. When I ran my script outside of web2py? in pure python so to speak, it was performing adequately. So now I?m using subprocess to call that script, and am quite happy. A wee bit more text here: http://stackoverflow.com/questions/35629471/need-help-to-solve-performance-problems-of-matplotlib-on-a-raspberry-pi So thanks for your insight, Ben. But that just seemed a bit too low-level for me. I just had to try something different. Cheers, Oliver Am 01.03.2016 um 17:22 schrieb Benjamin Root >: Sounds like you are describing the need for blitting, which most of the backends support in one way or another. The blitting pathways were designed with animations in mind, but I don't see why it couldn't be hijacked for your use as well. Note, you will have to do manual calls to copy_from_bbox() and such, but it should be doable. Ben Root On Tue, Mar 1, 2016 at 9:21 AM, Holmes, Oliver > wrote: Hey all, I?m trying to use matplotlib on a Raspberry Pi to visualize data the Pi receives via serial port - and of course I?m new to Python and matplotlib. The visualization need not be online, rather in form of a PDF once no more data is received. Then however as quick as possible. Please refer to my SO question for more details: http://stackoverflow.com/questions/35629471/need-help-to-solve-performance-problems-of-matplotlib-on-a-raspberry-pi Nevertheless here is a brief summary: During the better part of an hour my program does nothing but wait for input on the serial port, which is received once a second. During this waiting time it could already begin rendering the chart, and then just save it to file, once it?s done. I have not found out how to do this however. Whats more, I have read quite discouraging posts concerning the need to recalculate the axes and so forth. As an alternative to rendering the entire grid in the program, I guess it would be an improvement (speedwise) if I could just use an image of the grid and repeat it (as in tiling). But I have not quite found the means to do that either. Concerning the grid layout please refer to my other SO question http://stackoverflow.com/questions/35551080/is-it-possible-to-generate-a-chart-with-this-very-specific-background. Thanks a lot for reading?and perhaps answering :) Kind regards, Oliver Holmes _______________________________________________ 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 phyks at phyks.me Tue Mar 8 11:28:45 2016 From: phyks at phyks.me (Phyks) Date: Tue, 8 Mar 2016 17:28:45 +0100 Subject: [Matplotlib-users] Padding for unclipped 2D lines Message-ID: <56DEFDBD.800@phyks.me> Hi, I am plotting despined figures with large linewidths such as this one: https://cloud.githubusercontent.com/assets/3856586/13433245/4e9ea552-dfd1-11e5-90ed-3d302d0b861b.png (lines is not clipped, or it render poorly, being cropped). As you can see, there is some overlap between the figure and the title / ticks labels, which I would like to avoid. I was thinking in adding some padding to the figure so that ylim would not be 1.0 but a bit more and the line would stay within the figure frame in my previous example. But I am not sure which is the correct way of handling this? I found the `pyplot.margin` method, but it takes a float between 0 and 1, which I do not know how to get from the linewidth of my 2D line. I also thought I could use `set_xlim` (resp `ylim`), but same thing, I do not know how to convert my linewidth to real units of my plot. Thanks -- Phyks From gml at garymlewis.com Wed Mar 9 07:44:05 2016 From: gml at garymlewis.com (gml) Date: Wed, 9 Mar 2016 05:44:05 -0700 (MST) Subject: [Matplotlib-users] Problem with animation.save and extra_anim In-Reply-To: <1457452535310-46844.post@n5.nabble.com> References: <1457452535310-46844.post@n5.nabble.com> Message-ID: <1457527445076-46846.post@n5.nabble.com> Update 09-Mar-2016 1. I commented out the two individual saves (for anim0 and anim1). Same result; only the second animation appears in the mp4 file when using the extra_anim keyword. 2. I also ran this new script in a python shell instead of a jupyter notebook. Same result. 3. I read issues #5399 and #5822 on github re similar save problems with matplotlib animation. Those seem not be be related to the issue I raise here. Would very much appreciate your help. -- View this message in context: http://matplotlib.1069221.n5.nabble.com/Problem-with-animation-save-and-extra-anim-tp46844p46846.html Sent from the matplotlib - users mailing list archive at Nabble.com. From gml at garymlewis.com Tue Mar 8 10:55:35 2016 From: gml at garymlewis.com (gml) Date: Tue, 8 Mar 2016 08:55:35 -0700 (MST) Subject: [Matplotlib-users] Problem with animation.save and extra_anim Message-ID: <1457452535310-46844.post@n5.nabble.com> I'm stuck on animation.save. I cannot seem to save two animations into a single output file using the keyword extra_anim. It only saves the second of the two animations, even though each animation can be saved correctly to its own file. I've tried several different combinations of FuncAnimation and ArtistAnimation for the two animations, but all failed. Below is a very minimal example that illustrates the error. I'm using a Linux computer with version 1.5.1 of matplotlib installed. ffmpeg is the default animation.writer and mpeg4 is the default animation.codec. I should also say that I'm fairly new to python (1+ years), but very new to its animation. I have, however, spent considerable time researching this problem on the internet. And I've also read the chapter on animations in Ben Root's book. Any help would be much appreciated. ------------------- import numpy as np import matplotlib.pyplot as plt from matplotlib import animation # initialize xdata = np.array([0.2, 0.4, 0.6, 0.8]) ydata = np.array([0, 0, 0, 0]) anims = [] # list of animations # set up figure fig = plt.figure(figsize=(8,1.25)) ax = fig.add_subplot(111) ax.set_xlim(0, 1) ax.set_ylim(-0.5, 0.5) # first animation, with FuncAnimation line, = ax.plot([], []) line, = ax.plot(xdata, ydata, 'ro') def init(): line.set_data(xdata, ydata) return line, def animate(i): # update function ax.figure.canvas.draw() return line, anim0 = animation.FuncAnimation(fig, animate, init_func=init, frames=100, interval=20, blit=False) anim0.save('anim0.mp4', extra_args=['-vcodec', 'libx264']) # second animation, with ArtistAnimation ax.set_xlim(0.5, 1) frame_list = [] for i in range(100): frame = ax.plot(xdata, ydata, 'ro') frame_list.append(frame) anim1 = animation.ArtistAnimation(fig, frame_list, interval=20, repeat=False) anim1.save('anim1.mp4', extra_args=['-vcodec', 'libx264']) # combine the two animations anims = [anim0, anim1] anims[0].save('anims.mp4', extra_args=['-vcodec', 'libx264'], extra_anim=anims[1:]) -- View this message in context: http://matplotlib.1069221.n5.nabble.com/Problem-with-animation-save-and-extra-anim-tp46844.html Sent from the matplotlib - users mailing list archive at Nabble.com. From tcaswell at gmail.com Wed Mar 9 10:09:41 2016 From: tcaswell at gmail.com (Thomas Caswell) Date: Wed, 09 Mar 2016 15:09:41 +0000 Subject: [Matplotlib-users] Installing matplotlib1.5.1 in python3.5 and linux In-Reply-To: <1456131012420-46786.post@n5.nabble.com> References: <1456131012420-46786.post@n5.nabble.com> Message-ID: It looks like you do not have a complier installed or you have an env set to an empty string. That line should have g++ at the beginning of it. Tom On Wed, Mar 9, 2016, 09:16 msharmvikram wrote: > Hi > I am trying to install matplotlib 1.5.0 /1.5.1 version in my CentOS7 -- > Python3.5 active machine. I have resolved all the dependencies stated in > the > INSTALL file and also have updated setuptools to latest one. However, to my > bad luck i am not able to resolve this one particular issue shown in the > image. > > > I have tried following ways of install > > 1) pip3 install matplotlib==1.5.1 > 2) easy_install-3.5 -m matplotlib > > Both results in same above issue. I am clueless on what is the problem. > Anyone solved this issue? > > > > -- > View this message in context: > http://matplotlib.1069221.n5.nabble.com/Installing-matplotlib1-5-1-in-python3-5-and-linux-tp46786.html > Sent from the matplotlib - users mailing list archive at Nabble.com. > _______________________________________________ > Matplotlib-users mailing list > Matplotlib-users at python.org > https://mail.python.org/mailman/listinfo/matplotlib-users > -------------- next part -------------- An HTML attachment was scrubbed... URL: From tcaswell at gmail.com Wed Mar 9 10:12:05 2016 From: tcaswell at gmail.com (Thomas Caswell) Date: Wed, 09 Mar 2016 15:12:05 +0000 Subject: [Matplotlib-users] Curve Fitting In-Reply-To: <14431787-2565-4D06-BCC1-32DF719FEC00@gmail.com> References: <14431787-2565-4D06-BCC1-32DF719FEC00@gmail.com> Message-ID: This question is off topic for the matplotlib user mailing list. I suggest you try the supply scipy or pandas mailing lists or stack overflow. Tom On Wed, Mar 9, 2016, 09:16 Saloni Rao wrote: > Hi, > I was trying to write some Ipython code for Non linear Model fitting for a > complex formula( having polynomials in numerator and denominator). It has 3 > variables for which data is available and 3 variable which have to be > fitted. For data I have an excel file from which I am uploading the data. > I tried using scipy.optimize, lmfit and kmpfit but failed badly. Could you > suggest me a way to work around this problem? > Thanks. > _______________________________________________ > 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 jblackburne at gmail.com Wed Mar 9 13:08:40 2016 From: jblackburne at gmail.com (Jeff Blackburne) Date: Wed, 9 Mar 2016 10:08:40 -0800 Subject: [Matplotlib-users] Graph similiar to necked_tensile_specimen.png In-Reply-To: <1455524618872-46752.post@n5.nabble.com> References: <1455524618872-46752.post@n5.nabble.com> Message-ID: Hi Stefan, Looks like there is a small link to the source code near the top (right below "interpolation_none_vs_nearest.py"). -Jeff On Mon, Feb 15, 2016 at 12:23 AM, sprobst76 wrote: > Hello, > > in the examples I found a graph which is similar to a graph I want to have. > However the example is only given as png and I want to have the code. > > The example is the necked_tensile_specimen.pngimage of the following > example > > http://matplotlib.org/examples/images_contours_and_fields/interpolation_none_vs_nearest.html > > There is a 2D map which is compressed in the center. Does anybody has the > code for the example? > > Thank you & best regards > Stefan > > > > -- > View this message in context: > http://matplotlib.1069221.n5.nabble.com/Graph-similiar-to-necked-tensile-specimen-png-tp46752.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 pmhobson at gmail.com Wed Mar 9 19:57:46 2016 From: pmhobson at gmail.com (Paul Hobson) Date: Wed, 9 Mar 2016 16:57:46 -0800 Subject: [Matplotlib-users] Graph similiar to necked_tensile_specimen.png In-Reply-To: References: <1455524618872-46752.post@n5.nabble.com> Message-ID: The source code is also provided at the bottom of the page. On Wed, Mar 9, 2016 at 10:08 AM, Jeff Blackburne wrote: > Hi Stefan, > > Looks like there is a small link to the source code near the top (right > below "interpolation_none_vs_nearest.py"). > > -Jeff > > > > On Mon, Feb 15, 2016 at 12:23 AM, sprobst76 wrote: > >> Hello, >> >> in the examples I found a graph which is similar to a graph I want to >> have. >> However the example is only given as png and I want to have the code. >> >> The example is the necked_tensile_specimen.pngimage of the following >> example >> >> http://matplotlib.org/examples/images_contours_and_fields/interpolation_none_vs_nearest.html >> >> There is a 2D map which is compressed in the center. Does anybody has the >> code for the example? >> >> Thank you & best regards >> Stefan >> >> >> >> -- >> View this message in context: >> http://matplotlib.1069221.n5.nabble.com/Graph-similiar-to-necked-tensile-specimen-png-tp46752.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 >> > > > _______________________________________________ > 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 pmhobson at gmail.com Wed Mar 9 20:33:45 2016 From: pmhobson at gmail.com (Paul Hobson) Date: Wed, 9 Mar 2016 17:33:45 -0800 Subject: [Matplotlib-users] How to plot tick values in-place In-Reply-To: <56B9FD1F.1010609@nasa.gov> References: <56B9FD1F.1010609@nasa.gov> Message-ID: That's a really old version of MPL, so I'm not sure if this will work: http://stackoverflow.com/questions/9303728/matplotlib-yaxis-range-display-using-absolute-values-rather-than-offset-values On Tue, Feb 9, 2016 at 6:52 AM, Ilja Honkonen wrote: > Hello > I haven't been able to find a solution to this problem with google, > perhaps someone here can help. When I plot the following: > import matplotlib.pyplot as plot > plot.plot([0, 1e-9, 0, -1e-9]) > plot.show() > the y tick marks are shown as -1, -0.5, 0, 0.5, 1 and their scaling is > given elsewhere, how can I make matplotlib write the entire number at tick > location so I don't have to search for potential corrections to tick values > in other parts of the plot? matplotlib.__version__ is '1.1.1'. Thanks! > Ilja > _______________________________________________ > 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 silva at lma.cnrs-mrs.fr Thu Mar 10 03:49:11 2016 From: silva at lma.cnrs-mrs.fr (Fabrice Silva) Date: Thu, 10 Mar 2016 09:49:11 +0100 Subject: [Matplotlib-users] Graph similiar to necked_tensile_specimen.png In-Reply-To: References: <1455524618872-46752.post@n5.nabble.com> Message-ID: <1457599751.1456.36.camel@lma.cnrs-mrs.fr> Le mercredi 09 mars 2016, Paul Hobson a ?crit : > The source code is also provided at the bottom of the page. >? > > > > > > http://matplotlib.org/examples/images_contours_and_fields/interpo > > > lation_none_vs_nearest.html Hi, Note that the pdf file attached to that page is cropped, i.e. it does not render all the figure (at least as visible in evince 3.18 on debian). And for the image_demo* examples in the same folder, the images are poorly rendered (huge visible pixels)... Maybe there is some tuning to do on the configuration of the export to pdf.... From ben.v.root at gmail.com Thu Mar 10 09:23:31 2016 From: ben.v.root at gmail.com (Benjamin Root) Date: Thu, 10 Mar 2016 09:23:31 -0500 Subject: [Matplotlib-users] Graph similiar to necked_tensile_specimen.png In-Reply-To: <1457599751.1456.36.camel@lma.cnrs-mrs.fr> References: <1455524618872-46752.post@n5.nabble.com> <1457599751.1456.36.camel@lma.cnrs-mrs.fr> Message-ID: Whoa, you are right that the PDF is badly scaled. Both the Firefox pdf viewer and an older evince has it significantly zoomed in. As for the huge visible pixels, that is the point of this demonstration. It demonstrates the subtle difference between the "none" and "nearest" options for imshow. On Thu, Mar 10, 2016 at 3:49 AM, Fabrice Silva wrote: > Le mercredi 09 mars 2016, Paul Hobson a ?crit : > > The source code is also provided at the bottom of the page. > > > > > > > > > > http://matplotlib.org/examples/images_contours_and_fields/interpo > > > > lation_none_vs_nearest.html > > Hi, > Note that the pdf file attached to that page is cropped, i.e. it does > not render all the figure (at least as visible in evince 3.18 on > debian). > > And for the image_demo* examples in the same folder, the images are > poorly rendered (huge visible pixels)... > > Maybe there is some tuning to do on the configuration of the export to > pdf.... > _______________________________________________ > 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 StefanProbst at gmx.net Wed Mar 9 15:56:31 2016 From: StefanProbst at gmx.net (sprobst76) Date: Wed, 9 Mar 2016 13:56:31 -0700 (MST) Subject: [Matplotlib-users] Graph similiar to necked_tensile_specimen.png In-Reply-To: References: <1455524618872-46752.post@n5.nabble.com> Message-ID: <1457556991806-46863.post@n5.nabble.com> Hi Jeff, thank you for the reply. However I am not looking for the finished PNG. I am interested how the image necked_tensile_specimen.png was created. If it was created with matplotlib, I would like to have the code. Best regards Stefan -- View this message in context: http://matplotlib.1069221.n5.nabble.com/Graph-similiar-to-necked-tensile-specimen-png-tp46752p46863.html Sent from the matplotlib - users mailing list archive at Nabble.com. From StefanProbst at gmx.net Thu Mar 10 07:40:33 2016 From: StefanProbst at gmx.net (sprobst76) Date: Thu, 10 Mar 2016 05:40:33 -0700 (MST) Subject: [Matplotlib-users] Graph similiar to necked_tensile_specimen.png In-Reply-To: References: <1455524618872-46752.post@n5.nabble.com> Message-ID: <1457613633324-46870.post@n5.nabble.com> Hello, thank you. However as I mentioned before I am looking for the code for the image *necked_tensile_specimen.png* and not for the code of the interpolation example. The image *necked_tensile_specimen.png* is given as sample data (as finished PNG) in the matplotlib examples. So far I did not find the code to produce this image . As I plan to generate a plot similar to *necked_tensile_specimen.png* it would be perfect to get the code for a necked 2D map! Thank you again in advance! Best regards Stefan -- View this message in context: http://matplotlib.1069221.n5.nabble.com/Graph-similiar-to-necked-tensile-specimen-png-tp46752p46870.html Sent from the matplotlib - users mailing list archive at Nabble.com. From efiring at hawaii.edu Thu Mar 10 23:33:42 2016 From: efiring at hawaii.edu (Eric Firing) Date: Thu, 10 Mar 2016 18:33:42 -1000 Subject: [Matplotlib-users] Graph similiar to necked_tensile_specimen.png In-Reply-To: <1457613633324-46870.post@n5.nabble.com> References: <1455524618872-46752.post@n5.nabble.com> <1457613633324-46870.post@n5.nabble.com> Message-ID: <56E24AA6.709@hawaii.edu> On 2016/03/10 2:40 AM, sprobst76 wrote: > Hello, > > thank you. However as I mentioned before I am looking for the code for the > image *necked_tensile_specimen.png* and not for the code of the > interpolation example. > > The image *necked_tensile_specimen.png* is given as sample data (as finished > PNG) in the matplotlib examples. So far I did not find the code to produce > this image > > . > > As I plan to generate a plot similar to *necked_tensile_specimen.png* it > would be perfect to get the code for a necked 2D map! > I don't know where the exact code is, but it looks like it is produced using pcolormesh with Gouraud shading, as in this example: http://matplotlib.org/examples/pylab_examples/quadmesh_demo.html Eric From Nicolas.Rougier at inria.fr Fri Mar 11 01:44:00 2016 From: Nicolas.Rougier at inria.fr (Nicolas P. Rougier) Date: Fri, 11 Mar 2016 07:44:00 +0100 Subject: [Matplotlib-users] Graph similiar to necked_tensile_specimen.png In-Reply-To: <56E24AA6.709@hawaii.edu> References: <1455524618872-46752.post@n5.nabble.com> <1457613633324-46870.post@n5.nabble.com> <56E24AA6.709@hawaii.edu> Message-ID: <3D0CF0A8-A67F-4747-8BEE-284D70E47F91@inria.fr> It seems the graphic may come from http://clearplot.readthedocs.org/en/latest/ The author can certainly tells you how he did it (https://github.com/breedlun/clearplot) Nicolas > On 11 Mar 2016, at 05:33, Eric Firing wrote: > > On 2016/03/10 2:40 AM, sprobst76 wrote: >> Hello, >> >> thank you. However as I mentioned before I am looking for the code for the >> image *necked_tensile_specimen.png* and not for the code of the >> interpolation example. >> >> The image *necked_tensile_specimen.png* is given as sample data (as finished >> PNG) in the matplotlib examples. So far I did not find the code to produce >> this image >> >> . >> >> As I plan to generate a plot similar to *necked_tensile_specimen.png* it >> would be perfect to get the code for a necked 2D map! >> > > I don't know where the exact code is, but it looks like it is produced using pcolormesh with Gouraud shading, as in this example: > http://matplotlib.org/examples/pylab_examples/quadmesh_demo.html > > Eric > > _______________________________________________ > Matplotlib-users mailing list > Matplotlib-users at python.org > https://mail.python.org/mailman/listinfo/matplotlib-users From timmichelsen at gmx-topmail.de Sat Mar 12 05:50:14 2016 From: timmichelsen at gmx-topmail.de (Tim Michelsen) Date: Sat, 12 Mar 2016 11:50:14 +0100 Subject: [Matplotlib-users] What is the fastest way to plot map using Basemap and shapefile? In-Reply-To: <1455215798101-46743.post@n5.nabble.com> References: <1455215798101-46743.post@n5.nabble.com> Message-ID: > As the title suggest What is the fastest way to plot map using Basemap and > python? > As the title suggest What is the fastest way to plot map using Basemap and > python? I'd take a look at Cartopy: http://scitools.org.uk/cartopy/docs/latest/index.html From mckauf at gmail.com Sun Mar 13 23:42:45 2016 From: mckauf at gmail.com (Mike Kaufman) Date: Sun, 13 Mar 2016 23:42:45 -0400 Subject: [Matplotlib-users] getting back the old gridline style In-Reply-To: References: Message-ID: <56E63335.2040105@gmail.com> I'm not a fan of the new style of gridlines in 1.5.1 (the dot spacing has decreased significantly). How do I get the old style in 1.5.1? M -------------- next part -------------- A non-text attachment was scrubbed... Name: gridlines_new.pdf Type: application/pdf Size: 23707 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: gridlines_old.pdf Type: application/pdf Size: 23607 bytes Desc: not available URL: From tcaswell at gmail.com Sun Mar 13 23:50:06 2016 From: tcaswell at gmail.com (Thomas Caswell) Date: Mon, 14 Mar 2016 03:50:06 +0000 Subject: [Matplotlib-users] getting back the old gridline style In-Reply-To: <56E63335.2040105@gmail.com> References: <56E63335.2040105@gmail.com> Message-ID: Your 'new' style looks like it taken off of either master or v2.x, not 1.5.1. The default grid linestyle is controlled by 'grid.linestyle' rcparam. The old default is ':' (dotted), the new default is '-' (solid). There is also a 'classic' style which restores all of the old default styles. Tom On Sun, Mar 13, 2016 at 11:42 PM Mike Kaufman wrote: > > I'm not a fan of the new style of gridlines in 1.5.1 (the dot spacing > has decreased significantly). How do I get the old style in 1.5.1? > > M > _______________________________________________ > Matplotlib-users mailing list > Matplotlib-users at python.org > https://mail.python.org/mailman/listinfo/matplotlib-users > -------------- next part -------------- An HTML attachment was scrubbed... URL: From mckauf at gmail.com Sun Mar 13 23:52:20 2016 From: mckauf at gmail.com (Mike Kaufman) Date: Sun, 13 Mar 2016 23:52:20 -0400 Subject: [Matplotlib-users] getting back the old gridline style In-Reply-To: References: <56E63335.2040105@gmail.com> Message-ID: <56E63574.6060409@gmail.com> Sorry, yep this is master. I switched the grid.linestyle to ':', but the dot spacing is much much closer together than the old style. How do I change the spacing? M On 3/13/16 11:50 PM, Thomas Caswell wrote: > Your 'new' style looks like it taken off of either master or v2.x, not > 1.5.1. > > The default grid linestyle is controlled by 'grid.linestyle' rcparam. > The old default is ':' (dotted), the new default is '-' (solid). > > There is also a 'classic' style which restores all of the old default > styles. > > Tom > > On Sun, Mar 13, 2016 at 11:42 PM Mike Kaufman > wrote: > > > I'm not a fan of the new style of gridlines in 1.5.1 (the dot spacing > has decreased significantly). How do I get the old style in 1.5.1? > > M > _______________________________________________ > Matplotlib-users mailing list > Matplotlib-users at python.org > https://mail.python.org/mailman/listinfo/matplotlib-users > From tcaswell at gmail.com Mon Mar 14 00:00:24 2016 From: tcaswell at gmail.com (Thomas Caswell) Date: Mon, 14 Mar 2016 04:00:24 +0000 Subject: [Matplotlib-users] getting back the old gridline style In-Reply-To: <56E63574.6060409@gmail.com> References: <56E63335.2040105@gmail.com> <56E63574.6060409@gmail.com> Message-ID: See the new 'lines.*_pattern' rcparams. On Sun, Mar 13, 2016 at 11:52 PM Mike Kaufman wrote: > Sorry, yep this is master. I switched the grid.linestyle to ':', but the > dot spacing is much much closer together than the old style. How do I > change the spacing? > > M > > On 3/13/16 11:50 PM, Thomas Caswell wrote: > > Your 'new' style looks like it taken off of either master or v2.x, not > > 1.5.1. > > > > The default grid linestyle is controlled by 'grid.linestyle' rcparam. > > The old default is ':' (dotted), the new default is '-' (solid). > > > > There is also a 'classic' style which restores all of the old default > > styles. > > > > Tom > > > > On Sun, Mar 13, 2016 at 11:42 PM Mike Kaufman > > wrote: > > > > > > I'm not a fan of the new style of gridlines in 1.5.1 (the dot spacing > > has decreased significantly). How do I get the old style in 1.5.1? > > > > M > > _______________________________________________ > > Matplotlib-users mailing list > > Matplotlib-users at python.org > > https://mail.python.org/mailman/listinfo/matplotlib-users > > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From gml at garymlewis.com Mon Mar 14 07:32:11 2016 From: gml at garymlewis.com (gml) Date: Mon, 14 Mar 2016 04:32:11 -0700 (MST) Subject: [Matplotlib-users] Problem with animation.save and extra_anim In-Reply-To: <1457452535310-46844.post@n5.nabble.com> References: <1457452535310-46844.post@n5.nabble.com> Message-ID: <1457955131728-46886.post@n5.nabble.com> I made a detour around this problem, so it's no longer a pressing concern. But I'd still like to understand the issue better. Did it occur because of user (ie, my) inexperience and error? Or is it a bug in animation.save? Or something else? Thanks. -- View this message in context: http://matplotlib.1069221.n5.nabble.com/Problem-with-animation-save-and-extra-anim-tp46844p46886.html Sent from the matplotlib - users mailing list archive at Nabble.com. From ben.v.root at gmail.com Mon Mar 14 15:38:20 2016 From: ben.v.root at gmail.com (Benjamin Root) Date: Mon, 14 Mar 2016 15:38:20 -0400 Subject: [Matplotlib-users] Problem with animation.save and extra_anim In-Reply-To: <1457955131728-46886.post@n5.nabble.com> References: <1457452535310-46844.post@n5.nabble.com> <1457955131728-46886.post@n5.nabble.com> Message-ID: It seems like you have a few things mixed up here in your example. First, the "animate()" function shouldn't be doing any draw() calls. The animation infrastructure is responsible for that. The purpose of the "update" function for FuncAnimation is to update any of the artists and return what was updated. Also, with this example, I don't see how it is possible to distinguish between the ArtistAnimation part and the FuncAnimation part. They are both drawing the same animation, right? Ben Root On Mon, Mar 14, 2016 at 7:32 AM, gml wrote: > I made a detour around this problem, so it's no longer a pressing concern. > But I'd still like to understand the issue better. Did it occur because of > user (ie, my) inexperience and error? Or is it a bug in animation.save? Or > something else? Thanks. > > > > -- > View this message in context: > http://matplotlib.1069221.n5.nabble.com/Problem-with-animation-save-and-extra-anim-tp46844p46886.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 gml at garymlewis.com Mon Mar 14 21:46:24 2016 From: gml at garymlewis.com (gml) Date: Mon, 14 Mar 2016 18:46:24 -0700 (MST) Subject: [Matplotlib-users] Problem with animation.save and extra_anim In-Reply-To: References: <1457452535310-46844.post@n5.nabble.com> <1457955131728-46886.post@n5.nabble.com> Message-ID: <1458006384721-46897.post@n5.nabble.com> As you say, it's true that in my example both ArtistAnimation and FuncAnimation were static multi-frame "animations" of a 1D plot of points. But when done with a thousand or so Cantor set points, the static plot and the animated plot where xlim narrows around a clump of points are really quite effective. It's just that I cannot use animation.save and extra_anim to save the two animations into a single file. And it's not clear to me whether the problem is the python code I wrote or whether there's a bug in animation.save. -- View this message in context: http://matplotlib.1069221.n5.nabble.com/Problem-with-animation-save-and-extra-anim-tp46844p46897.html Sent from the matplotlib - users mailing list archive at Nabble.com. From ben.v.root at gmail.com Tue Mar 15 12:10:42 2016 From: ben.v.root at gmail.com (Benjamin Root) Date: Tue, 15 Mar 2016 12:10:42 -0400 Subject: [Matplotlib-users] getting back the old gridline style In-Reply-To: References: <56E63335.2040105@gmail.com> <56E63574.6060409@gmail.com> Message-ID: Thomas, was this expected (the change in dot spacing?). I wonder if it is a bug in the new spacing scaled by thickness feature? Ben Root On Mon, Mar 14, 2016 at 12:00 AM, Thomas Caswell wrote: > See the new 'lines.*_pattern' rcparams. > > On Sun, Mar 13, 2016 at 11:52 PM Mike Kaufman wrote: > >> Sorry, yep this is master. I switched the grid.linestyle to ':', but the >> dot spacing is much much closer together than the old style. How do I >> change the spacing? >> >> M >> >> On 3/13/16 11:50 PM, Thomas Caswell wrote: >> > Your 'new' style looks like it taken off of either master or v2.x, not >> > 1.5.1. >> > >> > The default grid linestyle is controlled by 'grid.linestyle' rcparam. >> > The old default is ':' (dotted), the new default is '-' (solid). >> > >> > There is also a 'classic' style which restores all of the old default >> > styles. >> > >> > Tom >> > >> > On Sun, Mar 13, 2016 at 11:42 PM Mike Kaufman > > > wrote: >> > >> > >> > I'm not a fan of the new style of gridlines in 1.5.1 (the dot >> spacing >> > has decreased significantly). How do I get the old style in 1.5.1? >> > >> > M >> > _______________________________________________ >> > Matplotlib-users mailing list >> > Matplotlib-users at python.org >> > https://mail.python.org/mailman/listinfo/matplotlib-users >> > >> >> > _______________________________________________ > Matplotlib-users mailing list > Matplotlib-users at python.org > https://mail.python.org/mailman/listinfo/matplotlib-users > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From glenn at glenn-nelson.us Tue Mar 15 14:52:39 2016 From: glenn at glenn-nelson.us (dr_glenn) Date: Tue, 15 Mar 2016 11:52:39 -0700 (MST) Subject: [Matplotlib-users] Matplotlib/Basemap display (pixel) coordinates are wrong values Message-ID: <1458067959237-46900.post@n5.nabble.com> Matplotlib/Basemap display (pixel) coordinates are wrong values. GOAL Compute display (pixel) coordinates from lat-long input and draw marker on a map image using Javascript. Use matplotlib/basemap to compute display coords, return values to web browser for drawing on top of map. PROBLEM The display (pixel) coordinates computed from geo coordinates by matplotlib/basemap are not always correct. It depends on the version of matplotlib and basemap and it also depends on the figure size! Only old versions of matplotlib (0.99.1.1) and basemap (0.99.4) are always correct! Newer versions are wrong unless figure size is small! NOTES: I only found out about pyproj after I started this investigtion, so my code example does not use pyproj, but I'm told that shouldn't matter. My example code (at bottom) prints out geo, projection, display and axes coordinates. It also displays a map, using matplotlib, with markers plotted either from geo, projection, or axes coordinates; I have not figured out how to correctly plot markers with display coordinates using matplotlib/basemap, although I can plot markers with display coordinates using javascript. SCENARIO I am using Basemap with Miiler projection centered at 180 longitude and a global map. The map image is written as PNG and displayed in web browser. The user can enter lat-long coordinates in HTML FORM and should then see a marker placed on the map. This is NOT done by redrawing the map, instead it is done by computing display coordinates (pixels) and using HTML CANVAS draw capabilities. >From the HTML FORM, I send lat-long coordinates to server and have matplotlib/basemap compute as follows: geo coordinates (lat-long) to projection coordinates (meters) to display coordinates (pixels). Then I return display coordinates to web browser and have javascript place a symbol on top of the map image by drawing on the canvas. This works fine in one environment, but fails on others. The failure is really strange ... Correct with Python 2.6.6, matpllotlib 0.99.1.1; mpl_toolkits.basemap 0.99.4 Wrong with two other environments: Python 2.6.6; matplotlib 1.4.2; mpl_toolkits.basemap 1.0.7 Python 2.7.11; matplotlib 1.5.0l; mpl_toolskits.basemap 1.0.7 The display (pixel) x-coordinate is correct in all cases. The display y-coordinate is wrong and appears to be a scaling issue: it is larger than it should be - the y-coordinate plots at a larger latitude, except 0 degrees latitude is correct. Here's where it gets really strange: the discrepancy depends on the figure size and it disappears when the figure is small enough! Stranger still is that I can take the display coordinates (pixels) and transform to axes coordinates (0 to 1), and even though two different matplotlib environments result in unequal display coordinates, the axes coordinates are identical! In all cases I'm using DPI=100.0 For example, here are coordinates for longitude=180, latitude=60,30, with figsize=(10,10) Good Bad Diff (in pixels) 60 647.6 707.8 60.2 30 566.6 593.7 27.1 Diff 81.0 114.1 Step down to (10,8): Good Bad Diff 60 547.6 566.3 18.7 30 466.6 475.0 8.4 Diff 81.0 91.3 Shrink to figsize=(10,7) and all is well! And it will be OK at any height smaller than 7. Good Bad Diff 30 415.6 415.6 0.0 60 495.5 495.5 0.0 Diff 79.9 79.9 I also experimented with figsize=(8,y) and found that there was a discrepancy when y >= 6 and no discrepancy when y <= 5. EXAMPLE This example is incomplete in that it does not include javascript and AJAX code that I am using. However, if this program is run in a matplotlib 0.99 environment and then in a more recent matplotlib (and Basemap), you can see the discrepancies in the printed output. The star markers are plotted with display coords and should fall on the 180 longitude line (except 180,0 has a small offset). # coding: utf-8 import matplotlib #matplotlib.use('GTKAgg') matplotlib.use('TKAgg') #matplotlib.use('Agg') from mpl_toolkits.basemap import Basemap import matplotlib.pyplot as plt import numpy as np grid_incr = 1.0 lats0 = np.arange(-90.0,90.1,grid_incr) lons0 = np.arange(0.0,359.9,grid_incr) lons,lats = np.meshgrid(lons0, lats0) plt.figure(figsize=(10,8)) map = Basemap(projection='mill', lon_0=180) #map = Basemap(projection='moll', lon_0=180) map.drawcoastlines() map.drawparallels(np.arange(-90,90,30),labels=[1,0,0,0]) map.drawmeridians(np.arange(lons0[0],lons0[-1]+30,60),labels=[0,0,0,1]) map.drawmapboundary(fill_color='grey') fig = plt.gcf() # get current figure fig.set_frameon(True) fig.set_dpi(100.0) width,height = fig.canvas.get_width_height() print 'canvas size = {0:.1f},{1:.1f}'.format(width,height) print 'DPI = %f' %(fig.get_dpi()) print 'fig size pixels = %s' %str((fig.transFigure.transform([1,1]))) fig.patch.set_visible(True) fig.patch.set_facecolor('green') # just want to know what part of display is "figure" ax = fig.gca() # get current axes # We have map projection coords (meters) and geographic coords (degrees). # You can transform between these two by using the Basemap object. # map_xy = my_basemap(lon,lat) # lon,lat = my_basemap(x,y,inverse=True) # But how to translate into axes? # Maybe this: https://scipy.github.io/old-wiki/pages/Cookbook/Matplotlib/Transformations.html # And there is some gold here, talking about chaining transforms: https://sourceforge.net/p/matplotlib/mailman/message/19700132/ from matplotlib.transforms import IdentityTransform # Function performs various coordinate transforms and prints values def plot_ll(lon,lat,ctype='proj'): ''' Start with lon-lat coordinate and convert to map projection (meters), then to display (pixel) coordinates. Finally convert display coordinates back to Axes coordinates (0.0 to 1.0). Print all of these. Then use ctype to determine which set of coordinates to use to plot marker on map. ''' global map global fig global ax global disp_org xy_format = '({0:.1f}, {1:.1f})' geo_xy = (lon,lat) geo_xy_s = '({0:5.1f}, {1:5.1f})'.format(lon,lat) proj_xy = map(lon,lat) proj_xy_s = '({0:11.1f}, {1:11.1f})'.format(proj_xy[0],proj_xy[1]) disp_xy = ax.transData.transform(proj_xy) disp_xy_s = '({0:6.1f}, {1:6.1f})'.format(disp_xy[0],disp_xy[1]) inv = ax.transAxes.inverted() axes_xy = inv.transform(disp_xy) axes_xy_s = '({0:.3f}, {1:.3f})'.format(axes_xy[0],axes_xy[1]) #print 'plot_ll: geo=%s, proj=%s, disp=%s, axes=%s' %(str(geo_xy),proj_xy_s,disp_xy_s,axes_xy_s) print 'plot_ll: geo=%s, proj=%s, disp=%s, axes=%s' %(geo_xy_s,proj_xy_s,disp_xy_s,axes_xy_s) if ctype == 'proj': mcolor = 'r' # red for projection coordinates marker = 'o' msize = 8 # Use map object to plot proj_xy with no transform map.plot(proj_xy[0],proj_xy[1],color=mcolor,marker=marker,ms=msize) elif ctype == 'disp': mcolor = 'b' # blue for display coords marker = 'o' msize = 8 # Next does not work - I thuoght it would plot '*' marker using display coords, # but the position is not correct. ax.plot(disp_xy[0]-disp_org[0],disp_xy[1]-disp_org[1],color=mcolor,marker='*',ms=msize, transform=IdentityTransform()) # Instead invert back to proj_xy and plot inv1 = ax.transData.inverted() pxy = inv1.transform(disp_xy) # Use ax object to plot proj_xy with transform=ax.transData ax.plot(pxy[0],pxy[1],color=mcolor,marker=marker,ms=msize, transform=ax.transData) elif ctype == 'axes': mcolor = 'g' # green for axes coords marker = 'o' msize = 8 ax.plot(axes_xy[0],axes_xy[1],color=mcolor,marker=marker,ms=msize,transform=ax.transAxes) # plot points on map, use different coordinates when plotting proj_org = map(0.0,-90.0) # map origin in projection coords disp_org = ax.transData.transform(proj_org) # map origin in display coords print 'display origin: ({0:6.1f}, {1:6.1f})'.format(disp_org[0],disp_org[1]) plot_ll(180.0,0.0,ctype='proj') plot_ll(180.0,89.0,ctype='proj') plot_ll(180.0,-89.0,ctype='proj') plot_ll(175.0,0.0,ctype='axes') plot_ll(175.0,89.0,ctype='axes') plot_ll(175.0,-89.0,ctype='axes') plot_ll(5.0,0.0,ctype='axes') plot_ll(5.0,89.0,ctype='axes') plot_ll(5.0,-89.0,ctype='axes') plot_ll(185.0,0.0,ctype='disp') plot_ll(185.0,89.0,ctype='disp') plot_ll(185.0,-89.0,ctype='disp') plot_ll(355.0,0.0,ctype='disp') plot_ll(355.0,89.0,ctype='disp') plot_ll(355.0,-89.0,ctype='disp') plot_ll(180.0,30.0,ctype='disp') plot_ll(180.0,60.0,ctype='disp') plot_ll(180.0,-30.0,ctype='disp') plot_ll(180.0,-60.0,ctype='disp') plt.show() -- View this message in context: http://matplotlib.1069221.n5.nabble.com/Matplotlib-Basemap-display-pixel-coordinates-are-wrong-values-tp46900.html Sent from the matplotlib - users mailing list archive at Nabble.com. From srinivas.boppu at gmail.com Tue Mar 15 12:29:10 2016 From: srinivas.boppu at gmail.com (srinivas boppu) Date: Tue, 15 Mar 2016 17:29:10 +0100 Subject: [Matplotlib-users] Regarding installation Message-ID: Hi, This is Srinivas. I would like to install "matplotlib" in office compute farm and our IT generally don't support such individual requests. So, I would like to install in a specific area where I have the write access. I wanted to know, what is the easiest way to install on linux? Any suggestions in this regard would help. Thanks, Srinivas -- Apologizing doesn't mean U r wrong & the other is right,It means that U value the relationship more than Ur ego... -------------- next part -------------- An HTML attachment was scrubbed... URL: From pmhobson at gmail.com Thu Mar 17 12:09:03 2016 From: pmhobson at gmail.com (Paul Hobson) Date: Thu, 17 Mar 2016 09:09:03 -0700 Subject: [Matplotlib-users] Regarding installation In-Reply-To: References: Message-ID: Anaconda is the way to go here: http://conda.pydata.org/miniconda.html -- you can install it anywhere and have as many environments in your user space as you need. On Tue, Mar 15, 2016 at 9:29 AM, srinivas boppu wrote: > Hi, > > This is Srinivas. I would like to install "matplotlib" in office compute > farm and our IT generally don't support such individual requests. > So, I would like to install in a specific area where I have the write > access. > > I wanted to know, what is the easiest way to install on linux? > Any suggestions in this regard would help. > > Thanks, > Srinivas > > -- > Apologizing doesn't mean U r wrong & the other is right,It means that U > value the relationship more than Ur ego... > > > _______________________________________________ > Matplotlib-users mailing list > Matplotlib-users at python.org > https://mail.python.org/mailman/listinfo/matplotlib-users > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From tcaswell at gmail.com Thu Mar 17 12:16:35 2016 From: tcaswell at gmail.com (Thomas Caswell) Date: Thu, 17 Mar 2016 16:16:35 +0000 Subject: [Matplotlib-users] Regarding installation In-Reply-To: References: Message-ID: Almost every major linux distribution packages mpl so if you _do_ need to go through your system admins there is a path that should be easy for them. Tom On Thu, Mar 17, 2016 at 12:11 PM Paul Hobson wrote: > Anaconda is the way to go here: > http://conda.pydata.org/miniconda.html -- you can install it anywhere and > have as many environments in your user space as you need. > > On Tue, Mar 15, 2016 at 9:29 AM, srinivas boppu > wrote: > >> Hi, >> >> This is Srinivas. I would like to install "matplotlib" in office compute >> farm and our IT generally don't support such individual requests. >> So, I would like to install in a specific area where I have the write >> access. >> >> I wanted to know, what is the easiest way to install on linux? >> Any suggestions in this regard would help. >> >> Thanks, >> Srinivas >> >> -- >> Apologizing doesn't mean U r wrong & the other is right,It means that U >> value the relationship more than Ur ego... >> >> >> _______________________________________________ >> Matplotlib-users mailing list >> Matplotlib-users at python.org >> https://mail.python.org/mailman/listinfo/matplotlib-users >> >> > _______________________________________________ > Matplotlib-users mailing list > Matplotlib-users at python.org > https://mail.python.org/mailman/listinfo/matplotlib-users > -------------- next part -------------- An HTML attachment was scrubbed... URL: From christopher.ys.bull at gmail.com Thu Mar 17 18:39:59 2016 From: christopher.ys.bull at gmail.com (Christopher Bull) Date: Fri, 18 Mar 2016 09:39:59 +1100 Subject: [Matplotlib-users] gridding subplots in matplotlib. Message-ID: Hello plotting enthusiasts! I've written a python class for gridding subplots in 'one line' (munging aside). Example: plth.Grid(plotdict,(4,3),dimlabels=dimlab,globalcbar='Accent',clevels=20,sharex=True,sharey=True,outputpath=plotoutputs+'005_GridEgDimLabShareXShareYglobalcbarAccentclevels.png') produces [1]. See this post for more details and options. Apologies in advance: - I'm sure I haven't followed the matplotlib API. (I'd be interested if someone can point me towards a good example of this.) I don't think I have time but if someone wants to turn this into a pull request that would be great! - I realise there are similar efforts in Pandas/Iris/ggplot, I just wanted something that would work on any numpy array. Also, any plt users on here that have ideas for this 3d plotting question I wrote on stackoverflow ? Cheers, Chris Bull. [1] -- *Christopher Bull* PhD Candidate BAMOS Associate Editor Climate Change Research Centre & ARC Centre of Excellence for Climate System Science University of New South Wales Sydney NSW 2052 Australia t: @ChrisBullOceanO gh: chrisb13 *w: christopherbull.com.au * -------------- next part -------------- An HTML attachment was scrubbed... URL: From efiring at hawaii.edu Fri Mar 18 20:12:35 2016 From: efiring at hawaii.edu (Eric Firing) Date: Fri, 18 Mar 2016 14:12:35 -1000 Subject: [Matplotlib-users] Struggle with ticker.SymmetricalLogLocator() In-Reply-To: <1455530629905-46753.post@n5.nabble.com> References: <1455530629905-46753.post@n5.nabble.com> Message-ID: <56EC9973.7020207@hawaii.edu> On 2016/02/15 12:03 AM, superchinchilla wrote: > Hi, > > I want to make a symmetric logarithmic plot, but unfortunately the y-values > are overlapping around 0. I don't want to display the first values around 0. > I'm not sure how to use the ticker.SymmetricalLogLocator command to change > the ticklocations or the tickfrequencies. I searched for a long time but > didn't find any proper solution for it besides the examples for the normal > Loglocater which didn't work. I tried to understand how the > ticker.SymmetricalLogLocator(transform, subs=None) instance is working on > the matplotlib documentation side which is not an easy target for me. I only > want that the first ticklabes around zero are not displayed in my plot. > > I'm using the plt.yscale('symlog') command in order to plot it symmetrically > around zero. My picture looks like > > > Sorry for my bad English, > thanx for any help in advance I'm sorry for the long delay, but in case you haven't found a solution yet, here is an example of one way of handling the situation: import matplotlib.pyplot as plt import numpy as np dt = 0.01 x = np.arange(-50.0, 50.0, dt) y = np.arange(0, 100.0, dt) fig, ax = plt.subplots() ax.plot(y, x) ax.set_yscale('symlog') ax.set_ylabel('symlogy') ylabs = ax.yaxis.get_ticklabels() i0 = int(len(ylabs) // 2) for label in ylabs[i0-1:i0+2]: label.set_visible(False) plt.show() ----- Eric > > > > -- > View this message in context: http://matplotlib.1069221.n5.nabble.com/Struggle-with-ticker-SymmetricalLogLocator-tp46753.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 chinchi at physik.tu-berlin.de Sat Mar 19 06:38:09 2016 From: chinchi at physik.tu-berlin.de (superchinchilla) Date: Sat, 19 Mar 2016 03:38:09 -0700 (MST) Subject: [Matplotlib-users] Struggle with ticker.SymmetricalLogLocator() In-Reply-To: <56EC9973.7020207@hawaii.edu> References: <1455530629905-46753.post@n5.nabble.com> <56EC9973.7020207@hawaii.edu> Message-ID: <56ED2BFE.4020502@physik.tu-berlin.de> Thanks for the answer, I'm actually struggling to set a new major yticks in the case symlog plot because it's not clear for me how the m=matplotlib.ticker.SymmetricallLogLocator(transform,subs=None) m.set_params() ... to change ytickfrequency and I didn't find a proper solution to it the internet? Do you know how to change it? What is the meaning of transform? Thank you very much,:) chinchi ||||////|| Am 19.03.2016 um 01:13 schrieb Eric Firing [via matplotlib]: > On 2016/02/15 12:03 AM, superchinchilla wrote: > > > Hi, > > > > I want to make a symmetric logarithmic plot, but unfortunately the > y-values > > are overlapping around 0. I don't want to display the first values > around 0. > > I'm not sure how to use the ticker.SymmetricalLogLocator command to > change > > the ticklocations or the tickfrequencies. I searched for a long time > but > > didn't find any proper solution for it besides the examples for the > normal > > Loglocater which didn't work. I tried to understand how the > > ticker.SymmetricalLogLocator(transform, subs=None) instance is > working on > > the matplotlib documentation side which is not an easy target for > me. I only > > want that the first ticklabes around zero are not displayed in my plot. > > > > I'm using the plt.yscale('symlog') command in order to plot it > symmetrically > > around zero. My picture looks like > > > > > > Sorry for my bad English, > > thanx for any help in advance > > I'm sorry for the long delay, but in case you haven't found a solution > yet, here is an example of one way of handling the situation: > > > import matplotlib.pyplot as plt > import numpy as np > > dt = 0.01 > x = np.arange(-50.0, 50.0, dt) > y = np.arange(0, 100.0, dt) > > fig, ax = plt.subplots() > ax.plot(y, x) > ax.set_yscale('symlog') > ax.set_ylabel('symlogy') > > ylabs = ax.yaxis.get_ticklabels() > i0 = int(len(ylabs) // 2) > > for label in ylabs[i0-1:i0+2]: > label.set_visible(False) > > plt.show() > > ----- > Eric > > > > > > > > > -- > > View this message in context: > http://matplotlib.1069221.n5.nabble.com/Struggle-with-ticker-SymmetricalLogLocator-tp46753.html > > Sent from the matplotlib - users mailing list archive at Nabble.com. > > _______________________________________________ > > Matplotlib-users mailing list > > [hidden email] > > https://mail.python.org/mailman/listinfo/matplotlib-users > > > > _______________________________________________ > Matplotlib-users mailing list > [hidden email] > https://mail.python.org/mailman/listinfo/matplotlib-users > > > ------------------------------------------------------------------------ > If you reply to this email, your message will be added to the > discussion below: > http://matplotlib.1069221.n5.nabble.com/Struggle-with-ticker-SymmetricalLogLocator-tp46753p46905.html > > To unsubscribe from Struggle with ticker.SymmetricalLogLocator(), > click here > . > NAML > > -- View this message in context: http://matplotlib.1069221.n5.nabble.com/Struggle-with-ticker-SymmetricalLogLocator-tp46753p46907.html Sent from the matplotlib - users mailing list archive at Nabble.com. -------------- next part -------------- An HTML attachment was scrubbed... URL: From jacob.barhak at gmail.com Thu Mar 24 04:02:05 2016 From: jacob.barhak at gmail.com (Jacob Barhak) Date: Thu, 24 Mar 2016 03:02:05 -0500 Subject: [Matplotlib-users] What changes from matplotlib 1.3.1 to matplotlib 1.5.1 break the following code? Message-ID: Greetings, Are there specific new changes in matplotlib 1.5.1 that break previous code? Below is a script that works nicely with matplotlib 1.3.1 and breaks on matplotlib 1.5.1 that comes with the new anaconda on Windows. I am trying to decide if a downgrade of the matplotlib version is the best solution or is there another simple fix that will make the code work again? Note that this is code generated by the MIST system test code, so do not look for logical output - the current goal is just to pass the test by not breaking on any commands. I will appreciate your insight. Jacob ############# Code that Breaks with 1.5.1 ############## from __future__ import division import matplotlib matplotlib.use('PDF') import matplotlib.pyplot as plt import matplotlib.font_manager import matplotlib.backends.backend_pdf import DataDef as DB Inf = DB.Inf NaN = DB.NaN inf = DB.inf nan = DB.nan HandlePDF = matplotlib.backends.backend_pdf.PdfPages('Temp\SelectedAssembledPlots.pdf') HandleFigure = plt.figure() HandleAxes = HandleFigure.add_subplot(111) DefaultLegendFontSize = matplotlib.font_manager.FontProperties(size=matplotlib.rcParams['legend.fontsize']).get_size_in_points() # New plot sequence HandleAxes.clear() HandleAxes.clear() HandleAxes.set_title('Age - Avg All') HandleAxes.set_xlabel('Time') HandleAxes.plot( [0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3] ,[None, 30.0, None, 30.0, None, 31.0, None, 31.0, 32.0, 32.0, 32.0, 32.0, 33.0, 33.0, 33.0, 33.0], 'ko-' , label = 'File 1') HandleAxes.plot( [] ,[], 'k:' , label = 'File 2') HandleSmallerFont = matplotlib.font_manager.FontProperties(size= DefaultLegendFontSize*1.0 ) LineHandles, LabelHandles = HandleAxes.get_legend_handles_labels() TheLegend = HandleAxes.legend(LineHandles, LabelHandles, 0, prop = HandleSmallerFont, handlelength = 2.0/1.0) TheLegend.get_frame().set_alpha(0.5) HandlePDF.savefig(HandleFigure) HandleAxes.clear() HandleAxes.set_title("""Create Plots Warning: No parameter entry : ('Alive', 'Avg All', '')""") HandlePDF.savefig(HandleFigure) HandleAxes.clear() HandleAxes.set_title(' - Rec Count') HandleAxes.set_xlabel('Time') HandleAxes.plot( [0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3] ,[None, 900, None, 1000, None, 900, None, 900, 63, 835, 772, 835, 61, 772, 711, 772], 'ko-' , label = 'File 1') HandleAxes.plot( [] ,[], 'k:' , label = 'File 2') HandleSmallerFont = matplotlib.font_manager.FontProperties(size= DefaultLegendFontSize*1.0 ) LineHandles, LabelHandles = HandleAxes.get_legend_handles_labels() TheLegend = HandleAxes.legend(LineHandles, LabelHandles, 0, prop = HandleSmallerFont, handlelength = 2.0/1.0) TheLegend.get_frame().set_alpha(0.5) HandlePDF.savefig(HandleFigure) # New plot sequence HandleAxes.clear() HandleAxes.set_title("""Create Plots Warning: No parameter entry : ('Alive', 'Avg All', '')""") HandlePDF.savefig(HandleFigure) HandleAxes.plot( [None, 30.0, None, 30.0, None, 31.0, None, 31.0, 32.0, 32.0, 32.0, 32.0, 33.0, 33.0, 33.0, 33.0] ,[None, 900, None, 1000, None, 900, None, 900, 63, 835, 772, 835, 61, 772, 711, 772], 'ko-' , label = 'File 1 - nested record count') HandleAxes.plot( [] ,[], 'k:' , label = 'File 2 - nested record count') HandleSmallerFont = matplotlib.font_manager.FontProperties(size= DefaultLegendFontSize*0.714285714286 ) LineHandles, LabelHandles = HandleAxes.get_legend_handles_labels() TheLegend = HandleAxes.legend(LineHandles, LabelHandles, 0, prop = HandleSmallerFont, handlelength = 2.0/0.714285714286) TheLegend.get_frame().set_alpha(0.5) HandlePDF.savefig(HandleFigure) HandleAxes.clear() HandleAxes.set_title("""Create Plots Warning: No parameter entry : ('AnError', 'Avg All', '')""") HandlePDF.savefig(HandleFigure) HandleAxes.clear() HandleAxes.set_title("""Create Plots Warning: No parameter entry : ('Alive', 'AlsoAnError', '')""") HandlePDF.savefig(HandleFigure) HandlePDF.close() -------------- next part -------------- An HTML attachment was scrubbed... URL: From pmhobson at gmail.com Thu Mar 24 11:45:23 2016 From: pmhobson at gmail.com (Paul Hobson) Date: Thu, 24 Mar 2016 08:45:23 -0700 Subject: [Matplotlib-users] What changes from matplotlib 1.3.1 to matplotlib 1.5.1 break the following code? In-Reply-To: References: Message-ID: Can you trim this down to a reproducible example? It's hard to debug a "this doesn't work" question when I can't get past the imports ("import DataDef as DB") At the very least, could you tell use where the error is occurring and what the error message is? -paul On Thu, Mar 24, 2016 at 1:02 AM, Jacob Barhak wrote: > Greetings, > > Are there specific new changes in matplotlib 1.5.1 that break previous > code? > > Below is a script that works nicely with matplotlib 1.3.1 and breaks on > matplotlib 1.5.1 that comes with the new anaconda on Windows. > > I am trying to decide if a downgrade of the matplotlib version is the best > solution or is there another simple fix that will make the code work again? > > Note that this is code generated by the MIST system test code, so do not > look for logical output - the current goal is just to pass the test by not > breaking on any commands. > > I will appreciate your insight. > > Jacob > > > ############# Code that Breaks with 1.5.1 ############## > > from __future__ import division > import matplotlib > matplotlib.use('PDF') > import matplotlib.pyplot as plt > import matplotlib.font_manager > import matplotlib.backends.backend_pdf > import DataDef as DB > Inf = DB.Inf > NaN = DB.NaN > inf = DB.inf > nan = DB.nan > HandlePDF = > matplotlib.backends.backend_pdf.PdfPages('Temp\SelectedAssembledPlots.pdf') > HandleFigure = plt.figure() > HandleAxes = HandleFigure.add_subplot(111) > DefaultLegendFontSize = > matplotlib.font_manager.FontProperties(size=matplotlib.rcParams['legend.fontsize']).get_size_in_points() > # New plot sequence > HandleAxes.clear() > HandleAxes.clear() > HandleAxes.set_title('Age - Avg All') > HandleAxes.set_xlabel('Time') > HandleAxes.plot( [0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3] ,[None, > 30.0, None, 30.0, None, 31.0, None, 31.0, 32.0, 32.0, 32.0, 32.0, 33.0, > 33.0, 33.0, 33.0], 'ko-' , label = 'File 1') > HandleAxes.plot( [] ,[], 'k:' , label = 'File 2') > HandleSmallerFont = matplotlib.font_manager.FontProperties(size= > DefaultLegendFontSize*1.0 ) > LineHandles, LabelHandles = HandleAxes.get_legend_handles_labels() > TheLegend = HandleAxes.legend(LineHandles, LabelHandles, 0, prop = > HandleSmallerFont, handlelength = 2.0/1.0) > TheLegend.get_frame().set_alpha(0.5) > HandlePDF.savefig(HandleFigure) > HandleAxes.clear() > HandleAxes.set_title("""Create Plots Warning: No parameter entry : > ('Alive', 'Avg All', '')""") > HandlePDF.savefig(HandleFigure) > HandleAxes.clear() > HandleAxes.set_title(' - Rec Count') > HandleAxes.set_xlabel('Time') > HandleAxes.plot( [0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3] ,[None, > 900, None, 1000, None, 900, None, 900, 63, 835, 772, 835, 61, 772, 711, > 772], 'ko-' , label = 'File 1') > HandleAxes.plot( [] ,[], 'k:' , label = 'File 2') > HandleSmallerFont = matplotlib.font_manager.FontProperties(size= > DefaultLegendFontSize*1.0 ) > LineHandles, LabelHandles = HandleAxes.get_legend_handles_labels() > TheLegend = HandleAxes.legend(LineHandles, LabelHandles, 0, prop = > HandleSmallerFont, handlelength = 2.0/1.0) > TheLegend.get_frame().set_alpha(0.5) > HandlePDF.savefig(HandleFigure) > # New plot sequence > HandleAxes.clear() > HandleAxes.set_title("""Create Plots Warning: No parameter entry : > ('Alive', 'Avg All', '')""") > HandlePDF.savefig(HandleFigure) > HandleAxes.plot( [None, 30.0, None, 30.0, None, 31.0, None, 31.0, 32.0, > 32.0, 32.0, 32.0, 33.0, 33.0, 33.0, 33.0] ,[None, 900, None, 1000, None, > 900, None, 900, 63, 835, 772, 835, 61, 772, 711, 772], 'ko-' , label = > 'File 1 - nested record count') > HandleAxes.plot( [] ,[], 'k:' , label = 'File 2 - nested record count') > HandleSmallerFont = matplotlib.font_manager.FontProperties(size= > DefaultLegendFontSize*0.714285714286 ) > LineHandles, LabelHandles = HandleAxes.get_legend_handles_labels() > TheLegend = HandleAxes.legend(LineHandles, LabelHandles, 0, prop = > HandleSmallerFont, handlelength = 2.0/0.714285714286) > TheLegend.get_frame().set_alpha(0.5) > HandlePDF.savefig(HandleFigure) > HandleAxes.clear() > HandleAxes.set_title("""Create Plots Warning: No parameter entry : > ('AnError', 'Avg All', '')""") > HandlePDF.savefig(HandleFigure) > HandleAxes.clear() > HandleAxes.set_title("""Create Plots Warning: No parameter entry : > ('Alive', 'AlsoAnError', '')""") > HandlePDF.savefig(HandleFigure) > HandlePDF.close() > > > > > > _______________________________________________ > 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 jacob.barhak at gmail.com Thu Mar 24 12:52:48 2016 From: jacob.barhak at gmail.com (Jacob Barhak) Date: Thu, 24 Mar 2016 11:52:48 -0500 Subject: [Matplotlib-users] What changes from matplotlib 1.3.1 to matplotlib 1.5.1 break the following code? In-Reply-To: References: Message-ID: Sorry Paul, The 5 lines with DB in them should ignored. So please comment the 5 lines after the line that things broke in - it is a file that MIST uses and is not needed for this script. You may also make sure the is a Temp sub directory below the execution path since the pdf filename should be stored there. Yet after making those fixes, you will find out that the script works on matplotlib 1.3.1 and breaks on matplotlib 1.5.1. with the following error: Traceback (most recent call last): File "PlotGeneration_Mod.py", line 21, in TheLegend = HandleAxes.legend(LineHandles, LabelHandles, 0, prop = HandleSma llerFont, handlelength = 2.0/1.0) File "C:\Anaconda\lib\site-packages\matplotlib\axes\_axes.py", line 536, in le gend raise TypeError('Invalid arguments to legend.') TypeError: Invalid arguments to legend. Hopefully this behavior can be explained with changes made. I am unsure I wish to upgrade the code, I am considering tow solutions 1) keeping the old matplotlib version, 2) making some code changes to match the newer version. Your explanation will help me decide on the best solution. Jacob On Thu, Mar 24, 2016 at 10:45 AM, Paul Hobson wrote: > Can you trim this down to a reproducible example? > > It's hard to debug a "this doesn't work" question when I can't get past > the imports ("import DataDef as DB") > > At the very least, could you tell use where the error is occurring and > what the error message is? > -paul > > On Thu, Mar 24, 2016 at 1:02 AM, Jacob Barhak > wrote: > >> Greetings, >> >> Are there specific new changes in matplotlib 1.5.1 that break previous >> code? >> >> Below is a script that works nicely with matplotlib 1.3.1 and breaks on >> matplotlib 1.5.1 that comes with the new anaconda on Windows. >> >> I am trying to decide if a downgrade of the matplotlib version is the >> best solution or is there another simple fix that will make the code work >> again? >> >> Note that this is code generated by the MIST system test code, so do not >> look for logical output - the current goal is just to pass the test by not >> breaking on any commands. >> >> I will appreciate your insight. >> >> Jacob >> >> >> ############# Code that Breaks with 1.5.1 ############## >> >> from __future__ import division >> import matplotlib >> matplotlib.use('PDF') >> import matplotlib.pyplot as plt >> import matplotlib.font_manager >> import matplotlib.backends.backend_pdf >> import DataDef as DB >> Inf = DB.Inf >> NaN = DB.NaN >> inf = DB.inf >> nan = DB.nan >> HandlePDF = >> matplotlib.backends.backend_pdf.PdfPages('Temp\SelectedAssembledPlots.pdf') >> HandleFigure = plt.figure() >> HandleAxes = HandleFigure.add_subplot(111) >> DefaultLegendFontSize = >> matplotlib.font_manager.FontProperties(size=matplotlib.rcParams['legend.fontsize']).get_size_in_points() >> # New plot sequence >> HandleAxes.clear() >> HandleAxes.clear() >> HandleAxes.set_title('Age - Avg All') >> HandleAxes.set_xlabel('Time') >> HandleAxes.plot( [0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3] ,[None, >> 30.0, None, 30.0, None, 31.0, None, 31.0, 32.0, 32.0, 32.0, 32.0, 33.0, >> 33.0, 33.0, 33.0], 'ko-' , label = 'File 1') >> HandleAxes.plot( [] ,[], 'k:' , label = 'File 2') >> HandleSmallerFont = matplotlib.font_manager.FontProperties(size= >> DefaultLegendFontSize*1.0 ) >> LineHandles, LabelHandles = HandleAxes.get_legend_handles_labels() >> TheLegend = HandleAxes.legend(LineHandles, LabelHandles, 0, prop = >> HandleSmallerFont, handlelength = 2.0/1.0) >> TheLegend.get_frame().set_alpha(0.5) >> HandlePDF.savefig(HandleFigure) >> HandleAxes.clear() >> HandleAxes.set_title("""Create Plots Warning: No parameter entry : >> ('Alive', 'Avg All', '')""") >> HandlePDF.savefig(HandleFigure) >> HandleAxes.clear() >> HandleAxes.set_title(' - Rec Count') >> HandleAxes.set_xlabel('Time') >> HandleAxes.plot( [0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3] ,[None, >> 900, None, 1000, None, 900, None, 900, 63, 835, 772, 835, 61, 772, 711, >> 772], 'ko-' , label = 'File 1') >> HandleAxes.plot( [] ,[], 'k:' , label = 'File 2') >> HandleSmallerFont = matplotlib.font_manager.FontProperties(size= >> DefaultLegendFontSize*1.0 ) >> LineHandles, LabelHandles = HandleAxes.get_legend_handles_labels() >> TheLegend = HandleAxes.legend(LineHandles, LabelHandles, 0, prop = >> HandleSmallerFont, handlelength = 2.0/1.0) >> TheLegend.get_frame().set_alpha(0.5) >> HandlePDF.savefig(HandleFigure) >> # New plot sequence >> HandleAxes.clear() >> HandleAxes.set_title("""Create Plots Warning: No parameter entry : >> ('Alive', 'Avg All', '')""") >> HandlePDF.savefig(HandleFigure) >> HandleAxes.plot( [None, 30.0, None, 30.0, None, 31.0, None, 31.0, 32.0, >> 32.0, 32.0, 32.0, 33.0, 33.0, 33.0, 33.0] ,[None, 900, None, 1000, None, >> 900, None, 900, 63, 835, 772, 835, 61, 772, 711, 772], 'ko-' , label = >> 'File 1 - nested record count') >> HandleAxes.plot( [] ,[], 'k:' , label = 'File 2 - nested record count') >> HandleSmallerFont = matplotlib.font_manager.FontProperties(size= >> DefaultLegendFontSize*0.714285714286 ) >> LineHandles, LabelHandles = HandleAxes.get_legend_handles_labels() >> TheLegend = HandleAxes.legend(LineHandles, LabelHandles, 0, prop = >> HandleSmallerFont, handlelength = 2.0/0.714285714286) >> TheLegend.get_frame().set_alpha(0.5) >> HandlePDF.savefig(HandleFigure) >> HandleAxes.clear() >> HandleAxes.set_title("""Create Plots Warning: No parameter entry : >> ('AnError', 'Avg All', '')""") >> HandlePDF.savefig(HandleFigure) >> HandleAxes.clear() >> HandleAxes.set_title("""Create Plots Warning: No parameter entry : >> ('Alive', 'AlsoAnError', '')""") >> HandlePDF.savefig(HandleFigure) >> HandlePDF.close() >> >> >> >> >> >> _______________________________________________ >> 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 Thu Mar 24 13:02:26 2016 From: ben.v.root at gmail.com (Benjamin Root) Date: Thu, 24 Mar 2016 13:02:26 -0400 Subject: [Matplotlib-users] What changes from matplotlib 1.3.1 to matplotlib 1.5.1 break the following code? In-Reply-To: References: Message-ID: try taking out the zero in the legend() call. The call signature does not support more than 2 positional arguments, I don't think. I don't know what that zero would have mean. Most likely, we tightened our error-checking since the v1.3.1 days. On Thu, Mar 24, 2016 at 12:52 PM, Jacob Barhak wrote: > Sorry Paul, > > The 5 lines with DB in them should ignored. So please comment the 5 lines > after the line that things broke in - it is a file that MIST uses and is > not needed for this script. You may also make sure the is a Temp sub > directory below the execution path since the pdf filename should be stored > there. > > Yet after making those fixes, you will find out that the script works on > matplotlib 1.3.1 and breaks on matplotlib 1.5.1. with the following error: > > Traceback (most recent call last): > File "PlotGeneration_Mod.py", line 21, in > TheLegend = HandleAxes.legend(LineHandles, LabelHandles, 0, prop = > HandleSma > llerFont, handlelength = 2.0/1.0) > File "C:\Anaconda\lib\site-packages\matplotlib\axes\_axes.py", line 536, > in le > gend > raise TypeError('Invalid arguments to legend.') > TypeError: Invalid arguments to legend. > > > Hopefully this behavior can be explained with changes made. > > I am unsure I wish to upgrade the code, I am considering tow solutions 1) > keeping the old matplotlib version, 2) making some code changes to match > the newer version. > > Your explanation will help me decide on the best solution. > > > Jacob > > On Thu, Mar 24, 2016 at 10:45 AM, Paul Hobson wrote: > >> Can you trim this down to a reproducible example? >> >> It's hard to debug a "this doesn't work" question when I can't get past >> the imports ("import DataDef as DB") >> >> At the very least, could you tell use where the error is occurring and >> what the error message is? >> -paul >> >> On Thu, Mar 24, 2016 at 1:02 AM, Jacob Barhak >> wrote: >> >>> Greetings, >>> >>> Are there specific new changes in matplotlib 1.5.1 that break previous >>> code? >>> >>> Below is a script that works nicely with matplotlib 1.3.1 and breaks on >>> matplotlib 1.5.1 that comes with the new anaconda on Windows. >>> >>> I am trying to decide if a downgrade of the matplotlib version is the >>> best solution or is there another simple fix that will make the code work >>> again? >>> >>> Note that this is code generated by the MIST system test code, so do not >>> look for logical output - the current goal is just to pass the test by not >>> breaking on any commands. >>> >>> I will appreciate your insight. >>> >>> Jacob >>> >>> >>> ############# Code that Breaks with 1.5.1 ############## >>> >>> from __future__ import division >>> import matplotlib >>> matplotlib.use('PDF') >>> import matplotlib.pyplot as plt >>> import matplotlib.font_manager >>> import matplotlib.backends.backend_pdf >>> import DataDef as DB >>> Inf = DB.Inf >>> NaN = DB.NaN >>> inf = DB.inf >>> nan = DB.nan >>> HandlePDF = >>> matplotlib.backends.backend_pdf.PdfPages('Temp\SelectedAssembledPlots.pdf') >>> HandleFigure = plt.figure() >>> HandleAxes = HandleFigure.add_subplot(111) >>> DefaultLegendFontSize = >>> matplotlib.font_manager.FontProperties(size=matplotlib.rcParams['legend.fontsize']).get_size_in_points() >>> # New plot sequence >>> HandleAxes.clear() >>> HandleAxes.clear() >>> HandleAxes.set_title('Age - Avg All') >>> HandleAxes.set_xlabel('Time') >>> HandleAxes.plot( [0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3] >>> ,[None, 30.0, None, 30.0, None, 31.0, None, 31.0, 32.0, 32.0, 32.0, 32.0, >>> 33.0, 33.0, 33.0, 33.0], 'ko-' , label = 'File 1') >>> HandleAxes.plot( [] ,[], 'k:' , label = 'File 2') >>> HandleSmallerFont = matplotlib.font_manager.FontProperties(size= >>> DefaultLegendFontSize*1.0 ) >>> LineHandles, LabelHandles = HandleAxes.get_legend_handles_labels() >>> TheLegend = HandleAxes.legend(LineHandles, LabelHandles, 0, prop = >>> HandleSmallerFont, handlelength = 2.0/1.0) >>> TheLegend.get_frame().set_alpha(0.5) >>> HandlePDF.savefig(HandleFigure) >>> HandleAxes.clear() >>> HandleAxes.set_title("""Create Plots Warning: No parameter entry : >>> ('Alive', 'Avg All', '')""") >>> HandlePDF.savefig(HandleFigure) >>> HandleAxes.clear() >>> HandleAxes.set_title(' - Rec Count') >>> HandleAxes.set_xlabel('Time') >>> HandleAxes.plot( [0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3] >>> ,[None, 900, None, 1000, None, 900, None, 900, 63, 835, 772, 835, 61, 772, >>> 711, 772], 'ko-' , label = 'File 1') >>> HandleAxes.plot( [] ,[], 'k:' , label = 'File 2') >>> HandleSmallerFont = matplotlib.font_manager.FontProperties(size= >>> DefaultLegendFontSize*1.0 ) >>> LineHandles, LabelHandles = HandleAxes.get_legend_handles_labels() >>> TheLegend = HandleAxes.legend(LineHandles, LabelHandles, 0, prop = >>> HandleSmallerFont, handlelength = 2.0/1.0) >>> TheLegend.get_frame().set_alpha(0.5) >>> HandlePDF.savefig(HandleFigure) >>> # New plot sequence >>> HandleAxes.clear() >>> HandleAxes.set_title("""Create Plots Warning: No parameter entry : >>> ('Alive', 'Avg All', '')""") >>> HandlePDF.savefig(HandleFigure) >>> HandleAxes.plot( [None, 30.0, None, 30.0, None, 31.0, None, 31.0, 32.0, >>> 32.0, 32.0, 32.0, 33.0, 33.0, 33.0, 33.0] ,[None, 900, None, 1000, None, >>> 900, None, 900, 63, 835, 772, 835, 61, 772, 711, 772], 'ko-' , label = >>> 'File 1 - nested record count') >>> HandleAxes.plot( [] ,[], 'k:' , label = 'File 2 - nested record count') >>> HandleSmallerFont = matplotlib.font_manager.FontProperties(size= >>> DefaultLegendFontSize*0.714285714286 ) >>> LineHandles, LabelHandles = HandleAxes.get_legend_handles_labels() >>> TheLegend = HandleAxes.legend(LineHandles, LabelHandles, 0, prop = >>> HandleSmallerFont, handlelength = 2.0/0.714285714286) >>> TheLegend.get_frame().set_alpha(0.5) >>> HandlePDF.savefig(HandleFigure) >>> HandleAxes.clear() >>> HandleAxes.set_title("""Create Plots Warning: No parameter entry : >>> ('AnError', 'Avg All', '')""") >>> HandlePDF.savefig(HandleFigure) >>> HandleAxes.clear() >>> HandleAxes.set_title("""Create Plots Warning: No parameter entry : >>> ('Alive', 'AlsoAnError', '')""") >>> HandlePDF.savefig(HandleFigure) >>> HandlePDF.close() >>> >>> >>> >>> >>> >>> _______________________________________________ >>> Matplotlib-users mailing list >>> Matplotlib-users at python.org >>> https://mail.python.org/mailman/listinfo/matplotlib-users >>> >>> >> > > _______________________________________________ > Matplotlib-users mailing list > Matplotlib-users at python.org > https://mail.python.org/mailman/listinfo/matplotlib-users > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From pmhobson at gmail.com Thu Mar 24 13:03:43 2016 From: pmhobson at gmail.com (Paul Hobson) Date: Thu, 24 Mar 2016 10:03:43 -0700 Subject: [Matplotlib-users] What changes from matplotlib 1.3.1 to matplotlib 1.5.1 break the following code? In-Reply-To: References: Message-ID: my guess is that that's the location argument. On Thu, Mar 24, 2016 at 10:02 AM, Benjamin Root wrote: > try taking out the zero in the legend() call. The call signature does not > support more than 2 positional arguments, I don't think. I don't know what > that zero would have mean. > > Most likely, we tightened our error-checking since the v1.3.1 days. > > > On Thu, Mar 24, 2016 at 12:52 PM, Jacob Barhak > wrote: > >> Sorry Paul, >> >> The 5 lines with DB in them should ignored. So please comment the 5 lines >> after the line that things broke in - it is a file that MIST uses and is >> not needed for this script. You may also make sure the is a Temp sub >> directory below the execution path since the pdf filename should be stored >> there. >> >> Yet after making those fixes, you will find out that the script works on >> matplotlib 1.3.1 and breaks on matplotlib 1.5.1. with the following error: >> >> Traceback (most recent call last): >> File "PlotGeneration_Mod.py", line 21, in >> TheLegend = HandleAxes.legend(LineHandles, LabelHandles, 0, prop = >> HandleSma >> llerFont, handlelength = 2.0/1.0) >> File "C:\Anaconda\lib\site-packages\matplotlib\axes\_axes.py", line >> 536, in le >> gend >> raise TypeError('Invalid arguments to legend.') >> TypeError: Invalid arguments to legend. >> >> >> Hopefully this behavior can be explained with changes made. >> >> I am unsure I wish to upgrade the code, I am considering tow solutions 1) >> keeping the old matplotlib version, 2) making some code changes to match >> the newer version. >> >> Your explanation will help me decide on the best solution. >> >> >> Jacob >> >> On Thu, Mar 24, 2016 at 10:45 AM, Paul Hobson wrote: >> >>> Can you trim this down to a reproducible example? >>> >>> It's hard to debug a "this doesn't work" question when I can't get past >>> the imports ("import DataDef as DB") >>> >>> At the very least, could you tell use where the error is occurring and >>> what the error message is? >>> -paul >>> >>> On Thu, Mar 24, 2016 at 1:02 AM, Jacob Barhak >>> wrote: >>> >>>> Greetings, >>>> >>>> Are there specific new changes in matplotlib 1.5.1 that break previous >>>> code? >>>> >>>> Below is a script that works nicely with matplotlib 1.3.1 and breaks on >>>> matplotlib 1.5.1 that comes with the new anaconda on Windows. >>>> >>>> I am trying to decide if a downgrade of the matplotlib version is the >>>> best solution or is there another simple fix that will make the code work >>>> again? >>>> >>>> Note that this is code generated by the MIST system test code, so do >>>> not look for logical output - the current goal is just to pass the test by >>>> not breaking on any commands. >>>> >>>> I will appreciate your insight. >>>> >>>> Jacob >>>> >>>> >>>> ############# Code that Breaks with 1.5.1 ############## >>>> >>>> from __future__ import division >>>> import matplotlib >>>> matplotlib.use('PDF') >>>> import matplotlib.pyplot as plt >>>> import matplotlib.font_manager >>>> import matplotlib.backends.backend_pdf >>>> import DataDef as DB >>>> Inf = DB.Inf >>>> NaN = DB.NaN >>>> inf = DB.inf >>>> nan = DB.nan >>>> HandlePDF = >>>> matplotlib.backends.backend_pdf.PdfPages('Temp\SelectedAssembledPlots.pdf') >>>> HandleFigure = plt.figure() >>>> HandleAxes = HandleFigure.add_subplot(111) >>>> DefaultLegendFontSize = >>>> matplotlib.font_manager.FontProperties(size=matplotlib.rcParams['legend.fontsize']).get_size_in_points() >>>> # New plot sequence >>>> HandleAxes.clear() >>>> HandleAxes.clear() >>>> HandleAxes.set_title('Age - Avg All') >>>> HandleAxes.set_xlabel('Time') >>>> HandleAxes.plot( [0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3] >>>> ,[None, 30.0, None, 30.0, None, 31.0, None, 31.0, 32.0, 32.0, 32.0, 32.0, >>>> 33.0, 33.0, 33.0, 33.0], 'ko-' , label = 'File 1') >>>> HandleAxes.plot( [] ,[], 'k:' , label = 'File 2') >>>> HandleSmallerFont = matplotlib.font_manager.FontProperties(size= >>>> DefaultLegendFontSize*1.0 ) >>>> LineHandles, LabelHandles = HandleAxes.get_legend_handles_labels() >>>> TheLegend = HandleAxes.legend(LineHandles, LabelHandles, 0, prop = >>>> HandleSmallerFont, handlelength = 2.0/1.0) >>>> TheLegend.get_frame().set_alpha(0.5) >>>> HandlePDF.savefig(HandleFigure) >>>> HandleAxes.clear() >>>> HandleAxes.set_title("""Create Plots Warning: No parameter entry : >>>> ('Alive', 'Avg All', '')""") >>>> HandlePDF.savefig(HandleFigure) >>>> HandleAxes.clear() >>>> HandleAxes.set_title(' - Rec Count') >>>> HandleAxes.set_xlabel('Time') >>>> HandleAxes.plot( [0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3] >>>> ,[None, 900, None, 1000, None, 900, None, 900, 63, 835, 772, 835, 61, 772, >>>> 711, 772], 'ko-' , label = 'File 1') >>>> HandleAxes.plot( [] ,[], 'k:' , label = 'File 2') >>>> HandleSmallerFont = matplotlib.font_manager.FontProperties(size= >>>> DefaultLegendFontSize*1.0 ) >>>> LineHandles, LabelHandles = HandleAxes.get_legend_handles_labels() >>>> TheLegend = HandleAxes.legend(LineHandles, LabelHandles, 0, prop = >>>> HandleSmallerFont, handlelength = 2.0/1.0) >>>> TheLegend.get_frame().set_alpha(0.5) >>>> HandlePDF.savefig(HandleFigure) >>>> # New plot sequence >>>> HandleAxes.clear() >>>> HandleAxes.set_title("""Create Plots Warning: No parameter entry : >>>> ('Alive', 'Avg All', '')""") >>>> HandlePDF.savefig(HandleFigure) >>>> HandleAxes.plot( [None, 30.0, None, 30.0, None, 31.0, None, 31.0, 32.0, >>>> 32.0, 32.0, 32.0, 33.0, 33.0, 33.0, 33.0] ,[None, 900, None, 1000, None, >>>> 900, None, 900, 63, 835, 772, 835, 61, 772, 711, 772], 'ko-' , label = >>>> 'File 1 - nested record count') >>>> HandleAxes.plot( [] ,[], 'k:' , label = 'File 2 - nested record count') >>>> HandleSmallerFont = matplotlib.font_manager.FontProperties(size= >>>> DefaultLegendFontSize*0.714285714286 ) >>>> LineHandles, LabelHandles = HandleAxes.get_legend_handles_labels() >>>> TheLegend = HandleAxes.legend(LineHandles, LabelHandles, 0, prop = >>>> HandleSmallerFont, handlelength = 2.0/0.714285714286) >>>> TheLegend.get_frame().set_alpha(0.5) >>>> HandlePDF.savefig(HandleFigure) >>>> HandleAxes.clear() >>>> HandleAxes.set_title("""Create Plots Warning: No parameter entry : >>>> ('AnError', 'Avg All', '')""") >>>> HandlePDF.savefig(HandleFigure) >>>> HandleAxes.clear() >>>> HandleAxes.set_title("""Create Plots Warning: No parameter entry : >>>> ('Alive', 'AlsoAnError', '')""") >>>> HandlePDF.savefig(HandleFigure) >>>> HandlePDF.close() >>>> >>>> >>>> >>>> >>>> >>>> _______________________________________________ >>>> Matplotlib-users mailing list >>>> Matplotlib-users at python.org >>>> https://mail.python.org/mailman/listinfo/matplotlib-users >>>> >>>> >>> >> >> _______________________________________________ >> Matplotlib-users mailing list >> Matplotlib-users at python.org >> https://mail.python.org/mailman/listinfo/matplotlib-users >> >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: From pmhobson at gmail.com Thu Mar 24 13:04:04 2016 From: pmhobson at gmail.com (Paul Hobson) Date: Thu, 24 Mar 2016 10:04:04 -0700 Subject: [Matplotlib-users] What changes from matplotlib 1.3.1 to matplotlib 1.5.1 break the following code? In-Reply-To: References: Message-ID: I'm not going to try to run that code (really a minimal example of ~10 lines should suffice to reproduce your problem). I'm surprised this ever worked: TheLegend = HandleAxes.legend(LineHandles, LabelHandles, 0, prop = HandleSma llerFont, handlelength = 2.0/1.0) Here's the new guide to legends: http://matplotlib.org/users/legend_guide.html#plotting-guide-legend I would definitely upgrade to the newest matplotlib as fixing the legend should be pretty easy. On Thu, Mar 24, 2016 at 9:52 AM, Jacob Barhak wrote: > Sorry Paul, > > The 5 lines with DB in them should ignored. So please comment the 5 lines > after the line that things broke in - it is a file that MIST uses and is > not needed for this script. You may also make sure the is a Temp sub > directory below the execution path since the pdf filename should be stored > there. > > Yet after making those fixes, you will find out that the script works on > matplotlib 1.3.1 and breaks on matplotlib 1.5.1. with the following error: > > Traceback (most recent call last): > File "PlotGeneration_Mod.py", line 21, in > TheLegend = HandleAxes.legend(LineHandles, LabelHandles, 0, prop = > HandleSma > llerFont, handlelength = 2.0/1.0) > File "C:\Anaconda\lib\site-packages\matplotlib\axes\_axes.py", line 536, > in le > gend > raise TypeError('Invalid arguments to legend.') > TypeError: Invalid arguments to legend. > > > Hopefully this behavior can be explained with changes made. > > I am unsure I wish to upgrade the code, I am considering tow solutions 1) > keeping the old matplotlib version, 2) making some code changes to match > the newer version. > > Your explanation will help me decide on the best solution. > > > Jacob > > On Thu, Mar 24, 2016 at 10:45 AM, Paul Hobson wrote: > >> Can you trim this down to a reproducible example? >> >> It's hard to debug a "this doesn't work" question when I can't get past >> the imports ("import DataDef as DB") >> >> At the very least, could you tell use where the error is occurring and >> what the error message is? >> -paul >> >> On Thu, Mar 24, 2016 at 1:02 AM, Jacob Barhak >> wrote: >> >>> Greetings, >>> >>> Are there specific new changes in matplotlib 1.5.1 that break previous >>> code? >>> >>> Below is a script that works nicely with matplotlib 1.3.1 and breaks on >>> matplotlib 1.5.1 that comes with the new anaconda on Windows. >>> >>> I am trying to decide if a downgrade of the matplotlib version is the >>> best solution or is there another simple fix that will make the code work >>> again? >>> >>> Note that this is code generated by the MIST system test code, so do not >>> look for logical output - the current goal is just to pass the test by not >>> breaking on any commands. >>> >>> I will appreciate your insight. >>> >>> Jacob >>> >>> >>> ############# Code that Breaks with 1.5.1 ############## >>> >>> from __future__ import division >>> import matplotlib >>> matplotlib.use('PDF') >>> import matplotlib.pyplot as plt >>> import matplotlib.font_manager >>> import matplotlib.backends.backend_pdf >>> import DataDef as DB >>> Inf = DB.Inf >>> NaN = DB.NaN >>> inf = DB.inf >>> nan = DB.nan >>> HandlePDF = >>> matplotlib.backends.backend_pdf.PdfPages('Temp\SelectedAssembledPlots.pdf') >>> HandleFigure = plt.figure() >>> HandleAxes = HandleFigure.add_subplot(111) >>> DefaultLegendFontSize = >>> matplotlib.font_manager.FontProperties(size=matplotlib.rcParams['legend.fontsize']).get_size_in_points() >>> # New plot sequence >>> HandleAxes.clear() >>> HandleAxes.clear() >>> HandleAxes.set_title('Age - Avg All') >>> HandleAxes.set_xlabel('Time') >>> HandleAxes.plot( [0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3] >>> ,[None, 30.0, None, 30.0, None, 31.0, None, 31.0, 32.0, 32.0, 32.0, 32.0, >>> 33.0, 33.0, 33.0, 33.0], 'ko-' , label = 'File 1') >>> HandleAxes.plot( [] ,[], 'k:' , label = 'File 2') >>> HandleSmallerFont = matplotlib.font_manager.FontProperties(size= >>> DefaultLegendFontSize*1.0 ) >>> LineHandles, LabelHandles = HandleAxes.get_legend_handles_labels() >>> TheLegend = HandleAxes.legend(LineHandles, LabelHandles, 0, prop = >>> HandleSmallerFont, handlelength = 2.0/1.0) >>> TheLegend.get_frame().set_alpha(0.5) >>> HandlePDF.savefig(HandleFigure) >>> HandleAxes.clear() >>> HandleAxes.set_title("""Create Plots Warning: No parameter entry : >>> ('Alive', 'Avg All', '')""") >>> HandlePDF.savefig(HandleFigure) >>> HandleAxes.clear() >>> HandleAxes.set_title(' - Rec Count') >>> HandleAxes.set_xlabel('Time') >>> HandleAxes.plot( [0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3] >>> ,[None, 900, None, 1000, None, 900, None, 900, 63, 835, 772, 835, 61, 772, >>> 711, 772], 'ko-' , label = 'File 1') >>> HandleAxes.plot( [] ,[], 'k:' , label = 'File 2') >>> HandleSmallerFont = matplotlib.font_manager.FontProperties(size= >>> DefaultLegendFontSize*1.0 ) >>> LineHandles, LabelHandles = HandleAxes.get_legend_handles_labels() >>> TheLegend = HandleAxes.legend(LineHandles, LabelHandles, 0, prop = >>> HandleSmallerFont, handlelength = 2.0/1.0) >>> TheLegend.get_frame().set_alpha(0.5) >>> HandlePDF.savefig(HandleFigure) >>> # New plot sequence >>> HandleAxes.clear() >>> HandleAxes.set_title("""Create Plots Warning: No parameter entry : >>> ('Alive', 'Avg All', '')""") >>> HandlePDF.savefig(HandleFigure) >>> HandleAxes.plot( [None, 30.0, None, 30.0, None, 31.0, None, 31.0, 32.0, >>> 32.0, 32.0, 32.0, 33.0, 33.0, 33.0, 33.0] ,[None, 900, None, 1000, None, >>> 900, None, 900, 63, 835, 772, 835, 61, 772, 711, 772], 'ko-' , label = >>> 'File 1 - nested record count') >>> HandleAxes.plot( [] ,[], 'k:' , label = 'File 2 - nested record count') >>> HandleSmallerFont = matplotlib.font_manager.FontProperties(size= >>> DefaultLegendFontSize*0.714285714286 ) >>> LineHandles, LabelHandles = HandleAxes.get_legend_handles_labels() >>> TheLegend = HandleAxes.legend(LineHandles, LabelHandles, 0, prop = >>> HandleSmallerFont, handlelength = 2.0/0.714285714286) >>> TheLegend.get_frame().set_alpha(0.5) >>> HandlePDF.savefig(HandleFigure) >>> HandleAxes.clear() >>> HandleAxes.set_title("""Create Plots Warning: No parameter entry : >>> ('AnError', 'Avg All', '')""") >>> HandlePDF.savefig(HandleFigure) >>> HandleAxes.clear() >>> HandleAxes.set_title("""Create Plots Warning: No parameter entry : >>> ('Alive', 'AlsoAnError', '')""") >>> HandlePDF.savefig(HandleFigure) >>> HandlePDF.close() >>> >>> >>> >>> >>> >>> _______________________________________________ >>> Matplotlib-users mailing list >>> Matplotlib-users at python.org >>> https://mail.python.org/mailman/listinfo/matplotlib-users >>> >>> >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: From tcaswell at gmail.com Thu Mar 24 13:04:07 2016 From: tcaswell at gmail.com (Thomas Caswell) Date: Thu, 24 Mar 2016 17:04:07 +0000 Subject: [Matplotlib-users] What changes from matplotlib 1.3.1 to matplotlib 1.5.1 break the following code? In-Reply-To: References: Message-ID: See https://github.com/matplotlib/matplotlib/pull/3943 You are using an API for legend that we no longer support. You just have to pass `loc` as a keyword argument rather than as the third positional. Running this code on 1.4 should produce a deprecation warning. In the future, please send the mailing list the minimal amount of code to reproduce your problem. People around here are typically more than happy to help, but please be respectful of our time and make it easy to help you. Tom On Thu, Mar 24, 2016 at 12:52 PM Jacob Barhak wrote: > Sorry Paul, > > The 5 lines with DB in them should ignored. So please comment the 5 lines > after the line that things broke in - it is a file that MIST uses and is > not needed for this script. You may also make sure the is a Temp sub > directory below the execution path since the pdf filename should be stored > there. > > Yet after making those fixes, you will find out that the script works on > matplotlib 1.3.1 and breaks on matplotlib 1.5.1. with the following error: > > Traceback (most recent call last): > File "PlotGeneration_Mod.py", line 21, in > > TheLegend = HandleAxes.legend(LineHandles, LabelHandles, 0, prop = > HandleSma > llerFont, handlelength = 2.0/1.0) > File "C:\Anaconda\lib\site-packages\matplotlib\axes\_axes.py", line 536, > in le > gend > raise TypeError('Invalid arguments to legend.') > TypeError: Invalid arguments to legend. > > > Hopefully this behavior can be explained with changes made. > > I am unsure I wish to upgrade the code, I am considering tow solutions 1) > keeping the old matplotlib version, 2) making some code changes to match > the newer version. > > Your explanation will help me decide on the best solution. > > > Jacob > > On Thu, Mar 24, 2016 at 10:45 AM, Paul Hobson wrote: > >> Can you trim this down to a reproducible example? >> >> It's hard to debug a "this doesn't work" question when I can't get past >> the imports ("import DataDef as DB") >> >> At the very least, could you tell use where the error is occurring and >> what the error message is? >> -paul >> >> On Thu, Mar 24, 2016 at 1:02 AM, Jacob Barhak >> wrote: >> >>> Greetings, >>> >>> Are there specific new changes in matplotlib 1.5.1 that break previous >>> code? >>> >>> Below is a script that works nicely with matplotlib 1.3.1 and breaks on >>> matplotlib 1.5.1 that comes with the new anaconda on Windows. >>> >>> I am trying to decide if a downgrade of the matplotlib version is the >>> best solution or is there another simple fix that will make the code work >>> again? >>> >>> Note that this is code generated by the MIST system test code, so do not >>> look for logical output - the current goal is just to pass the test by not >>> breaking on any commands. >>> >>> I will appreciate your insight. >>> >>> Jacob >>> >>> >>> ############# Code that Breaks with 1.5.1 ############## >>> >>> from __future__ import division >>> import matplotlib >>> matplotlib.use('PDF') >>> import matplotlib.pyplot as plt >>> import matplotlib.font_manager >>> import matplotlib.backends.backend_pdf >>> import DataDef as DB >>> Inf = DB.Inf >>> NaN = DB.NaN >>> inf = DB.inf >>> nan = DB.nan >>> HandlePDF = >>> matplotlib.backends.backend_pdf.PdfPages('Temp\SelectedAssembledPlots.pdf') >>> HandleFigure = plt.figure() >>> HandleAxes = HandleFigure.add_subplot(111) >>> DefaultLegendFontSize = >>> matplotlib.font_manager.FontProperties(size=matplotlib.rcParams['legend.fontsize']).get_size_in_points() >>> # New plot sequence >>> HandleAxes.clear() >>> HandleAxes.clear() >>> HandleAxes.set_title('Age - Avg All') >>> HandleAxes.set_xlabel('Time') >>> HandleAxes.plot( [0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3] >>> ,[None, 30.0, None, 30.0, None, 31.0, None, 31.0, 32.0, 32.0, 32.0, 32.0, >>> 33.0, 33.0, 33.0, 33.0], 'ko-' , label = 'File 1') >>> HandleAxes.plot( [] ,[], 'k:' , label = 'File 2') >>> HandleSmallerFont = matplotlib.font_manager.FontProperties(size= >>> DefaultLegendFontSize*1.0 ) >>> LineHandles, LabelHandles = HandleAxes.get_legend_handles_labels() >>> TheLegend = HandleAxes.legend(LineHandles, LabelHandles, 0, prop = >>> HandleSmallerFont, handlelength = 2.0/1.0) >>> TheLegend.get_frame().set_alpha(0.5) >>> HandlePDF.savefig(HandleFigure) >>> HandleAxes.clear() >>> HandleAxes.set_title("""Create Plots Warning: No parameter entry : >>> ('Alive', 'Avg All', '')""") >>> HandlePDF.savefig(HandleFigure) >>> HandleAxes.clear() >>> HandleAxes.set_title(' - Rec Count') >>> HandleAxes.set_xlabel('Time') >>> HandleAxes.plot( [0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3] >>> ,[None, 900, None, 1000, None, 900, None, 900, 63, 835, 772, 835, 61, 772, >>> 711, 772], 'ko-' , label = 'File 1') >>> HandleAxes.plot( [] ,[], 'k:' , label = 'File 2') >>> HandleSmallerFont = matplotlib.font_manager.FontProperties(size= >>> DefaultLegendFontSize*1.0 ) >>> LineHandles, LabelHandles = HandleAxes.get_legend_handles_labels() >>> TheLegend = HandleAxes.legend(LineHandles, LabelHandles, 0, prop = >>> HandleSmallerFont, handlelength = 2.0/1.0) >>> TheLegend.get_frame().set_alpha(0.5) >>> HandlePDF.savefig(HandleFigure) >>> # New plot sequence >>> HandleAxes.clear() >>> HandleAxes.set_title("""Create Plots Warning: No parameter entry : >>> ('Alive', 'Avg All', '')""") >>> HandlePDF.savefig(HandleFigure) >>> HandleAxes.plot( [None, 30.0, None, 30.0, None, 31.0, None, 31.0, 32.0, >>> 32.0, 32.0, 32.0, 33.0, 33.0, 33.0, 33.0] ,[None, 900, None, 1000, None, >>> 900, None, 900, 63, 835, 772, 835, 61, 772, 711, 772], 'ko-' , label = >>> 'File 1 - nested record count') >>> HandleAxes.plot( [] ,[], 'k:' , label = 'File 2 - nested record count') >>> HandleSmallerFont = matplotlib.font_manager.FontProperties(size= >>> DefaultLegendFontSize*0.714285714286 ) >>> LineHandles, LabelHandles = HandleAxes.get_legend_handles_labels() >>> TheLegend = HandleAxes.legend(LineHandles, LabelHandles, 0, prop = >>> HandleSmallerFont, handlelength = 2.0/0.714285714286) >>> TheLegend.get_frame().set_alpha(0.5) >>> HandlePDF.savefig(HandleFigure) >>> HandleAxes.clear() >>> HandleAxes.set_title("""Create Plots Warning: No parameter entry : >>> ('AnError', 'Avg All', '')""") >>> HandlePDF.savefig(HandleFigure) >>> HandleAxes.clear() >>> HandleAxes.set_title("""Create Plots Warning: No parameter entry : >>> ('Alive', 'AlsoAnError', '')""") >>> HandlePDF.savefig(HandleFigure) >>> HandlePDF.close() >>> >>> >>> >>> >>> >>> _______________________________________________ >>> Matplotlib-users mailing list >>> Matplotlib-users at python.org >>> https://mail.python.org/mailman/listinfo/matplotlib-users >>> >>> >> > _______________________________________________ > Matplotlib-users mailing list > Matplotlib-users at python.org > https://mail.python.org/mailman/listinfo/matplotlib-users > -------------- next part -------------- An HTML attachment was scrubbed... URL: From ben.v.root at gmail.com Thu Mar 24 13:05:21 2016 From: ben.v.root at gmail.com (Benjamin Root) Date: Thu, 24 Mar 2016 13:05:21 -0400 Subject: [Matplotlib-users] What changes from matplotlib 1.3.1 to matplotlib 1.5.1 break the following code? In-Reply-To: References: Message-ID: The zero might have been a position, which zero means "best". I should point out that we are not very strict about keeping backwards compatibility for automated legend placement. So, I hope your tests aren't depending on the legend to always be in the exact same place in the figure. Try specifying "loc=0" to keep the zero in-play in that call. On Thu, Mar 24, 2016 at 1:02 PM, Benjamin Root wrote: > try taking out the zero in the legend() call. The call signature does not > support more than 2 positional arguments, I don't think. I don't know what > that zero would have mean. > > Most likely, we tightened our error-checking since the v1.3.1 days. > > > On Thu, Mar 24, 2016 at 12:52 PM, Jacob Barhak > wrote: > >> Sorry Paul, >> >> The 5 lines with DB in them should ignored. So please comment the 5 lines >> after the line that things broke in - it is a file that MIST uses and is >> not needed for this script. You may also make sure the is a Temp sub >> directory below the execution path since the pdf filename should be stored >> there. >> >> Yet after making those fixes, you will find out that the script works on >> matplotlib 1.3.1 and breaks on matplotlib 1.5.1. with the following error: >> >> Traceback (most recent call last): >> File "PlotGeneration_Mod.py", line 21, in >> TheLegend = HandleAxes.legend(LineHandles, LabelHandles, 0, prop = >> HandleSma >> llerFont, handlelength = 2.0/1.0) >> File "C:\Anaconda\lib\site-packages\matplotlib\axes\_axes.py", line >> 536, in le >> gend >> raise TypeError('Invalid arguments to legend.') >> TypeError: Invalid arguments to legend. >> >> >> Hopefully this behavior can be explained with changes made. >> >> I am unsure I wish to upgrade the code, I am considering tow solutions 1) >> keeping the old matplotlib version, 2) making some code changes to match >> the newer version. >> >> Your explanation will help me decide on the best solution. >> >> >> Jacob >> >> On Thu, Mar 24, 2016 at 10:45 AM, Paul Hobson wrote: >> >>> Can you trim this down to a reproducible example? >>> >>> It's hard to debug a "this doesn't work" question when I can't get past >>> the imports ("import DataDef as DB") >>> >>> At the very least, could you tell use where the error is occurring and >>> what the error message is? >>> -paul >>> >>> On Thu, Mar 24, 2016 at 1:02 AM, Jacob Barhak >>> wrote: >>> >>>> Greetings, >>>> >>>> Are there specific new changes in matplotlib 1.5.1 that break previous >>>> code? >>>> >>>> Below is a script that works nicely with matplotlib 1.3.1 and breaks on >>>> matplotlib 1.5.1 that comes with the new anaconda on Windows. >>>> >>>> I am trying to decide if a downgrade of the matplotlib version is the >>>> best solution or is there another simple fix that will make the code work >>>> again? >>>> >>>> Note that this is code generated by the MIST system test code, so do >>>> not look for logical output - the current goal is just to pass the test by >>>> not breaking on any commands. >>>> >>>> I will appreciate your insight. >>>> >>>> Jacob >>>> >>>> >>>> ############# Code that Breaks with 1.5.1 ############## >>>> >>>> from __future__ import division >>>> import matplotlib >>>> matplotlib.use('PDF') >>>> import matplotlib.pyplot as plt >>>> import matplotlib.font_manager >>>> import matplotlib.backends.backend_pdf >>>> import DataDef as DB >>>> Inf = DB.Inf >>>> NaN = DB.NaN >>>> inf = DB.inf >>>> nan = DB.nan >>>> HandlePDF = >>>> matplotlib.backends.backend_pdf.PdfPages('Temp\SelectedAssembledPlots.pdf') >>>> HandleFigure = plt.figure() >>>> HandleAxes = HandleFigure.add_subplot(111) >>>> DefaultLegendFontSize = >>>> matplotlib.font_manager.FontProperties(size=matplotlib.rcParams['legend.fontsize']).get_size_in_points() >>>> # New plot sequence >>>> HandleAxes.clear() >>>> HandleAxes.clear() >>>> HandleAxes.set_title('Age - Avg All') >>>> HandleAxes.set_xlabel('Time') >>>> HandleAxes.plot( [0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3] >>>> ,[None, 30.0, None, 30.0, None, 31.0, None, 31.0, 32.0, 32.0, 32.0, 32.0, >>>> 33.0, 33.0, 33.0, 33.0], 'ko-' , label = 'File 1') >>>> HandleAxes.plot( [] ,[], 'k:' , label = 'File 2') >>>> HandleSmallerFont = matplotlib.font_manager.FontProperties(size= >>>> DefaultLegendFontSize*1.0 ) >>>> LineHandles, LabelHandles = HandleAxes.get_legend_handles_labels() >>>> TheLegend = HandleAxes.legend(LineHandles, LabelHandles, 0, prop = >>>> HandleSmallerFont, handlelength = 2.0/1.0) >>>> TheLegend.get_frame().set_alpha(0.5) >>>> HandlePDF.savefig(HandleFigure) >>>> HandleAxes.clear() >>>> HandleAxes.set_title("""Create Plots Warning: No parameter entry : >>>> ('Alive', 'Avg All', '')""") >>>> HandlePDF.savefig(HandleFigure) >>>> HandleAxes.clear() >>>> HandleAxes.set_title(' - Rec Count') >>>> HandleAxes.set_xlabel('Time') >>>> HandleAxes.plot( [0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3] >>>> ,[None, 900, None, 1000, None, 900, None, 900, 63, 835, 772, 835, 61, 772, >>>> 711, 772], 'ko-' , label = 'File 1') >>>> HandleAxes.plot( [] ,[], 'k:' , label = 'File 2') >>>> HandleSmallerFont = matplotlib.font_manager.FontProperties(size= >>>> DefaultLegendFontSize*1.0 ) >>>> LineHandles, LabelHandles = HandleAxes.get_legend_handles_labels() >>>> TheLegend = HandleAxes.legend(LineHandles, LabelHandles, 0, prop = >>>> HandleSmallerFont, handlelength = 2.0/1.0) >>>> TheLegend.get_frame().set_alpha(0.5) >>>> HandlePDF.savefig(HandleFigure) >>>> # New plot sequence >>>> HandleAxes.clear() >>>> HandleAxes.set_title("""Create Plots Warning: No parameter entry : >>>> ('Alive', 'Avg All', '')""") >>>> HandlePDF.savefig(HandleFigure) >>>> HandleAxes.plot( [None, 30.0, None, 30.0, None, 31.0, None, 31.0, 32.0, >>>> 32.0, 32.0, 32.0, 33.0, 33.0, 33.0, 33.0] ,[None, 900, None, 1000, None, >>>> 900, None, 900, 63, 835, 772, 835, 61, 772, 711, 772], 'ko-' , label = >>>> 'File 1 - nested record count') >>>> HandleAxes.plot( [] ,[], 'k:' , label = 'File 2 - nested record count') >>>> HandleSmallerFont = matplotlib.font_manager.FontProperties(size= >>>> DefaultLegendFontSize*0.714285714286 ) >>>> LineHandles, LabelHandles = HandleAxes.get_legend_handles_labels() >>>> TheLegend = HandleAxes.legend(LineHandles, LabelHandles, 0, prop = >>>> HandleSmallerFont, handlelength = 2.0/0.714285714286) >>>> TheLegend.get_frame().set_alpha(0.5) >>>> HandlePDF.savefig(HandleFigure) >>>> HandleAxes.clear() >>>> HandleAxes.set_title("""Create Plots Warning: No parameter entry : >>>> ('AnError', 'Avg All', '')""") >>>> HandlePDF.savefig(HandleFigure) >>>> HandleAxes.clear() >>>> HandleAxes.set_title("""Create Plots Warning: No parameter entry : >>>> ('Alive', 'AlsoAnError', '')""") >>>> HandlePDF.savefig(HandleFigure) >>>> HandlePDF.close() >>>> >>>> >>>> >>>> >>>> >>>> _______________________________________________ >>>> Matplotlib-users mailing list >>>> Matplotlib-users at python.org >>>> https://mail.python.org/mailman/listinfo/matplotlib-users >>>> >>>> >>> >> >> _______________________________________________ >> Matplotlib-users mailing list >> Matplotlib-users at python.org >> https://mail.python.org/mailman/listinfo/matplotlib-users >> >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: From ben.v.root at gmail.com Thu Mar 24 13:07:56 2016 From: ben.v.root at gmail.com (Benjamin Root) Date: Thu, 24 Mar 2016 13:07:56 -0400 Subject: [Matplotlib-users] What changes from matplotlib 1.3.1 to matplotlib 1.5.1 break the following code? In-Reply-To: References: Message-ID: I think what helped more than anything else was the full traceback. But yes: short code example >> long code example >> no code example. On Thu, Mar 24, 2016 at 1:04 PM, Thomas Caswell wrote: > See https://github.com/matplotlib/matplotlib/pull/3943 > > You are using an API for legend that we no longer support. You just have > to pass `loc` as a keyword argument rather than as the third positional. > > Running this code on 1.4 should produce a deprecation warning. > > In the future, please send the mailing list the minimal amount of code to > reproduce your problem. People around here are typically more than happy > to help, but please be respectful of our time and make it easy to help you. > > Tom > > On Thu, Mar 24, 2016 at 12:52 PM Jacob Barhak > wrote: > >> Sorry Paul, >> >> The 5 lines with DB in them should ignored. So please comment the 5 lines >> after the line that things broke in - it is a file that MIST uses and is >> not needed for this script. You may also make sure the is a Temp sub >> directory below the execution path since the pdf filename should be stored >> there. >> >> Yet after making those fixes, you will find out that the script works on >> matplotlib 1.3.1 and breaks on matplotlib 1.5.1. with the following error: >> >> Traceback (most recent call last): >> File "PlotGeneration_Mod.py", line 21, in >> >> TheLegend = HandleAxes.legend(LineHandles, LabelHandles, 0, prop = >> HandleSma >> llerFont, handlelength = 2.0/1.0) >> File "C:\Anaconda\lib\site-packages\matplotlib\axes\_axes.py", line >> 536, in le >> gend >> raise TypeError('Invalid arguments to legend.') >> TypeError: Invalid arguments to legend. >> >> >> Hopefully this behavior can be explained with changes made. >> >> I am unsure I wish to upgrade the code, I am considering tow solutions 1) >> keeping the old matplotlib version, 2) making some code changes to match >> the newer version. >> >> Your explanation will help me decide on the best solution. >> >> >> Jacob >> >> On Thu, Mar 24, 2016 at 10:45 AM, Paul Hobson wrote: >> >>> Can you trim this down to a reproducible example? >>> >>> It's hard to debug a "this doesn't work" question when I can't get past >>> the imports ("import DataDef as DB") >>> >>> At the very least, could you tell use where the error is occurring and >>> what the error message is? >>> -paul >>> >>> On Thu, Mar 24, 2016 at 1:02 AM, Jacob Barhak >>> wrote: >>> >>>> Greetings, >>>> >>>> Are there specific new changes in matplotlib 1.5.1 that break previous >>>> code? >>>> >>>> Below is a script that works nicely with matplotlib 1.3.1 and breaks on >>>> matplotlib 1.5.1 that comes with the new anaconda on Windows. >>>> >>>> I am trying to decide if a downgrade of the matplotlib version is the >>>> best solution or is there another simple fix that will make the code work >>>> again? >>>> >>>> Note that this is code generated by the MIST system test code, so do >>>> not look for logical output - the current goal is just to pass the test by >>>> not breaking on any commands. >>>> >>>> I will appreciate your insight. >>>> >>>> Jacob >>>> >>>> >>>> ############# Code that Breaks with 1.5.1 ############## >>>> >>>> from __future__ import division >>>> import matplotlib >>>> matplotlib.use('PDF') >>>> import matplotlib.pyplot as plt >>>> import matplotlib.font_manager >>>> import matplotlib.backends.backend_pdf >>>> import DataDef as DB >>>> Inf = DB.Inf >>>> NaN = DB.NaN >>>> inf = DB.inf >>>> nan = DB.nan >>>> HandlePDF = >>>> matplotlib.backends.backend_pdf.PdfPages('Temp\SelectedAssembledPlots.pdf') >>>> HandleFigure = plt.figure() >>>> HandleAxes = HandleFigure.add_subplot(111) >>>> DefaultLegendFontSize = >>>> matplotlib.font_manager.FontProperties(size=matplotlib.rcParams['legend.fontsize']).get_size_in_points() >>>> # New plot sequence >>>> HandleAxes.clear() >>>> HandleAxes.clear() >>>> HandleAxes.set_title('Age - Avg All') >>>> HandleAxes.set_xlabel('Time') >>>> HandleAxes.plot( [0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3] >>>> ,[None, 30.0, None, 30.0, None, 31.0, None, 31.0, 32.0, 32.0, 32.0, 32.0, >>>> 33.0, 33.0, 33.0, 33.0], 'ko-' , label = 'File 1') >>>> HandleAxes.plot( [] ,[], 'k:' , label = 'File 2') >>>> HandleSmallerFont = matplotlib.font_manager.FontProperties(size= >>>> DefaultLegendFontSize*1.0 ) >>>> LineHandles, LabelHandles = HandleAxes.get_legend_handles_labels() >>>> TheLegend = HandleAxes.legend(LineHandles, LabelHandles, 0, prop = >>>> HandleSmallerFont, handlelength = 2.0/1.0) >>>> TheLegend.get_frame().set_alpha(0.5) >>>> HandlePDF.savefig(HandleFigure) >>>> HandleAxes.clear() >>>> HandleAxes.set_title("""Create Plots Warning: No parameter entry : >>>> ('Alive', 'Avg All', '')""") >>>> HandlePDF.savefig(HandleFigure) >>>> HandleAxes.clear() >>>> HandleAxes.set_title(' - Rec Count') >>>> HandleAxes.set_xlabel('Time') >>>> HandleAxes.plot( [0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3] >>>> ,[None, 900, None, 1000, None, 900, None, 900, 63, 835, 772, 835, 61, 772, >>>> 711, 772], 'ko-' , label = 'File 1') >>>> HandleAxes.plot( [] ,[], 'k:' , label = 'File 2') >>>> HandleSmallerFont = matplotlib.font_manager.FontProperties(size= >>>> DefaultLegendFontSize*1.0 ) >>>> LineHandles, LabelHandles = HandleAxes.get_legend_handles_labels() >>>> TheLegend = HandleAxes.legend(LineHandles, LabelHandles, 0, prop = >>>> HandleSmallerFont, handlelength = 2.0/1.0) >>>> TheLegend.get_frame().set_alpha(0.5) >>>> HandlePDF.savefig(HandleFigure) >>>> # New plot sequence >>>> HandleAxes.clear() >>>> HandleAxes.set_title("""Create Plots Warning: No parameter entry : >>>> ('Alive', 'Avg All', '')""") >>>> HandlePDF.savefig(HandleFigure) >>>> HandleAxes.plot( [None, 30.0, None, 30.0, None, 31.0, None, 31.0, 32.0, >>>> 32.0, 32.0, 32.0, 33.0, 33.0, 33.0, 33.0] ,[None, 900, None, 1000, None, >>>> 900, None, 900, 63, 835, 772, 835, 61, 772, 711, 772], 'ko-' , label = >>>> 'File 1 - nested record count') >>>> HandleAxes.plot( [] ,[], 'k:' , label = 'File 2 - nested record count') >>>> HandleSmallerFont = matplotlib.font_manager.FontProperties(size= >>>> DefaultLegendFontSize*0.714285714286 ) >>>> LineHandles, LabelHandles = HandleAxes.get_legend_handles_labels() >>>> TheLegend = HandleAxes.legend(LineHandles, LabelHandles, 0, prop = >>>> HandleSmallerFont, handlelength = 2.0/0.714285714286) >>>> TheLegend.get_frame().set_alpha(0.5) >>>> HandlePDF.savefig(HandleFigure) >>>> HandleAxes.clear() >>>> HandleAxes.set_title("""Create Plots Warning: No parameter entry : >>>> ('AnError', 'Avg All', '')""") >>>> HandlePDF.savefig(HandleFigure) >>>> HandleAxes.clear() >>>> HandleAxes.set_title("""Create Plots Warning: No parameter entry : >>>> ('Alive', 'AlsoAnError', '')""") >>>> HandlePDF.savefig(HandleFigure) >>>> HandlePDF.close() >>>> >>>> >>>> >>>> >>>> >>>> _______________________________________________ >>>> Matplotlib-users mailing list >>>> Matplotlib-users at python.org >>>> https://mail.python.org/mailman/listinfo/matplotlib-users >>>> >>>> >>> >> _______________________________________________ >> Matplotlib-users mailing list >> Matplotlib-users at python.org >> https://mail.python.org/mailman/listinfo/matplotlib-users >> > > _______________________________________________ > Matplotlib-users mailing list > Matplotlib-users at python.org > https://mail.python.org/mailman/listinfo/matplotlib-users > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jacob.barhak at gmail.com Thu Mar 24 15:54:24 2016 From: jacob.barhak at gmail.com (Jacob Barhak) Date: Thu, 24 Mar 2016 14:54:24 -0500 Subject: [Matplotlib-users] What changes from matplotlib 1.3.1 to matplotlib 1.5.1 break the following code? In-Reply-To: References: Message-ID: Thanks Ben, Thanks Thomas, Thanks Paul, Your suggestion of adding loc = 0 fixed the code. I just tested it after adding loc in 3 places in the code. Here is the corrected line for a possible future reader. TheLegend = HandleAxes.legend(LineHandles, LabelHandles, loc = 0, prop = HandleSmallerFont, handlelength = 2.0/1.0) I will incorporate this code into future releases on MIST, until then, I will point towards an older version. Making code stricter is a good idea in many cases, and it seems that you added deprecation warnings, so this is normal, yet there is a trickle down price with changing code. I guess we see it now. I appreciate your rapid and well focused replies. Jacob On Thu, Mar 24, 2016 at 12:07 PM, Benjamin Root wrote: > I think what helped more than anything else was the full traceback. But > yes: short code example >> long code example >> no code example. > > On Thu, Mar 24, 2016 at 1:04 PM, Thomas Caswell > wrote: > >> See https://github.com/matplotlib/matplotlib/pull/3943 >> >> You are using an API for legend that we no longer support. You just have >> to pass `loc` as a keyword argument rather than as the third positional. >> >> Running this code on 1.4 should produce a deprecation warning. >> >> In the future, please send the mailing list the minimal amount of code to >> reproduce your problem. People around here are typically more than happy >> to help, but please be respectful of our time and make it easy to help you. >> >> Tom >> >> On Thu, Mar 24, 2016 at 12:52 PM Jacob Barhak >> wrote: >> >>> Sorry Paul, >>> >>> The 5 lines with DB in them should ignored. So please comment the 5 >>> lines after the line that things broke in - it is a file that MIST uses and >>> is not needed for this script. You may also make sure the is a Temp sub >>> directory below the execution path since the pdf filename should be stored >>> there. >>> >>> Yet after making those fixes, you will find out that the script works on >>> matplotlib 1.3.1 and breaks on matplotlib 1.5.1. with the following error: >>> >>> Traceback (most recent call last): >>> File "PlotGeneration_Mod.py", line 21, in >>> >>> TheLegend = HandleAxes.legend(LineHandles, LabelHandles, 0, prop = >>> HandleSma >>> llerFont, handlelength = 2.0/1.0) >>> File "C:\Anaconda\lib\site-packages\matplotlib\axes\_axes.py", line >>> 536, in le >>> gend >>> raise TypeError('Invalid arguments to legend.') >>> TypeError: Invalid arguments to legend. >>> >>> >>> Hopefully this behavior can be explained with changes made. >>> >>> I am unsure I wish to upgrade the code, I am considering tow solutions >>> 1) keeping the old matplotlib version, 2) making some code changes to match >>> the newer version. >>> >>> Your explanation will help me decide on the best solution. >>> >>> >>> Jacob >>> >>> On Thu, Mar 24, 2016 at 10:45 AM, Paul Hobson >>> wrote: >>> >>>> Can you trim this down to a reproducible example? >>>> >>>> It's hard to debug a "this doesn't work" question when I can't get past >>>> the imports ("import DataDef as DB") >>>> >>>> At the very least, could you tell use where the error is occurring and >>>> what the error message is? >>>> -paul >>>> >>>> On Thu, Mar 24, 2016 at 1:02 AM, Jacob Barhak >>>> wrote: >>>> >>>>> Greetings, >>>>> >>>>> Are there specific new changes in matplotlib 1.5.1 that break previous >>>>> code? >>>>> >>>>> Below is a script that works nicely with matplotlib 1.3.1 and breaks >>>>> on matplotlib 1.5.1 that comes with the new anaconda on Windows. >>>>> >>>>> I am trying to decide if a downgrade of the matplotlib version is the >>>>> best solution or is there another simple fix that will make the code work >>>>> again? >>>>> >>>>> Note that this is code generated by the MIST system test code, so do >>>>> not look for logical output - the current goal is just to pass the test by >>>>> not breaking on any commands. >>>>> >>>>> I will appreciate your insight. >>>>> >>>>> Jacob >>>>> >>>>> >>>>> ############# Code that Breaks with 1.5.1 ############## >>>>> >>>>> from __future__ import division >>>>> import matplotlib >>>>> matplotlib.use('PDF') >>>>> import matplotlib.pyplot as plt >>>>> import matplotlib.font_manager >>>>> import matplotlib.backends.backend_pdf >>>>> import DataDef as DB >>>>> Inf = DB.Inf >>>>> NaN = DB.NaN >>>>> inf = DB.inf >>>>> nan = DB.nan >>>>> HandlePDF = >>>>> matplotlib.backends.backend_pdf.PdfPages('Temp\SelectedAssembledPlots.pdf') >>>>> HandleFigure = plt.figure() >>>>> HandleAxes = HandleFigure.add_subplot(111) >>>>> DefaultLegendFontSize = >>>>> matplotlib.font_manager.FontProperties(size=matplotlib.rcParams['legend.fontsize']).get_size_in_points() >>>>> # New plot sequence >>>>> HandleAxes.clear() >>>>> HandleAxes.clear() >>>>> HandleAxes.set_title('Age - Avg All') >>>>> HandleAxes.set_xlabel('Time') >>>>> HandleAxes.plot( [0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3] >>>>> ,[None, 30.0, None, 30.0, None, 31.0, None, 31.0, 32.0, 32.0, 32.0, 32.0, >>>>> 33.0, 33.0, 33.0, 33.0], 'ko-' , label = 'File 1') >>>>> HandleAxes.plot( [] ,[], 'k:' , label = 'File 2') >>>>> HandleSmallerFont = matplotlib.font_manager.FontProperties(size= >>>>> DefaultLegendFontSize*1.0 ) >>>>> LineHandles, LabelHandles = HandleAxes.get_legend_handles_labels() >>>>> TheLegend = HandleAxes.legend(LineHandles, LabelHandles, 0, prop = >>>>> HandleSmallerFont, handlelength = 2.0/1.0) >>>>> TheLegend.get_frame().set_alpha(0.5) >>>>> HandlePDF.savefig(HandleFigure) >>>>> HandleAxes.clear() >>>>> HandleAxes.set_title("""Create Plots Warning: No parameter entry : >>>>> ('Alive', 'Avg All', '')""") >>>>> HandlePDF.savefig(HandleFigure) >>>>> HandleAxes.clear() >>>>> HandleAxes.set_title(' - Rec Count') >>>>> HandleAxes.set_xlabel('Time') >>>>> HandleAxes.plot( [0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3] >>>>> ,[None, 900, None, 1000, None, 900, None, 900, 63, 835, 772, 835, 61, 772, >>>>> 711, 772], 'ko-' , label = 'File 1') >>>>> HandleAxes.plot( [] ,[], 'k:' , label = 'File 2') >>>>> HandleSmallerFont = matplotlib.font_manager.FontProperties(size= >>>>> DefaultLegendFontSize*1.0 ) >>>>> LineHandles, LabelHandles = HandleAxes.get_legend_handles_labels() >>>>> TheLegend = HandleAxes.legend(LineHandles, LabelHandles, 0, prop = >>>>> HandleSmallerFont, handlelength = 2.0/1.0) >>>>> TheLegend.get_frame().set_alpha(0.5) >>>>> HandlePDF.savefig(HandleFigure) >>>>> # New plot sequence >>>>> HandleAxes.clear() >>>>> HandleAxes.set_title("""Create Plots Warning: No parameter entry : >>>>> ('Alive', 'Avg All', '')""") >>>>> HandlePDF.savefig(HandleFigure) >>>>> HandleAxes.plot( [None, 30.0, None, 30.0, None, 31.0, None, 31.0, >>>>> 32.0, 32.0, 32.0, 32.0, 33.0, 33.0, 33.0, 33.0] ,[None, 900, None, 1000, >>>>> None, 900, None, 900, 63, 835, 772, 835, 61, 772, 711, 772], 'ko-' , label >>>>> = 'File 1 - nested record count') >>>>> HandleAxes.plot( [] ,[], 'k:' , label = 'File 2 - nested record count') >>>>> HandleSmallerFont = matplotlib.font_manager.FontProperties(size= >>>>> DefaultLegendFontSize*0.714285714286 ) >>>>> LineHandles, LabelHandles = HandleAxes.get_legend_handles_labels() >>>>> TheLegend = HandleAxes.legend(LineHandles, LabelHandles, 0, prop = >>>>> HandleSmallerFont, handlelength = 2.0/0.714285714286) >>>>> TheLegend.get_frame().set_alpha(0.5) >>>>> HandlePDF.savefig(HandleFigure) >>>>> HandleAxes.clear() >>>>> HandleAxes.set_title("""Create Plots Warning: No parameter entry : >>>>> ('AnError', 'Avg All', '')""") >>>>> HandlePDF.savefig(HandleFigure) >>>>> HandleAxes.clear() >>>>> HandleAxes.set_title("""Create Plots Warning: No parameter entry : >>>>> ('Alive', 'AlsoAnError', '')""") >>>>> HandlePDF.savefig(HandleFigure) >>>>> HandlePDF.close() >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> _______________________________________________ >>>>> Matplotlib-users mailing list >>>>> Matplotlib-users at python.org >>>>> https://mail.python.org/mailman/listinfo/matplotlib-users >>>>> >>>>> >>>> >>> _______________________________________________ >>> Matplotlib-users mailing list >>> Matplotlib-users at python.org >>> https://mail.python.org/mailman/listinfo/matplotlib-users >>> >> >> _______________________________________________ >> Matplotlib-users mailing list >> Matplotlib-users at python.org >> https://mail.python.org/mailman/listinfo/matplotlib-users >> >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: From ndbecker2 at gmail.com Wed Mar 30 07:58:16 2016 From: ndbecker2 at gmail.com (Neal Becker) Date: Wed, 30 Mar 2016 07:58:16 -0400 Subject: [Matplotlib-users] point right on axis limit not very visible Message-ID: I have a couple of semilogy line plots, with markers. One line has only 1 point, just the marker. It is right on the left vertical axis and is not very visible. It would be better if the xaxis limit was set a bit lower so the point marker was more visible (and not clipped). What's a good way to do this that hopefully doesn't involve a lot of manual tweaking? From flyamer at gmail.com Wed Mar 30 08:09:38 2016 From: flyamer at gmail.com (Ilya Flyamer) Date: Wed, 30 Mar 2016 13:09:38 +0100 Subject: [Matplotlib-users] point right on axis limit not very visible In-Reply-To: References: Message-ID: How about plt.margins? Example: plt.margins(x=.05) http://matplotlib.org/api/pyplot_api.html?highlight=margins#matplotlib.pyplot.margins 2016-03-30 12:58 GMT+01:00 Neal Becker : > I have a couple of semilogy line plots, with markers. One line has only 1 > point, just the marker. It is right on the left vertical axis and is not > very visible. > > It would be better if the xaxis limit was set a bit lower so the point > marker was more visible (and not clipped). > > What's a good way to do this that hopefully doesn't involve a lot of manual > tweaking? > > _______________________________________________ > 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 emilia.petrisor at gmail.com Wed Mar 30 10:41:31 2016 From: emilia.petrisor at gmail.com (empet) Date: Wed, 30 Mar 2016 07:41:31 -0700 (MST) Subject: [Matplotlib-users] plt.hexbin underlying algorithm Message-ID: <1459348891325-46927.post@n5.nabble.com> Hi all, Recently I experimented how plt.hexbin works. I read a little bit about the history of this method of binning, and I'm curious how it was implemented in matplotlib. Could someone, please, point out where in /site-packages/matplotlib is implemented the construction of the prototypical hexagon returned by: plt.hexbin(x, y, gridsize=25, cmap=my_cmap, mincnt=1).get_paths() as well as the computation of the PolyCollection offsets? I ran my code in a Jupyter notebook and noticed that if I don't set %matplotlib inline, then the PolyCollection instance HB=plt.hexbin(x, y, gridsize=25, cmap=my_cmap, mincnt=1) has only one facecolor initialized, i.e. len(Hb.get_facecolors())=1, while len(HB.get_offsets())=300. Is there a posibility to generate the facecolors without effective plotting of the hexbin object? Thanks, Em -- View this message in context: http://matplotlib.1069221.n5.nabble.com/plt-hexbin-underlying-algorithm-tp46927.html Sent from the matplotlib - users mailing list archive at Nabble.com. From pmhobson at gmail.com Wed Mar 30 11:48:00 2016 From: pmhobson at gmail.com (Paul Hobson) Date: Wed, 30 Mar 2016 08:48:00 -0700 Subject: [Matplotlib-users] plt.hexbin underlying algorithm In-Reply-To: <1459348891325-46927.post@n5.nabble.com> References: <1459348891325-46927.post@n5.nabble.com> Message-ID: Em, hexbin is a method of the Axe class: https://github.com/matplotlib/matplotlib/blob/master/lib/matplotlib/axes/_axes.py#L3958 There is surely some infrastructure below that, but the link above is the entrance to the rabbit hole. Is that what you needed? -p On Wed, Mar 30, 2016 at 7:41 AM, empet wrote: > Hi all, > > Recently I experimented how plt.hexbin works. > I read a little bit about the history of this method of binning, and I'm > curious how it was implemented in matplotlib. > Could someone, please, point out where in /site-packages/matplotlib is > implemented the construction of the prototypical hexagon returned by: > > plt.hexbin(x, y, gridsize=25, cmap=my_cmap, mincnt=1).get_paths() > > as well as the computation of the PolyCollection offsets? > > I ran my code in a Jupyter notebook and noticed that if I don't set > %matplotlib inline, then the > PolyCollection instance > > HB=plt.hexbin(x, y, gridsize=25, cmap=my_cmap, mincnt=1) > > has only one facecolor initialized, i.e. len(Hb.get_facecolors())=1, while > len(HB.get_offsets())=300. > Is there a posibility to generate the facecolors without effective plotting > of the hexbin object? > > Thanks, > > Em > > > > -- > View this message in context: > http://matplotlib.1069221.n5.nabble.com/plt-hexbin-underlying-algorithm-tp46927.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 emilia.petrisor at gmail.com Wed Mar 30 12:32:16 2016 From: emilia.petrisor at gmail.com (empet) Date: Wed, 30 Mar 2016 09:32:16 -0700 (MST) Subject: [Matplotlib-users] plt.hexbin underlying algorithm In-Reply-To: References: <1459348891325-46927.post@n5.nabble.com> Message-ID: <1459355536630-46929.post@n5.nabble.com> Fine!!! Thank you very much!!! -- View this message in context: http://matplotlib.1069221.n5.nabble.com/plt-hexbin-underlying-algorithm-tp46927p46929.html Sent from the matplotlib - users mailing list archive at Nabble.com. From m.hofsaess at gmail.com Thu Mar 31 04:14:30 2016 From: m.hofsaess at gmail.com (=?UTF-8?B?TWFydGluIEhvZnPDpMOf?=) Date: Thu, 31 Mar 2016 10:14:30 +0200 Subject: [Matplotlib-users] having a 3d plot making a 2d plot Message-ID: Hi all, i having a 3d plot and need only a view of the x-y plane. Is there a simple approach to get a nice looking 2d view of the 3d plot? Regards, Martin -------------- next part -------------- An HTML attachment was scrubbed... URL: From flyamer at gmail.com Thu Mar 31 04:16:34 2016 From: flyamer at gmail.com (Ilya Flyamer) Date: Thu, 31 Mar 2016 09:16:34 +0100 Subject: [Matplotlib-users] having a 3d plot making a 2d plot In-Reply-To: References: Message-ID: Hi Martin, Why not just make a 2d plot of x vs y? Cheers, Ilya 2016-03-31 9:14 GMT+01:00 Martin Hofs?? : > Hi all, > > i having a 3d plot and need only a view of the x-y plane. Is there a > simple approach to get a nice looking 2d view of the 3d plot? > > > Regards, > > Martin > > _______________________________________________ > 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 Thu Mar 31 09:22:27 2016 From: ben.v.root at gmail.com (Benjamin Root) Date: Thu, 31 Mar 2016 09:22:27 -0400 Subject: [Matplotlib-users] having a 3d plot making a 2d plot In-Reply-To: References: Message-ID: Are you asking for a "live" view of the 3d data? That might be something that glueviz might be well-suited for: http://www.glueviz.org/en/stable/ On Thu, Mar 31, 2016 at 4:16 AM, Ilya Flyamer wrote: > Hi Martin, > > Why not just make a 2d plot of x vs y? > > Cheers, > Ilya > > 2016-03-31 9:14 GMT+01:00 Martin Hofs?? : > >> Hi all, >> >> i having a 3d plot and need only a view of the x-y plane. Is there a >> simple approach to get a nice looking 2d view of the 3d plot? >> >> >> Regards, >> >> Martin >> >> _______________________________________________ >> Matplotlib-users mailing list >> Matplotlib-users at python.org >> https://mail.python.org/mailman/listinfo/matplotlib-users >> >> > > _______________________________________________ > Matplotlib-users mailing list > Matplotlib-users at python.org > https://mail.python.org/mailman/listinfo/matplotlib-users > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From christopher.y.bull at student.unsw.edu.au Thu Mar 17 18:36:56 2016 From: christopher.y.bull at student.unsw.edu.au (Christopher Bull) Date: Thu, 17 Mar 2016 22:36:56 -0000 Subject: [Matplotlib-users] gridding subplots in matplotlib. Message-ID: Hello plotting enthusiasts! I've written a python class for gridding subplots in 'one line' (munging aside). Example: plth.Grid(plotdict,(4,3),dimlabels=dimlab,globalcbar='Accent',clevels=20,sharex=True,sharey=True,outputpath=plotoutputs+'005_GridEgDimLabShareXShareYglobalcbarAccentclevels.png') produces [1]. See this post for more details and options. Apologies in advance: - I'm sure I haven't followed the matplotlib API. (I'd be interested if someone can point me towards a good example of this.) I don't think I have time but if someone wants to turn this into a pull request that would be great! - I realise there are similar efforts in Pandas/Iris/ggplot, I just wanted something that would work on any numpy array. Also, any plt users on here that have ideas for this 3d plotting question I wrote on stackoverflow ? Cheers, Chris Bull. [1] -- *Christopher Bull* PhD Candidate BAMOS Associate Editor Climate Change Research Centre & ARC Centre of Excellence for Climate System Science University of New South Wales Sydney NSW 2052 Australia t: @ChrisBullOceanO gh: chrisb13 *w: christopherbull.com.au * -------------- next part -------------- An HTML attachment was scrubbed... URL: From egayer at gmail.com Mon Mar 21 05:37:43 2016 From: egayer at gmail.com (Eric Gayer) Date: Mon, 21 Mar 2016 09:37:43 -0000 Subject: [Matplotlib-users] perspective Message-ID: <6F355DF7-0518-484D-A066-6519E47462BA@gmail.com> Hi all, I am not sure this is the right place for my question, but I don?t really know where to ask? I would like to know if there is a chance for matplolib to provide the same 3D plot perspective as the perp() function in R or from the plot3D package from Karline Soetaert (based on persp()) in R http://www.r-bloggers.com/creating-surface-plots/ http://www.r-bloggers.com/3d-plots-in-r/ I found nothing on how to change perspective aspect in mplot3d. I am afraid it is not possible to work on the depth of the perspective in a mplot3d plot, is anyone knows how to do it ? Does anyone think it would be possible in a near future ? Thanks Eric -------------- next part -------------- An HTML attachment was scrubbed... URL: From john.brodie at gmail.com Thu Mar 24 15:25:59 2016 From: john.brodie at gmail.com (jungleb77) Date: Thu, 24 Mar 2016 19:25:59 -0000 Subject: [Matplotlib-users] New matplotlib book: Mastering matplotlib In-Reply-To: References: Message-ID: <1458846438461-46920.post@n5.nabble.com> Hi Duncan, I just bought your book, I'm excited to get through it. I'm wondering if the 'make' commands are supposed to work in OS X? I tried following the examples in the first couple of chapters and the make errors out with some files not found. Any ideas? thanks again, John Brodie -- View this message in context: http://matplotlib.1069221.n5.nabble.com/New-matplotlib-book-Mastering-matplotlib-tp45921p46920.html Sent from the matplotlib - users mailing list archive at Nabble.com. From fengbo.zhang at hirain.com Sun Mar 27 14:26:31 2016 From: fengbo.zhang at hirain.com (=?GB2312?B?t++yqQ==?=) Date: Sun, 27 Mar 2016 18:26:31 -0000 Subject: [Matplotlib-users] issues about the transform of AnnotationBbox Message-ID: <699EF672-00B0-4009-B85F-4053327CBD1D@hirain.com> Hi, I am an user of matplotlib. AnnotationBbox has an API called "set_transform". However, when I use this API and set the rotation of AnnotationBbox, the AnnotationBbox is not transformed. My question is that whether this API is ignored by matplotlib. thanks ???? iPad From benjamin.trendelkampschroer at googlemail.com Tue Mar 29 06:00:13 2016 From: benjamin.trendelkampschroer at googlemail.com (Benjamin Trendelkamp-Schroer) Date: Tue, 29 Mar 2016 10:00:13 -0000 Subject: [Matplotlib-users] Line plot ending with arrow-head Message-ID: <56FA5227.3000909@gmail.com> Hello, my problem is the following: I want to plot an arrow-head onto the end of a line plot. So far I have been able to devise the following solution, which I find to be unsatisfactory. Minimal working example below. >>>import numpy as np >>>import matplotlib.pyplot as plt >>>x = np.linspace(0.5, 1.0, 50) >>>y = x**2 >>>fig = plt.figure(0) >>>ax = fig.add_subplot(111) >>>ax.plot(x[:-1], y[:-1], c='k') >>>ax.arrow(x[-2], y[-2], x[-1]-x[-2], y[-1]-y[-2], fc='k', ec='k) >>>plt.show() But the thickness of the tail of the arrow and the thickness of the line are not matching and I do not know which parameters I would need to tune in order to get a visual appealing match. I have looked into matplotlib.patches.FancyArrowPatch, but it was not clear to me how I can use it to add the arrowhead to the line plot. Unfortunately, I am not too familiar with the whole matplotlib object-structure so that it is likely that I have overlooked something that will make this relatively straightforward to achieve. Any suggestions would be very helpful. Thanks, Benjamin From fai1007 at hotmail.com Thu Mar 31 13:44:05 2016 From: fai1007 at hotmail.com (glory ghazr) Date: Thu, 31 Mar 2016 17:44:05 -0000 Subject: [Matplotlib-users] itfish.net Message-ID: Hello how are you doing my name is miss glory i saw your profile on itfish.net today and became interested in you please contact me back here (gloryghazi at yandex.com) I have something very important to discaurse with you. God bless you. glory -------------- next part -------------- An HTML attachment was scrubbed... URL: