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 6 results of 6

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

Showing 6 results 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 によって変換されたページ (->オリジナル) /