SourceForge logo
SourceForge logo
Menu

matplotlib-users — Discussion related to using matplotlib

You can subscribe to this list here.

2003 Jan
Feb
Mar
Apr
May
(3)
Jun
Jul
Aug
(12)
Sep
(12)
Oct
(56)
Nov
(65)
Dec
(37)
2004 Jan
(59)
Feb
(78)
Mar
(153)
Apr
(205)
May
(184)
Jun
(123)
Jul
(171)
Aug
(156)
Sep
(190)
Oct
(120)
Nov
(154)
Dec
(223)
2005 Jan
(184)
Feb
(267)
Mar
(214)
Apr
(286)
May
(320)
Jun
(299)
Jul
(348)
Aug
(283)
Sep
(355)
Oct
(293)
Nov
(232)
Dec
(203)
2006 Jan
(352)
Feb
(358)
Mar
(403)
Apr
(313)
May
(165)
Jun
(281)
Jul
(316)
Aug
(228)
Sep
(279)
Oct
(243)
Nov
(315)
Dec
(345)
2007 Jan
(260)
Feb
(323)
Mar
(340)
Apr
(319)
May
(290)
Jun
(296)
Jul
(221)
Aug
(292)
Sep
(242)
Oct
(248)
Nov
(242)
Dec
(332)
2008 Jan
(312)
Feb
(359)
Mar
(454)
Apr
(287)
May
(340)
Jun
(450)
Jul
(403)
Aug
(324)
Sep
(349)
Oct
(385)
Nov
(363)
Dec
(437)
2009 Jan
(500)
Feb
(301)
Mar
(409)
Apr
(486)
May
(545)
Jun
(391)
Jul
(518)
Aug
(497)
Sep
(492)
Oct
(429)
Nov
(357)
Dec
(310)
2010 Jan
(371)
Feb
(657)
Mar
(519)
Apr
(432)
May
(312)
Jun
(416)
Jul
(477)
Aug
(386)
Sep
(419)
Oct
(435)
Nov
(320)
Dec
(202)
2011 Jan
(321)
Feb
(413)
Mar
(299)
Apr
(215)
May
(284)
Jun
(203)
Jul
(207)
Aug
(314)
Sep
(321)
Oct
(259)
Nov
(347)
Dec
(209)
2012 Jan
(322)
Feb
(414)
Mar
(377)
Apr
(179)
May
(173)
Jun
(234)
Jul
(295)
Aug
(239)
Sep
(276)
Oct
(355)
Nov
(144)
Dec
(108)
2013 Jan
(170)
Feb
(89)
Mar
(204)
Apr
(133)
May
(142)
Jun
(89)
Jul
(160)
Aug
(180)
Sep
(69)
Oct
(136)
Nov
(83)
Dec
(32)
2014 Jan
(71)
Feb
(90)
Mar
(161)
Apr
(117)
May
(78)
Jun
(94)
Jul
(60)
Aug
(83)
Sep
(102)
Oct
(132)
Nov
(154)
Dec
(96)
2015 Jan
(45)
Feb
(138)
Mar
(176)
Apr
(132)
May
(119)
Jun
(124)
Jul
(77)
Aug
(31)
Sep
(34)
Oct
(22)
Nov
(23)
Dec
(9)
2016 Jan
(26)
Feb
(17)
Mar
(10)
Apr
(8)
May
(4)
Jun
(8)
Jul
(6)
Aug
(5)
Sep
(9)
Oct
(4)
Nov
Dec
2017 Jan
(5)
Feb
(7)
Mar
(1)
Apr
(5)
May
Jun
(3)
Jul
(6)
Aug
(1)
Sep
Oct
(2)
Nov
(1)
Dec
2018 Jan
Feb
Mar
Apr
(1)
May
Jun
Jul
Aug
Sep
Oct
Nov
Dec
2020 Jan
Feb
Mar
Apr
May
(1)
Jun
Jul
Aug
Sep
Oct
Nov
Dec
2025 Jan
(1)
Feb
Mar
Apr
May
Jun
Jul
Aug
Sep
Oct
Nov
Dec
S M T W T F S




1
(2)
2
(3)
3
4
(3)
5
(11)
6
(3)
7
(2)
8
(6)
9
(6)
10
(8)
11
(3)
12
(7)
13
(8)
14
(5)
15
(11)
16
(11)
17
(3)
18
(2)
19
(7)
20
(11)
21
(6)
22
(5)
23
(1)
24
25
26
(6)
27
(3)
28
(8)
29
(2)
30
(1)

Showing 11 results of 11

From: Sterling S. <sm...@fu...> - 2012年11月16日 23:13:49
On Nov 16, 2012, at 2:25PM, Russell E. Owen wrote:
> In article <50A...@ed...>,
> Mathew Topper <mat...@ed...> wrote:
> 
>> Hi,
>> 
>> I'm interested to know why the pip package manager is not more widely 
>> supported for installation of python packages like matplotlib? 
>> Matplotlib seems to be particularly slowly updated in the Fedora 
>> repositories, for example, so I often find that a source installation is 
>> necessary. I know this isn't especially difficult for the experienced 
>> user, but surely using something like pip would make this process for 
>> accessible for all users of python packages, particularly those that do 
>> not receive much attention from the big distribution maintainers? Yet, 
>> pip doesn't get a mention on the installation documentation of 
>> matplotlib or many other python packs.
>> 
>> I would love to hear anyone's thoughts on this matter.
> 
> Unfortunately pip cannot install binaries, so any user that tried to 
> install matplotlib using pip would have to have a C compiler.
> 
> Unfortunately many users do not have a compiler on MacOS and Windows.
> 
> In addition, matplotlib has some important dependencies that may not be 
> available on all systems. MacOS now includes all necessary libraries. I 
> don't think that is true for most flavors linux (though there is 
> probably an easy way to get all missing packages). I have no idea about 
> Windows.
> 
> I agree pip should be mentioned, but I don't see it as a viable 
> mainstream means of installing matplotlib.
> 
> (Does it even work with matplotlib? I've never tried it.)
> 
> -- Russell
pip is the only method I have used in my Linux work.
-Sterling
> 
> 
> ------------------------------------------------------------------------------
> Monitor your physical, virtual and cloud infrastructure from a single
> web console. Get in-depth insight into apps, servers, databases, vmware,
> SAP, cloud infrastructure, etc. Download 30-day Free Trial.
> Pricing starts from 795ドル for 25 servers or applications!
> http://p.sf.net/sfu/zoho_dev2dev_nov
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
From: Sterling S. <sm...@fu...> - 2012年11月16日 23:12:42
Chao,
If you don't need the tick marks and are only annoyed by their appearance in the colorbar, then I am pasting below our code so far setting the tick length to 0. 
Code so far:
from pylab import *
fig = figure(2)
fig.clear()
a = np.arange(100).reshape(10,10)
cbarlevel=np.arange(0,101,10)
contourf(a,levels=cbarlevel)
cbar = colorbar()
cbar.set_ticks((cbarlevel[1:]+cbarlevel[:-1])/2.)
#to manipulate the range:
cbar_label = []
for i in range(len(cbarlevel)-1):
 cbar_label.append("{0}-{1}".format(cbarlevel[i],cbarlevel[i+1]))
#Then to apply on the colorbar:
cbar.set_ticklabels(cbar_label)
ax = fig.axes[-1] #This is not as clean as making the axes before the colorbar and passing to the colorbar...
ax.yaxis.set_tick_params(length=0)
If you still want the ticks, then you might think of keeping the ticks where you had set them originally, then placing texts (pylab.text) with the transAxes transform, using the following script:
from pylab import *
fig = figure(2)
fig.clear()
a = np.arange(100).reshape(10,10)
cbarlevel=np.arange(0,101,10)
contourf(a,levels=cbarlevel)
cbar = colorbar()
#cbar.set_ticks((cbarlevel[1:]+cbarlevel[:-1])/2.)
cbar.set_ticks(cbarlevel)
#to manipulate the range:
cbar_label = []
for i in range(len(cbarlevel)-1):
 cbar_label.append("{0}-{1}".format(cbarlevel[i],cbarlevel[i+1]))
#cbar_label.append('')
print cbar_label
#['0-10', '10-20', '20-30', '30-40', '40-50', '50-60', '60-70', '70-80',
#'80-90', '90-100', '']
#Then to apply on the colorbar:
cbar.set_ticklabels(['']*len(cbarlevel))
ax = fig.axes[-1]
#ax.yaxis.set_tick_params(length=0)
yloc = linspace(0,1,len(cbar_label)+1)
yloc = yloc[:-1] + yloc[1]/2.
for l,y in zip(cbar_label,yloc):
	ax.text(1,y,l,transform=ax.transAxes,ha='left')
draw()
-Sterling
On Nov 16, 2012, at 12:58PM, Chao YUE wrote:
> Thanks Sterling. It's a good idea. 
> 
> Unluckily, I lose the original ticks and the ticks appeared in the middle. Is there any approach I can keep the original ticks while realizing what has been shown in the figure?
> 
> Chao
> 
> On Fri, Nov 16, 2012 at 5:47 PM, Sterling Smith <sm...@fu...> wrote:
> Chao,
> 
> The secret is positioning your ticks. I list here an untested attempt at putting the labels at the average of the current and next levels:
> 
> cbar.set_ticks((cbarlevel[1:]+cbarlevel[:-1])/2.)
> 
> Because you have less ticks, then you will want to remove the line
> 
> cbar_level.append('')
> 
> Hope that helps,
> Sterling
> 
> On Nov 16, 2012, at 7:46AM, ChaoYue wrote:
> 
> > I have a bit progress, but still not very well.
> >
> > #to have a contourf plot
> > a = np.arange(100).reshape(10,10)
> > cbarlevel=np.arange(0,101,10)
> > contourf(a,levels=cbarlevel)
> > cbar = colorbar()
> > cbar.set_ticks(cbarlevel)
> >
> > #to manipulate the range:
> > cbar_label = []
> > for i in range(len(cbarlevel)-1):
> > cbar_label.append("{0}-{1}".format(cbarlevel[i],cbarlevel[i+1]))
> > cbar_label.append('')
> >
> > In [54]: print cbar_label
> > ['0-10', '10-20', '20-30', '30-40', '40-50', '50-60', '60-70', '70-80',
> > '80-90', '90-100', '']
> >
> > #Then to apply on the colorbar:
> > cbar.set_ticklabels(cbar_label)
> >
> > The generated figure is attached. But how can I put the labels a little bit
> > upward to make them parallel with the respective small rectangles in the
> > colorbar? <http://matplotlib.1069221.n5.nabble.com/file/n39786/fig.jpg>
> >
> >
> >
> >
> >
> > --
> > View this message in context: http://matplotlib.1069221.n5.nabble.com/how-to-put-colorbar-label-beside-the-handle-tp39705p39786.html
> > Sent from the matplotlib - users mailing list archive at Nabble.com.
> >
> > ------------------------------------------------------------------------------
> > Monitor your physical, virtual and cloud infrastructure from a single
> > web console. Get in-depth insight into apps, servers, databases, vmware,
> > SAP, cloud infrastructure, etc. Download 30-day Free Trial.
> > Pricing starts from 795ドル for 25 servers or applications!
> > http://p.sf.net/sfu/zoho_dev2dev_nov
> > _______________________________________________
> > Matplotlib-users mailing list
> > Mat...@li...
> > https://lists.sourceforge.net/lists/listinfo/matplotlib-users
> 
> 
> 
> 
> -- 
> ***********************************************************************************
> Chao YUE
> Laboratoire des Sciences du Climat et de l'Environnement (LSCE-IPSL)
> UMR 1572 CEA-CNRS-UVSQ
> Batiment 712 - Pe 119
> 91191 GIF Sur YVETTE Cedex
> Tel: (33) 01 69 08 29 02; Fax:01.69.08.77.16
> ************************************************************************************
> 
> <fig.jpg>
From: Russell E. O. <ro...@uw...> - 2012年11月16日 22:25:32
In article <50A...@ed...>,
 Mathew Topper <mat...@ed...> wrote:
> Hi,
> 
> I'm interested to know why the pip package manager is not more widely 
> supported for installation of python packages like matplotlib? 
> Matplotlib seems to be particularly slowly updated in the Fedora 
> repositories, for example, so I often find that a source installation is 
> necessary. I know this isn't especially difficult for the experienced 
> user, but surely using something like pip would make this process for 
> accessible for all users of python packages, particularly those that do 
> not receive much attention from the big distribution maintainers? Yet, 
> pip doesn't get a mention on the installation documentation of 
> matplotlib or many other python packs.
> 
> I would love to hear anyone's thoughts on this matter.
Unfortunately pip cannot install binaries, so any user that tried to 
install matplotlib using pip would have to have a C compiler.
Unfortunately many users do not have a compiler on MacOS and Windows.
In addition, matplotlib has some important dependencies that may not be 
available on all systems. MacOS now includes all necessary libraries. I 
don't think that is true for most flavors linux (though there is 
probably an easy way to get all missing packages). I have no idea about 
Windows.
I agree pip should be mentioned, but I don't see it as a viable 
mainstream means of installing matplotlib.
(Does it even work with matplotlib? I've never tried it.)
-- Russell
From: Tony Yu <ts...@gm...> - 2012年11月16日 21:35:06
On Fri, Nov 16, 2012 at 11:35 AM, Jon Ramsey <jon...@gm...> wrote:
> Hi Everyone,
>
> I have just upgraded to matplotlib 1.2.0 so that I can use the streamplot
> module, which I'm quite happy about!
> However, I've noticed that when one tries to color the streamlines using a
> 2-D array which contains NaNs, streamlines of only one color are shown! I
> have appended example code below which reproduces the problem.
>
> Meanwhile, if the following two lines are inserted inside an "if
> use_multicolor_lines:" region within streamplot.py, then the problem goes
> away (for example, after line 84 or line 115):
> if np.any(np.isnan(color)):
> color = np.ma.array(color, mask=np.isnan(color))
>
> This check already exists on the input arrays U and V, but not for color.
> I am also not sure this issue will persist when a normalize object is
> explicitly specified.
>
> Example code (derived from streamplot_demo.py):
>
> import numpy as np
> import matplotlib.pyplot as plt
>
> Y, X = np.mgrid[-3:3:100j, -3:3:100j]
> U = -1 - X**2 + Y
> V = 1 + X - Y**2
> speed = np.sqrt(U*U + V*V)
>
> m = np.sqrt(X**2 + Y**2) < 1.0
> speed[m] = np.nan
>
> plt.streamplot(X, Y, U, V, color=speed, linewidth=2, cmap=plt.cm.autumn)
> plt.colorbar()
> plt.show()
>
> Additional info:
> Linux 2.6.38-16-generic #67-Ubuntu SMP Thu Sep 6 17:58:38 UTC 2012 x86_64
> x86_64 x86_64 GNU/Linux
> Matplotlib v1.2.0
>
>
> Best Regards,
>
> Jon Ramsey
>
> P.S. Long time reader, first time poster.
>
>
Hi Jon,
Welcome! This fix looks good to me. Since you mentioned that you're using
the latest release, I assume you're not running matplotlib from github, so
I filed a pull request with your fix:
https://github.com/matplotlib/matplotlib/pull/1514
Thanks for the bug report and fix!
-Tony
From: Sterling S. <sm...@fu...> - 2012年11月16日 16:47:41
Chao,
The secret is positioning your ticks. I list here an untested attempt at putting the labels at the average of the current and next levels:
cbar.set_ticks((cbarlevel[1:]+cbarlevel[:-1])/2.)
Because you have less ticks, then you will want to remove the line
cbar_level.append('')
Hope that helps,
Sterling
On Nov 16, 2012, at 7:46AM, ChaoYue wrote:
> I have a bit progress, but still not very well.
> 
> #to have a contourf plot
> a = np.arange(100).reshape(10,10)
> cbarlevel=np.arange(0,101,10)
> contourf(a,levels=cbarlevel)
> cbar = colorbar()
> cbar.set_ticks(cbarlevel)
> 
> #to manipulate the range:
> cbar_label = []
> for i in range(len(cbarlevel)-1):
> cbar_label.append("{0}-{1}".format(cbarlevel[i],cbarlevel[i+1]))
> cbar_label.append('')
> 
> In [54]: print cbar_label
> ['0-10', '10-20', '20-30', '30-40', '40-50', '50-60', '60-70', '70-80',
> '80-90', '90-100', '']
> 
> #Then to apply on the colorbar:
> cbar.set_ticklabels(cbar_label)
> 
> The generated figure is attached. But how can I put the labels a little bit
> upward to make them parallel with the respective small rectangles in the
> colorbar? <http://matplotlib.1069221.n5.nabble.com/file/n39786/fig.jpg> 
> 
> 
> 
> 
> 
> --
> View this message in context: http://matplotlib.1069221.n5.nabble.com/how-to-put-colorbar-label-beside-the-handle-tp39705p39786.html
> Sent from the matplotlib - users mailing list archive at Nabble.com.
> 
> ------------------------------------------------------------------------------
> Monitor your physical, virtual and cloud infrastructure from a single
> web console. Get in-depth insight into apps, servers, databases, vmware,
> SAP, cloud infrastructure, etc. Download 30-day Free Trial.
> Pricing starts from 795ドル for 25 servers or applications!
> http://p.sf.net/sfu/zoho_dev2dev_nov
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
From: Jon R. <jon...@gm...> - 2012年11月16日 16:36:20
Hi Everyone,
I have just upgraded to matplotlib 1.2.0 so that I can use the streamplot
module, which I'm quite happy about!
However, I've noticed that when one tries to color the streamlines using a
2-D array which contains NaNs, streamlines of only one color are shown! I
have appended example code below which reproduces the problem.
Meanwhile, if the following two lines are inserted inside an "if
use_multicolor_lines:" region within streamplot.py, then the problem goes
away (for example, after line 84 or line 115):
 if np.any(np.isnan(color)):
 color = np.ma.array(color, mask=np.isnan(color))
This check already exists on the input arrays U and V, but not for color.
I am also not sure this issue will persist when a normalize object is
explicitly specified.
Example code (derived from streamplot_demo.py):
import numpy as np
import matplotlib.pyplot as plt
Y, X = np.mgrid[-3:3:100j, -3:3:100j]
U = -1 - X**2 + Y
V = 1 + X - Y**2
speed = np.sqrt(U*U + V*V)
m = np.sqrt(X**2 + Y**2) < 1.0
speed[m] = np.nan
plt.streamplot(X, Y, U, V, color=speed, linewidth=2, cmap=plt.cm.autumn)
plt.colorbar()
plt.show()
Additional info:
Linux 2.6.38-16-generic #67-Ubuntu SMP Thu Sep 6 17:58:38 UTC 2012 x86_64
x86_64 x86_64 GNU/Linux
Matplotlib v1.2.0
Best Regards,
Jon Ramsey
P.S. Long time reader, first time poster.
From: ChaoYue <cha...@gm...> - 2012年11月16日 15:46:35
I have a bit progress, but still not very well.
#to have a contourf plot
a = np.arange(100).reshape(10,10)
cbarlevel=np.arange(0,101,10)
contourf(a,levels=cbarlevel)
cbar = colorbar()
cbar.set_ticks(cbarlevel)
#to manipulate the range:
cbar_label = []
for i in range(len(cbarlevel)-1):
 cbar_label.append("{0}-{1}".format(cbarlevel[i],cbarlevel[i+1]))
cbar_label.append('')
In [54]: print cbar_label
['0-10', '10-20', '20-30', '30-40', '40-50', '50-60', '60-70', '70-80',
'80-90', '90-100', '']
#Then to apply on the colorbar:
cbar.set_ticklabels(cbar_label)
The generated figure is attached. But how can I put the labels a little bit
upward to make them parallel with the respective small rectangles in the
colorbar? <http://matplotlib.1069221.n5.nabble.com/file/n39786/fig.jpg> 
--
View this message in context: http://matplotlib.1069221.n5.nabble.com/how-to-put-colorbar-label-beside-the-handle-tp39705p39786.html
Sent from the matplotlib - users mailing list archive at Nabble.com.
From: Mathew T. <mat...@ed...> - 2012年11月16日 15:25:31
The University of Edinburgh is a charitable body, registered in
Scotland, with registration number SC005336.
From: Michael D. <md...@st...> - 2012年11月16日 14:16:39
One of the reasons (historically) is that the build scripts predate 
setuptools and ships copies of dependencies rather than using 
easy_install or pip to install them. There is an open PR to address 
this here:
https://github.com/matplotlib/matplotlib/pull/1454
But you do make a good point that `pip` should be mentioned in the docs 
as part of that change.
Mike
On 11/16/2012 05:54 AM, Mathew Topper wrote:
> Hi,
>
> I'm interested to know why the pip package manager is not more widely 
> supported for installation of python packages like matplotlib? 
> Matplotlib seems to be particularly slowly updated in the Fedora 
> repositories, for example, so I often find that a source installation 
> is necessary. I know this isn't especially difficult for the 
> experienced user, but surely using something like pip would make this 
> process for accessible for all users of python packages, particularly 
> those that do not receive much attention from the big distribution 
> maintainers? Yet, pip doesn't get a mention on the installation 
> documentation of matplotlib or many other python packs.
>
> I would love to hear anyone's thoughts on this matter.
>
> Many Thanks,
>
> Mat
> -- 
> Dr. Mathew Topper
> Institute for Energy Systems
> School of Engineering
> The University of Edinburgh
> Faraday Building
> The King's Buildings
> Edinburgh EH9 3JL
> Tel: +44 (0)131 650 5570
> School fax: +44 (0)131 650 6554
> mat...@ed... <mailto:mat...@ed...>
> http://www.see.ed.ac.uk <http://www.see.ed.ac.uk/>
>
>
> The University of Edinburgh is a charitable body, registered in
> Scotland, with registration number SC005336.
>
>
> ------------------------------------------------------------------------------
> Monitor your physical, virtual and cloud infrastructure from a single
> web console. Get in-depth insight into apps, servers, databases, vmware,
> SAP, cloud infrastructure, etc. Download 30-day Free Trial.
> Pricing starts from 795ドル for 25 servers or applications!
> http://p.sf.net/sfu/zoho_dev2dev_nov
>
>
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
From: Mathew T. <mat...@ed...> - 2012年11月16日 10:54:30
The University of Edinburgh is a charitable body, registered in
Scotland, with registration number SC005336.
From: Paul I. <piv...@gm...> - 2012年11月16日 03:29:46
On Thu, Nov 15, 2012 at 3:24 PM, David Brunell <qua...@gm...> wrote:
> Hello Paul,
>
> Thanks so much for your carefully-crafted reply. I had a hunch that it
> would not be a simple matter. I'm using wxAgg for the backend.
>
> I ended up using a Matplotlib widget cursor like this:
> cursor = Cursor(ax, useblit=True, color='red', alpha = 0.5, linestyle =
> '-', linewidth=1)
>
> It does not do exactly what I want, but it's cleaner than hacking into the
> backend.
>
This is, of course, a perfectly legitimate solution, so I hope you don't
mind me forwarding the correspondence to the list for posterity.
> Again, thanks for your help.
>
Happy to be helpful,
-- 
Paul Ivanov
314 address only used for lists, off-list direct email at:
http://pirsquared.org | GPG/PGP key id: 0x0F3E28F7

Showing 11 results of 11

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.
Thanks for helping keep SourceForge clean.
X





Briefly describe the problem (required):
Upload screenshot of ad (required):
Select a file, or drag & drop file here.
Screenshot instructions:

Click URL instructions:
Right-click on the ad, choose "Copy Link", then paste here →
(This may not be possible with some types of ads)

More information about our ad policies

Ad destination/click URL:

AltStyle によって変換されたページ (->オリジナル) /