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

Showing results of 407

<< < 1 .. 12 13 14 15 16 17 > >> (Page 14 of 17)
From: Claus <cla...@gm...> - 2010年04月04日 07:16:34
Hi,
I've got two questions: 
1) one is related to colorbar() on multiple subfigures (see code example below): how do I add a scatterplot if I wanted multiple subfigures? Or, what am I doing wrong in the second code example
2) in either of the examples, how can I increase the distance between the top of the plot (imshow) and the bottom of the title?
# code example 1: this works
fig = plt.figure()
plt.title('Hello')
plt.imshow(interpolValsRas, cmap=cm.jet, interpolation='nearest', origin = 'lower', extent=[5,95,5,95]) # , 
plt.scatter(measurementLoc[:,0], measurementLoc[:,1], 10, messwerte, cmap=cm.jet)
plt.colorbar();
# code example 2: this works generally, but only if the second last line is commented out
# Q: how do I add a scatterplot if I wanted multiple subfigures?
fig = plt.figure()
ax = fig.add_subplot(111)
plt.title('Hello')
ax.imshow(interpolValsRas, cmap=cm.jet, interpolation='nearest', origin = 'lower', extent=[5,95,5,95]) # , 
ax.scatter(measurementLoc[:,0], measurementLoc[:,1], 10, messwerte, cmap=cm.jet)
# plt.colorbar();
plt.show()
Thanks for your help,
Claus
From: Enzo M. <enz...@gm...> - 2010年04月04日 07:16:12
Alan G Isaac <alan.isaac@...> writes:
> 
> On 4/3/2010 11:19 PM, Enzo Michelangeli wrote:
> > multiple show() functionality is important for many users (see
> > e.g.
> >
http://www.mail-archive.com/matplotlib-users-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f
<at> public.gmane.org/msg13099.html
> > 
> 
> http://matplotlib.sourceforge.net/api/pyplot_api.html#matplotlib.pyplot.ion
>From what I undrstand, ion() doesn't do what I need: it just forces a draw()
after every pyplot command allowing animated plots. Instead, I want the program
 to draw and show a complete plot, then pause allowing me to interact with its
window (e.g., to pan, zoom and/or save a screenshot), then, after I close that
window, proceed to build a new, entirely different plot, show it in a new window
and so on.
Enzo 
From: Levi K. <lev...@gm...> - 2010年04月04日 06:57:22
Can anyone else confirm this bug? It was giving me fits for a while.
I can't control the size of markers in my plots.
Here is an old post describing exactly my problem:
http://sourceforge.net/mailarchive/message.php?msg_id=972d0a0e0809232229ue9aa42eg5d791a08692f7e7b%40mail.gmail.com
I am running python 2.6.4, ipython 0.10, and matplotlib 0.99.0.
And what the heck are the line objects in the legend? Are there
separate marker objects that I am missing?
I tried messing with the legend.get_lines() objects, but these have
marker types "None". Where are the marker objects I see in my legend?
For those that also run across this problem, here is a hack I used to
overcome the problem:
----------SNIP----------
from pylab import *
x = [1,2,3]; y = [1,2,3]
plot(x,y,ls='',marker='o',ms=1,color='r')
plot(NaN,NaN,ls='',marker='o',ms=1*5,label='test',color='r')
legend()
show()
----------SNAP----------
In other words, make a plot object that has a label, with larger
markers, but no data (NaN's).
Thanks for any help,
Levi K.
The Original post (September 2008):
----------SNIP----------
Dear matplotlib users.
I'm using matplotlib 0.98.3 from the packman repository on opensuse 11.0.
I tried to adjust the 'markerscale option to enlarge a marker size in a
legend.
However, it simply did not work even in a simple code like following.
from pylab import *
x = [1,2,3]; y = [1,2,3]
plot(x,y,ls='',marker='o',ms=1,label='test')
legend(markerscale=5)
show()
I could only get a legend marker in a same size with the plot marker.
I tried to reinstall all the packages related with python, including
matplotlib,
the legend marker size, however, does not change.
Please help me here to change the legend marker size.
Thanks.
-- 
Yong-Duk Jin
----------SNAP----------
From: Tymoteusz J. <tym...@gm...> - 2010年04月04日 06:48:36
Hi!
Can anyone help me to achive this?
I'd like to plot rgb spectrum with matplotlib.
For example let the x axis be green element, and for example... let the y 
axis be red element.
Eventually i'd like to plot 3D figure with all of three elements RGB.
Regards,
T.
From: Alan G I. <ala...@gm...> - 2010年04月04日 03:52:29
On 4/3/2010 11:19 PM, Enzo Michelangeli wrote:
> multiple show() functionality is important for many users (see
> e.g.
> http://www.mail-archive.com/mat...@li.../msg13099.html
> 
http://matplotlib.sourceforge.net/api/pyplot_api.html#matplotlib.pyplot.ion
hth,
Alan Isaac
From: Enzo M. <enz...@gm...> - 2010年04月04日 03:20:09
OK, I found the answer myself. It appears that multiple calls to show() are at
the moment officially unsupported, although they do work for some backends on
some platforms (see e.g.
http://matplotlib.sourceforge.net/faq/howto_faq.html#use-show ). In particular,
I have found that: 
- With Qt4Agg they work under Windows (where Qt4Agg is the default backend, at
least in the Python(X,Y) distribution) but under Linux they result in an
"Underlying C/C++ object has been deleted" error at line 64 of backend_qt4.py
- With TkAgg they fail silently under Linux (where TkAgg is the default backend,
and under Windows they cause a "Fatal Python error: PyEval_RestoreThread: NULL
tstate" exception
- with GTKAgg, not available in my Windows installation, they work well under
Linux, apart from a deprecation warning on the use of GTK.Tooltips() instead of
the new GTK.Tooltip()
Considering that multiple show() functionality is important for many users (see
e.g.
http://www.mail-archive.com/mat...@li.../msg13099.html
) I'd like to ask the backend developers to try their best and support this
feature on as many platforms as possible.
Enzo
From: ericyosho <eri...@gm...> - 2010年04月04日 01:01:16
Year, I think we could do unsorted scatter plot as well, however I'm
still not satisfied with the book tracking routines I have to check
when doing the surface plotting.
Anyway, thanks, man. You saved a lot.
Hope this time, it CC to the mailing list as well. :-)
From: Friedrich R. <fri...@gm...> - 2010年04月03日 21:14:09
Oh, sorry, it was late at night, and so on, but in fact you said it's
a standard example, so well ... I was wrong.
Friedrich
2010年4月1日 Friedrich Romstedt <fri...@gm...>:
> You forgot about the attachment?
>
> Friedrich
>
From: Friedrich R. <fri...@gm...> - 2010年04月03日 20:49:40
I think it should be possible to do unsorted scatter plot, so you can
avoid the second loop. Maybe the current source doesn't allow for,
but it's certainly possible (hu, I'm not that aquainted with current
z-sorting code, so maybe I'm wrong?) It may be that current z-sorting
uses the mesh grid.
One point caught my attention: Maybe use sets, or check in loop 1 if
you do not duplicate x or y data?
Do you mask the mesh points not used?
Friedrich
P.S.: And make shure to select "Answer to all" :-)
2010年4月2日 ericyosho <eri...@gm...>:
> Thanks, Friendrich,
>
> So the only problem narrows down to whether I've got to loop through
> the dict to form all the arrays, or there might be some way to define
> a "formatter", so that when I apply this formatter on to the
> dictionary, it splits the data into arrays properly.
>
> Zhe Yao
>
From: Diakronik <fre...@gm...> - 2010年04月03日 20:33:35
konstellationen wrote:
> 
> Hi, 
> 
> I am making plots for a publication using matplotlib which requires the
> use of heavy fonts. I am rendering text in the graph with Latex, which has
> a limited capability to make fonts more heavy. I partially solved the
> problem using the \boldmath Latex command for the axis-labels and text
> inside the plot (see attached figure). The only remaining text to be
> "bolden" are the tick labels. I can change their size via the
> xtick.labelsize rc parameter, but do not know how to make them heavier. 
> 
> Does anybody know what can be done to solve this?
> 
> Any help would be appreciated!!!! 
> 
> Best, Daniel 
> 
> 
I ran into the same problem today trying to prepare figures for my thesis,
and I figured out a way to do it...it's not pretty, but it works:
import matplotlib.pyplt as plt
tick_locs = range(start, stop, increment)
plt.xticks(tick_locs, [r"$\mathbf{%s}$" % x for x in tick_locs])
Hope this helps!
-- 
View this message in context: http://old.nabble.com/Bold-Latex-Tick-Labels-tp28037900p28129365.html
Sent from the matplotlib - users mailing list archive at Nabble.com.
From: ms <dev...@gm...> - 2010年04月03日 18:04:27
Hi,
I am trying to use griddata to plot some (irregularly) spaced data as a
contour plot, but sometimes ALL the grid it outputs is masked: so no plot.
In the docs I read:
"A masked array is returned if any grid points are outside convex hull
defined by input data (no extrapolation is done)."
but I have no real idea of what does it mean.
Any suggestion to troubleshoot / understand what's going on?
Thanks!
m.
From: David F. <dav...@ya...> - 2010年04月03日 17:19:19
Hello -
I am using matplotlib in eclipse. For 3D plot test, I am using:
====================
from mpl_toolkits.mplot3d import Axes3D
from matplotlib import cm
import matplotlib.pyplot as plt
import numpy as np
fig = plt.figure()
ax = Axes3D(fig)
X = np.arange(-5, 5, 0.25)
Y = np.arange(-5, 5, 0.25)
X, Y = np.meshgrid(X, Y)
R = np.sqrt(X**2 + Y**2)
Z = np.sin(R)
ax.plot_surface(X, Y, Z, rstride=1, cstride=1, cmap=cm.jet)
plt.show()
====================
This script works fine outside of Eclipse; that is, just by running
"python testplot1.py"
but Eclipse says "undefined import from variable: jet"
The following are my script's header lines:
====================
from mpl_toolkits.mplot3d import Axes3D
from matplotlib import cm
import numpy as np
import matplotlib.pyplot as plt
====================
Suggestions are appreciated.
Regards, David
 
From: Enzo M. <enz...@gm...> - 2010年04月03日 14:40:18
Dear all,
Consider the following short program:
from matplotlib.pyplot import title, show
for i in xrange(3):
 title(i+1)
 print "window No. "+str(i+1)+" was closed"
 show()
If I run it under Windows XP, at each show() the program displays a window and
blocks; if I close the window by clicking on the "X" at the top right corner,
the program prints the message "window No. ... was closed" , then opens a new
window, and so on for a total of three iterations.
If I run it under Linux (Ubuntu 9.10, living inside a Virtualbox machine),
everything works the same until I close the first window, after which no new
windows are ever opened and displayed. The program does not die, because all
three messages are sent to console:
window No. 1 was closed
window No. 2 was closed
window No. 3 was closed
My questions for the cognoscenti are:
1. Why this difference?
2. How can I get under Linux the same behaviour as under Windows?
Thanks in advance,
Enzo
From: Marius 't H. <M.t...@ai...> - 2010年04月03日 11:43:14
Try this:
from pylab import *
from numpy import *
Z = random.randn(100,100)
figure()
subplot(1,2,1)
imgHandle = imshow(Z, cmap=cm.gray)
scatter(random.rand(10)*100,random.rand(10)*100)
colorbar(imgHandle)
title('Hello')
show()
By the way, I find jet a bad colormap to represent scientific data: it 
suggests bands in the data that aren't there and when reduced to 
luminance (eg. students printing/copying in black/white or in the eyes 
of all your colorblind colleagues) the two halves of the scale are 
identical, rendering all graphs completely ambiguous. ;)
Claus wrote:
> Hi,
> I've got two questions: 
> 1) one is related to colorbar() on multiple subfigures (see code example below): how do I add a scatterplot if I wanted multiple subfigures? Or, what am I doing wrong in the second code example
> 2) in either of the examples, how can I increase the distance between the top of the plot (imshow) and the bottom of the title?
>
>
> # code example 1: this works
> fig = plt.figure()
> plt.title('Hello')
> plt.imshow(interpolValsRas, cmap=cm.jet, interpolation='nearest', origin = 'lower', extent=[5,95,5,95]) # , 
> plt.scatter(measurementLoc[:,0], measurementLoc[:,1], 10, messwerte, cmap=cm.jet)
> plt.colorbar();
>
>
> # code example 2: this works generally, but only if the second last line is commented out
> # Q: how do I add a scatterplot if I wanted multiple subfigures?
> fig = plt.figure()
> ax = fig.add_subplot(111)
> plt.title('Hello')
> ax.imshow(interpolValsRas, cmap=cm.jet, interpolation='nearest', origin = 'lower', extent=[5,95,5,95]) # , 
> ax.scatter(measurementLoc[:,0], measurementLoc[:,1], 10, messwerte, cmap=cm.jet)
> # plt.colorbar();
> plt.show()
>
> Thanks for your help,
> Claus
> ------------------------------------------------------------------------------
> Download Intel&#174; Parallel Studio Eval
> Try the new software tools for yourself. Speed compiling, find bugs
> proactively, and fine-tune applications for parallel performance.
> See why Intel Parallel Studio got high marks during beta.
> http://p.sf.net/sfu/intel-sw-dev
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
> 
From: Claus <cla...@gm...> - 2010年04月03日 10:56:06
Hi,
I've got two questions: 
1) one is related to colorbar() on multiple subfigures (see code example below): how do I add a scatterplot if I wanted multiple subfigures? Or, what am I doing wrong in the second code example
2) in either of the examples, how can I increase the distance between the top of the plot (imshow) and the bottom of the title?
# code example 1: this works
fig = plt.figure()
plt.title('Hello')
plt.imshow(interpolValsRas, cmap=cm.jet, interpolation='nearest', origin = 'lower', extent=[5,95,5,95]) # , 
plt.scatter(measurementLoc[:,0], measurementLoc[:,1], 10, messwerte, cmap=cm.jet)
plt.colorbar();
# code example 2: this works generally, but only if the second last line is commented out
# Q: how do I add a scatterplot if I wanted multiple subfigures?
fig = plt.figure()
ax = fig.add_subplot(111)
plt.title('Hello')
ax.imshow(interpolValsRas, cmap=cm.jet, interpolation='nearest', origin = 'lower', extent=[5,95,5,95]) # , 
ax.scatter(measurementLoc[:,0], measurementLoc[:,1], 10, messwerte, cmap=cm.jet)
# plt.colorbar();
plt.show()
Thanks for your help,
Claus
From: Gary R. <gr...@bi...> - 2010年04月03日 00:25:53
Attachments: cplot_like.py
Hi Guy,
I am also interested in the answer to this. The cplot function in the 
mpmath module does exactly this using matplotlib, but very 
inefficiently, as it computes the colour of each pixel in the image in 
hls colour-space and generates the corresponding rgb value directly. I 
suspect this is how it has to be done, as colormaps in matplotlib are 1D 
sequences and the black-white (lightness) value is really another 
dimension. However mpmath's method can be improved by doing the mapping 
using array operations instead of computing it for each pixel.
I've attached a function I wrote to reproduce the Sage cplot command in 
my own work. It's a bit old and can be improved. It takes the Arg and 
Abs of a complex array as the first two arguments - you can easily 
change this to compute these inside the function if you prefer. The line
np.vectorize(hls_to_rgb) can be replaced - recent versions of matplotlib 
have a vectorized function called hsv_to_rgb() inside colors.py - so you 
replace the return line with the commented-out version if you first 
import hsv_to_rgb from colors.
I hope this helps.
I'm also curious: the plots you point to also show plots of the function 
"extrema", which are the phase singularities - does mathematica have a 
function that gives you these, or did you write your own function to 
find them?
regards,
Gary
Guy Rutenberg wrote:
> Hi,
> 
> Is there a way to generate colormaps for complex-valued functions using 
> matplotlib? The type of plots I'm looking for are like the plots in:
> http://commons.wikimedia.org/wiki/User:Jan_Homann/Mathematics
> 
> Thanks in advance,
> 
> Guy
From: Andrew K. <ndr...@gm...> - 2010年04月02日 21:49:56
Slow on my OSX machine as well. I also get this strange warning which I
have never seen before (I usually only use MPL on my windows machine).
Warning (from warnings module):
 File
"/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/pytz/__init__.py",
line 29
 from pkg_resources import resource_stream
UserWarning: Module numpy was already imported from
/Library/Frameworks/GDAL.framework/Versions/1.6/Python/site-packages/numpy/__init__.pyc,
but
/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages
is being added to sys.path
On Fri, Apr 2, 2010 at 1:41 PM, Eric Firing <ef...@ha...> wrote:
> Andrew Kelly wrote:
>
>> import pytz only took 0.0 seconds.
>>
>>
>
> Sounds like it was already imported, so you were not really timing that
> import.
>
> On linux (ubuntu 9.10, Lenovo T60 laptop) importing pytz takes longer than
> importing numpy:
>
>
> efiring@manini:~$ time python -c "import pytz"
>
> real 0m0.203s
> user 0m0.144s
> sys 0m0.052s
> efiring@manini:~$ time python -c "import pylab"
>
> real 0m0.626s
> user 0m0.480s
> sys 0m0.124s
>
> efiring@manini:~$ time python -c "import numpy"
>
> real 0m0.113s
> user 0m0.088s
> sys 0m0.020s
>
> (Probably everything is in cache in these tests; repeats yielded similar
> results.)
>
> Eric
>
>
> I actually just ran that pstats module and there is one line that stuck
>> out at me:
>> ncalls tottime percall cumtime percall filename:lineno(function)
>> 1 0.000 0.000 0.000 0.000
>> C:\Python26\lib\os.py:35(_get_exports_list)
>> 560 3.107 0.006 3.107 0.006 {open}
>> That is ~50% of the load time. I have 0 idea what this is though.
>> Let me try this on my os machine.....
>> -Andy
>>
>> On Fri, Apr 2, 2010 at 12:31 PM, Michael Droettboom <md...@st...<mailto:
>> md...@st...>> wrote:
>>
>> It looks like most of the time is being taken up by pytz (timezone
>> library), which opens ~500 files. How does the total time of
>> "import pytz" compare?
>>
>> Mike
>>
>> Andrew Kelly wrote:
>>
>> I see. I was wondering why it spit out a binary file.
>>
>> test.out is attached...
>>
>> -Andy
>>
>> On Fri, Apr 2, 2010 at 10:55 AM, Michael Droettboom
>> <md...@st... <mailto:md...@st...>
>> <mailto:md...@st... <mailto:md...@st...>>> wrote:
>>
>> Can you provide the actual saved profiler data? The output
>> of the
>> command itself doesn't provide enough information to diagnose
>> the
>> problem, since it doesn't have full file paths etc.
>>
>> When you do (thanks Gökhan for the less verbose version):
>>
>> python.exe -c "import cProfile; cProfile.run('import pylab',
>> 'test.out')"
>>
>> this should produce a binary file "test.out" that can be loaded
>> with the pstats module and used by GUI tools such as KCacheGrind
>> to help us get to the bottom of this.
>>
>> Mike
>>
>> Andrew Kelly wrote:
>>
>> I'm back.
>>
>> My backend is wx. "Import wx" does not really take much
>> time
>> to import at all. In fact time.time() before and after =
>> 0.0
>>
>> Some computer details:
>> Processor: AMD Phenom IIx4 810 Processor 2.6 GHz
>> RAM: 8.00 GB
>>
>> As for the cProfiler output on pylab, I have attached the
>> output as test.txt.
>> -Andy
>>
>> On Fri, Apr 2, 2010 at 7:22 AM, Gökhan Sever
>> <gok...@gm... <mailto:gok...@gm...>
>> <mailto:gok...@gm... <mailto:gok...@gm...>>
>> <mailto:gok...@gm...
>> <mailto:gok...@gm...> <mailto:gok...@gm...
>> <mailto:gok...@gm...>>>>
>>
>> wrote:
>>
>>
>>
>> On Fri, Apr 2, 2010 at 8:28 AM, Michael Droettboom
>> <md...@st... <mailto:md...@st...>
>> <mailto:md...@st... <mailto:md...@st...>>
>> <mailto:md...@st... <mailto:md...@st...>
>> <mailto:md...@st... <mailto:md...@st...>>>> wrote:
>>
>> My gut says it's probably the GUI framework import
>> that is
>> dominating
>> the time. Which backend are you using? Does
>> importing it
>> take a large
>> amount of time as well?
>>
>> Can you provide a profiler output file we can examine
>> to narrow it
>> down? The following from a command prompt should be
>> sufficient to write
>> out a file called "import.prof":
>>
>> python.exe -c "import cProfile;
>> prof=cProfile.Profile();
>> prof.run('import pylab', 'import.prof')"
>>
>> Mike
>>
>>
>> Just for the records,
>>
>> It reads as:
>>
>> python -c "import cProfile; cProfile.run('import pylab',
>> filename='test.out')
>>
>> in Python 2.6.2
>>
>> These helped me to load the profile output:
>>
>> import pstats
>> stats = pstats.Stats("test.out")
>> stats.print_stats()
>>
>> -- Gökhan
>>
>>
>> ------------------------------------------------------------------------------
>> Download Intel&#174; Parallel Studio Eval
>> Try the new software tools for yourself. Speed compiling,
>> find bugs
>> proactively, and fine-tune applications for parallel
>> performance.
>> See why Intel Parallel Studio got high marks during beta.
>> http://p.sf.net/sfu/intel-sw-dev
>> _______________________________________________
>> Matplotlib-users mailing list
>> Mat...@li...
>> <mailto:Mat...@li...>
>> <mailto:Mat...@li...
>> <mailto:Mat...@li...>>
>> <mailto:Mat...@li...
>> <mailto:Mat...@li...>
>> <mailto:Mat...@li...
>> <mailto:Mat...@li...>>>
>>
>>
>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>>
>>
>>
>> -- Michael Droettboom
>> Science Software Branch
>> Operations and Engineering Division
>> Space Telescope Science Institute
>> Operated by AURA for NASA
>>
>>
>>
>> -- Michael Droettboom
>> Science Software Branch
>> Operations and Engineering Division
>> Space Telescope Science Institute
>> Operated by AURA for NASA
>>
>>
>>
>> ------------------------------------------------------------------------
>>
>>
>>
>> ------------------------------------------------------------------------------
>> Download Intel&#174; Parallel Studio Eval
>> Try the new software tools for yourself. Speed compiling, find bugs
>> proactively, and fine-tune applications for parallel performance.
>> See why Intel Parallel Studio got high marks during beta.
>> http://p.sf.net/sfu/intel-sw-dev
>>
>>
>> ------------------------------------------------------------------------
>>
>> _______________________________________________
>> Matplotlib-users mailing list
>> Mat...@li...
>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>>
>
>
From: Thomas R. <tho...@gm...> - 2010年04月02日 21:13:43
Hi,
I have been trying to use the Affine2D transformation with pcolor and contour, with no success. The following script and comments illustrates my problems:
matplotlib.use('Agg')
import matplotlib.pyplot as mpl
from matplotlib.transforms import Affine2D
import numpy as np
image = np.random.random((100,100))
fig = mpl.figure()
ax = fig.add_subplot(1,1,1)
ax.pcolor(image, transform=Affine2D()) # Does not work - the image is not there!
fig.savefig('test1.png')
fig = mpl.figure()
ax = fig.add_subplot(1,1,1)
ax.contour(image, transform=Affine2D()) # Ok, but transformation wouldn't change anything anyway
fig.savefig('test2.png')
fig = mpl.figure()
ax = fig.add_subplot(1,1,1)
ax.contour(image, transform=Affine2D().scale(10.,10.)) # Does not work - the image is unchanged
fig.savefig('test3.png')
Is there a reason why transform doesn't work for contour and pcolor?
Thanks for any help,
Thomas
From: Eric F. <ef...@ha...> - 2010年04月02日 20:41:59
Andrew Kelly wrote:
> import pytz only took 0.0 seconds.
> 
Sounds like it was already imported, so you were not really timing that 
import.
On linux (ubuntu 9.10, Lenovo T60 laptop) importing pytz takes longer 
than importing numpy:
efiring@manini:~$ time python -c "import pytz"
real	0m0.203s
user	0m0.144s
sys	0m0.052s
efiring@manini:~$ time python -c "import pylab"
real	0m0.626s
user	0m0.480s
sys	0m0.124s
efiring@manini:~$ time python -c "import numpy"
real	0m0.113s
user	0m0.088s
sys	0m0.020s
(Probably everything is in cache in these tests; repeats yielded similar 
results.)
Eric
> I actually just ran that pstats module and there is one line that stuck 
> out at me:
> ncalls tottime percall cumtime percall filename:lineno(function)
> 1 0.000 0.000 0.000 0.000 
> C:\Python26\lib\os.py:35(_get_exports_list)
> 560 3.107 0.006 3.107 0.006 {open}
> 
> That is ~50% of the load time. I have 0 idea what this is though.
> 
> Let me try this on my os machine.....
> 
> -Andy
> 
> On Fri, Apr 2, 2010 at 12:31 PM, Michael Droettboom <md...@st... 
> <mailto:md...@st...>> wrote:
> 
> It looks like most of the time is being taken up by pytz (timezone
> library), which opens ~500 files. How does the total time of
> "import pytz" compare?
> 
> Mike
> 
> Andrew Kelly wrote:
> 
> I see. I was wondering why it spit out a binary file.
> 
> test.out is attached...
> 
> -Andy
> 
> On Fri, Apr 2, 2010 at 10:55 AM, Michael Droettboom
> <md...@st... <mailto:md...@st...>
> <mailto:md...@st... <mailto:md...@st...>>> wrote:
> 
> Can you provide the actual saved profiler data? The output
> of the
> command itself doesn't provide enough information to diagnose the
> problem, since it doesn't have full file paths etc.
> 
> When you do (thanks Gökhan for the less verbose version):
> 
> python.exe -c "import cProfile; cProfile.run('import pylab',
> 'test.out')"
> 
> this should produce a binary file "test.out" that can be loaded
> with the pstats module and used by GUI tools such as KCacheGrind
> to help us get to the bottom of this.
> 
> Mike
> 
> Andrew Kelly wrote:
> 
> I'm back.
> 
> My backend is wx. "Import wx" does not really take much time
> to import at all. In fact time.time() before and after = 0.0
> 
> Some computer details:
> Processor: AMD Phenom IIx4 810 Processor 2.6 GHz
> RAM: 8.00 GB
> 
> As for the cProfiler output on pylab, I have attached the
> output as test.txt.
> -Andy
> 
> On Fri, Apr 2, 2010 at 7:22 AM, Gökhan Sever
> <gok...@gm... <mailto:gok...@gm...>
> <mailto:gok...@gm... <mailto:gok...@gm...>>
> <mailto:gok...@gm...
> <mailto:gok...@gm...> <mailto:gok...@gm...
> <mailto:gok...@gm...>>>>
> 
> wrote:
> 
> 
> 
> On Fri, Apr 2, 2010 at 8:28 AM, Michael Droettboom
> <md...@st... <mailto:md...@st...>
> <mailto:md...@st... <mailto:md...@st...>>
> <mailto:md...@st... <mailto:md...@st...>
> <mailto:md...@st... <mailto:md...@st...>>>> wrote:
> 
> My gut says it's probably the GUI framework import
> that is
> dominating
> the time. Which backend are you using? Does
> importing it
> take a large
> amount of time as well?
> 
> Can you provide a profiler output file we can examine
> to narrow it
> down? The following from a command prompt should be
> sufficient to write
> out a file called "import.prof":
> 
> python.exe -c "import cProfile;
> prof=cProfile.Profile();
> prof.run('import pylab', 'import.prof')"
> 
> Mike
> 
> 
> Just for the records,
> 
> It reads as:
> 
> python -c "import cProfile; cProfile.run('import pylab',
> filename='test.out')
> 
> in Python 2.6.2
> 
> These helped me to load the profile output:
> 
> import pstats
> stats = pstats.Stats("test.out")
> stats.print_stats()
> 
> -- Gökhan
> 
> 
> ------------------------------------------------------------------------------
> Download Intel&#174; Parallel Studio Eval
> Try the new software tools for yourself. Speed compiling,
> find bugs
> proactively, and fine-tune applications for parallel
> performance.
> See why Intel Parallel Studio got high marks during beta.
> http://p.sf.net/sfu/intel-sw-dev
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> <mailto:Mat...@li...>
> <mailto:Mat...@li...
> <mailto:Mat...@li...>>
> <mailto:Mat...@li...
> <mailto:Mat...@li...>
> <mailto:Mat...@li...
> <mailto:Mat...@li...>>>
> 
> 
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
> 
> 
> 
> -- Michael Droettboom
> Science Software Branch
> Operations and Engineering Division
> Space Telescope Science Institute
> Operated by AURA for NASA
> 
> 
> 
> -- 
> Michael Droettboom
> Science Software Branch
> Operations and Engineering Division
> Space Telescope Science Institute
> Operated by AURA for NASA
> 
> 
> 
> ------------------------------------------------------------------------
> 
> ------------------------------------------------------------------------------
> Download Intel&#174; Parallel Studio Eval
> Try the new software tools for yourself. Speed compiling, find bugs
> proactively, and fine-tune applications for parallel performance.
> See why Intel Parallel Studio got high marks during beta.
> http://p.sf.net/sfu/intel-sw-dev
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
From: Andrew K. <ndr...@gm...> - 2010年04月02日 20:00:02
import pytz only took 0.0 seconds.
I actually just ran that pstats module and there is one line that stuck out
at me:
 ncalls tottime percall cumtime percall filename:lineno(function)
 1 0.000 0.000 0.000 0.000
C:\Python26\lib\os.py:35(_get_exports_list)
 560 3.107 0.006 3.107 0.006 {open}
That is ~50% of the load time. I have 0 idea what this is though.
Let me try this on my os machine.....
-Andy
On Fri, Apr 2, 2010 at 12:31 PM, Michael Droettboom <md...@st...> wrote:
> It looks like most of the time is being taken up by pytz (timezone
> library), which opens ~500 files. How does the total time of "import pytz"
> compare?
>
> Mike
>
> Andrew Kelly wrote:
>
>> I see. I was wondering why it spit out a binary file.
>>
>> test.out is attached...
>>
>> -Andy
>>
>> On Fri, Apr 2, 2010 at 10:55 AM, Michael Droettboom <md...@st...<mailto:
>> md...@st...>> wrote:
>>
>> Can you provide the actual saved profiler data? The output of the
>> command itself doesn't provide enough information to diagnose the
>> problem, since it doesn't have full file paths etc.
>>
>> When you do (thanks Gökhan for the less verbose version):
>>
>> python.exe -c "import cProfile; cProfile.run('import pylab',
>> 'test.out')"
>>
>> this should produce a binary file "test.out" that can be loaded
>> with the pstats module and used by GUI tools such as KCacheGrind
>> to help us get to the bottom of this.
>>
>> Mike
>>
>> Andrew Kelly wrote:
>>
>> I'm back.
>>
>> My backend is wx. "Import wx" does not really take much time
>> to import at all. In fact time.time() before and after = 0.0
>>
>> Some computer details:
>> Processor: AMD Phenom IIx4 810 Processor 2.6 GHz
>> RAM: 8.00 GB
>>
>> As for the cProfiler output on pylab, I have attached the
>> output as test.txt.
>> -Andy
>>
>> On Fri, Apr 2, 2010 at 7:22 AM, Gökhan Sever
>> <gok...@gm... <mailto:gok...@gm...>
>> <mailto:gok...@gm... <mailto:gok...@gm...>>>
>>
>> wrote:
>>
>>
>>
>> On Fri, Apr 2, 2010 at 8:28 AM, Michael Droettboom
>> <md...@st... <mailto:md...@st...>
>> <mailto:md...@st... <mailto:md...@st...>>> wrote:
>>
>> My gut says it's probably the GUI framework import that is
>> dominating
>> the time. Which backend are you using? Does importing it
>> take a large
>> amount of time as well?
>>
>> Can you provide a profiler output file we can examine
>> to narrow it
>> down? The following from a command prompt should be
>> sufficient to write
>> out a file called "import.prof":
>>
>> python.exe -c "import cProfile; prof=cProfile.Profile();
>> prof.run('import pylab', 'import.prof')"
>>
>> Mike
>>
>>
>> Just for the records,
>>
>> It reads as:
>>
>> python -c "import cProfile; cProfile.run('import pylab',
>> filename='test.out')
>>
>> in Python 2.6.2
>>
>> These helped me to load the profile output:
>>
>> import pstats
>> stats = pstats.Stats("test.out")
>> stats.print_stats()
>>
>> -- Gökhan
>>
>>
>> ------------------------------------------------------------------------------
>> Download Intel&#174; Parallel Studio Eval
>> Try the new software tools for yourself. Speed compiling,
>> find bugs
>> proactively, and fine-tune applications for parallel
>> performance.
>> See why Intel Parallel Studio got high marks during beta.
>> http://p.sf.net/sfu/intel-sw-dev
>> _______________________________________________
>> Matplotlib-users mailing list
>> Mat...@li...
>> <mailto:Mat...@li...>
>> <mailto:Mat...@li...
>> <mailto:Mat...@li...>>
>>
>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>>
>>
>>
>> -- Michael Droettboom
>> Science Software Branch
>> Operations and Engineering Division
>> Space Telescope Science Institute
>> Operated by AURA for NASA
>>
>>
>>
> --
> Michael Droettboom
> Science Software Branch
> Operations and Engineering Division
> Space Telescope Science Institute
> Operated by AURA for NASA
>
>
From: Michael D. <md...@st...> - 2010年04月02日 19:31:59
It looks like most of the time is being taken up by pytz (timezone 
library), which opens ~500 files. How does the total time of "import 
pytz" compare?
Mike
Andrew Kelly wrote:
> I see. I was wondering why it spit out a binary file.
>
> test.out is attached...
>
> -Andy
>
> On Fri, Apr 2, 2010 at 10:55 AM, Michael Droettboom <md...@st... 
> <mailto:md...@st...>> wrote:
>
> Can you provide the actual saved profiler data? The output of the
> command itself doesn't provide enough information to diagnose the
> problem, since it doesn't have full file paths etc.
>
> When you do (thanks Gökhan for the less verbose version):
>
> python.exe -c "import cProfile; cProfile.run('import pylab',
> 'test.out')"
>
> this should produce a binary file "test.out" that can be loaded
> with the pstats module and used by GUI tools such as KCacheGrind
> to help us get to the bottom of this.
>
> Mike
>
> Andrew Kelly wrote:
>
> I'm back.
>
> My backend is wx. "Import wx" does not really take much time
> to import at all. In fact time.time() before and after = 0.0
>
> Some computer details:
> Processor: AMD Phenom IIx4 810 Processor 2.6 GHz
> RAM: 8.00 GB
>
> As for the cProfiler output on pylab, I have attached the
> output as test.txt.
> -Andy
>
> On Fri, Apr 2, 2010 at 7:22 AM, Gökhan Sever
> <gok...@gm... <mailto:gok...@gm...>
> <mailto:gok...@gm... <mailto:gok...@gm...>>>
> wrote:
>
>
>
> On Fri, Apr 2, 2010 at 8:28 AM, Michael Droettboom
> <md...@st... <mailto:md...@st...>
> <mailto:md...@st... <mailto:md...@st...>>> wrote:
>
> My gut says it's probably the GUI framework import that is
> dominating
> the time. Which backend are you using? Does importing it
> take a large
> amount of time as well?
>
> Can you provide a profiler output file we can examine
> to narrow it
> down? The following from a command prompt should be
> sufficient to write
> out a file called "import.prof":
>
> python.exe -c "import cProfile; prof=cProfile.Profile();
> prof.run('import pylab', 'import.prof')"
>
> Mike
>
>
> Just for the records,
>
> It reads as:
>
> python -c "import cProfile; cProfile.run('import pylab',
> filename='test.out')
>
> in Python 2.6.2
>
> These helped me to load the profile output:
>
> import pstats
> stats = pstats.Stats("test.out")
> stats.print_stats()
>
> -- Gökhan
>
> 
> ------------------------------------------------------------------------------
> Download Intel&#174; Parallel Studio Eval
> Try the new software tools for yourself. Speed compiling,
> find bugs
> proactively, and fine-tune applications for parallel
> performance.
> See why Intel Parallel Studio got high marks during beta.
> http://p.sf.net/sfu/intel-sw-dev
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> <mailto:Mat...@li...>
> <mailto:Mat...@li...
> <mailto:Mat...@li...>>
>
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>
>
> -- 
> Michael Droettboom
> Science Software Branch
> Operations and Engineering Division
> Space Telescope Science Institute
> Operated by AURA for NASA
>
>
-- 
Michael Droettboom
Science Software Branch
Operations and Engineering Division
Space Telescope Science Institute
Operated by AURA for NASA
From: Michael D. <md...@st...> - 2010年04月02日 17:55:56
Can you provide the actual saved profiler data? The output of the 
command itself doesn't provide enough information to diagnose the 
problem, since it doesn't have full file paths etc.
When you do (thanks Gökhan for the less verbose version):
 python.exe -c "import cProfile; cProfile.run('import pylab', 'test.out')"
this should produce a binary file "test.out" that can be loaded with the 
pstats module and used by GUI tools such as KCacheGrind to help us get 
to the bottom of this.
Mike
Andrew Kelly wrote:
> I'm back.
>
> My backend is wx. "Import wx" does not really take much time to 
> import at all. In fact time.time() before and after = 0.0
>
> Some computer details:
> Processor: AMD Phenom IIx4 810 Processor 2.6 GHz
> RAM: 8.00 GB
>
> As for the cProfiler output on pylab, I have attached the output as 
> test.txt.
> 
> -Andy
>
> On Fri, Apr 2, 2010 at 7:22 AM, Gökhan Sever <gok...@gm... 
> <mailto:gok...@gm...>> wrote:
>
>
>
> On Fri, Apr 2, 2010 at 8:28 AM, Michael Droettboom
> <md...@st... <mailto:md...@st...>> wrote:
>
> My gut says it's probably the GUI framework import that is
> dominating
> the time. Which backend are you using? Does importing it
> take a large
> amount of time as well?
>
> Can you provide a profiler output file we can examine to narrow it
> down? The following from a command prompt should be
> sufficient to write
> out a file called "import.prof":
>
> python.exe -c "import cProfile; prof=cProfile.Profile();
> prof.run('import pylab', 'import.prof')"
>
> Mike
>
>
> Just for the records,
>
> It reads as:
>
> python -c "import cProfile; cProfile.run('import pylab',
> filename='test.out')
>
> in Python 2.6.2
>
> These helped me to load the profile output:
>
> import pstats
> stats = pstats.Stats("test.out")
> stats.print_stats()
>
> -- 
> Gökhan
>
> ------------------------------------------------------------------------------
> Download Intel&#174; Parallel Studio Eval
> Try the new software tools for yourself. Speed compiling, find bugs
> proactively, and fine-tune applications for parallel performance.
> See why Intel Parallel Studio got high marks during beta.
> http://p.sf.net/sfu/intel-sw-dev
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> <mailto:Mat...@li...>
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>
-- 
Michael Droettboom
Science Software Branch
Operations and Engineering Division
Space Telescope Science Institute
Operated by AURA for NASA
From: Eric F. <ef...@ha...> - 2010年04月02日 17:01:35
Bruce Ford wrote:
> Below is the example script (sorry!). I've tried all three methods of
> establishing a colormap to no avail. The most promising looked like
> option 2, but that gave me the "AttributeError: 'module' object has no
> attribute 'register_cmap'" error.
> 
> I'm getting this error with:
> Python 2.4 (user requirement because this application I'm building
> will live on a RHEL5 server)
> matplotlib 0.99.1.1
> numpy 1.3.0
> 
> Could this be a versioning issue?
Yes, register_cmap is quite new--but it is just a convenience, and not 
at all necessary. Use of a custom cmap without register_cmap is 
illustrated in the first subplot of the example; you could modify the 
example so that all of the subplots are made without register_cmap.
Eric
> 
> Bruce
> 
> #!/usr/bin/env python
> 
> import numpy as np
> import matplotlib.pyplot as plt
> from matplotlib.colors import LinearSegmentedColormap
> 
> """
> 
> Example: suppose you want red to increase from 0 to 1 over the bottom
> half, green to do the same over the middle half, and blue over the top
> half. Then you would use:
> 
> cdict = {'red': ((0.0, 0.0, 0.0),
> (0.5, 1.0, 1.0),
> (1.0, 1.0, 1.0)),
> 
> 'green': ((0.0, 0.0, 0.0),
> (0.25, 0.0, 0.0),
> (0.75, 1.0, 1.0),
> (1.0, 1.0, 1.0)),
> 
> 'blue': ((0.0, 0.0, 0.0),
> (0.5, 0.0, 0.0),
> (1.0, 1.0, 1.0))}
> 
> If, as in this example, there are no discontinuities in the r, g, and b
> components, then it is quite simple: the second and third element of
> each tuple, above, is the same--call it "y". The first element ("x")
> defines interpolation intervals over the full range of 0 to 1, and it
> must span that whole range. In other words, the values of x divide the
> 0-to-1 range into a set of segments, and y gives the end-point color
> values for each segment.
> 
> Now consider the green. cdict['green'] is saying that for
> 0 <= x <= 0.25, y is zero; no green.
> 0.25 < x <= 0.75, y varies linearly from 0 to 1.
> x > 0.75, y remains at 1, full green.
> 
> If there are discontinuities, then it is a little more complicated.
> Label the 3 elements in each row in the cdict entry for a given color as
> (x, y0, y1). Then for values of x between x[i] and x[i+1] the color
> value is interpolated between y1[i] and y0[i+1].
> 
> Going back to the cookbook example, look at cdict['red']; because y0 !=
> y1, it is saying that for x from 0 to 0.5, red increases from 0 to 1,
> but then it jumps down, so that for x from 0.5 to 1, red increases from
> 0.7 to 1. Green ramps from 0 to 1 as x goes from 0 to 0.5, then jumps
> back to 0, and ramps back to 1 as x goes from 0.5 to 1.
> 
> row i: x y0 y1
> /
> /
> row i+1: x y0 y1
> 
> Above is an attempt to show that for x in the range x[i] to x[i+1], the
> interpolation is between y1[i] and y0[i+1]. So, y0[0] and y1[-1] are
> never used.
> 
> """
> 
> 
> 
> cdict1 = {'red': ((0.0, 0.0, 0.0),
> (0.5, 0.0, 0.1),
> (1.0, 1.0, 1.0)),
> 
> 'green': ((0.0, 0.0, 0.0),
> (1.0, 0.0, 0.0)),
> 
> 'blue': ((0.0, 0.0, 1.0),
> (0.5, 0.1, 0.0),
> (1.0, 0.0, 0.0))
> }
> 
> cdict2 = {'red': ((0.0, 0.0, 0.0),
> (0.5, 0.0, 1.0),
> (1.0, 0.1, 1.0)),
> 
> 'green': ((0.0, 0.0, 0.0),
> (1.0, 0.0, 0.0)),
> 
> 'blue': ((0.0, 0.0, 0.1),
> (0.5, 1.0, 0.0),
> (1.0, 0.0, 0.0))
> }
> 
> cdict3 = {'red': ((0.0, 0.0, 0.0),
> (0.25,0.0, 0.0),
> (0.5, 0.8, 1.0),
> (0.75,1.0, 1.0),
> (1.0, 0.4, 1.0)),
> 
> 'green': ((0.0, 0.0, 0.0),
> (0.25,0.0, 0.0),
> (0.5, 0.9, 0.9),
> (0.75,0.0, 0.0),
> (1.0, 0.0, 0.0)),
> 
> 'blue': ((0.0, 0.0, 0.4),
> (0.25,1.0, 1.0),
> (0.5, 1.0, 0.8),
> (0.75,0.0, 0.0),
> (1.0, 0.0, 0.0))
> }
> 
> # Now we will use this example to illustrate 3 ways of
> # handling custom colormaps.
> # First, the most direct and explicit:
> 
> blue_red1 = LinearSegmentedColormap('BlueRed1', cdict1)
> 
> # Second, create the map explicitly and register it.
> # Like the first method, this method works with any kind
> # of Colormap, not just
> # a LinearSegmentedColormap:
> 
> blue_red2 = LinearSegmentedColormap('BlueRed2', cdict2)
> plt.register_cmap(cmap=blue_red2)
> 
> # Third, for LinearSegmentedColormap only,
> # leave everything to register_cmap:
> 
> plt.register_cmap(name='BlueRed3', data=cdict3) # optional lut kwarg
> 
> x = np.arange(0, np.pi, 0.1)
> y = np.arange(0, 2*np.pi, 0.1)
> X, Y = np.meshgrid(x,y)
> Z = np.cos(X) * np.sin(Y)
> 
> plt.figure(figsize=(10,4))
> plt.subplots_adjust(wspace=0.3)
> 
> plt.subplot(1,3,1)
> plt.imshow(Z, interpolation='nearest', cmap=blue_red1)
> plt.colorbar()
> 
> plt.subplot(1,3,2)
> cmap = plt.get_cmap('BlueRed2')
> plt.imshow(Z, interpolation='nearest', cmap=cmap)
> plt.colorbar()
> 
> # Now we will set the third cmap as the default. One would
> # not normally do this in the middle of a script like this;
> # it is done here just to illustrate the method.
> 
> plt.rcParams['image.cmap'] = 'BlueRed3'
> 
> # Also see below for an alternative, particularly for
> # interactive use.
> 
> plt.subplot(1,3,3)
> plt.imshow(Z, interpolation='nearest')
> plt.colorbar()
> 
> # Or as yet another variation, we could replace the rcParams
> # specification *before* the imshow with the following *after*
> # imshow:
> #
> # plt.set_cmap('BlueRed3')
> #
> # This sets the new default *and* sets the colormap of the last
> # image-like item plotted via pyplot, if any.
> 
> 
> plt.suptitle('Custom Blue-Red colormaps')
> 
> plt.show()
> ---------------------------------------
> Bruce W. Ford
> Clear Science, Inc.
> br...@cl...
> bru...@na...
> http://www.ClearScienceInc.com
> Phone/Fax: 904-379-9704
> 8241 Parkridge Circle N.
> Jacksonville, FL 32211
> Skype: bruce.w.ford
> Google Talk: fo...@gm...
> 
> 
> 
> On Thu, Apr 1, 2010 at 6:30 PM, Chloe Lewis <ch...@be...> wrote:
>> The example works for me; Python 2.6.4 (recent Enthought install).
>>
>> Can you use your new colormap without registering it?
>>
>> &C
>>
>> On Apr 1, 2010, at 1 Apr, 2:14 PM, Bruce Ford wrote:
>>
>>> I'm running into walls trying to create a custom cmap.
>>>
>>> Running the example custom_cmap.py unchanged, I get :
>>>
>>> AttributeError: 'module' object has no attribute 'register_cmap'
>>> args = ("'module' object has no attribute 'register_cmap'",)
>>>
>>> I've included custom_cmap.py below. It's a major shortcoming that
>>> there is not a suitable anomaly cmap (with white about the middle).
>>> Please consider this for an addition.
>>>
>>> Anyway, what am I missing with this error? Thanks so much!
>>>
>>> Bruce
>>> ---------------------------------------
>>> Bruce W. Ford
>>> Clear Science, Inc.
>>> br...@cl...
>>> http://www.ClearScienceInc.com
>>> Phone/Fax: 904-379-9704
>>> 8241 Parkridge Circle N.
>>> Jacksonville, FL 32211
>>> Skype: bruce.w.ford
>>> Google Talk: fo...@gm...
>>>
>>>
>>> ------------------------------------------------------------------------------
>>> Download Intel&#174; Parallel Studio Eval
>>> Try the new software tools for yourself. Speed compiling, find bugs
>>> proactively, and fine-tune applications for parallel performance.
>>> See why Intel Parallel Studio got high marks during beta.
>>> http://p.sf.net/sfu/intel-sw-dev
>>> _______________________________________________
>>> Matplotlib-users mailing list
>>> Mat...@li...
>>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>>
>> Chloe Lewis
>> Graduate student, Amundson Lab
>> Ecosystem Sciences
>> 137 Mulford Hall
>> Berkeley, CA 94720-3114
>> http://nature.berkeley.edu/~chlewis
>>
>>
>>
>>
>>
>>
>>
>>
> 
> ------------------------------------------------------------------------------
> Download Intel&#174; Parallel Studio Eval
> Try the new software tools for yourself. Speed compiling, find bugs
> proactively, and fine-tune applications for parallel performance.
> See why Intel Parallel Studio got high marks during beta.
> http://p.sf.net/sfu/intel-sw-dev
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
From: Thomas R. <tho...@gm...> - 2010年04月02日 15:44:47
I just tried running epstopdf, and this does work correctly, so maybe now the only issue is that Preview.app on mac always uses pstopdf, even for eps files? (which then is not a matplotlib issue) I also checked that giving the file the extension '.ps' produces a ps file, and that does open correctly in Preview.app.
Cheers,
Tom
On Apr 2, 2010, at 11:20 AM, Michael Droettboom wrote:
> At least on my Linux box with gs 7.07, I have to use epstopdf (not pstopdf) to convert an eps file to a pdf. ps2pdf does work for both .ps and .eps files however.
> 
> It looks like the 0.99.1.1 file is not in fact an .eps file, but a .ps file, (it certainly hasn't had the ps2eps function run on it) and I think it was probably a bug (now fixed) that 0.99.1.1 was writing out the wrong kind of file. 
> It seems the relevant change is in r8102: "fix some issues in the bbox after the postscript distiller is run". This change removed a commented out call to ps2eps. I'm a bit out of my depth here as to why that change was made, and why .eps files seemingly haven't been true .eps files for a long time prior to that change. Anyone else?
> 
> Mike
> 
> Thomas Robitaille wrote:
>> It seems that removing 'restore' on line 1073 of the test_tex_r8216.eps file fixes the problem, although I don't understand postscript well enough to understand why that is.
>> 
>> Thomas
>> 
>> On Apr 2, 2010, at 9:30 AM, Michael Droettboom wrote:
>> 
>> 
>>> Can you provide us with the EPS file? What version of LaTeX is this?
>>> 
>>> Mike
>>> 
>>> Thomas Robitaille wrote:
>>> 
>>>> Hello,
>>>> 
>>>> I upgraded to the latest svn version of matplotlib today, and found that eps files produced with the system latex now seem to be invalid. For example, if I run the following script
>>>> 
>>>> import matplotlib
>>>> matplotlib.use('Agg')
>>>> import matplotlib.pyplot as mpl
>>>> 
>>>> mpl.rc('text', usetex=False)
>>>> 
>>>> fig = mpl.figure()
>>>> ax = fig.add_subplot(1,1,1)
>>>> fig.savefig('test_notex.eps')
>>>> 
>>>> mpl.rc('text', usetex=True)
>>>> 
>>>> fig = mpl.figure()
>>>> ax = fig.add_subplot(1,1,1)
>>>> fig.savefig('test_tex.eps')
>>>> 
>>>> and try running pstopdf on them (on MacOS 10.6) I get the following
>>>> 
>>>> air:air tom$ pstopdf test_tex.eps %%[ Warning: Empty job. No PDF file produced. ] %%
>>>> air:air tom$ pstopdf test_notex.eps air:air tom$ So the file with the system LaTeX enabled no longer works. ps2pdf still works, but the error with pstopdf is important, because for example Preview.app on mac relies on pstopdf, not ps2pdf.
>>>> 
>>>> I tried this on two different computers under MacOS 10.6, and tried with ghostscript 8.70 and 8.71 installed, and the problem occurs either way.
>>>> 
>>>> Does anyone know what might be causing this? I submitted a bug report a little while back about this
>>>> 
>>>> https://sourceforge.net/tracker/?func=detail&aid=2974953&group_id=80706&atid=560720
>>>> 
>>>> Thanks in advance for any help,
>>>> 
>>>> Thomas
>>>> 
>>>> 
>>>> 
>>>> 
>>>> 
>>>> ------------------------------------------------------------------------------
>>>> Download Intel&#174; Parallel Studio Eval
>>>> Try the new software tools for yourself. Speed compiling, find bugs
>>>> proactively, and fine-tune applications for parallel performance.
>>>> See why Intel Parallel Studio got high marks during beta.
>>>> http://p.sf.net/sfu/intel-sw-dev
>>>> _______________________________________________
>>>> Matplotlib-users mailing list
>>>> Mat...@li...
>>>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>>>> 
>>> -- 
>>> Michael Droettboom
>>> Science Software Branch
>>> Operations and Engineering Division
>>> Space Telescope Science Institute
>>> Operated by AURA for NASA
>>> 
>>> 
>> 
>> 
> 
> -- 
> Michael Droettboom
> Science Software Branch
> Operations and Engineering Division
> Space Telescope Science Institute
> Operated by AURA for NASA
> 
From: Michael D. <md...@st...> - 2010年04月02日 15:20:34
At least on my Linux box with gs 7.07, I have to use epstopdf (not 
pstopdf) to convert an eps file to a pdf. ps2pdf does work for both .ps 
and .eps files however.
It looks like the 0.99.1.1 file is not in fact an .eps file, but a .ps 
file, (it certainly hasn't had the ps2eps function run on it) and I 
think it was probably a bug (now fixed) that 0.99.1.1 was writing out 
the wrong kind of file. 
It seems the relevant change is in r8102: "fix some issues in the bbox 
after the postscript distiller is run". This change removed a commented 
out call to ps2eps. I'm a bit out of my depth here as to why that 
change was made, and why .eps files seemingly haven't been true .eps 
files for a long time prior to that change. Anyone else?
Mike
Thomas Robitaille wrote:
> It seems that removing 'restore' on line 1073 of the test_tex_r8216.eps file fixes the problem, although I don't understand postscript well enough to understand why that is.
>
> Thomas
>
> On Apr 2, 2010, at 9:30 AM, Michael Droettboom wrote:
>
> 
>> Can you provide us with the EPS file? What version of LaTeX is this?
>>
>> Mike
>>
>> Thomas Robitaille wrote:
>> 
>>> Hello,
>>>
>>> I upgraded to the latest svn version of matplotlib today, and found that eps files produced with the system latex now seem to be invalid. For example, if I run the following script
>>>
>>> import matplotlib
>>> matplotlib.use('Agg')
>>> import matplotlib.pyplot as mpl
>>>
>>> mpl.rc('text', usetex=False)
>>>
>>> fig = mpl.figure()
>>> ax = fig.add_subplot(1,1,1)
>>> fig.savefig('test_notex.eps')
>>>
>>> mpl.rc('text', usetex=True)
>>>
>>> fig = mpl.figure()
>>> ax = fig.add_subplot(1,1,1)
>>> fig.savefig('test_tex.eps')
>>>
>>> and try running pstopdf on them (on MacOS 10.6) I get the following
>>>
>>> air:air tom$ pstopdf test_tex.eps %%[ Warning: Empty job. No PDF file produced. ] %%
>>> air:air tom$ pstopdf test_notex.eps air:air tom$ 
>>> So the file with the system LaTeX enabled no longer works. ps2pdf still works, but the error with pstopdf is important, because for example Preview.app on mac relies on pstopdf, not ps2pdf.
>>>
>>> I tried this on two different computers under MacOS 10.6, and tried with ghostscript 8.70 and 8.71 installed, and the problem occurs either way.
>>>
>>> Does anyone know what might be causing this? I submitted a bug report a little while back about this
>>>
>>> https://sourceforge.net/tracker/?func=detail&aid=2974953&group_id=80706&atid=560720
>>>
>>> Thanks in advance for any help,
>>>
>>> Thomas
>>>
>>>
>>>
>>>
>>>
>>> ------------------------------------------------------------------------------
>>> Download Intel&#174; Parallel Studio Eval
>>> Try the new software tools for yourself. Speed compiling, find bugs
>>> proactively, and fine-tune applications for parallel performance.
>>> See why Intel Parallel Studio got high marks during beta.
>>> http://p.sf.net/sfu/intel-sw-dev
>>> _______________________________________________
>>> Matplotlib-users mailing list
>>> Mat...@li...
>>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>>> 
>>> 
>> -- 
>> Michael Droettboom
>> Science Software Branch
>> Operations and Engineering Division
>> Space Telescope Science Institute
>> Operated by AURA for NASA
>>
>> 
>
> 
-- 
Michael Droettboom
Science Software Branch
Operations and Engineering Division
Space Telescope Science Institute
Operated by AURA for NASA
25 messages has been excluded from this view by a project administrator.

Showing results of 407

<< < 1 .. 12 13 14 15 16 17 > >> (Page 14 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 によって変換されたページ (->オリジナル) /