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

Showing 7 results of 7

From: Jochen V. <li...@se...> - 2008年02月25日 21:53:58
Hi,
I have a strange (to me) problem with matplotlib version 0.91.2,
installed from source on a Debian Linux system.
I try to generate a plot which combines bitmap data (using "pcolor")
and some lines (using "plot") as in the appended script. I switch off
the coordinate axes using the command axis("off") and I try to set the
displayed coordinate range using the command
 axis([x0-p, x1+p, y0-p, y1+p])
near the end of the script.
Problem: the output of this script, i.e. the file "out.eps" is
shifted. To me it seems that the PostScript bounding box is wrong.
Some things I noticed:
1) It seems that the pixel data from the pcolor command is centred in
the boundign box. If I plot the pcolor output at different locations,
the bounding box changes. This seems wrong to me, because I expect
the bounding box to be determined by the above axis command.
2) If I comment out the axis("off") command, the output is no longer
shifted and looks perfect, except that it now has the unwanted
coordinate axes.
3) If I output an .png file, using the Agg backend, the problem does
not appear. This does not help, since I need an .eps file.
My questions: What am I doing wrong? How do I get an unshifted .eps
file without coordinate axes? Any help would be very welcome.
Many thanks in advance,
Jochen
== script starts next line ===========================================
#! /usr/bin/env python
import matplotlib
matplotlib.use("PS")
from pylab import *
def create_hist():
 X = array([-2.3, -2.0, -1.7 ])
 Y = array([-0.3, -0.0, 0.3 ])
 hist = array([[ 0.2, 0.4 ], [ 0.6, 0.8 ]])
 return X, Y, hist
def generate_figure(fname, X, Y, hist, stamp=None):
 width = 4.5
 height = 1.6
 margin = 0.05
 padding = 0.05
 x0 = -3.3
 x1 = 4.0
 q = (x1-x0)/(width - 2*margin - 2*padding)
 y0 = -0.3
 y1 = y0 + (height - 2*margin - 2*padding)*q
 # create an appropriately sized figure
 rc('text', usetex=True)
 rc('font', family="serif", serif="Times", size=12.0)
 rc('xtick', labelsize=12)
 rc('ytick', labelsize=12)
 rc('figure.subplot', left=margin/width)
 rc('figure.subplot', right=(width-margin)/width)
 rc('figure.subplot', bottom=margin/height)
 rc('figure.subplot', top=(height-margin)/height)
 fig = figure(figsize=(width, height))
 ax = axes([margin/width, margin/height,
 (width-2*margin)/width, (height-2*margin)/height])
 p = q*padding
 # plot the density data
 mycmdata = {
 'red': ((0., 1.0, 1.0), (0.01, 0.95, 0.95), (1.0, 0.0, 0.0)),
 'green': ((0., 1.0, 1.0), (0.01, 0.95, 0.95), (1.0, 0.0, 0.0)),
 'blue': ((0., 1.0, 1.0), (0.01, 0.95, 0.95), (1.0, 0.0, 0.0)),
 }
 mycm = matplotlib.colors.LinearSegmentedColormap('mycm', mycmdata)
 pcolor(X, Y, hist, cmap=mycm, shading='flat')
 # plot the corner
 plot([x0, x0, x1], [y1, y0, y0], "k-")
 plot([x0+0.6, x0+0.6, x1], [y1, y0+0.6, y0+0.6], "k-")
 # place the stamp
 if stamp is not None:
 text(x1-p, y1-p, stamp, va='top', ha='right')
 # save the result
 axis([x0-p, x1+p, y0-p, y1+p])
 axis("off")
 savefig(fname, facecolor="yellow")
X, Y, hist = create_hist()
generate_figure("out.eps", X, Y, hist, "$t=1$")
From: Bernhard V. <ber...@gm...> - 2008年02月25日 18:50:11
Hi Eric!
Are you sure you want a colorbar with lines and not a legend?
Well, I've got a couple of lines (~50) and thus the legend would become
confusing.
I wanted to have lines in the colorbar because I think it's more adequate to
have lines in the bar when there are lines in the plot.
A colorbar with lines only, matching a LineCollection, can be done with
> the facilities in mpl's colorbar.py module; you might take a look at
> the code in that module to see how it is being done in the line contour
> case. Note that ColorbarBase has a method, add_lines, for this. I'm
> sorry I don't have time to be more specific now, though.
Thanks for the hint! I was quite simple, I made a call to
pylab.colorbar(filled=False)
which gave me an empty colorbar. Then I add lines to this instance:
colorbar.ColorbarBase.add_lines(cbar, myrange, linecl.get_colors(),
linecl.get_linewidth())
Thanks! Bernhard
>
> Eric
>
> Bernhard Voigt wrote:
> > Dear all!
> >
> > I'm folowing the line_collection2.py example to create a LineCollection
> > plot with a colorbar.
> > How can I force the colorbar to show distinct lines like it does in
> > contour plots for a LineCollection plot?
> >
> > Thanks! Bernhard
>
From: BL <bra...@gm...> - 2008年02月25日 18:03:08
 Hi,
I've made a local installation of python2.5, numpy 1.0.4 and matplotlib
0.91.2.
I didn't see any pb during compilation, but when I try to show a figure, I
received SIGSEGV.
You will find attached to this mail the log of my installation, and a
backtrace of a segfault in gdb, I don't know if this helps.
Have you got any glue ?
-- 
LB
Thanks for the reply,
It was not a problem with the specific python I used.
In fact I have a problem because the Tcl/Tk libraries were in /usr/share/lib
whereas their include files were in /usr/include. In my case, I used the
debian package tkx8.3-dev which does not follow that idiom ( I don't know
why..)
As far as I understand, matplotlib asks Python for the path of its Tk
library, and guess the path of the include directory from this path by
adding '../../include/tk' + tk_ver.
I solved my problem by removing this old version of Tk and building a new
one.
But I still think matplotlib should look in the directories given at the top
of setupext.py (or in the setup.cfg file, which would be even better, I
don't like the fact of having to modify directly setupext.py).
Regards,
-- 
LB
From: Shane L. <sh...@ve...> - 2008年02月25日 17:26:17
Hi,
I'm new here so sorry in advance if this has already been addressed
and I missed it in my archive search...
I think there is a significant bug in plot_wireframe in matplotlib
where it incorrectly displays the Z axis values. The code below
demonstrates the problem:
import scipy
import pylab as p
import matplotlib.axes3d as p3
from numpy import *
"""
# If you do a wire frame of the following, the graph is correct:
Z = scipy.array(
[[ 0.52, 0.00020],
 [ 0.45, 0.00018],
 [ 0.34, 0.00016]] )
"""
# but if you put negative signs in:
Z = scipy.array(
[[ -0.52, -0.00020],
 [ -0.45, -0.00018],
 [ -0.34, -0.00016]] )
"""
 the graph displays:
[[ -0.62, -0.10020 ],
 [ -0.55, -0.10018 ],
 [ -0.44, -0.10016 ]]
"""
X, Y = meshgrid(arange(0, 3, 1.0), arange(0, 4, 1.0))
fig = p.figure()
ax = p3.Axes3D(fig)
ax.plot_wireframe(X, Y, Z)
ax.set_xlabel('X')
ax.set_ylabel('Y')
ax.set_zlabel('Z')
p.show()
I'm running Ubuntu 7.10 x64 with python 2.5.1-1ubuntu2 and
python-scipy 0.5.2-9ubuntu4 both installed from the .deb files.
I sent the above code to somebody with a 32bit Linux system
and they had the same problem.
Any help appreciated!
Cheers
Shane
From: Michael D. <md...@st...> - 2008年02月25日 16:40:05
You may want to confirm that the python use use to build matplotlib is 
the intended one (in your home). As a first try, matplotlib's setup 
will import Tkinter and grab the include paths from there.
By this I mean when you type:
 python setup.py install
that "python" is the specific python use want to use.
Also check that Tkinter imports without errors in your custom Python.
Cheers,
Mike
BL wrote:
> Hi,
> 
> I've got difficulties to make a local installation of matplotlib.
> I think it's due to my nonstandard installation of python and tk, which 
> both are in my home.
> 
> I've seen on the website that , for non standard installation, I should 
> complete the basedir dictionary defined in the setupext.py script.
> 
> But for the Tcl/Tk header files, this does not seems to work. Whatever I 
> put in this dictionary, the module.include_dirs corresponding to Tk 
> (line 825 of setupext.py) is always equal to ['/usr/share/include', 
> '/usr/share/include'].
> 
> Did I miss something obvious ?
> 
> I'm on a linux2 platform and I''m trying make a local installation of 
> python2.5 + matplotlib 0.91.2 in my home.
> 
> Regards,
> -- 
> LB
> 
> 
> ------------------------------------------------------------------------
> 
> -------------------------------------------------------------------------
> 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
-- 
Michael Droettboom
Science Software Branch
Operations and Engineering Division
Space Telescope Science Institute
Operated by AURA for NASA
From: Troels K. J. <tkj...@gm...> - 2008年02月25日 13:55:59
Hi Guys
Is there an eays way to plot a number vs a label from a file?
Here is an example
I have a datafile like this:
#Aa Bb nA nB Surf Bulk segEnergy
Fe Cr 19 1 -909.065612 -909.060586 -0.100520
Fe Ni 19 1 -855.708731 -855.700865 -0.157320
Fe Mo 19 1 -810.257339 -810.252167 -0.103440
I want to plot the last row vs the second row.
Now i have to do:
y,dummy = load('data.dat',usecols=(6,6),unpack=True)
xticks=xticks(arange(3),('Cr','Ni','Mo'))
plot(y)
Is there an easy way to do this?
And why does usecols=(6) not work?
-- 
Med Venlig Hilsen / Best Regards
Troels Kofoed Jacobsen

Showing 7 results of 7

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