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

Showing results of 141

<< < 1 2 3 4 5 6 > >> (Page 3 of 6)
From: gaspra <ye...@gm...> - 2013年05月21日 17:20:26
Michael Droettboom-3 wrote
> I have opened an issue (with a fix) here:
> 
> https://github.com/matplotlib/matplotlib/pull/2036
Awesome, this solved the problem I encountered. 
Many thanks,
Yuan
--
View this message in context: http://matplotlib.1069221.n5.nabble.com/missing-ticks-on-inverted-log-axis-tp41063p41099.html
Sent from the matplotlib - users mailing list archive at Nabble.com.
From: Michael D. <md...@st...> - 2013年05月21日 14:22:15
I have opened an issue (with a fix) here:
https://github.com/matplotlib/matplotlib/pull/2036
Gregorio: Could you please confirm that the patch there addresses your 
original problem?
Mike
On 05/21/2013 08:54 AM, Michael Droettboom wrote:
> On 05/20/2013 06:42 PM, gaspra wrote:
>> Michael Droettboom-3 wrote
>>> I have created https://github.com/matplotlib/matplotlib/issues/2025 to
>>> track this.
>> Hi Michael, thanks. I am somewhat convinced the problem is related to
>> matplotlib 1.3.x, not the Tk library. I tried on Linux that uses Tk8.5 and I
>> got the missing ticks for inverted log axes as well. So the TkAgg backend
>> only works properly with matplotlib 1.2.0.
>>
>> I further tested macports python, matplotlib 1.3.x and system Tk 8.5 on Mac.
>> I did so by uninstalling macports version of Tk/Tcl (8.6). The ticks are
>> also missing.
>>
>> Additional test on gtkagg backend shows the same thing: matplotlib 1.2.0
>> works perfectly fine with gtkagg, while matplotlib 1.3.x has the missing
>> ticks.
>>
>> Probably you have a better sense on what is going on?
>>
> The issue I filed was related to the build problem you reported -- that
> building matplotlib with a MacPorts python is trying to use the system
> (framework) Tcl/Tk. That's completely independent of the other problem
> related to ticks, which should not be affected by the backend at all.
> In my quick skimming of this thread, I thought that that issue was
> resolved, but apparently not. I'll look into that further and file a
> separate issue for that if need be.
>
> Mike
>
> ------------------------------------------------------------------------------
> Try New Relic Now & We'll Send You this Cool Shirt
> New Relic is the only SaaS-based application performance monitoring service
> that delivers powerful full stack analytics. Optimize and monitor your
> browser, app, & servers with just a few lines of code. Try New Relic
> and get this awesome Nerd Life shirt! http://p.sf.net/sfu/newrelic_d2d_may
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
From: Michael D. <md...@st...> - 2013年05月21日 12:54:54
On 05/20/2013 06:42 PM, gaspra wrote:
> Michael Droettboom-3 wrote
>> I have created https://github.com/matplotlib/matplotlib/issues/2025 to
>> track this.
> Hi Michael, thanks. I am somewhat convinced the problem is related to
> matplotlib 1.3.x, not the Tk library. I tried on Linux that uses Tk8.5 and I
> got the missing ticks for inverted log axes as well. So the TkAgg backend
> only works properly with matplotlib 1.2.0.
>
> I further tested macports python, matplotlib 1.3.x and system Tk 8.5 on Mac.
> I did so by uninstalling macports version of Tk/Tcl (8.6). The ticks are
> also missing.
>
> Additional test on gtkagg backend shows the same thing: matplotlib 1.2.0
> works perfectly fine with gtkagg, while matplotlib 1.3.x has the missing
> ticks.
>
> Probably you have a better sense on what is going on?
>
The issue I filed was related to the build problem you reported -- that 
building matplotlib with a MacPorts python is trying to use the system 
(framework) Tcl/Tk. That's completely independent of the other problem 
related to ticks, which should not be affected by the backend at all. 
In my quick skimming of this thread, I thought that that issue was 
resolved, but apparently not. I'll look into that further and file a 
separate issue for that if need be.
Mike
From: Gregorio B. <gre...@gm...> - 2013年05月21日 08:47:00
Thanks, I opened an issue for it:
https://github.com/matplotlib/matplotlib/issues/2035
2013年5月17日 Sterling Smith <sm...@fu...>:
> Gregorio,
>
> I'm glad that helped. I have not reported it on the issue tracker, but your case certainly has more of a bug with it (where it works sometimes, but not always), so I would recommend it.
>
> -Sterling
>
> On May 17, 2013, at 2:10AM, Gregorio Bastardo wrote:
>
>> Hi Sterling,
>>
>> Thanks for the hint, using "line._legmarker" attribute solved the problem.
>>
>> I see the reason behind, however I still consider this as an incorrect
>> behaviour, since marker toggling works in case the line is originally
>> added to the legend without marker (so legend line and marker do not
>> behave like separated). Is it worth reporting on the mpl issue tracker
>> (or have you done it that time)?
>>
>> Gregorio
>>
>> 2013年5月16日 Sterling Smith <sm...@fu...>:
>>> Gregorio,
>>>
>>> I experienced a similar issue with trying to change the marker color.
>>>
>>> See below the previous response from JJ for accessing the legend marker or using a proxy artist.
>>>
>>> -Sterling
>>>
>
From: gaspra <ye...@gm...> - 2013年05月20日 22:42:50
Michael Droettboom-3 wrote
> I have created https://github.com/matplotlib/matplotlib/issues/2025 to 
> track this.
Hi Michael, thanks. I am somewhat convinced the problem is related to
matplotlib 1.3.x, not the Tk library. I tried on Linux that uses Tk8.5 and I
got the missing ticks for inverted log axes as well. So the TkAgg backend
only works properly with matplotlib 1.2.0.
I further tested macports python, matplotlib 1.3.x and system Tk 8.5 on Mac.
I did so by uninstalling macports version of Tk/Tcl (8.6). The ticks are
also missing. 
Additional test on gtkagg backend shows the same thing: matplotlib 1.2.0
works perfectly fine with gtkagg, while matplotlib 1.3.x has the missing
ticks. 
Probably you have a better sense on what is going on? 
--
View this message in context: http://matplotlib.1069221.n5.nabble.com/missing-ticks-on-inverted-log-axis-tp41063p41095.html
Sent from the matplotlib - users mailing list archive at Nabble.com.
From: Jim St.C. <jim...@gm...> - 2013年05月20日 17:27:26
I'm using Basemap to display the East Coast of the US and the Atlantic Ocean. 
Shapefile is used to read a shapefile the contents of which is loaded into a 
PyPlot subplot hosted Line Collection which overlays the ocean with a series of 
closed polygons. PyPlot text is used to label each polygon with it's designator.
I have two questions both of which involve the polygons I'm loading from the 
shapefile.
1.) In order to simplify polygon\shoreline intersections the sides of the 
polygons were brought onto shore to close the polygon. How do I make these 
lines not show up on the land portion of the basemap? I tried zorder but it 
didn't seem to make a difference.
2.) Is there a way to color fill the polygons being created in the LineCollection?
Thank you for the assist. PNG available by PM if needed.
Jim
import shapefile
import matplotlib as mpl
import matplotlib.pyplot as plt
from matplotlib.collections import LineCollection
from matplotlib import cm
from mpl_toolkits.basemap import Basemap
fig = plt.figure(figsize=(11.7,8.3))
#Custom adjust of the subplots
plt.subplots_adjust(left=0.05,right=0.95,top=0.90,bottom=0.05,wspace=0.15,hspace=0.05)
ax = plt.subplot(111)
#Let's create a basemap of the Northeast Region
x1 = -78.
x2 = -64.
y1 = 34.
y2 = 46.
m = Basemap(resolution='i',projection='merc', 
llcrnrlat=y1,urcrnrlat=y2,llcrnrlon=x1,urcrnrlon=x2,lat_ts=(x1+x2)/2)
m.drawcountries(linewidth=0.5,zorder = 10)
m.drawcoastlines(linewidth=0.5,zorder = 11)
m.drawstates(linewidth=0.5,zorder = 12)
##m.drawrivers(linewidth=0.5)
m.fillcontinents(color='coral')
sf = 
shapefile.Reader("c:\\temp\\US_Stat_Areas_no_Coastline\\US_Stat_Areas_no_Coastline")
shapeRecs = sf.shapeRecords()
centroids = []
for area in shapeRecs:
 shpsegs = []
 shpinfo = []
 points = []
 stat_area = area.record[0]
 if int(stat_area) > 700:
 continue
 else:
 if int(stat_area) <= 463:
 continue
 else:
 pass
 print "Processing Stat Area: %s" % stat_area
 vertices = area.shape.points
 lons = []
 lats = []
 for each_vertice in vertices:
 lons.append(each_vertice[0])
 lats.append(each_vertice[1])
 x, y = m(lons, lats)
 shpsegs.append(zip(x,y))
 shpseg = zip(x,y)
 for point in shpseg:
 points.append(Point(point[0],point[1]))
 lines = LineCollection(shpsegs,antialiaseds=(1,),zorder = 5)
 lines.set_edgecolors('k')
 lines.set_linewidth(0.3)
 ax.add_collection(lines)
plt.savefig('test_plot.png',dpi=300)
From: Martin M. <mmo...@fo...> - 2013年05月20日 16:42:45
Attachments: foobar.png
Hi Ben,
Benjamin Root wrote:
> 
> 
> 
> On Mon, May 20, 2013 at 12:02 PM, Martin Mokrejs <mmo...@fo... <mailto:mmo...@fo...>> wrote:
> 
> Hi,
> I am having trouble to get space allocated for a long legend text,
> lets say spanning 2/3 - 3/4 of the whole output. I would like to have
> stacked barchart as 1st subplot and the place of remaining 3 subplots
> to be actually allocated by the legend. Alternatively, could I get the
> legend saved into a separate figure?
> 
> Or could the space for legend text be allocated automatically minimizing
> output figure size? For example, the width would be 1120px while height
> be multiples of 840px (840 for each subplot)?
> 
> Attached is a quick example. It shows also that I tried tight_layout()
> but wasn't successful with this either. I would be glad for some help,
> ideally converting the whole thing into an object-oriented approach.
> I am generating several figures in a row and would like to clear()/del()
> any previously used data ASAP.
> 
> 
> Thank you,
> Martin
> Am using mpl-1.2.2
> 
> 
> Try "fig.savefig('foobar.png', bbox_inches='tight')" when saving the
> image. It will make the figure size such that all the visible
> elements of the figure will fit into the saved output. tight_layout()
> is meant to make sure the elements don't overlap each other, but does
> nothing about making sure nothing gets clipped.
Ah, would be nice to make this clear in the docs. So far was doing
import pylab
F = pylab.gcf()
F.set_tight_layout(True)
which as you say does not help the way I thought.
Unfortunately, while
fig.savefig('foobar.png', bbox_inches='tight')
helped to get everything into the .png file (attached), the barchart itself
should span according to the code I posted just 1/2 of the figure. But somehow
it is enlarged and rescaled so that it occupies *more than* 1/2 of the figure.
What in pylab is resizing my image? Note: the final image is 625x1075.
Martin
From: Benjamin R. <ben...@ou...> - 2013年05月20日 16:27:02
On Mon, May 20, 2013 at 12:02 PM, Martin Mokrejs <
mmo...@fo...> wrote:
> Hi,
> I am having trouble to get space allocated for a long legend text,
> lets say spanning 2/3 - 3/4 of the whole output. I would like to have
> stacked barchart as 1st subplot and the place of remaining 3 subplots
> to be actually allocated by the legend. Alternatively, could I get the
> legend saved into a separate figure?
>
> Or could the space for legend text be allocated automatically minimizing
> output figure size? For example, the width would be 1120px while height
> be multiples of 840px (840 for each subplot)?
>
> Attached is a quick example. It shows also that I tried tight_layout()
> but wasn't successful with this either. I would be glad for some help,
> ideally converting the whole thing into an object-oriented approach.
> I am generating several figures in a row and would like to clear()/del()
> any previously used data ASAP.
>
>
> Thank you,
> Martin
> Am using mpl-1.2.2
>
>
Try "fig.savefig('foobar.png', bbox_inches='tight')" when saving the
image. It will make the figure size such that all the visible elements of
the figure will fit into the saved output. tight_layout() is meant to make
sure the elements don't overlap each other, but does nothing about making
sure nothing gets clipped.
Cheers!
Ben Root
Hi,
 I am having trouble to get space allocated for a long legend text,
lets say spanning 2/3 - 3/4 of the whole output. I would like to have
stacked barchart as 1st subplot and the place of remaining 3 subplots
to be actually allocated by the legend. Alternatively, could I get the
legend saved into a separate figure?
Or could the space for legend text be allocated automatically minimizing
output figure size? For example, the width would be 1120px while height
be multiples of 840px (840 for each subplot)?
 Attached is a quick example. It shows also that I tried tight_layout()
but wasn't successful with this either. I would be glad for some help,
ideally converting the whole thing into an object-oriented approach.
I am generating several figures in a row and would like to clear()/del()
any previously used data ASAP.
Thank you,
Martin
Am using mpl-1.2.2
From: Michael D. <md...@st...> - 2013年05月20日 13:28:44
I have created https://github.com/matplotlib/matplotlib/issues/2025 to 
track this.
On 05/19/2013 05:18 PM, gaspra wrote:
> Michael Droettboom-3 wrote
>> If you use the macports version of Python, this shouldn't be a problem.
>> I think the problem is (perhaps) that you're trying to use the system
>> Python with packages from MacPorts?
> Yes, I can confirm the system Python doesn't work with TkAgg and
> matplotlib 1.3.x. The problem with matplotlib 1.3.x and Macports Python
> is that the Tk/Tcl library used in setupext.py is hardwired to system Tk/Tcl
> for Mac platform. Here is the piece of code from setupext.py:
>
> elif sys.platform == 'darwin':
> # this config section lifted directly from Imaging - thanks to
> # the effbot!
>
> # First test for a MacOSX/darwin framework install
> from os.path import join, exists
> framework_dirs = [
> join(os.getenv('HOME'), '/Library/Frameworks'),
> '/Library/Frameworks',
> '/System/Library/Frameworks/',
> ]
>
> Therefore matplotlib 1.3.x is compiled with system Tk/Tcl regardless which
> python is used (macports or system). I have tried to hardwire the macports
> Tk dynamic library but there are errors when importing matplotlib in python.
> It would be great if the devs can modify the setupext.py to use macports
> Tk/Tcl
> libraries properly, e.g., enabling a choice for using system or macports
> Tk/Tcl
> libraries.
>
>
> Michael Droettboom-3 wrote
>>> I really need the "tri" package in matplotlib 1.3.x. Is there anyway I
>>> can
>>> manually replace the "tri" package in matplotlib 1.2.0 (installed by
>>> macports) with the one in matplotlib 1.3.x (downloaded from the latest
>>> master in github repository?
>> Possible, but probably not straightforward. I would try to tackle the
>> environmental problem above first.
> I guess I will just modify the codes in "tri" package so I can use them as
> standalone modules.
>
> Thanks.
> Yuan
>
>
>
>
> --
> View this message in context: http://matplotlib.1069221.n5.nabble.com/missing-ticks-on-inverted-log-axis-tp41063p41086.html
> Sent from the matplotlib - users mailing list archive at Nabble.com.
>
> ------------------------------------------------------------------------------
> AlienVault Unified Security Management (USM) platform delivers complete
> security visibility with the essential security capabilities. Easily and
> efficiently configure, manage, and operate all of your security controls
> from a single console and one unified framework. Download a free trial.
> http://p.sf.net/sfu/alienvault_d2d
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
From: gaspra <ye...@gm...> - 2013年05月19日 21:18:59
Michael Droettboom-3 wrote
> If you use the macports version of Python, this shouldn't be a problem. 
> I think the problem is (perhaps) that you're trying to use the system 
> Python with packages from MacPorts?
Yes, I can confirm the system Python doesn't work with TkAgg and 
matplotlib 1.3.x. The problem with matplotlib 1.3.x and Macports Python 
is that the Tk/Tcl library used in setupext.py is hardwired to system Tk/Tcl 
for Mac platform. Here is the piece of code from setupext.py:
elif sys.platform == 'darwin':
 # this config section lifted directly from Imaging - thanks to
 # the effbot!
 # First test for a MacOSX/darwin framework install
 from os.path import join, exists
 framework_dirs = [
 join(os.getenv('HOME'), '/Library/Frameworks'),
 '/Library/Frameworks',
 '/System/Library/Frameworks/',
 ]
Therefore matplotlib 1.3.x is compiled with system Tk/Tcl regardless which 
python is used (macports or system). I have tried to hardwire the macports 
Tk dynamic library but there are errors when importing matplotlib in python.
It would be great if the devs can modify the setupext.py to use macports
Tk/Tcl 
libraries properly, e.g., enabling a choice for using system or macports
Tk/Tcl 
libraries.
Michael Droettboom-3 wrote
>>
>> I really need the "tri" package in matplotlib 1.3.x. Is there anyway I
>> can
>> manually replace the "tri" package in matplotlib 1.2.0 (installed by
>> macports) with the one in matplotlib 1.3.x (downloaded from the latest
>> master in github repository?
> 
> Possible, but probably not straightforward. I would try to tackle the 
> environmental problem above first.
I guess I will just modify the codes in "tri" package so I can use them as 
standalone modules.
Thanks.
Yuan 
--
View this message in context: http://matplotlib.1069221.n5.nabble.com/missing-ticks-on-inverted-log-axis-tp41063p41086.html
Sent from the matplotlib - users mailing list archive at Nabble.com.
From: Michael D. <md...@st...> - 2013年05月18日 15:35:42
On 05/18/2013 04:17 AM, gaspra wrote:
> I find the issue came from the matplotlib backend. The problem is gone when
> using TkAgg backend. However, TkAgg doesn't work with matplotlib 1.3.x,
> which has some conflict of Tk dynamic library due to different Tk version,
> i.e., macports uses Tk8.6 and Mac OSX 10.8.3 uses Tk8.5.
If you use the macports version of Python, this shouldn't be a problem. 
I think the problem is (perhaps) that you're trying to use the system 
Python with packages from MacPorts?
>
> I really need the "tri" package in matplotlib 1.3.x. Is there anyway I can
> manually replace the "tri" package in matplotlib 1.2.0 (installed by
> macports) with the one in matplotlib 1.3.x (downloaded from the latest
> master in github repository?
Possible, but probably not straightforward. I would try to tackle the 
environmental problem above first.
Mike
>
> Thanks.
>
>
>
>
>
> --
> View this message in context: http://matplotlib.1069221.n5.nabble.com/missing-ticks-on-inverted-log-axis-tp41063p41084.html
> Sent from the matplotlib - users mailing list archive at Nabble.com.
>
> ------------------------------------------------------------------------------
> AlienVault Unified Security Management (USM) platform delivers complete
> security visibility with the essential security capabilities. Easily and
> efficiently configure, manage, and operate all of your security controls
> from a single console and one unified framework. Download a free trial.
> http://p.sf.net/sfu/alienvault_d2d
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
From: gaspra <ye...@gm...> - 2013年05月18日 08:17:26
I find the issue came from the matplotlib backend. The problem is gone when
using TkAgg backend. However, TkAgg doesn't work with matplotlib 1.3.x,
which has some conflict of Tk dynamic library due to different Tk version,
i.e., macports uses Tk8.6 and Mac OSX 10.8.3 uses Tk8.5. 
I really need the "tri" package in matplotlib 1.3.x. Is there anyway I can
manually replace the "tri" package in matplotlib 1.2.0 (installed by
macports) with the one in matplotlib 1.3.x (downloaded from the latest
master in github repository? 
Thanks.
--
View this message in context: http://matplotlib.1069221.n5.nabble.com/missing-ticks-on-inverted-log-axis-tp41063p41084.html
Sent from the matplotlib - users mailing list archive at Nabble.com.
From: Mark B. <mar...@gm...> - 2013年05月18日 05:26:32
I am trying to draw plasmid maps in matplotlib. This requires drawing
arrows with a circular curvature (see here for example
http://www.encyclon.net/docs/plasmidmap/images/ex6.gif). However, when I
try to curve the arrows, for instance using this example (
http://matplotlib.org/api/artist_api.html#matplotlib.patches.ArrowStyle), I
can only get parabolic type curves, not circular curves. Can someone who
understands this a little better help me out with a simple example?
Thanks,
Mark
From: Florian M. W. <wag...@st...> - 2013年05月17日 21:32:22
Dear matplotlib users,
is it possible to pick an individual artist (Polygon) within a 
PolyCollection?
Cheers, Florian
From: Matthias F. <mat...@gm...> - 2013年05月17日 15:59:45
Thanks for the comment, Jonathan.
Yeah, I did not expect aspect='equal' to work but I tried it anyway ;-)
Removing the extent argument indeed produces a very nice output but I have
not tried yet to also get the tick labels right. Instead, I have now
reverted back to matplotlib.pylab's subplots method and an extra axes for
the colorbar (see code below just in case somebody else can use that). With
some fiddling with spacing it looks ok now. It's just a mess to produce
differently sized figures but I probably won't need to do that.
Best, Matthias
<http://matplotlib.1069221.n5.nabble.com/file/n41080/2imshow%2B1colorbar.png> 
###########################################################
import numpy as np
import numpy.random as npr
from scipy.interpolate import griddata
import matplotlib.pyplot as plt
fig, axes = plt.subplots(nrows=1, ncols=2, figsize=[12,5])
for ax in axes:
 xmin, xmax = 0., 1.
 ymin, ymax = 0., 0.5
 zmin, zmax = -1., 1.
 
 # create random data:
 N = 100
 X = xmin + (xmax-xmin)*npr.random((N,)) # x_i in [0, 1]
 Y = ymin + (ymax-ymin)*npr.random((N,)) # y_i in [0, 0.5]
 Z = zmin + (zmax-zmin)*npr.random((N,)) # z_i in [-1, 1]
 
 # generate griddata for contour plot:
 numspaces = np.sqrt(N)
 xi = linspace(xmin, xmax, numspaces)
 yi = linspace(ymin, ymax, numspaces)
 zi = griddata((X, Y), Z, (xi[None,:], yi[:,None]), method='nearest')
 norm = matplotlib.colors.normalize(vmin=zmin, vmax=zmax)
 
 im = ax.imshow(zi,
 extent = [xmin,xmax,ymin,ymax], 
 norm = norm, 
 vmin = zmin,
 vmax = zmax, 
 origin = 'lower', 
 aspect = 2., 
 interpolation = 'nearest')
 
 ax.grid(False)
 ax.set_xlabel('x')
 ax.set_ylabel('y')
 
# add a colorbar:
fig.subplots_adjust(left=0.05, bottom=0.2, right=0.8, top=0.95, wspace=0.2,
hspace=0.2)
cbar_ax = fig.add_axes([0.85, 0.2, 0.03, 0.75])
fig.colorbar(im, cax=cbar_ax)
cbar_ax.set_ylabel('color level')
fig.subplots_adjust(left=0.05, bottom=0.2, right=0.8, top=0.95, wspace=0.2,
hspace=0.2)
##############################################################
--
View this message in context: http://matplotlib.1069221.n5.nabble.com/Squashed-axes-with-AxesGrid-tp40699p41080.html
Sent from the matplotlib - users mailing list archive at Nabble.com.
From: Sterling S. <sm...@fu...> - 2013年05月17日 15:30:38
Gregorio,
I'm glad that helped. I have not reported it on the issue tracker, but your case certainly has more of a bug with it (where it works sometimes, but not always), so I would recommend it. 
-Sterling
On May 17, 2013, at 2:10AM, Gregorio Bastardo wrote:
> Hi Sterling,
> 
> Thanks for the hint, using "line._legmarker" attribute solved the problem.
> 
> I see the reason behind, however I still consider this as an incorrect
> behaviour, since marker toggling works in case the line is originally
> added to the legend without marker (so legend line and marker do not
> behave like separated). Is it worth reporting on the mpl issue tracker
> (or have you done it that time)?
> 
> Gregorio
> 
> 2013年5月16日 Sterling Smith <sm...@fu...>:
>> Gregorio,
>> 
>> I experienced a similar issue with trying to change the marker color.
>> 
>> See below the previous response from JJ for accessing the legend marker or using a proxy artist.
>> 
>> -Sterling
>> 
From: Jonathan S. <js...@cf...> - 2013年05月17日 13:56:19
Matthias,
It's clear to me why apect='equal' doesn't work for you. That option
means to give the axes equal scaling -- i.e., the ratio of length in
axis units to length in the plot is the same for both axes, so that an
axis that goes from 0 to 1 will be twice as long as one that goes from 0
to 0.5. What is quite unclear to me is why aspect=2 should give a
result like it does. You can get the right image, though wrong tick
labeling, if you omit the extent argument to imshow.
Jon
On Thu, 2013年05月16日 at 12:43 -0700, Matthias Flor wrote:
> Hi all,
> 
> it seems that I am experiencing the same problem here with imshow (rather
> than scatter) and AxesGrid. But calling imshow with aspect=False does not do
> the trick for me.
> I am trying to have two imshow subplots next to each other and a single
> colorbar at the right. The data underlying the imshow's have different x-
> and y-ranges but I want the x- and y-axis to have an aspect ratio of 1 (i.e.
> each imshow should produce a square). I've tried aspect=False,
> aspect='equal', and explicitely setting aspect=2 which should be the correct
> value. See the three images below the code example.
> 
> I've also tried Grid instead of AxesGrid as suggested but I didn't manage to
> achieve good results with the colorbar in that case.
> 
> I'd appreciate any help,
> 
> Matthias
> 
> 
> 
> Here's a more or less minimal code example:
> #############################################
> import numpy as np
> import numpy.random as npr
> from scipy.interpolate import griddata
> import matplotlib.pyplot as plt
> from mpl_toolkits.axes_grid1 import AxesGrid
> 
> fig = figure(1, figsize=[12,10])
> 
> grid = AxesGrid(fig, 111,
> nrows_ncols = (1, 2),
> axes_pad = 0.2,
> share_all = False,
> label_mode = 'L',
> cbar_location = 'right',
> cbar_mode = 'single',
> cbar_pad = 0.2
> )
> 
> for i in range(2): 
> xmin, xmax = 0., 1.
> ymin, ymax = 0., 0.5
> zmin, zmax = -1., 1.
> 
> # generate random data:
> N = 100
> X = xmin + (xmax-xmin)*npr.random((N,)) # x_i in [0, 1]
> Y = ymin + (ymax-ymin)*npr.random((N,)) # y_i in [0, 0.5]
> Z = zmin + (zmax-zmin)*npr.random((N,)) # z_i in [-1, 1]
> 
> # generate griddata for imshow plot:
> numspaces = np.sqrt(N)
> xi = linspace(xmin, xmax, numspaces)
> yi = linspace(ymin, ymax, numspaces)
> zi = griddata((X, Y), Z, (xi[None,:], yi[:,None]), method='nearest')
> norm = matplotlib.colors.normalize(vmin=zmin, vmax=zmax)
> 
> ax = grid[i]
> im = ax.imshow(zi,
> extent = [xmin,xmax,ymin,ymax], 
> norm = norm, 
> vmin = zmin,
> vmax = zmax, 
> origin = 'lower', 
> aspect = 'equal', # or False, or 'auto', or 2, or ...
> interpolation = 'nearest')
> 
> ax.grid(False)
> ax.set_xlabel('x')
> ax.set_ylabel('y')
> 
> # add a colorbar:
> cbar = plt.colorbar(im, cax=grid.cbar_axes[0])
> cbar.ax.set_ylabel('color level')
> ############################################
> 
> And here are the three resulting images:
> 
> aspect='equal':
> <http://matplotlib.1069221.n5.nabble.com/file/n41075/equal.png> 
> 
> aspect=False:
> <http://matplotlib.1069221.n5.nabble.com/file/n41075/False.png> 
> 
> aspect=2.:
> <http://matplotlib.1069221.n5.nabble.com/file/n41075/two.png> 
> 
> 
> 
> --
> View this message in context: http://matplotlib.1069221.n5.nabble.com/Squashed-axes-with-AxesGrid-tp40699p41075.html
> Sent from the matplotlib - users mailing list archive at Nabble.com.
> 
> 
-- 
______________________________________________________________
Jonathan D. Slavin Harvard-Smithsonian CfA
js...@cf... 60 Garden Street, MS 83
phone: (617) 496-7981 Cambridge, MA 02138-1516
 cell: (781) 363-0035 USA
______________________________________________________________
From: Gregorio B. <gre...@gm...> - 2013年05月17日 09:10:38
Hi Sterling,
Thanks for the hint, using "line._legmarker" attribute solved the problem.
I see the reason behind, however I still consider this as an incorrect
behaviour, since marker toggling works in case the line is originally
added to the legend without marker (so legend line and marker do not
behave like separated). Is it worth reporting on the mpl issue tracker
(or have you done it that time)?
Gregorio
2013年5月16日 Sterling Smith <sm...@fu...>:
> Gregorio,
>
> I experienced a similar issue with trying to change the marker color.
>
> See below the previous response from JJ for accessing the legend marker or using a proxy artist.
>
> -Sterling
>
From: blueone <rar...@gm...> - 2013年05月16日 21:48:05
Thank you very much! This is exactly what i was looking for! 
--
View this message in context: http://matplotlib.1069221.n5.nabble.com/Matplotlib-gray-area-around-plot-tp41073p41076.html
Sent from the matplotlib - users mailing list archive at Nabble.com.
From: Matthias F. <mat...@gm...> - 2013年05月16日 19:43:32
Hi all,
it seems that I am experiencing the same problem here with imshow (rather
than scatter) and AxesGrid. But calling imshow with aspect=False does not do
the trick for me.
I am trying to have two imshow subplots next to each other and a single
colorbar at the right. The data underlying the imshow's have different x-
and y-ranges but I want the x- and y-axis to have an aspect ratio of 1 (i.e.
each imshow should produce a square). I've tried aspect=False,
aspect='equal', and explicitely setting aspect=2 which should be the correct
value. See the three images below the code example.
I've also tried Grid instead of AxesGrid as suggested but I didn't manage to
achieve good results with the colorbar in that case.
I'd appreciate any help,
Matthias
Here's a more or less minimal code example:
#############################################
import numpy as np
import numpy.random as npr
from scipy.interpolate import griddata
import matplotlib.pyplot as plt
from mpl_toolkits.axes_grid1 import AxesGrid
fig = figure(1, figsize=[12,10])
grid = AxesGrid(fig, 111,
 nrows_ncols = (1, 2),
 axes_pad = 0.2,
 share_all = False,
 label_mode = 'L',
 cbar_location = 'right',
 cbar_mode = 'single',
 cbar_pad = 0.2
)
for i in range(2): 
 xmin, xmax = 0., 1.
 ymin, ymax = 0., 0.5
 zmin, zmax = -1., 1.
 
 # generate random data:
 N = 100
 X = xmin + (xmax-xmin)*npr.random((N,)) # x_i in [0, 1]
 Y = ymin + (ymax-ymin)*npr.random((N,)) # y_i in [0, 0.5]
 Z = zmin + (zmax-zmin)*npr.random((N,)) # z_i in [-1, 1]
 
 # generate griddata for imshow plot:
 numspaces = np.sqrt(N)
 xi = linspace(xmin, xmax, numspaces)
 yi = linspace(ymin, ymax, numspaces)
 zi = griddata((X, Y), Z, (xi[None,:], yi[:,None]), method='nearest')
 norm = matplotlib.colors.normalize(vmin=zmin, vmax=zmax)
 
 ax = grid[i]
 im = ax.imshow(zi,
 extent = [xmin,xmax,ymin,ymax], 
 norm = norm, 
 vmin = zmin,
 vmax = zmax, 
 origin = 'lower', 
 aspect = 'equal', # or False, or 'auto', or 2, or ...
 interpolation = 'nearest')
 
 ax.grid(False)
 ax.set_xlabel('x')
 ax.set_ylabel('y')
 
# add a colorbar:
cbar = plt.colorbar(im, cax=grid.cbar_axes[0])
cbar.ax.set_ylabel('color level')
############################################
And here are the three resulting images:
aspect='equal':
<http://matplotlib.1069221.n5.nabble.com/file/n41075/equal.png> 
aspect=False:
<http://matplotlib.1069221.n5.nabble.com/file/n41075/False.png> 
aspect=2.:
<http://matplotlib.1069221.n5.nabble.com/file/n41075/two.png> 
--
View this message in context: http://matplotlib.1069221.n5.nabble.com/Squashed-axes-with-AxesGrid-tp40699p41075.html
Sent from the matplotlib - users mailing list archive at Nabble.com.
From: Benjamin R. <ben...@ou...> - 2013年05月16日 19:13:49
On Thu, May 16, 2013 at 2:41 PM, blueone <rar...@gm...> wrote:
> Hi,
>
> I am working on my first project involving Matplotlib. I haven't used it
> much, but i'm already impressed by it!
> The project i am working on uses Matplotlib embedded in wxPython. I have
> already embedded it successfully, but there is one thing that i would still
> like to change and that is the gray area around the plot. The background of
> the plot is white and around it there's this thick gray rectangle. Is there
> a way of making it smaller?
>
> Thanks in advance!
>
>
>
You can adjust the margins using subplots_adjust():
http://matplotlib.org/api/pyplot_api.html#matplotlib.pyplot.subplots_adjust
Cheers!
Ben Root
From: blueone <rar...@gm...> - 2013年05月16日 18:41:41
Hi,
I am working on my first project involving Matplotlib. I haven't used it
much, but i'm already impressed by it!
The project i am working on uses Matplotlib embedded in wxPython. I have
already embedded it successfully, but there is one thing that i would still
like to change and that is the gray area around the plot. The background of
the plot is white and around it there's this thick gray rectangle. Is there
a way of making it smaller?
Thanks in advance!
--
View this message in context: http://matplotlib.1069221.n5.nabble.com/Matplotlib-gray-area-around-plot-tp41073.html
Sent from the matplotlib - users mailing list archive at Nabble.com.
From: Sterling S. <sm...@fu...> - 2013年05月16日 16:45:28
Gregorio,
I experienced a similar issue with trying to change the marker color. 
See below the previous response from JJ for accessing the legend marker or using a proxy artist.
-Sterling
> On Sep 4, 2012, at 5:33PM, Jae-Joon Lee wrote:
> 
> On Wed, Sep 5, 2012 at 6:05 AM, Sterling Smith <sm...@fu...> wrote:
>> I still do not get black markers. Furthermore, if you try to make a new legend with the result of leg.get_lines(), you will get lines without markers, which leads me to the conclusion I stated in my previous email (which you did not copy)
>>>> I suspect that this is because the legend marker is drawn separately from the legend line to accommodate the numpoints argument of the legend functions. Then the question is how to access these markers if they are separate from the line2d objects in the legend. I didn't even see them in the children of the legend [legend.get_children()].
> 
> This is correct. To support legend handle like --o-- (i.e., no markers
> at the ends), lines and markers are drawn as a separate artist. You
> may use something like,
> 
> line[0]._legmarker.set_markerfacecolor('black')
> line[1]._legmarker.set_markerfacecolor('black')
> 
> I, personally, recommend you to use a proxy artist.
> 
> http://matplotlib.sourceforge.net/users/legend_guide.html#using-proxy-artist
> 
> For example,
> 
> You may do something like
> 
> import pylab
> pylab.plot(pylab.linspace(0,1,100),marker='o',ls='')
> pylab.plot(pylab.linspace(0,1,100),marker='o',ls='-')
> 
> # creates artists for legend purpose only
> l1, = pylab.plot(pylab.linspace(0,1,100), 'ko-')
> l2, = pylab.plot(pylab.linspace(0,1,100), 'ko')
> # remove them from the axes.
> l1.remove()
> l2.remove()
> 
> leg=pylab.legend([l1, l2], ["Test 1", "Test 2"], loc='best')
> 
> Regards,
> 
> -JJ
On May 16, 2013, at 7:25AM, Gregorio Bastardo wrote:
> Hi,
> 
> I've recently come accross an issue when working on an interactive
> marker toggling callback. The problem is illustrated below:
> 
> import matplotlib.pyplot as plt
> fig = plt.figure()
> ax = fig.add_subplot(111)
> line, = ax.plot(range(10), range(10))
> # uncomment next line to reproduce bug
> # line.set_marker('d')
> legend = ax.legend([line], ['foo'])
> legend_line, = legend.get_lines()
> fig.show()
> raw_input('press enter to clear marker')
> line.set_marker('')
> legend_line.set_marker('')
> fig.canvas.draw()
> raw_input('press enter to set marker')
> line.set_marker('d')
> legend_line.set_marker('d')
> fig.canvas.draw()
> raw_input('press enter to exit')
> 
> So when I add a line object to the legend *without marker*, the update
> works fine both on data and legend line, but *with marker* it does not
> refresh the legend line. I consider it as a bug, please tell me if I'm
> doing something wrong.
> 
> python 2.7.4 win32
> matplotlib 1.2.1
> 
> Thanks,
> Gregorio
> 
> ------------------------------------------------------------------------------
> AlienVault Unified Security Management (USM) platform delivers complete
> security visibility with the essential security capabilities. Easily and
> efficiently configure, manage, and operate all of your security controls
> from a single console and one unified framework. Download a free trial.
> http://p.sf.net/sfu/alienvault_d2d
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
From: Gregorio B. <gre...@gm...> - 2013年05月16日 14:25:54
Hi,
I've recently come accross an issue when working on an interactive
marker toggling callback. The problem is illustrated below:
import matplotlib.pyplot as plt
fig = plt.figure()
ax = fig.add_subplot(111)
line, = ax.plot(range(10), range(10))
# uncomment next line to reproduce bug
# line.set_marker('d')
legend = ax.legend([line], ['foo'])
legend_line, = legend.get_lines()
fig.show()
raw_input('press enter to clear marker')
line.set_marker('')
legend_line.set_marker('')
fig.canvas.draw()
raw_input('press enter to set marker')
line.set_marker('d')
legend_line.set_marker('d')
fig.canvas.draw()
raw_input('press enter to exit')
So when I add a line object to the legend *without marker*, the update
works fine both on data and legend line, but *with marker* it does not
refresh the legend line. I consider it as a bug, please tell me if I'm
doing something wrong.
python 2.7.4 win32
matplotlib 1.2.1
Thanks,
Gregorio
1 message has been excluded from this view by a project administrator.

Showing results of 141

<< < 1 2 3 4 5 6 > >> (Page 3 of 6)
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 によって変換されたページ (->オリジナル) /