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

Showing 6 results of 6

From: Michael D. <md...@st...> - 2011年04月29日 14:00:41
You could use Python string formatting, like so:
ax.annotate('Time = %s' % Time, size=18, xy=(3, 1), xycoords='data',
 xytext=(0.8, 0.95), textcoords='axes fraction',
 horizontalalignment='right', verticalalignment='top',
 )
On 04/29/2011 06:54 AM, Pau wrote:
> Hello,
>
> I am trying to print in the plot the value of a time variable which I
> obtain like this
>
> Time = MBH_inst[0] # Column 1
>
> This should be placed on the top right part of the plot showing the current time
>
> Time = XXX yrs
>
> But I do not know how to pass this to ax.annotate:
>
> ax.annotate('Time = ', size=18, xy=(3, 1), xycoords='data',
> xytext=(0.8, 0.95), textcoords='axes fraction',
> horizontalalignment='right', verticalalignment='top',
> )
>
> Thanks,
>
> Pau
>
> ------------------------------------------------------------------------------
> WhatsUp Gold - Download Free Network Management Software
> The most intuitive, comprehensive, and cost-effective network
> management toolset available today. Delivers lowest initial
> acquisition cost and overall TCO of any competing solution.
> http://p.sf.net/sfu/whatsupgold-sd
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
> 
-- 
Michael Droettboom
Science Software Branch
Space Telescope Science Institute
Baltimore, Maryland, USA
From: Thomas R. <tho...@gm...> - 2011年04月29日 13:05:54
Hi,
I've found a bug in imread which causes images in PNG and JPEG format to be flipped when using imshow. For example,
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
fig = plt.figure()
ax = fig.add_subplot(1,2,1)
image = plt.imread('2mass_rgb.png')
ax.imshow(image, origin='upper', extent=[0.5,723.5,0.5,724.5])
ax = fig.add_subplot(1,2,2)
image = plt.imread('2mass_rgb.jpg')
ax.imshow(image, origin='upper', extent=[0.5,723.5,0.5,724.5])
fig.savefig('rgb.png')
The input and output files can be found at https://www.dropbox.com/s/96npxuglpkd7y1u
I have submitted a bug report at https://github.com/matplotlib/matplotlib/issues/101
Thanks for any help,
Cheers,
Tom
From: Pau <vim...@go...> - 2011年04月29日 10:55:04
Hello,
I am trying to print in the plot the value of a time variable which I
obtain like this
Time = MBH_inst[0] # Column 1
This should be placed on the top right part of the plot showing the current time
Time = XXX yrs
But I do not know how to pass this to ax.annotate:
ax.annotate('Time = ', size=18, xy=(3, 1), xycoords='data',
 xytext=(0.8, 0.95), textcoords='axes fraction',
 horizontalalignment='right', verticalalignment='top',
 )
Thanks,
Pau
From: Ian T. <ian...@gm...> - 2011年04月29日 08:50:58
On 28 April 2011 22:56, Luke <haz...@gm...> wrote:
> I am thinking that perhaps the approach I should be taking should
> involve contouring the real part of the eigenvalues which determine
> the stability, and then plot the zero-level curve. I'll have to think
> about that some more.
>
This sounds like a very sensible approach and is quick and easy to try out
using tricontour/tricontourf. You may have to use a very small positive
value for the contour level rather then zero to get what you want.
> Is it clear what I am trying to do? If so, do you think the Delaunay
> triangulation is the right way to go?
>
Yes, it is clear what you are trying to do. I think that you shouldn't be
concerned with the triangulation, Delaunay or not, as this is at too low a
level for what you are attempting. Stick to the high-level data analysis
and presentation functions like tricontour and ignore details of the
underlying triangulation. If you are having to manipulate a triangulation
then you are becoming a computational geometrist - it is a completely valid
and interesting thing to do but is probably taking your attention away from
your real work.
Ian
From: Jason G. <jas...@cr...> - 2011年04月29日 03:08:51
On 4/28/11 9:03 PM, gary ruben wrote:
> http://stackoverflow.com/questions/1920145/how-to-find-duplicate-elements-in-array-using-for-loop-in-python-like-c-c
> i.e.
> dups = [x for x in list_a if list_a.count(x)> 1]
That involves iterating through your list_a a number of times to look 
for elements. It probably would be much faster to use something like 
the Counter class to just get the items that occur once or more than once:
http://docs.python.org/library/collections.html#counter-objects
Thanks,
Jason
From: gary r. <gr...@bi...> - 2011年04月29日 02:03:31
If you generate a big list of all the edges from the triangle data,
you should get repeat entries only for all the internal edges. You
could then find all the duplicates using this recipe
http://stackoverflow.com/questions/1920145/how-to-find-duplicate-elements-in-array-using-for-loop-in-python-like-c-c
i.e.
dups = [x for x in list_a if list_a.count(x) > 1]
After removing all of these, you should be left with just the boundary edges.
Gary R.
On Fri, Apr 29, 2011 at 7:56 AM, Luke <haz...@gm...> wrote:
> Ian,
> Thanks for the response and the example code. I guess what I'm
> trying to do might be well defined. Here is a plot that should
> illustrate the data I'm working with:
>
> http://biosport.ucdavis.edu/blog/copy_of_steady_benchmark_tau.png
>
> The green and red regions are being displayed by plotting each and
> every point in my data set that is stable. So the set of points I was
> describing in my original message looks like these green and red
> regions.
>
> What I would like is just the boundary of the stable region, which
> maybe isn't a very well defined statement. The convex hull of these
> points would enclose a part of the x-y plane that isn't stable, so I
> don't want to include it in my plot.
>
> I am thinking that perhaps the approach I should be taking should
> involve contouring the real part of the eigenvalues which determine
> the stability, and then plot the zero-level curve. I'll have to think
> about that some more.
>
> Is it clear what I am trying to do? If so, do you think the Delaunay
> triangulation is the right way to go?
>
> ~Luke
>
> On Thu, Apr 28, 2011 at 2:14 PM, Ian Thomas <ian...@gm...> wrote:
>> On 28 April 2011 08:51, Luke <haz...@gm...> wrote:
>>>
>>> I have a set of unstructured (x,y) points which I would like to
>>> compute a boundary polygon for. I don't want the convex hull.
>>>
>>> I was able to use matplotlib.tri to get a Delaunay triangulation for
>>> my points by following the examples online, but I'm having trouble
>>> masking everything but the triangles with a boundary edge.
>>> Additionally, once I get this, I'm not clear on how to plot just the
>>> boundary.
>>>
>>> Here is what it seems like the mask should be, assume triang comes
>>> from matplotlib.tri.Triangulation().
>>>
>>> mask = np.where(np.where(triang.neighbors < 0, 0, 1).all(axis=1), 1, 0)
>>> triang.set_mask(mask)
>>>
>>> but, when I plot triang using plot.triplot(), or plt.plot() to plot
>>> the edges, I am getting a bunch of extra stuff that isn't just the
>>> boundary triangles/edges.
>>>
>>> Anybody have example code for properly masking and plotting only the
>>> boundary edges?
>>>
>>> ~Luke
>>
>> Luke,
>>
>> I am not entirely clear exactly what you want to do, but I'll try to help.
>>
>> Your masking of the triangulation masks the triangles not the edges, and so
>> your triplot call displays those triangles that include a boundary edge but
>> also the other edges of those triangles. As you say, this isn't what you
>> want.
>>
>> I've attached an example script that follows on from your idea of testing
>> triang.neighbors to determine the boundary edges, and displays just those
>> edges. However, this is the convex hull as, by definition, the boundary of
>> an unconstrained Delaunay triangulation is the convex hull. As you don't
>> want the convex hull, I am not clear what you want instead.
>>
>> If I have misunderstood your requirements and/or you have further questions,
>> please post your example code as it is much easier for others on the mailing
>> list to correct existing code than come up with their own freestanding
>> example.
>>
>> I hope some of this helps!
>> Ian Thomas
>>
>
>
>
> --
> "Those who would give up essential liberty to purchase a little
> temporary safety deserve neither liberty nor safety."
>
> -- Benjamin Franklin, Historical Review of Pennsylvania, 1759
>
> ------------------------------------------------------------------------------
> WhatsUp Gold - Download Free Network Management Software
> The most intuitive, comprehensive, and cost-effective network
> management toolset available today. Delivers lowest initial
> acquisition cost and overall TCO of any competing solution.
> http://p.sf.net/sfu/whatsupgold-sd
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
1 message has been excluded from this view by a project administrator.

Showing 6 results of 6

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