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



Showing 17 results of 17

From: Eric F. <ef...@ha...> - 2007年02月23日 23:07:16
kc1...@ya... wrote:
> I installed gsview and gscript and tried it. The good news is that when I print from inside gsview, the error page is gone. The bad news is that the oritentation is wrong. My plot is designed for landscape. From word, I set the page setup to landscape, import the picture, and print. But with gsview, it imports my plot 90 degree wrong. Changing orientation flips the whole page 90 degree but the plot gets rotated as well and so it still prints wrong.
> 
> I guess I have no choice but to regress step by step and see which MPL feature aggrevated this condition.
> 
Did you try saving the figure using the orientation kwarg? This is 
intended for postscript output.
e.g.
from pylab import figure, show, close
fig = figure()
ax = fig.add_subplot(1,1,1)
ax.plot([0,1], [0,1])
fig.savefig('myplot.ps', orientation='landscape')
close(fig)
Eric
Hello Folks,
 
 I was wondering what would be the best way to approach this issue: in a subplot that displays a data plot, is there any way of finding what the first and last points of the data plots are; i.e., when I use the pan function in the toolbar, it would be great to know which data points are at the extremities. For e.g., considering a data set x[0]...x[50] in a subplot I have the first data point x[0] as 2 and the last data point, say x[50] as 8. What would be the best way to pass on these values to a function, that did something like print on the screen "Hey, the data value at the left most location of this subplot is 2 and the data value at the right most location of this subplot is 8".
 
 Pointers would be appreciated.
 
 Thanks.
 iyer
 
 
 
---------------------------------
The fish are biting.
 Get more visitors on your site using Yahoo! Search Marketing.
From: <kc1...@ya...> - 2007年02月23日 21:41:00
I installed gsview and gscript and tried it. The good news is that when I=
 print from inside gsview, the error page is gone. The bad news is that th=
e oritentation is wrong. My plot is designed for landscape. From word, I =
set the page setup to landscape, import the picture, and print. But with g=
sview, it imports my plot 90 degree wrong. Changing orientation flips the=
 whole page 90 degree but the plot gets rotated as well and so it still pri=
nts wrong.=0A=0AI guess I have no choice but to regress step by step and se=
e which MPL feature aggrevated this condition.=0A=0A> -----Original Message=
-----=0A> From: Eric Firing [mailto:ef...@ha...] =0A> Sent: Friday, =
February 23, 2007 12:06 PM=0A> To: kc1...@ya...=0A> Cc: =
mat...@li...=0A> Subject: Re: [Matplotlib-users] =
invalidrestore=0A> =0A> =0A> kc1...@ya... wrote:=0A> > H=
i list,=0A> > =0A> > I am getting an "invalidrestore" from the printer when=
 I =0A> print a figure created with MPL. The page prints fine but =0A> for=
 each plot, I am getting an error page. I didn't have =0A> this problem u=
ntil I started making a number of font related =0A> changes. Before I go t=
hrough a bunch of painful regression =0A> steps to see what causes this, do=
es anybody has experience in this?=0A> > =0A> > Don't know if it matters bu=
t I am using Word to print the =0A> .eps file by =0A> > imported it into a =
word doc file and then print from there. I am =0A> > using Word because I =
don't have any other software that =0A> would allow me =0A> > to print .eps=
 file.=0A> =0A> Maybe this will help; certainly you should have it if you a=
re =0A> going to =0A> work with ps or eps files. http://www.cs.wisc.edu/~gh=
ost/gsview/=0A> Eric=0A> > =0A> > Regards,=0A> > =0A> > --=0A> > John Henr=
y=0A> =0A =0A--=0AJohn Henry=0A=0A
From: <jk...@ik...> - 2007年02月23日 20:48:26
Eric Firing <ef...@ha...> writes:
> Jouni K. Seppänen wrote:
>> So, to make the interface familiar to Matlab users, I suggest to add
>> properties line.linestyleorder and line.colororder 
>
> Are you talking about Axes properties (instance attributes) or rcParam 
> entries or both? In any case, I agree that built-in support would easy 
> to provide and would help enough people to be worthwhile.
I was thinking about rcParam entries, but now that you mention it,
Axes properties would make more sense.
-- 
Jouni K. Seppänen
http://www.iki.fi/jks
From: Christopher B. <Chr...@no...> - 2007年02月23日 20:43:54
Jeff Peery wrote:
> ok.... so sourceforge only has down to wxpython2.7... is there a link to 
> earlier versions that I'm not seeing? thanks.
You're right -- they are hard to find! This should do it, though:
http://www.wxpython.org/download-2.6.3.3.php
-Chris
-- 
Christopher Barker, Ph.D.
Oceanographer
Emergency Response Division
NOAA/NOS/OR&R (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception
Chr...@no...
From: Eric F. <ef...@ha...> - 2007年02月23日 20:07:02
kc1...@ya... wrote:
> Hi list,
> 
> I am getting an "invalidrestore" from the printer when I print a figure created with MPL. The page prints fine but for each plot, I am getting an error page. I didn't have this problem until I started making a number of font related changes. Before I go through a bunch of painful regression steps to see what causes this, does anybody has experience in this?
> 
> Don't know if it matters but I am using Word to print the .eps file by imported it into a word doc file and then print from there. I am using Word because I don't have any other software that would allow me to print .eps file.
Maybe this will help; certainly you should have it if you are going to 
work with ps or eps files.
http://www.cs.wisc.edu/~ghost/gsview/
Eric
> 
> Regards,
> 
> --
> John Henry
From: <kc1...@ya...> - 2007年02月23日 19:08:20
Hi list,=0A=0AI am getting an "invalidrestore" from the printer when I prin=
t a figure created with MPL. The page prints fine but for each plot, I am =
getting an error page. I didn't have this problem until I started making =
a number of font related changes. Before I go through a bunch of painful r=
egression steps to see what causes this, does anybody has experience in thi=
s?=0A=0ADon't know if it matters but I am using Word to print the .eps file=
 by imported it into a word doc file and then print from there. I am using=
 Word because I don't have any other software that would allow me to print =
.eps file.=0A=0ARegards,=0A =0A--=0AJohn Henry=0A=0A
From: Rajarshi G. <rg...@in...> - 2007年02月23日 18:51:06
Hi, I'm trying to generate a barplot and subsequently dumping it to a
PNG file and making an HTML imagemap out of it. I've pasted my code
below.
The problem is that the coordinates I need to supply for the imagemap
don't seem to be correct.
I'm getting the screen coordinates using:
coords = []
for rectangle in b:
 vertices = rectangle.get_verts()
 top_left = get_top_left(vertices)
 lower_right = get_lower_right(vertices)
 trans = rectangle.get_transform()
 top_left = trans.xy_tup(top_left)
 lower_right = trans.xy_tup(lower_right)
 coords.append( (top_left, lower_right) )
However when I use these coordinates as the top left and lower right
coordinates of each bar in the imagemap, they don't line up properly
with the regions of the bars. The top left coordinate is always a bit
below the top edge of the bar and shifted to the left.
[ In the code below I transform the screen coordinates from the plot to
the HTML coordinate system (0,0 is the top left) ]
The code below, when run, generates an HTML file called junk.html. If
you view it in a browser and look at the status line it will be apparent
that the 5th bar doesn't get any region assigned to it.
Any pointers to a solution would be much appreciated.
Thanks,
--8<--------------------------------------------------------
import random, sys
from pylab import *
from matplotlib.figure import Figure
from matplotlib.patches import Polygon
from matplotlib.backends.backend_agg import FigureCanvasAgg
def get_top_left(v):
 return v[1]
def get_lower_right(v):
 return v[3]
 
obs = [random.random() for x in range(0,5)] 
x = range(0,5)
imgwidth = None
imgheight = None
fig = Figure(figsize=(4,4))
ax = fig.add_subplot(1,1,1 )
b = ax.bar(x, obs)
canvas = FigureCanvasAgg(fig)
canvas.print_figure("junk.png", dpi=100)
imgwidth = fig.get_figwidth() * 100
imgheight = fig.get_figheight() * 100
# get coords for the bars of this plot
coords = []
for rectangle in b:
 vertices = rectangle.get_verts()
 top_left = get_top_left(vertices)
 lower_right = get_lower_right(vertices)
 trans = rectangle.get_transform()
 top_left = trans.xy_tup(top_left)
 lower_right = trans.xy_tup(lower_right)
 print top_left, " <-> ", lower_right
 coords.append( (top_left, lower_right) )
f = open('junk.html', 'w')
f.write("""
<html>
<body>
<img src="junk.png" ismap usemap='#points' width="%d" height="%d">
<map name="points"> """ % (imgwidth, imgheight))
cnt = 1
for tl, lr in coords:
 f.write("""
 <area shape="rect" coords="%d,%d %d,%d" href="http://junk%d.com", alt="Cell %d">\n""" % \
 (tl[0], imgheight-tl[1], lr[0], imgheight-lr[1], cnt, cnt))
 cnt += 1
f.write("""</map></body></html>""")
f.close()
-------------------------------------------------------------------
Rajarshi Guha <rg...@in...>
GPG Fingerprint: 0CCA 8EE2 2EEB 25E2 AB04 06F7 1BB9 E634 9B87 56EE
-------------------------------------------------------------------
"A fractal is by definition a set for which the Hausdorff Besicovitch
dimension strictly exceeds the topological dimension."
-- Mandelbrot, "The Fractal Geometry of Nature"
From: Eric F. <ef...@ha...> - 2007年02月23日 18:40:27
Jouni K. Seppänen wrote:
> The question of setting the color and line style sequences comes up
> every now and then, and although there are neat solutions like
> Fernando demonstrated, perhaps we should add support for them to
> matplotlib. The Matlab interface seems to be like this:
> 
>>> figure 
>>> set(gca, 'LineStyleOrder', '-o|-x|-^') % sequence of three line styles 
>>> set(gca, 'ColorOrder', [1 0 0; 0 0 1]) % sequence of two colors (red and blue)
>>> set(gca, 'NextPlot', 'replacechildren') % don't reset the properties I just set
>>> plot(random(6))
> 
> This plots six lines with different combinations of style and color;
> the seventh line would look the same as the first. Probably you can
> avoid the NextPlot thing by setting DefaultLineStyleOrder on the root
> handle, but never mind.
> 
> So, to make the interface familiar to Matlab users, I suggest to add
> properties line.linestyleorder and line.colororder that can take any
> sequences of linestyles and colors, or an n-by-3 array of rgb color
> values for the latter. I think the |-separated linestyles spec is a
> hack (necessary in Matlab because it cannot have vectors of strings
> because of the auto-flattening matrices) that we shouldn't emulate.
> How does that sound?
> 
Are you talking about Axes properties (instance attributes) or rcParam 
entries or both? In any case, I agree that built-in support would easy 
to provide and would help enough people to be worthwhile.
Eric
From: <jk...@ik...> - 2007年02月23日 11:10:18
The question of setting the color and line style sequences comes up
every now and then, and although there are neat solutions like
Fernando demonstrated, perhaps we should add support for them to
matplotlib. The Matlab interface seems to be like this:
>> figure 
>> set(gca, 'LineStyleOrder', '-o|-x|-^') % sequence of three line styles 
>> set(gca, 'ColorOrder', [1 0 0; 0 0 1]) % sequence of two colors (red and blue)
>> set(gca, 'NextPlot', 'replacechildren') % don't reset the properties I just set
>> plot(random(6))
This plots six lines with different combinations of style and color;
the seventh line would look the same as the first. Probably you can
avoid the NextPlot thing by setting DefaultLineStyleOrder on the root
handle, but never mind.
So, to make the interface familiar to Matlab users, I suggest to add
properties line.linestyleorder and line.colororder that can take any
sequences of linestyles and colors, or an n-by-3 array of rgb color
values for the latter. I think the |-separated linestyles spec is a
hack (necessary in Matlab because it cannot have vectors of strings
because of the auto-flattening matrices) that we shouldn't emulate.
How does that sound?
-- 
Jouni K. Seppänen
http://www.iki.fi/jks
From: Fernando P. <fpe...@gm...> - 2007年02月23日 09:29:52
On 2/23/07, Fernando Perez <fpe...@gm...> wrote:
> On 2/23/07, Jouni K. Sepp=E4nen <jk...@ik...> wrote:
> > Brian Blais <bb...@br...> writes:
> >
> > > Is there a way to specify the default order of line colors and
> > > styles, for plot commands given in sequence
> >
> > I don't think there is built-in support for this. See e.g.
> > http://thread.gmane.org/gmane.comp.python.matplotlib.general/5708
> > for some previous discussion and suggestions.
>
> It's probably worth mentioning that the cyclers John mentions are
> trivial to write using itertools:
Sorry, tab put me in the 'send' button in gmail too early... I meant:
import itertools
colorcycler =3D itertools.cycle(['blue','green','red','magenta','cyan']).ne=
xt
linecycler =3D itertools.cycle([ '-','--', '-.' , ':' ]).next
n =3D itertools.count().next
y =3D array([1,2,3])
for i in range(10):
 plot(y+n(),color=3Dcolorcycler(),linestyle=3Dlinecycler())
Cheers,
f
From: Fernando P. <fpe...@gm...> - 2007年02月23日 09:24:54
On 2/23/07, Jouni K. Sepp=E4nen <jk...@ik...> wrote:
> Brian Blais <bb...@br...> writes:
>
> > Is there a way to specify the default order of line colors and
> > styles, for plot commands given in sequence
>
> I don't think there is built-in support for this. See e.g.
> http://thread.gmane.org/gmane.comp.python.matplotlib.general/5708
> for some previous discussion and suggestions.
It's probably worth mentioning that the cyclers John mentions are
trivial to write using itertools:
colorcycler =3D itertools.cycle(['blue','green','red','magenta','cyan'])
linecycler =3D itertools.cycle([ '-','--', '-.' , ':' ])
n =3D itertools.count()
y =3D array([1,2,3])
Then, try:
for i in range(10):
plot(y+n.next(),color=3Dc.next(),linestyle=3Dlinecycler.next())
plot(y+n.next(),color=3Dc.next(),linestyle=3Dlinecycler.next())
plot(y+n.next(),color=3Dc.next(),linestyle=3Dlinecycler.next())
plot(y+n.next(),color=3Dc.next(),linestyle=3Dlinecycler.next())
plot(y+n.next(),color=3Dc.next(),linestyle=3Dlinecycler.next())
plot(y+n.next(),color=3Dc.next(),linestyle=3Dlinecycler.next())
plot(y+n.next(),color=3Dc.next(),linestyle=3Dlinecycler.next())
plot(y+n.next(),color=3Dc.next(),linestyle=3Dlinecycler.next())
From: Giorgio L. <gio...@ch...> - 2007年02月23日 09:10:32
Sorry for the easy question, I've searched the web but find nothing 
"really" helpful.
Is there some editor more user friendly for Windows to have a workspace 
where to copy and paste from gnumeric/excel like the matlab workspace
I'm using orange, which is wonderful, but if you have a lot of array to 
copy and paste is not so comfortable as a simple command
line x=[(ctrl+v)]
Thanks in advance to all.
I guess that a workspace like matlab for numpy/scipy will make a lot of 
people to switch more easily form matlab :)))
Giorgio
From: <jk...@ik...> - 2007年02月23日 09:02:12
Brian Blais <bb...@br...> writes:
> Is there a way to specify the default order of line colors and
> styles, for plot commands given in sequence
I don't think there is built-in support for this. See e.g.
http://thread.gmane.org/gmane.comp.python.matplotlib.general/5708
for some previous discussion and suggestions.
-- 
Jouni K. Seppänen
http://www.iki.fi/jks
From: Jeff P. <jef...@ya...> - 2007年02月23日 04:35:28
ok.... so sourceforge only has down to wxpython2.7... is there a link to earlier versions that I'm not seeing? thanks.
 
 Jeff
Ken McIvor <mc...@ii...> wrote:
 On Feb 22, 2007, at 10:39 AM, Jeff Peery wrote:
>
> So it works ok when I execute my wxApp from boa, but it acts 
> strange then locks up when I run it from the IDLE???
Yep. It's a result of the way programs like Boa and IDLE are 
written. In general, you can't mix and match GUI libraries (e.g. 
wxPython and Tkinter) without heroic measures.
> Since I'm using matplotlib and wxpython, should I be using 
> wxpython2.6? If so where can I get teh wxpython2.6 windows 
> installer? I looked at sourceforge and the oldest version is 2.7.
Right now you'll probably be happiest using 2.6. You can download 
the win32 installer from http://www.wxpython.org/download.php
Hopefully the 0.91 release will include some improvements I'm working 
on, but haven't committed yet. At that point wxPython 2.8 will 
(hopefully) become the best choice for win32.
> thanks again for teh help!
You are teh welcome!
Ken
 
---------------------------------
Everyone is raving about the all-new Yahoo! Mail beta.
From: Brian B. <bb...@br...> - 2007年02月23日 02:57:34
Hello,
I poked around a bit, and couldn't find the answer to this. Is there a way to 
specify the default order of line colors and styles, for plot commands given in 
sequence, like:
plot(x1,y1)
plot(x2,y2)
plot(x3,y3)
	thanks,
			Brian Blais
-- 
-----------------
 bb...@br...
 http://web.bryant.edu/~bblais
From: <kc1...@ya...> - 2007年02月23日 00:59:23
Please ignore this message. I discovered the subplot_toolbar.py example wh=
ich helped me figure out what I did wrong.=0A=0AThanks=0A =0A--=0AJohn Henr=
y=0A=0A----- Original Message ----=0AFrom: "kc1...@ya...=
" <kc1...@ya...>=0ATo: mat...@li...urceforg=
e.net=0ASent: Thursday, February 22, 2007 3:15:02 PM=0ASubject: Controlling=
 vertical space between subplots=0A=0AHi list,=0A=0AI have a figure of 3 ro=
ws by 2 col of plots. I have a need to use 2 line xlabels for each of the =
subplots. So I did something like:=0A=0Axlabel("Label 1\nLine 2")=0A=0Afor=
 each of the subplots.=0A=0AHowever when I do that, the 2nd line is lost fo=
r the top 4 subplots because I don't have enough vertical spaces between th=
em. I tried something like:=0A=0Asubplots_adjust(hspace=3D0.4)=0A=0Abut i=
t didn't seem to have any effect (I also tried different values for hspace =
- no effect at all).=0A=0AWhat am I doing wrong?=0A=0AI also have too much =
white space on the left and right side of the page and I tried to reduce th=
at using the subplots_adjust function but it didn't seem to be doing what I=
 want. I am sure I am not understanding something about subplots_adjust.=
=0A=0ACould some one please clarify it (or point me to the right direction)=
?=0A=0AThanks,=0A=0A=0A=0A =0A--=0AJohn Henry=0A=0A=0A=0A=0A

Showing 17 results of 17

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