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 13 results of 13

From: Paul I. <piv...@gm...> - 2011年04月13日 23:01:51
Hi Oğuz,
Oğuz Yarımtepe, on 2011年04月13日 23:09, wrote:
> I didn't understand why i can not see 20 dots with the below command,
> but i just see 3 dots at the graph.
> a1 = N.ndarray(shape=(10,2))*2
When you allocate an array this way - you're just allocating
space for it without initializing it to anything - there are no
guarantees about what values that array will take on - and on
most operating systems it will vary from one run to another. 
If you're trying to get a random number, changes the a1 and a2
lines to:
a1 = N.random.rand(10,2)*2
a2 = N.random.rand(10,2)+10
> P.xlim(xmin=n_x.min()*10, xmax=n_x.max()*10)
> P.ylim(ymin=n_y.min()*10, ymax=n_y.max()*10)
I don't think you want to do n_x.min()*10 - multiplying the min
and max values has a different effect on the limits depending on
the sign of those values. You probably want to find the
difference between min and max and then use that to extend and
limits, instead.
 
> Normally i have 20 different points to be plotted but because they are
> so close values it just plots three of them. Any idea how i can fix
> it?
The fact that you weren't initializing your arrays with anything
affects how many unique combinations of x and y you'll have.
len(set(zip(n_x,n_y))) will tell you how many points you should
see.
best,
-- 
Paul Ivanov
314 address only used for lists, off-list direct email at:
http://pirsquared.org | GPG/PGP key id: 0x0F3E28F7 
From: <st...@eb...> - 2011年04月13日 20:33:01
Dear experts,
is there a way of rotating a single subplot in a multi-faceted figure with
respect to the others?
i.e. I have a contour plot representing a 2D histogram and on the top of
it and to its left two line plots, representing the respective 1D
components. I am aware of the possibility to swap x- and y- coordinates in
analogy of one example in the gallery where they use vertical bar graphs
for the y-component and bar graphs for the x-component, so essentially I
can do what I want, but I thought that there might be an alternative way.
Thanks a lot!
cheers
ben
From: Oğuz Y. <ogu...@gm...> - 2011年04月13日 20:09:47
I didn't understand why i can not see 20 dots with the below command,
but i just see 3 dots at the graph.
import pylab as P
import numpy as N
a1 = N.ndarray(shape=(10,2))*2
x = a1[:,0]
y = a1[:,1]
a2 = N.ndarray(shape=(10,2))+10
xx = a2[:,0]
yy = a2[:,1]
n_x = N.append(x,xx)
n_y = N.append(y,yy)
P.scatter(n_x, n_y, alpha=0.5)
P.xlim(xmin=n_x.min()*10, xmax=n_x.max()*10)
P.ylim(ymin=n_y.min()*10, ymax=n_y.max()*10)
P.plot(n_x, n_y, 's', alpha=0.7, ms=3)
P.show()
Normally i have 20 different points to be plotted but because they are
so close values it just plots three of them. Any idea how i can fix
it?
From: Mathew Y. <mat...@gm...> - 2011年04月13日 19:00:15
Hi
Has anyone ever added this capability? I want to be able to rotate a
projection of the earth.
Thanks
Mathew
From: Goyo <goy...@gm...> - 2011年04月13日 18:14:17
2011年4月13日 Tim Åberg <qw...@ho...>:
>
> Due to that my first question a couple of day back was a mess i thougth i
> could clear things up.
>
> Is there any way to label the lines using linecollection. In plot there is
> label, example;
> plot(x,y,label = "Hello")
>
> But are there any way to do the same thing with linecollection?
> If not, is there any eother asy way of creating labels on a line?
You can customize the legend by hand.
http://matplotlib.sourceforge.net/users/legend_guide.html
Goyo
From: Paul I. <piv...@gm...> - 2011年04月13日 16:52:46
Neal Becker, on 2011年04月13日 11:18, wrote:
> Suppose I'm generating multiple seperate plots. I'd like them auto-scaled, but 
> in the end want the same axis (so they can be visually compared). Any 
> suggestions? (semilogy, if that matters).
Hi Neal,
provided that the scales are different only in one dimension,
something like twinx() or twiny() would work to create new axes
on top of another one, sharing the one of the dimension, while
being independent in the other.
best,
-- 
Paul Ivanov
314 address only used for lists, off-list direct email at:
http://pirsquared.org | GPG/PGP key id: 0x0F3E28F7 
From: Paul I. <piv...@gm...> - 2011年04月13日 16:43:31
Hi Jerome,
jerome thircuir, on 2011年04月13日 10:15, wrote:
> hello, can someone give me a hint to get started.
we'll try our best, but I think we'll need more information from
you.
 
> context:
> i'm trying to use pythonxy and matplotlib
> i've got python 2.7 installed, and pythonxy
> i also have matplotlib installed (i know that because it runs from ipythonxy
> - the interactive console)
so 'import matplotlib' works in ipythonxy?
 
> eventually i'll need to be getting data from a database so that why i've
> chosen eclipse
are you talking about Eclipse IDE? I'm a little unclear about how
the IDE will help you get data out of a database, but maybe I
just don't know enough about eclipse.
> problem:
> 1. my import matplotlib shows an error (a bad start)
this error occurs when you import in Eclipse? What does the error
say?
> 2. i can't run my module
does your module import in plain python? what is the error
message?
 
best,
-- 
Paul Ivanov
314 address only used for lists, off-list direct email at:
http://pirsquared.org | GPG/PGP key id: 0x0F3E28F7 
From: Andrea C. <and...@gm...> - 2011年04月13日 16:15:27
I need to generate in some cases a subplot with two plots one on top of
the other, and in some other cases just one subplot.
So after some attempts I ended up with the ugliest code I've ever
written (maybe not) that you see below.
Is there a better way to do it?
I still didn't fully get how to get "rid" of the implicit global state
in matplotlib and use a more object/functional programming approach.
Anyway the second thing is that I'm not able to disable the autoscale, I
just would like to see the grid as it should be (geometrically).
It should just be matplotlib.pyplot.autoscale but in my version is not
present, isn't there another way?
Thanks a lot,
Andrea
--8<---------------cut here---------------start------------->8---
 def write_graph(self, output_file, title, show=False):
 def upper_graph():
 def draw_nodes(nlist, color):
 # this returns the list of all the patches, also from axes.patches
 nx.draw_networkx_nodes(self.graph, nodelist=nlist, pos=self.pos,
 node_color=color, node_size=700, alpha=0.6)
 draw_nodes(self.lands, 'red')
 draw_nodes(self.mobiles, 'green')
 simple_nodes = set(self.nodes) - set(self.lands + self.mobiles)
 draw_nodes(simple_nodes, 'blue')
 old_axes = plt.axis()
 sizes = old_axes[1] - old_axes[0], old_axes[3] - old_axes[2]
 offset = lambda x: int((float(x) / 10))
 new_axes = []
 for i in range(len(old_axes)):
 new_val = old_axes[i] + (((-1) ** (i + 1)) * offset(sizes[i % 2]))
 new_axes.append(new_val)
 plt.axis(new_axes)
 nx.draw_networkx_edges(self.graph, self.pos, edge_color='k', alpha=0.5)
 labels = dict((x, str(x)) for x in self.nodes)
 # for the landmarks also add its index
 for land in self.lands:
 labels[land] = "%d (%d)" % (land, self.lands.index(land))
 for recv in self.receivers:
 labels[recv] += " (R)"
 for send in self.senders:
 labels[send] += " (S)"
 nx.draw_networkx_labels(self.graph, self.pos, labels, font_size=8)
 plt.clf()
 plt.title(title)
 plt.xlabel("x")
 plt.ylabel("y")
 if show:
 upper_graph()
 plt.show()
 else:
 plt.subplot(211)
 upper_graph()
 plt.subplot(212)
 legend = self.coordinate_text()
 # remove useless ticks
 plt.xticks([])
 plt.yticks([])
 plt.text(0.05, 0, "\n".join(legend))
 plt.text(0.5, 0, str(self.event_buffer))
 plt.savefig(output_file)
--8<---------------cut here---------------end--------------->8---
From: Neal B. <ndb...@gm...> - 2011年04月13日 15:19:25
Suppose I'm generating multiple seperate plots. I'd like them auto-scaled, but 
in the end want the same axis (so they can be visually compared). Any 
suggestions? (semilogy, if that matters).
From: Wolfgang K. <wke...@go...> - 2011年04月13日 15:01:22
Dear all,
Is it possible to make a qt config dialogue that works in a similar 
fashion to the backend of matplotlib when using with ipython --pylab. It 
should be able to interact with plots (pressing buttons changing stuff 
in the plot) as well as not block ipython. Is that possible. Are there 
examples to do that?
Cheers
 Wolfgang
From: Tim Å. <qw...@ho...> - 2011年04月13日 13:59:27
Due to that my first question a couple of day back was a mess i thougth i could clear things up.
Is there any way to label the lines using linecollection. In plot there is label, example;
plot(x,y,label = "Hello")
But are there any way to do the same thing with linecollection?
If not, is there any eother asy way of creating labels on a line? 
Best regards,
Tim
 		 	 		 
From: jerome t. <jer...@gm...> - 2011年04月13日 09:16:04
hello, can someone give me a hint to get started.
context:
i'm trying to use pythonxy and matplotlib
i've got python 2.7 installed, and pythonxy
i also have matplotlib installed (i know that because it runs from ipythonxy
- the interactive console)
eventually i'll need to be getting data from a database so that why i've
chosen eclipse
problem:
1. my import matplotlib shows an error (a bad start)
2. i can't run my module
this is probably basic, can someone give me a pointer?
best,
From: Eric F. <ef...@ha...> - 2011年04月13日 01:11:11
On 04/12/2011 01:32 PM, Thomas Robitaille wrote:
> Hi,
>
> If I use interpolation='nearest' in an imshow command, when I try and save the image using savefig, the dpi= argument seems to have no effect. I have created a bug report on GitHub:
>
> https://github.com/matplotlib/matplotlib/issues/83
>
> Thanks for any help,
>
> Tom
>
Tom,
As a workaround you can use the pdf backend and then convert to eps if 
necessary using an external tool.
Eric

Showing 13 results of 13

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