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





Showing 9 results of 9

From: Jose Gomez-D. <jgo...@gm...> - 2009年11月26日 19:57:08
Hi,
I'm not sure this is entirely on-topic as it relates to the matplotlib
sphinx extension. I hope it's still acceptable!
I am writing some documentation using sphinx, and I would like to refer
plots that are rendered from an external python script. I can do the plot
and it gets imported fine just by issuing
.. plot:: ../samples/MyPythonPlot.py
I would like to have a cross reference to it and a caption. If I were to
select a normal figure, I could do this just by (see <
http://sphinx.pocoo.org/markup/inline.html#cross-referencing-arbitrary-locations
>)
.. _my-figure:
.. figure:: whatever
 Figure caption
But how can I do this with a matplotlib plot rather than a png file?
Thanks!
J
From: chombee <ch...@la...> - 2009年11月26日 19:29:54
> You could perhaps use 6 subplots, and place the titles manually. 
> Something like
> 
> 	suptitle(r'Top title', y=0.95)
> 	suptitle(r'Bottom title', y=0.05)
Thanks, that worked very well. I got the plot that I wanted and with
much tidier source code:
http://dl.dropbox.com/u/136038/bar-00-protagonist.png
(It still needs a bit of tweaking but it's more or less what I was going
for.)
From: Pauli V. <pa...@ik...> - 2009年11月26日 18:19:46
2009年11月26日 15:13:57 +0000, chombee wrote:
> I'm trying to make a figure with six subplots, here's what I've managed
> so far:
> 
> http://dl.dropbox.com/u/136038/bar-00-protagonist.png
> 
> That's actually done with two subplots (the top row and the bottom row)
> and what looks almost like 3 separate pairs of axes in each row is
> actually just one pair of axes with three sets of data plotted on it.
> 
> Perhaps what I've done is the best way to do it. But I think the code
> for this would be much simpler if I used six subplots instead, but
> here's my problem: I want each subplot to have its own title (easily
> done), and I also want the top row of three subplots to have an
> associated title and the bottom row of three subplots to have an
> associated title. Can I do this? My first instinct was to create two
> subplots (top row and bottom row) then within each subplot create three
> subplots (three columns), then I could just place all the titles I want
> using title() commands. This recursive subplotting doesn't seem to work
> though.
You could perhaps use 6 subplots, and place the titles manually. 
Something like
	suptitle(r'Top title', y=0.95)
	suptitle(r'Bottom title', y=0.05)
could work. Also, mpl_toolkits.axesgrid may be useful.
-- 
Pauli Virtanen
From: thumperj <mrt...@gm...> - 2009年11月26日 17:01:25
John Hunter-4 wrote:
> 
> On Tue, Nov 24, 2009 at 5:38 PM, thumperj <mrt...@gm...>
> wrote:
>>
>> I'm certain this is in an example somewhere but I can't seem to find it.
>> If
>> someone can just point me to the example I'll take it from there. Thank
>> you!
>>
>> I have a line chart. I just want to add text or callout box that shows
>> the
>> last value in the line.
> 
> Use "text" or "annotate", eg
> 
> http://matplotlib.sourceforge.net/examples/pylab_examples/annotation_demo.html
> http://matplotlib.sourceforge.net/examples/pylab_examples/annotation_demo2.html
> 
> Let us know if you need any more help
> 
> JDH
> 
> 
John, thank you. This was exactly what I needed. I now have annotations
all over the place.
One last question. My graph is updating constantly and I need to move
annotation around to highlite certain points as they appear. I can add new
annotations easily enough and they stick to the place where I put them. As
more data is added to the graph, the old annotations become irrelevant and I
need to remove them. How do I delete the ones I don't need anymore from the
graph? I could also just just modify the properties of the existing ones,
both the text and location, if I knew how to get at them, so to speak.
Can you point me the right way?
-- 
View this message in context: http://old.nabble.com/Line-chart---want-to-show-value-of-last-data-point-tp26505250p26532286.html
Sent from the matplotlib - users mailing list archive at Nabble.com.
From: chombee <ch...@la...> - 2009年11月26日 15:17:25
I'm trying to make a figure with six subplots, here's what I've managed
so far:
http://dl.dropbox.com/u/136038/bar-00-protagonist.png
That's actually done with two subplots (the top row and the bottom row)
and what looks almost like 3 separate pairs of axes in each row is
actually just one pair of axes with three sets of data plotted on it.
Perhaps what I've done is the best way to do it. But I think the code
for this would be much simpler if I used six subplots instead, but
here's my problem: I want each subplot to have its own title (easily
done), and I also want the top row of three subplots to have an
associated title and the bottom row of three subplots to have an
associated title. Can I do this? My first instinct was to create two
subplots (top row and bottom row) then within each subplot create three
subplots (three columns), then I could just place all the titles I want
using title() commands. This recursive subplotting doesn't seem to work
though.
Thanks
From: Jae-Joon L. <lee...@gm...> - 2009年11月26日 11:51:05
One option would be to use a proxy artist, an artist with properties you want.
http://matplotlib.sourceforge.net/users/legend_guide.html#using-proxy-artist
Regards,
-JJ
On Fri, Nov 20, 2009 at 7:01 PM, Zunbeltz Izaola
<zun...@he...> wrote:
> Hi,
>
> I would like to have a different marker facecolor in the legend that in
> the plot. Is there any way to change this color?
>
> In more detail my problem is the following. I plotted 6 dataset. They
> are divided in 2 groups; one with blue and the other with red color.
> In each group I have used 3 different markers. I have annotated the
> meaning of the color in the plot, so I don't need a legend with 6 lines.
> I only need 3, but I would like that the markers in this plot will be
> empty (markerfacecolor=white). Is it possible?
>
> Best regards,
>
> Zunbeltz
>
> --
> Dr Zunbeltz Izaola
> G-I1 Methods and instruments of neutron scattering
> Tel +49 30 8062-3179
>
> Helmholtz-Zentrum Berlin für Materialien und Energie GmbH
> Glienicker Straße 100, 14109 Berlin
> Vorsitzende des Aufsichtsrates: Dr. Beatrix Vierkorn-Rudolph
> Stellvertretende Vorsitzende: Dr. Jutta Koch-Unterseher
> Geschäftsführer: Prof. Dr. Anke Rita Pyzalla, Prof. Dr. Dr. h.c.
> Wolfgang Eberhardt, Dr. Ulrich Breuer
> Sitz der Gesellschaft: Berlin
> Handelsregister: AG Charlottenburg, 89 HRB 5583
>
>
>
> ------------------------------------------------------------------------------
> Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
> trial. Simplify your report design, integration and deployment - and focus on
> what you do best, core application coding. Discover what's new with
> Crystal Reports now. http://p.sf.net/sfu/bobj-july
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
From: David <ld...@gm...> - 2009年11月26日 10:06:46
Dear list,
I recently came across the following code:
In [7]: size = 50*np.random.randn(100)
In [8]: colours = np.random.rand(100)
In [9]: scatter(x, y, s=size, c=colours);
In [10]: show()
which works beautifully. My question though is this: why?
I came to understand, with Google's help, that the randomly generated
values (ranging between 0.0 and 1.0) for the variable colours are mapped
to a color table, so that the generated value of, say, 0.21985792 is
linked to a given color. This color is then used to paint one scatter point.
I was unable to find helpful (i.e. newbie friendly) information on how
this color mapping exactly works. Where is the table? The matplotlib
documentation caused me confusion.
Thanks for your kind help,
David
From: Mike A. <ma...@ry...> - 2009年11月26日 02:41:54
I have been looking at this for the past day and in am pretty sure I could
replace the instance of polyc by the "cmap if statements" my colour array
and I should be able to get close to what I want. However I am new to both
python & mpl, and I am not entirely sure in how I would go about testing my
hypothesis. Furthermore I am also relatively new to submitting fixes to
open-source projects so I have lots of questions about how I would go about
suggesting a modification.
 
1.) can I just modify the file in the
C:\python26\Lib\site-packages\mpl-toolkits\mplot3d\axes3d.py file to do my
tests? 
a. Also, where are these files usually kept in a linux environment ?
b. What do I do with the. pyc files with the same name? are they
re-complied automatically when I call the function externally? 
2.) Is this capability already built in with the colour argument ? if so
how do I properly call it?
3.) If I do make a modification should it be as a separate function with
the additional variable or should I try to stuff the new capability into the
old function
4.) is there a clean easy to follow tutorial for submitting changes via
svn or can I rely on someone else to do the final commit?
 
I have attached the function in question for reference to save others from
digging down into their python directories 
 
 
Again thanks for taking your time to help me figure this out
 
Mike Alger
 
< Code>
 def plot_surface(self, X, Y, Z, *args, **kwargs):
 '''
 Create a surface plot.
 
 By default it will be colored in shades of a solid color,
 but it also supports color mapping by supplying the *cmap*
 argument.
 
 ========== ================================================
 Argument Description
 ========== ================================================
 *X*, *Y*, Data values as numpy.arrays
 *Z*
 *rstride* Array row stride (step size)
 *cstride* Array column stride (step size)
 *color* Color of the surface patches
 *cmap* A colormap for the surface patches.
 ========== ================================================
 '''
 
 had_data = self.has_data()
 
 rows, cols = Z.shape
 tX, tY, tZ = np.transpose(X), np.transpose(Y), np.transpose(Z)
 rstride = kwargs.pop('rstride', 10)
 cstride = kwargs.pop('cstride', 10)
 
 color = kwargs.pop('color', 'b')
 color = np.array(colorConverter.to_rgba(color))
 cmap = kwargs.get('cmap', None)
 
 polys = []
 normals = []
 avgz = []
 for rs in np.arange(0, rows-1, rstride):
 for cs in np.arange(0, cols-1, cstride):
 ps = []
 corners = []
 for a, ta in [(X, tX), (Y, tY), (Z, tZ)]:
 ztop = a[rs][cs:min(cols, cs+cstride+1)]
 zleft = ta[min(cols-1, cs+cstride)][rs:min(rows,
rs+rstride+1)]
 zbase = a[min(rows-1, rs+rstride)][cs:min(cols,
cs+cstride+1):]
 zbase = zbase[::-1]
 zright = ta[cs][rs:min(rows, rs+rstride+1):]
 zright = zright[::-1]
 corners.append([ztop[0], ztop[-1], zbase[0], zbase[-1]])
 z = np.concatenate((ztop, zleft, zbase, zright))
 ps.append(z)
 
 # The construction leaves the array with duplicate points,
which
 # are removed here.
 ps = zip(*ps)
 lastp = np.array([])
 ps2 = []
 avgzsum = 0.0
 for p in ps:
 if p != lastp:
 ps2.append(p)
 lastp = p
 avgzsum += p[2]
 polys.append(ps2)
 avgz.append(avgzsum / len(ps2)) 
 
 v1 = np.array(ps2[0]) - np.array(ps2[1])
 v2 = np.array(ps2[2]) - np.array(ps2[0])
 normals.append(np.cross(v1, v2))
 
 polyc = art3d.Poly3DCollection(polys, *args, **kwargs) ## this is
where a modification could be made to allow for a separate colour matrix
 if cmap is not None:
 polyc.set_array(np.array(avgz))
 polyc.set_linewidth(0)
 else:
 colors = self._shade_colors(color, normals)
 polyc.set_facecolors(colors)
 
 self.add_collection(polyc)
 self.auto_scale_xyz(X, Y, Z, had_data)
 
 return polyc
</Code>
 
From: Mike Alger [mailto:mik...@ng...] 
Sent: November-23-09 3:42 PM
To: mat...@li...
Subject: [Matplotlib-users] Color in 3d plots
 
This may be a dumb question, however I have been scratching my head trying
to figure out how to plot a 3 dimensional plot with with a colour map
different from the elevation(Z) parameter. 
 
An example of this done in Matlab would be 
 
[X,Y,Z] = peaks(30);
C=Z'% could be anything other than Z as long as it has the same dimensions
surf(X,Y,Z,C)
 
axis([-3 3 -3 3 -10 5])
 
 
Is this possible with matplotlib '0.99.1'
 
If so how do i go about doing this is there some sample code?
 
Mike Alger, M.A.Sc
ma...@ry...
 
From: <do...@us...> - 2009年11月26日 00:43:51
Yes, I should have mentioned that; saving an image works fine. But
then if I want to display it 1:1 with figimage() or such, I can't. :(
 Silly GUIs, not wanting to display a window larger than my screen....
On Wed, Nov 25, 2009 at 9:43 AM, Michael Droettboom <md...@st...> wrote:
> There may be a limitation on window sizes in the various GUI backends. Have
> you tried using the non-GUI backend (agg), and now "show"ing it, but just
> using "savefig"?
>
> Mike
>
> do...@us... wrote:
>>
>> I'm trying to make a 10 inch wide by 30 inch high, 72 dpi figure and
>> display it interactively. Matplotlib seems to squash the height for
>> anything over a certain size, depending on the backend:
>>
>> ---------------------------------------------------
>> #!/usr/bin/env python
>>
>> import sys, os, matplotlib
>> matplotlib.use('TkAgg')
>> import matplotlib.pyplot as plt
>>
>> print os.uname()
>> print sys.version
>> print matplotlib.__version__
>> print
>>
>> f = plt.figure(figsize=(10,30), dpi=72)
>> print "figheight before show(): %f" % f.get_figheight()
>> plt.show()
>> print "figheight after show(): %f" % f.get_figheight()
>> --------------------------------------------------
>>
>> Prints this:
>>
>> ==========================
>> ('Linux', 'prime', '2.6.31-14-generic', '#48-Ubuntu SMP Fri Oct 16
>> 14:05:01 UTC 2009', 'x86_64')
>> 2.6.4 (r264:75706, Nov 2 2009, 14:44:17)
>> [GCC 4.4.1]
>> 0.99.0
>>
>> figheight before show(): 30.000000
>> figheight after show(): 22.027778
>> ==========================
>>
>> Tk squashes heights over 12 inches (the heights do get larger as you
>> request larger figures, but not as large as what you request); GTK
>> goes up to 11; and Qt4Agg only goes up to 7.3. WX seems to be the
>> only backend that will give me a 30 inch figure, but even then I have
>> to manually resize the window to make it fit. This happens in scripts
>> with pyplot, in ipython with or without -pylab, and via the matplotlib
>> API.
>>
>> Is there some limitation on figure sizes?
>>
>>
>> ------------------------------------------------------------------------------
>> Let Crystal Reports handle the reporting - Free Crystal Reports 2008
>> 30-Day trial. Simplify your report design, integration and deployment - and
>> focus on what you do best, core application coding. Discover what's new with
>> Crystal Reports now. http://p.sf.net/sfu/bobj-july
>> _______________________________________________
>> 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
>
>

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