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





Showing 9 results of 9

From: Michael H. <mh...@us...> - 2008年03月13日 22:31:06
I realize I was probably too wordy the first time I posted this:
Does anyone know how to specify arbitrary colors to the fill() function?
None of the following methods I tried seemed to work:
ax.fill(array([0.25,0.75,0.75,0.25,0.25]),array 
([0.75,0.75,0.25,0.25,0.75]),'#FF0000')
ax.fill(array([0.25,0.75,0.75,0.25,0.25]),array 
([0.75,0.75,0.25,0.25,0.75]),color='#FF0000')
ax.fill(array([0.25,0.75,0.75,0.25,0.25]),array 
([0.75,0.75,0.25,0.25,0.75]),color=(1,0,0))
Thanks,
Mike Hearne
------------------------------------------------------
Michael Hearne
mh...@us...
(303) 273-8620
USGS National Earthquake Information Center
1711 Illinois St. Golden CO 80401
Senior Software Engineer
Synergetics, Inc.
------------------------------------------------------
From: Rich F. <wha...@fs...> - 2008年03月13日 18:08:46
I'm plotting some grid data using pcolor, and trying to get canvas pixel 
locations of data points using the
ax.transData.xy_tup()
method. I am saving these figures to PNG files using the default Agg 
backend. When I open these images up in Gimp and check the pixel 
locations, the X pixel locations are accurate, but the Y pixel locations 
I am getting from matplotlib seem to be exaggerated the further away 
from Y=0 I go. Am I using this method incorrectly? Could this be an 
artifact of the rendering to PNG?
Thanks,
Rich
From: Zachary P. <zac...@ya...> - 2008年03月13日 18:07:49
Hi Stephane,
[CC'd to the matplotlib-users list in case others will find this 
useful.]
> I got the same problem.
> Can you tell me where you specified the -Os option to gcc to escape 
> the problem?
So the compile that command that failed is printed right above the 
error message it generated. (The long line that starts with 
'gcc' ...). I just copied this command, edited the -O3 to an -Os, and 
pasted that command-line back into the terminal. Total low-tech hack, 
as I didn't want to much with the setup.py file to fix compile flags 
on a per-file basis.
After that file is compiled manually, you can re-run 'python setup.py 
build', and it will start up at the next step after the error.
I got the same error in another step, which was a bit trickier to fix, 
because for some reason, src/_image.cpp gets copied to src/image.cpp 
on a temporary basis, and then compiled. (I presume the file isn't 
also modified?) But after the compile errors out, the copy is deleted, 
so just pasting in the offending gcc command doesn't work. So I had to 
manually copy src/_image.cpp to scr/image.cpp, and then paste in the 
modified gcc command.
Ugh! I'd really love some help reducing this to a test case that I can 
send to Apple.
Zach
On Mar 13, 2008, at 12:16 PM, Stephane Raynaud wrote:
> Hi,
>
> I got the same problem.
> Can you tell me where you specified the -Os option to gcc to escape 
> the problem?
>
>
> On Mon, Mar 10, 2008 at 4:35 AM, Zachary Pincus <zac...@ya... 
> > wrote:
>> Hello,
>>
>> I just tried to compile the SVN head of matplotlib (r4994) from 
>> source
>> on OS X 10.5.2 (with source builds of python 2.5.2 and the SVN head 
>> of
>> numpy), and ran into an "internal compiler error" in the agg code.
>> (pkgconfig 0.23 and wxPython 2.8.7.1 also present and accounted for.)
>>
>> Here's the compile line and error:
>>> building 'matplotlib.backends._backend_agg' extension
>>> gcc -fno-strict-aliasing -Wno-long-double -no-cpp-precomp -mno- 
>>> fused-
>>> madd -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-
>>> prototypes -I/Library/Frameworks/Python.framework/Versions/2.5/lib/
>>> python2.5/site-packages/numpy/core/include -I/usr/X11/include/
>>> libpng12 -I/usr/local/include -I/usr/include -I/usr/X11R6/include -
>>> I. -I/Library/Frameworks/Python.framework/Versions/2.5/lib/ 
>>> python2.5/
>>> site-packages/numpy/core/include -Isrc -Iagg24/include -I. -I/usr/
>>> X11/include/freetype2 -I/usr/X11/include -I/usr/local/include -I/ 
>>> usr/
>>> include -I/usr/X11R6/include -I. -I/Library/Frameworks/
>>> Python.framework/Versions/2.5/include/python2.5 -c src/_image.cpp -o
>>> build/temp.macosx-10.4-i386-2.5/src/_image.o
>>> cc1plus: warning: command line option "-Wstrict-prototypes" is valid
>>> for C/ObjC but not for C++
>>> src/_image.cpp: In member function 'Py::Object
>>> _image_module::from_images(const Py::Tuple&)':
>>> src/_image.cpp:842: error: insn does not satisfy its constraints:
>>> (insn 2573 1070 2574 126 agg24/include/agg_color_rgba.h:268 (set
>>> (mem:QI (plus:SI (reg/f:SI 6 bp)
>>> (const_int -280 [0xfffffffffffffee8])) [0 SR.2969+0
>>> S1 A8])
>>> (reg:QI 5 di)) 56 {*movqi_1} (nil)
>>> (nil))
>>> src/_image.cpp:842: internal compiler error: in
>>> reload_cse_simplify_operands, at postreload.c:391
>>> Please submit a full bug report, with preprocessed source if
>>> appropriate.
>>> See <URL:http://developer.apple.com/bugreporter> for instructions.
>>
>> This seems to be an agg and OS X error; it's cropped up here:
>> http://trac.osgeo.org/mapserver/ticket/2368
>> and John Hunter reported it on the agg list here:
>> http://article.gmane.org/gmane.comp.graphics.agg/3963
>>
>> Unfortunately, the error appears to either not have been fixed by the
>> 10.5.1 update, as suggested in the email thread cited above, or the
>> error re-appeared in 10.5.2.
>>
>> Changing the optimization flag from -O3 to -Os and compiling
>> _image.cpp manually (along with copying src/_image.cpp to src/
>> image.cpp and compiling that manually in the same way) allowed me to
>> finish building matplotlib, but clearly an optimized agg image 
>> library
>> is pretty important... (-O2 didn't work...)
>>
>> Anyone have any idea at all about this error? Or is just turning 
>> off -
>> O3 for this file the best thing to do until Apple fixes the compiler
>> bug? Does anyone who knows more about agg than I want to try to 
>> reduce
>> this to a test case?
>>
>>
>> Zach Pincus
>>
>> Postdoctoral Fellow
>> Molecular, Cellular, and Developmental Biology
>> Yale University
>>
>>
>> -------------------------------------------------------------------------
>> This SF.net email is sponsored by: Microsoft
>> Defy all challenges. Microsoft(R) Visual Studio 2008.
>> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
>> _______________________________________________
>> Matplotlib-users mailing list
>> Mat...@li...
>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>>
>
>
>
> -- 
> Stephane Raynaud
From: Anthony F. <ant...@gm...> - 2008年03月13日 17:26:07
On Thu, Mar 6, 2008 at 3:00 AM, <Jou...@xt...> wrote:
> "Anthony Floyd" <ant...@gm...> writes:
>
> > I would like to 'watermark' a plot. That is, display an image 'under'
> > several lines. [...] I've tried using figure.figimage, but that only
>
> > draws the watermark 'outside' the plot area. Fair enough.
>
> The background of the axes object is called a "frame", and you want to
> not draw it at all (pass frameon=False to add_axes) or make it
> translucent:
>
> fig=figure(...)
> fig.figimage(...)
> ax=fig.add_subplot(...)
> ax.get_frame().set_alpha(0.5)
>
Thanks! That essentially works as expected.
Anthony.
From: Ryan M. <rm...@gm...> - 2008年03月13日 16:34:10
Michael Hearne wrote:
> Ryan - Thanks for your response.
> 
> Shouldn't a color dictionary have 4 "columns" - a value, and the 
> corresponding R,G,B values? If I understand your response, the "row" 
> with 0.2 as the first column has only two values. How does 
> LinearSegmentedColormap derive an RGB triplet from those two numbers?
> 
Not quite. I'm pretty sure I was a little vague in my last message, so 
let me be more concrete. Here's an example of a 5 gray level color map 
data dictionary:
_Gray5_data = {'blue': [(0.0, 0.42352941176470588, 0.42352941176470588),
 (0.25, 0.53333333333333333, 0.53333333333333333),
 (0.5, 0.6588235294117647, 0.6588235294117647),
 (0.75, 0.81568627450980391, 0.81568627450980391),
 (1.0, 0.93725490196078431, 0.93725490196078431)],
 'green': [(0.0, 0.42352941176470588, 0.42352941176470588),
 (0.25, 0.53333333333333333, 0.53333333333333333),
 (0.5, 0.6588235294117647, 0.6588235294117647),
 (0.75, 0.81568627450980391, 0.81568627450980391),
 (1.0, 0.93725490196078431, 0.93725490196078431)],
 'red': [(0.0, 0.42352941176470588, 0.42352941176470588),
 (0.25, 0.53333333333333333, 0.53333333333333333),
 (0.5, 0.6588235294117647, 0.6588235294117647),
 (0.75, 0.81568627450980391, 0.81568627450980391),
 (1.0, 0.93725490196078431, 0.93725490196078431)]}
Note that the dictionary contains one list each for red, green, and 
blue. Each entry in the a list for the color corresponds to an entry in 
the table. This entry has 3 pieces of information: The first (item #1) 
is the corresponding normalized data value for this color (between 0 and 
1). The next two values are normalized color values, the first if the 
actual data value is below the value in item #1 and the 2nd if it is 
above. In the case of the one above, the color is the same regardless.
So, for example, a normalized data value of 0.25 gets an RGB tuple of 
(0.5333,0.5333,0.5333).
HTH,
Ryan
-- 
Ryan May
Graduate Research Assistant
School of Meteorology
University of Oklahoma
From: Andy C. <And...@br...> - 2008年03月13日 16:34:05
 Hi people
Using the axes3d functionality, I am able to create 3D graph of desired 
mathematical functions ala the cookbook example. However, it would be 
useful to be able to have a 2D contour plot upon the xy plane of a graph 
at the same time. I've googled to no avail and wondered if someone can 
point me in the right direction
Thanks
Andy
From: Michael H. <mh...@us...> - 2008年03月13日 16:16:21
If you read the documentation for the fill() function, it says the 
following:
"The same color strings that plot supports are supported by the fill
format string."
The plot() documentation says this:
"In addition, you can specify colors in many weird and
wonderful ways, including full names 'green', hex strings
'#008000', RGB or RGBA tuples (0,1,0,1) or grayscale
intensities as a string '0.8'. Of these, the string
specifications can be used in place of a fmt group, but the
tuple forms can be used only as kwargs."
Through experimentation, I determined this:
plot(array([1,2,3,4]),array([1,2,3,4]),'r') => works
plot(array([1,2,3,4]),array([1,2,3,4]),'#FF0000') => does NOT work
plot(array([1,2,3,4]),array([1,2,3,4]),color='#FF0000') => works
plot(array([1,2,3,4]),array([1,2,3,4]),color=(1,0,0)) => works
My second example would seem to contradict the documentation.
However, my real question has to do with fill - the only color 
strings that it seems to support are the ones that plot does - 
namely, defined colors like 'r', 'g','b', etc.
Assuming I have an axes set up as follows:
f=figure();
ax = gca()
None of the following seem to work:
ax.fill(array([0.25,0.75,0.75,0.25,0.25]),array 
([0.75,0.75,0.25,0.25,0.75]),'#FF0000')
ax.fill(array([0.25,0.75,0.75,0.25,0.25]),array 
([0.75,0.75,0.25,0.25,0.75]),color='#FF0000')
ax.fill(array([0.25,0.75,0.75,0.25,0.25]),array 
([0.75,0.75,0.25,0.25,0.75]),color=(1,0,0))
How can I specify an non-predefined color for the fill() function?
I am using matplotlib version 0.90.1, I think. I don't know the best 
way to get my matplotlib version information.
------------------------------------------------------
Michael Hearne
mh...@us...
(303) 273-8620
USGS National Earthquake Information Center
1711 Illinois St. Golden CO 80401
Senior Software Engineer
Synergetics, Inc.
------------------------------------------------------
From: Marcus H. <M.H...@ls...> - 2008年03月13日 16:01:23
Dear all,
is it possible to use a shared xaxis for several plots and switch off
the xticklabels on all but the lowest plot?
When I use ax.set_xticklabels([]) on one of the shared xaxis, the
ticklabels on all xaxis vanishes...???
Example:
ax0 = pylab.axes( [0.1, 0.05, 0.88, 0.22] )
plot...
ax1 = pylab.axes( [0.1, 0.27, 0.88, 0.22], sharex = ax0)
plot...
ax2 = pylab.axes( [0.1, 0.49, 0.88, 0.22], sharex = ax0)
ax2.set_xticklabels([])
plot...
The result is that neither ax0 nor ax1 have any xticklabes shown.
I am using matplotlib 0.87 on Debian Etch.
Regards,
Marcus
From: Chris W. <ch...@si...> - 2008年03月13日 11:56:06
Cheng-Kong Wu wrote:
> I created several plots and want to export them to a
> Word file sequentially, how can I do that?
Why Word? It's a horrible file format and very difficult to deal with.
Why not just use one of the PDF backends (I don't think I'm making that 
up, there are PDF back ends for Matplotlib, right?)
If you really insist on trying with Word, your best bet is to interact 
with Word via the win32com package...
cheers,
Chris
-- 
Simplistix - Content Management, Zope & Python Consulting
 - http://www.simplistix.co.uk

Showing 9 results of 9

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