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



Showing 14 results of 14

From: Steven B. <bo...@ph...> - 2011年11月09日 21:45:36
Hi List,
I cannot save a semilog (x axis) scatter plot as a postscript file. I 
have tried as many backends as I can think of. I can save PNG fine, just 
not a PDF or a PS.
Here is some sample code that doesn't work. I did this test in ipython, 
so no imports or anything like that.
figure()
subplot(111)
x = randn(1000)
y = randn(1000)
scatter(x,y)
xscale('log')
Then save the ps. I just used the interactive window to save it. Try to 
open the ps and it fails.
Next I tried
figure()
semilogx()
scatter(x,y)
Still no dice...
System specs:
Ubuntu 11.04
matplotlib 1.1.0
backend GTKagg
Thanks list.
Steven
From: Russell E. O. <ro...@uw...> - 2011年11月09日 19:23:12
In article <629...@pi...>,
 Bedartha Goswami <go...@pi...> 
 wrote:
> Hi,
> 
> I have recently installed Python 32/64bit from Python.org and then I 
> proceeded to install bumpy, scipy, matplotlib and igraph on it. But the 
> Matplotlib does not show the plots even if it opens a Figure window. Here is 
> a summary of what I had done in my installation:
> -----
> I first did a "clean install" by following the instructions at (with an idea 
> to reinstall Matplotlib and see if the rror repeats):
> http://matplotlib.sourceforge.net/faq/installing_faq.html#clean-install
> -----
> So now my python does not have matplotlib:
> 
> Bedarthas-MacBook-Air:~ bedartha$ cd ~/Desktop/
> Bedarthas-MacBook-Air:Desktop bedartha$ python
> Python 2.7.2 (v2.7.2:8527427914a2, Jun 11 2011, 15:22:34) 
> [GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
> Type "help", "copyright", "credits" or "license" for more information.
> >>> import matplotlib
> Traceback (most recent call last):
> File "<stdin>", line 1, in <module>
> ImportError: No module named matplotlib
> >>> 
> Bedarthas-MacBook-Air:Desktop bedartha$
> -----
> Then I downloaded (again) the DMG file at: 
> http://sourceforge.net/projects/matplotlib/files/matplotlib/matplotlib-1.1.0/m
> atplotlib-1.1.0-py2.7-python.org-macosx10.3.dmg/download
> -----
> and installed Matplotlib (which seems to go through fine). But after that:
> 
> Bedarthas-MacBook-Air:~ bedartha$ cd ~/Desktop/
> Bedarthas-MacBook-Air:Desktop bedartha$ python
> Python 2.7.2 (v2.7.2:8527427914a2, Jun 11 2011, 15:22:34) 
> [GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
I suspect you are trying to install matplotlib on the 64-bit Python 
instead of the 32-bit python for which it was built
I say this because 32-bit python is built using GCC 4.0.1.
There is no matplotlib binary for 64-bit Python yet because I've not 
figured out how to build one successfully -- I get horrible conflicts 
with Tcl/Tk.
-- Russell
From: Benjamin R. <ben...@ou...> - 2011年11月09日 16:53:53
On Tue, Nov 8, 2011 at 11:15 AM, Bedartha Goswami <go...@pi...>wrote:
> Hi,
>
> I have recently installed Python 32/64bit from Python.org and then I
> proceeded to install bumpy, scipy, matplotlib and igraph on it. But the
> Matplotlib does not show the plots even if it opens a Figure window. Here
> is a summary of what I had done in my installation:
> -----
> I first did a "clean install" by following the instructions at (with an
> idea to reinstall Matplotlib and see if the rror repeats):
> http://matplotlib.sourceforge.net/faq/installing_faq.html#clean-install
> -----
> So now my python does not have matplotlib:
>
> Bedarthas-MacBook-Air:~ bedartha$ cd ~/Desktop/
> Bedarthas-MacBook-Air:Desktop bedartha$ python
> Python 2.7.2 (v2.7.2:8527427914a2, Jun 11 2011, 15:22:34)
> [GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
> Type "help", "copyright", "credits" or "license" for more information.
> >>> import matplotlib
> Traceback (most recent call last):
> File "<stdin>", line 1, in <module>
> ImportError: No module named matplotlib
> >>>
> Bedarthas-MacBook-Air:Desktop bedartha$
> -----
> Then I downloaded (again) the DMG file at:
>
> http://sourceforge.net/projects/matplotlib/files/matplotlib/matplotlib-1.1.0/matplotlib-1.1.0-py2.7-python.org-macosx10.3.dmg/download
> -----
> and installed Matplotlib (which seems to go through fine). But after that:
>
> Bedarthas-MacBook-Air:~ bedartha$ cd ~/Desktop/
> Bedarthas-MacBook-Air:Desktop bedartha$ python
> Python 2.7.2 (v2.7.2:8527427914a2, Jun 11 2011, 15:22:34)
> [GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
> Type "help", "copyright", "credits" or "license" for more information.
> >>> import matplotlib as mpl
> >>> from pylab import *
> >>> plot([1,2,3])
> [<matplotlib.lines.Line2D object at 0x2f87fb0>]
> >>> show()
> Exception in Tkinter callback
> Traceback (most recent call last):
> File
> "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-tk/Tkinter.py",
> line 1410, in __call__
> return self.func(*args)
> File
> "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/backends/backend_tkagg.py",
> line 236, in resize
> self.show()
> File
> "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/backends/backend_tkagg.py",
> line 240, in draw
> tkagg.blit(self._tkphoto, self.renderer._renderer, colormode=2)
> File
> "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/backends/tkagg.py",
> line 19, in blit
> tk.call("PyAggImagePhoto", photoimage, id(aggimage), colormode,
> id(bbox_array))
> TclError
> >>>
> Bedarthas-MacBook-Air:Desktop bedartha$
> -----
> Here is the essential info about my machine and my Python and Matplotlib
> versions:
>
> Bedarthas-MacBook-Air:~ bedartha$ uname -a
> Darwin Bedarthas-MacBook-Air.local 11.0.1 Darwin Kernel Version 11.0.1:
> Wed Jun 29 19:53:22 PDT 2011; root:xnu-1699232~1/RELEASE_X86_64 x86_64
> -----
> Bedarthas-MacBook-Air:Desktop bedartha$ python
> Python 2.7.2 (v2.7.2:8527427914a2, Jun 11 2011, 15:22:34)
> [GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
> Type "help", "copyright", "credits" or "license" for more information.
> >>> import matplotlib as mpl
> >>> mpl.__version__
> '1.1.0'
> >>>
> Bedarthas-MacBook-Air:Desktop bedartha$
> -----
> I also have the following alias (in ~/.bash_profile) for my Python2.7 (to
> deal with some issues in igraph):
>
> alias python="arch -i386 python"
> -----
>
> Can anyone please help me out?
>
> Best regards,
> and apologies for the lengthy post,
>
> Bedartha
>
>
As a test, try to set your backend to either 'cocoaagg' or 'macosx' like so:
import matplotlib as mpl
mpl.use('cocoaagg')
There have been issues with TkAgg on macs. I have personally not had any
success with it (even with ActiveState's Tcl).
Ben Root
From: Joe K. <jki...@wi...> - 2011年11月09日 16:32:53
On Wed, Nov 9, 2011 at 10:20 AM, Howard <ho...@re...> wrote:
> On 11/9/11 11:13 AM, Joe Kington wrote:
>
> On Wed, Nov 9, 2011 at 10:07 AM, Howard <ho...@re...> wrote:
>
>> Hi all
>>
>> I'm a new user to matplotlib, and I'm having a little difficulty with
>> something I feel must be basic. When I plot our data, I'm using a canvas
>> that is 4"x4" at 128 DPI and saving the canvas as a png. Here's the basics
>> of the code:
>>
>> imageWidth = 4
>> imageHeight = 4
>> DPI = 128
>>
>> figure1 = plt.figure(figsize=(imageWidth,imageHeight))
>> plt.axis("off")
>> plt.tricontourf(theTriangulation,
>> modelData,
>> theLookupTable.N,
>> cmap=theLookupTable)
>> canvas = FigureCanvasAgg(figure1)
>> canvas.print_figure(prefix + ".png", dpi=DPI)
>>
>> The png is 512x512 as I would expect, but the contoured image doesn't
>> fill the whole image. How do I tell the library to map the plotted are to
>> the entire canvas and not leave a border around the rendered image?
>>
>
> You need to make an axis that fills up the entire figure.
>
> By default, axes don't fill up the entire figure to leave room for tick
> labels, axis lables, titles, etc.
>
> Try something like:
>
> import matplotlib as plt
>
> dpi = 128
> fig = plt.figure(figsize=(4,4))
>
> # Specifies an axis at 0, 0 with a width and height of 1 (the full width
> of the figure)
> ax = fig.add_axes([0,0,1,1])
>
> ax.tricontourf(...)
>
> fig.savefig('output.png', dpi=dpi)
>
> Hope that helps,
> -Joe
>
> Hi Joe
>
> That did it! Thanks much. Can I also turn off the tick marks on the new
> axis?
>
>
Sure! If you want an exact duplicate of your original code snippet, just
add an:
ax.axis('off')
or one of the many equivalent ways of hiding the entire axis.
If you'd rather keep the outline and white background patch, but just turn
the ticks off, then you can do something like:
for axis in [ax.xaxis, ax.yaxis]:
 ax.set_ticks([])
or similarly:
ax.tick_params(color='none')
Also, as you've probably already noticed, I meant to have "import
matplotlib.pyplot as plt" in my first reply, rather than "import matplotlib
as plt".
Cheers!
From: Howard <ho...@re...> - 2011年11月09日 16:32:01
On 11/9/11 11:20 AM, Howard wrote:
> On 11/9/11 11:13 AM, Joe Kington wrote:
>> On Wed, Nov 9, 2011 at 10:07 AM, Howard <ho...@re... 
>> <mailto:ho...@re...>> wrote:
>>
>> Hi all
>>
>> I'm a new user to matplotlib, and I'm having a little difficulty
>> with something I feel must be basic. When I plot our data, I'm
>> using a canvas that is 4"x4" at 128 DPI and saving the canvas as
>> a png. Here's the basics of the code:
>>
>> imageWidth = 4
>> imageHeight = 4
>> DPI = 128
>>
>> figure1 = plt.figure(figsize=(imageWidth,imageHeight))
>> plt.axis("off")
>> plt.tricontourf(theTriangulation,
>> modelData,
>> theLookupTable.N,
>> cmap=theLookupTable)
>> canvas = FigureCanvasAgg(figure1)
>> canvas.print_figure(prefix + ".png", dpi=DPI)
>>
>> The png is 512x512 as I would expect, but the contoured image
>> doesn't fill the whole image. How do I tell the library to map
>> the plotted are to the entire canvas and not leave a border
>> around the rendered image?
>>
>>
>> You need to make an axis that fills up the entire figure.
>>
>> By default, axes don't fill up the entire figure to leave room for 
>> tick labels, axis lables, titles, etc.
>>
>> Try something like:
>>
>> import matplotlib as plt
>>
>> dpi = 128
>> fig = plt.figure(figsize=(4,4))
>>
>> # Specifies an axis at 0, 0 with a width and height of 1 (the full 
>> width of the figure)
>> ax = fig.add_axes([0,0,1,1])
>>
>> ax.tricontourf(...)
>>
>> fig.savefig('output.png', dpi=dpi)
>>
>> Hope that helps,
>> -Joe
> Hi Joe
>
> That did it! Thanks much. Can I also turn off the tick marks on the 
> new axis?
>
> Howard
 For the sake of reply, this seems to work to get rid of the tick marks:
ax.tick_params(axis="both", length=0, width=0)
Thanks
Howard
>
> -- 
> Howard Lander <mailto:ho...@re...>
> Senior Research Software Developer
> Renaissance Computing Institute (RENCI) <http://www.renci.org>
> The University of North Carolina at Chapel Hill
> Duke University
> North Carolina State University
> 100 Europa Drive
> Suite 540
> Chapel Hill, NC 27517
> 919-445-9651
-- 
Howard Lander <mailto:ho...@re...>
Senior Research Software Developer
Renaissance Computing Institute (RENCI) <http://www.renci.org>
The University of North Carolina at Chapel Hill
Duke University
North Carolina State University
100 Europa Drive
Suite 540
Chapel Hill, NC 27517
919-445-9651
From: Howard <ho...@re...> - 2011年11月09日 16:20:13
On 11/9/11 11:13 AM, Joe Kington wrote:
> On Wed, Nov 9, 2011 at 10:07 AM, Howard <ho...@re... 
> <mailto:ho...@re...>> wrote:
>
> Hi all
>
> I'm a new user to matplotlib, and I'm having a little difficulty
> with something I feel must be basic. When I plot our data, I'm
> using a canvas that is 4"x4" at 128 DPI and saving the canvas as a
> png. Here's the basics of the code:
>
> imageWidth = 4
> imageHeight = 4
> DPI = 128
>
> figure1 = plt.figure(figsize=(imageWidth,imageHeight))
> plt.axis("off")
> plt.tricontourf(theTriangulation,
> modelData,
> theLookupTable.N,
> cmap=theLookupTable)
> canvas = FigureCanvasAgg(figure1)
> canvas.print_figure(prefix + ".png", dpi=DPI)
>
> The png is 512x512 as I would expect, but the contoured image
> doesn't fill the whole image. How do I tell the library to map
> the plotted are to the entire canvas and not leave a border around
> the rendered image?
>
>
> You need to make an axis that fills up the entire figure.
>
> By default, axes don't fill up the entire figure to leave room for 
> tick labels, axis lables, titles, etc.
>
> Try something like:
>
> import matplotlib as plt
>
> dpi = 128
> fig = plt.figure(figsize=(4,4))
>
> # Specifies an axis at 0, 0 with a width and height of 1 (the full 
> width of the figure)
> ax = fig.add_axes([0,0,1,1])
>
> ax.tricontourf(...)
>
> fig.savefig('output.png', dpi=dpi)
>
> Hope that helps,
> -Joe
Hi Joe
That did it! Thanks much. Can I also turn off the tick marks on the new 
axis?
Howard
-- 
Howard Lander <mailto:ho...@re...>
Senior Research Software Developer
Renaissance Computing Institute (RENCI) <http://www.renci.org>
The University of North Carolina at Chapel Hill
Duke University
North Carolina State University
100 Europa Drive
Suite 540
Chapel Hill, NC 27517
919-445-9651
From: Joe K. <jki...@wi...> - 2011年11月09日 16:13:55
On Wed, Nov 9, 2011 at 10:07 AM, Howard <ho...@re...> wrote:
> Hi all
>
> I'm a new user to matplotlib, and I'm having a little difficulty with
> something I feel must be basic. When I plot our data, I'm using a canvas
> that is 4"x4" at 128 DPI and saving the canvas as a png. Here's the basics
> of the code:
>
> imageWidth = 4
> imageHeight = 4
> DPI = 128
>
> figure1 = plt.figure(figsize=(imageWidth,imageHeight))
> plt.axis("off")
> plt.tricontourf(theTriangulation,
> modelData,
> theLookupTable.N,
> cmap=theLookupTable)
> canvas = FigureCanvasAgg(figure1)
> canvas.print_figure(prefix + ".png", dpi=DPI)
>
> The png is 512x512 as I would expect, but the contoured image doesn't fill
> the whole image. How do I tell the library to map the plotted are to the
> entire canvas and not leave a border around the rendered image?
>
You need to make an axis that fills up the entire figure.
By default, axes don't fill up the entire figure to leave room for tick
labels, axis lables, titles, etc.
Try something like:
import matplotlib as plt
dpi = 128
fig = plt.figure(figsize=(4,4))
# Specifies an axis at 0, 0 with a width and height of 1 (the full width of
the figure)
ax = fig.add_axes([0,0,1,1])
ax.tricontourf(...)
fig.savefig('output.png', dpi=dpi)
 Hope that helps,
-Joe
From: Howard <ho...@re...> - 2011年11月09日 16:07:55
Hi all
I'm a new user to matplotlib, and I'm having a little difficulty with 
something I feel must be basic. When I plot our data, I'm using a canvas 
that is 4"x4" at 128 DPI and saving the canvas as a png. Here's the 
basics of the code:
 imageWidth = 4
 imageHeight = 4
 DPI = 128
 figure1 = plt.figure(figsize=(imageWidth,imageHeight))
 plt.axis("off")
 plt.tricontourf(theTriangulation,
 modelData,
 theLookupTable.N,
 cmap=theLookupTable)
 canvas = FigureCanvasAgg(figure1)
 canvas.print_figure(prefix + ".png", dpi=DPI)
The png is 512x512 as I would expect, but the contoured image doesn't 
fill the whole image. How do I tell the library to map the plotted are 
to the entire canvas and not leave a border around the rendered image?
Thanks
Howard
-- 
Howard Lander <mailto:ho...@re...>
Senior Research Software Developer
Renaissance Computing Institute (RENCI) <http://www.renci.org>
The University of North Carolina at Chapel Hill
Duke University
North Carolina State University
100 Europa Drive
Suite 540
Chapel Hill, NC 27517
919-445-9651
From: Brent P. <bpe...@gm...> - 2011年11月09日 15:37:56
Hi,
I have an image like this:
https://docs.google.com/open?id=0B7eMlcFeoB_rMTU1OTU0NmMtMzM3MC00YWI3LWFlNTYtNzg0MTM4MWI3OWMz
with an axes inside of another. I'd like to set the background behind
the labels of the inner figure.
I've tried set_frame_on on the axis, set_frameon on the figure,
axisbg_color, and so on.
How can I set the color being the axes labels.
thanks,
-Brent
From: Richard R. <rr...@fi...> - 2011年11月09日 14:50:52
Hi,
I read the legend guide, so when I did this:
ax.legend([Circle((0,0),1,fc='red')], ['red circle'])
I expected the symbol in the legend to be a red circle, but got a red
rectangle. In fact, no matter what artists I pass in as the first
argument, the legend shows rectangles (the colors are correct, though).
 Why?
Matplotlib 1.1.0, python 2.6/2.7 on linux.
thanks
-Rick
From: Skipper S. <jss...@gm...> - 2011年11月09日 04:19:50
On Tue, Nov 8, 2011 at 8:53 PM, Benjamin Root <ben...@ou...> wrote:
> On Tuesday, November 8, 2011, Skipper Seabold <jss...@gm...> wrote:
>> On Tue, Nov 8, 2011 at 6:13 PM, Benjamin Root <ben...@ou...> wrote:
>>>
>>> On Tue, Nov 8, 2011 at 4:55 PM, Skipper Seabold <jss...@gm...>
>>> wrote:
>>>>
>>>> Hi,
>>>>
>>>> Two related questions. Consider this plot
>>>>
>>>> -----
>>>>
>>>> import matplotlib.pyplot as plt
>>>> from mpl_toolkits.mplot3d import Axes3D
>>>>
>>>> fig = plt.figure()
>>>> ax = fig.add_subplot(111, projection='3d')
>>>> ax.plot([1,0,0,1],[0,1,0,0],[0,0,1,0])
>>>>
>>>> ax.set_xlim3d(0,1)
>>>> ax.set_ylim3d(0,1)
>>>> #ax.set_ylim3d(1,0)
>>>> ax.set_zlim3d(0,1)
>>>>
>>>> plt.show()
>>>>
>>>> -----
>>>>
>>>> I want to uncomment the line above to reverse the y axis, but as soon
>>>> as I do, the tick labels disappear on the y axis and the z axis tick
>>>> label padding changing. Is there another way to reverse the y axis, or
>>>> should I fix thing after the fact. If so, how can I do this? I don't
>>>> see a zaxis in rcParams.
>>>>
>>>
>>> The first would be a bug (could you please file one?). The second should
>>> probably be a feature request, but I wouldn't expect anything for that
>>> right
>>> away.
>>>
>>
>> 1. https://github.com/matplotlib/matplotlib/issues/570
>
> Thanks.
>
>> 2. Surely there's another workaround in the meantime? I've never
>> worked much with rcParams, going the long way instead, but now that
>> I've discovered it, it's my preferred way of doing things. Anyone have
>> any ideas?
>>
>
> The problem is that mplot3d doesn't query for any params yet. A lot of
> defaults are hard-coded. I would like to start adding defaults, but we will
> need to figure out a consistent naming scheme.
>
File under duh. The answer is just to adjust my plot coordinates
accordingly and fix the label. For example,
import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
alpha = [4,4,2]
nobs = 2000
# draw the r.v.s
p1,p2,p3 = np.random.dirichlet(alpha, size=nobs).T
fig = plt.figure()
ax = fig.add_subplot(111, projection='3d')
#NOTE: 1 - p2 to reverse the y-axis
ax.scatter(p1, 1-p2, p3, zdir='z',s=2)
# plot the simplex with adjusted y coordinates
ax.plot([1,0,0,1],[1,0,1,1],[0,0,1,0])
ax.set_xlim3d(0,1)
ax.set_ylim3d(0,1)
# reverse the tick labels
ax.set_yticklabels([1.0, .8, .6, .4, .2, 0.0])
ax.set_zlim3d(0,1)
ax.set_title("Dirichlet(4,4,2) on the 2-simplex")
plt.show()
Skipper
From: questions a. <que...@gm...> - 2011年11月09日 03:06:19
thanks, will look at these options.
On Fri, Nov 4, 2011 at 10:21 AM, Matt S. <sle...@gm...> wrote:
> I've used Pyshapelib and Polygon to do this type of analysis in the past.
> Thuban may get ya what you need.
>
> On Thu, Nov 3, 2011 at 3:40 PM, questions anon <que...@gm...>wrote:
>
>> Hi All,
>> Is there a way to select only the values within a particular shapefile to
>> analyse.
>> I would like to do something like:
>>
>> array=numpyarraycoveringtemperatureofwholestate
>> shapefile=forestedregions.shp
>>
>> newarray=ma.masked_values(array, shapefile)
>> meantemperatureofforestedregions=MA.mean(newarray)
>> print meantemperatureofforestedregions
>>
>>
>> Any ideas of functions I could use, examples I could follow?
>> thanks
>>
>>
>> ------------------------------------------------------------------------------
>> RSA(R) Conference 2012
>> Save 700ドル by Nov 18
>> Register now
>> http://p.sf.net/sfu/rsa-sfdev2dev1
>> _______________________________________________
>> Matplotlib-users mailing list
>> Mat...@li...
>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>>
>>
>
From: Benjamin R. <ben...@ou...> - 2011年11月09日 01:53:30
On Tuesday, November 8, 2011, Skipper Seabold <jss...@gm...> wrote:
> On Tue, Nov 8, 2011 at 6:13 PM, Benjamin Root <ben...@ou...> wrote:
>>
>> On Tue, Nov 8, 2011 at 4:55 PM, Skipper Seabold <jss...@gm...>
wrote:
>>>
>>> Hi,
>>>
>>> Two related questions. Consider this plot
>>>
>>> -----
>>>
>>> import matplotlib.pyplot as plt
>>> from mpl_toolkits.mplot3d import Axes3D
>>>
>>> fig = plt.figure()
>>> ax = fig.add_subplot(111, projection='3d')
>>> ax.plot([1,0,0,1],[0,1,0,0],[0,0,1,0])
>>>
>>> ax.set_xlim3d(0,1)
>>> ax.set_ylim3d(0,1)
>>> #ax.set_ylim3d(1,0)
>>> ax.set_zlim3d(0,1)
>>>
>>> plt.show()
>>>
>>> -----
>>>
>>> I want to uncomment the line above to reverse the y axis, but as soon
>>> as I do, the tick labels disappear on the y axis and the z axis tick
>>> label padding changing. Is there another way to reverse the y axis, or
>>> should I fix thing after the fact. If so, how can I do this? I don't
>>> see a zaxis in rcParams.
>>>
>>
>> The first would be a bug (could you please file one?). The second should
>> probably be a feature request, but I wouldn't expect anything for that
right
>> away.
>>
>
> 1. https://github.com/matplotlib/matplotlib/issues/570
Thanks.
> 2. Surely there's another workaround in the meantime? I've never
> worked much with rcParams, going the long way instead, but now that
> I've discovered it, it's my preferred way of doing things. Anyone have
> any ideas?
>
The problem is that mplot3d doesn't query for any params yet. A lot of
defaults are hard-coded. I would like to start adding defaults, but we will
need to figure out a consistent naming scheme.
Ben Root
From: magurling <mag...@gm...> - 2011年11月09日 00:49:40
I want a legend without the black border. I've tried a few things that have
been suggested on this forum and elsewhere to no avail. According to what
I've seen, it should be as simple as:
import matplotlib.pyplot as plt
import numpy as np
N = 5
Means1 = (20, 35, 30, 35, 27)
Means2 = (25, 32, 34, 20, 25)
ind = np.arange(N) # the x locations for the groups
width = 0.20 # the width of the bars
fig = plt.figure()
ax = fig.add_subplot(111)
rects1 = ax.bar(ind, Means1, width, color='k')
rects2 = ax.bar(ind+width, Means2, width, color='w')
ax.legend( (rects1[0], rects2[0]), ('set1', 'set2'), frameon=False )
plt.show()
It all works except for "frameon=False"
I get this:
/usr/lib/pymodules/python2.7/matplotlib/axes.pyc in legend(self, *args,
**kwargs)
 4042 
 4043 handles = cbook.flatten(handles)
-> 4044 self.legend_ = mlegend.Legend(self, handles, labels,
**kwargs)
 4045 return self.legend_
 4046 
TypeError: __init__() got an unexpected keyword argument 'frameon'
I've also checked my matplotlibrc under the "Legend" section and I don't see
a "legend.frameon" line.
It must be something simple that I am doing wrong. Any ideas?
-- 
View this message in context: http://old.nabble.com/legend-border%2C-frameon-keyword-tp32807933p32807933.html
Sent from the matplotlib - users mailing list archive at Nabble.com.

Showing 14 results of 14

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