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

Showing 11 results of 11

From: Paul H. <pmh...@gm...> - 2012年11月15日 23:41:40
On Thu, Nov 15, 2012 at 2:48 PM, Boris Vladimir Comi
<gl...@co...> wrote:
> Hi all:
>
> I have begun to learn about python / matplolib / basemap and really need some help.
>
> My data is in an Excel workbook in format .xls or csv(see attached):
>
> 1. How to open excel file in python?
>
> 2. I would like to plot multiple line joining the positions of each of the events, it is possible to do this? Have any idea how to do it?
>
> The idea is to plot the trajectories on a particular region, for my case is Mexico.
Boris,
If you can, install pandas and openpyxl on your machine. Pandas and
read in the csv by itself. Openpyxl is only needed if you really want
to read the Excel file.
Sticking with the csv approach, all you'll have to do is this:
import matplotlib.pyplot
import pandas
fig, ax = plt.subplots()
data = pandas.read_csv("/path/to/Trayectorias-scm-2004.csv")
data.plot(ax=ax)
That will plot all of the non-index columns in your dataframe.
Hope that helps,
-paul
From: Ethan G. <eth...@gm...> - 2012年11月15日 23:39:33
> 1. How to open excel file in python?
You can read excel files with the xlrd module : http://www.python-excel.org/ 
However, you may want to simply read your exported CSV files. 
> 2. I would like to plot multiple line joining the positions of each of the events, it is possible to do this? Have any idea how to do it?
I'm not quite sure what you are aiming for with this. You should be able to just plot a series of lines, as long as they have common start and end points they will appear joined, but the lines can have different attributes (e.g. color). Or you can plot all the points as a single line with multiple segments (all segments having the same attributes). 
> The idea is to plot the trajectories on a particular region, for my case is Mexico.
> <Trayectorias-scm-2004.csv><Trayectorias-scm-2004.xls>------------------------------------------------------------------------------
From: Boris V. C. <gl...@co...> - 2012年11月15日 23:04:09
________________________________________
Hi all:
I have begun to learn about python / matplolib / basemap and really need some help.
 My data is in an Excel workbook in format .xls or csv(see attached):
1. How to open excel file in python?
2. I would like to plot multiple line joining the positions of each of the events, it is possible to do this? Have any idea how to do it?
The idea is to plot the trajectories on a particular region, for my case is Mexico.
From: Ryan N. <rne...@gm...> - 2012年11月15日 22:41:36
Claus,
I agree with Sterling that the colors api page has a great deal of useful
info. However, as another solution to your problem, keep in mind that the
predefined colormaps contained in matplotlib.pyplot.cm return color tuples
when called with a float between 0 and 1. To illustrate with an extension
of your example code, try the following:
import numpy as np
import matplotlib.pyplot as plt
x = np.linspace(0,10,25) # Your x values
# A list of parameters for generating the y values
p = np.linspace(1,10,5)
# An array of values between 0 and 1 with the same length as your parameter
list.
d = np.linspace(0, 1, 5)
for i,j in zip(p,d):
 y = np.sin(x*i)
 plt.scatter(x, y, color=plt.cm.copper(j))
 plt.plot(x, y, color=plt.cm.jet(j))
plt.show()
If you have a lot of parameters, hence a large number of plots, you might
want to start reading up on collections:
http://matplotlib.org/api/collections_api.html
My understanding is that collections plot faster than many repeated calls
to plt.plot or plt.scatter. I've used LineCollection to plot a large number
of lines: I don't know which collection to use for repeated scatter plots,
though.
Good luck
Ryan
On Thu, Nov 15, 2012 at 12:49 PM, Sterling Smith <sm...@fu...>wrote:
> Claus,
>
> I think you are looking for something in
> http://matplotlib.org/api/colors_api.html
>
> -Sterling
>
> On Nov 15, 2012, at 8:24AM, Claus wrote:
>
> > Hi,
> > I have this issue, schematically:
> >
> > import numpy as np
> > import matplotlib.pyplot as plt
> >
> > x = np.linspace(0.0, a, b)
> >
> > for i in range(d):
> > y1 = f1(x, p1_i, p2_i)
> > y2 = f2(x, p1_i, p2_i)
> > plt.scatter(x, y1, c=color[i])
> > plt.plot(x, y2, '-', c=color[i]
> >
> >
> > my question:
> > how can I setup color to be d colors from some colormap (like cm.copper
> or cm.jet), they should be somewhat "equally" spaced... maybe the loop is not
> ideal, but I don't know a better way (yet)...
> >
> > Thanks for your help,
> > Cheers,
> > Claus
> >
> >
> >
> >
> ------------------------------------------------------------------------------
> > Monitor your physical, virtual and cloud infrastructure from a single
> > web console. Get in-depth insight into apps, servers, databases, vmware,
> > SAP, cloud infrastructure, etc. Download 30-day Free Trial.
> > Pricing starts from 795ドル for 25 servers or applications!
> > http://p.sf.net/sfu/zoho_dev2dev_nov
> > _______________________________________________
> > Matplotlib-users mailing list
> > Mat...@li...
> > https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>
>
> ------------------------------------------------------------------------------
> Monitor your physical, virtual and cloud infrastructure from a single
> web console. Get in-depth insight into apps, servers, databases, vmware,
> SAP, cloud infrastructure, etc. Download 30-day Free Trial.
> Pricing starts from 795ドル for 25 servers or applications!
> http://p.sf.net/sfu/zoho_dev2dev_nov
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
From: Benjamin R. <ben...@ou...> - 2012年11月15日 20:32:23
On Thu, Nov 15, 2012 at 12:06 PM, Paul Hobson <pmh...@gm...> wrote:
> Hey Will,
>
> As a user, all I can tell you is that pylab is there for convenience when:
> 1) quickly and interactively exploring some new data
> or
> 2) making the switch over from matlab or some other numerical analysis
> framework.
>
> In general, if you're doing some serious work -- especially work that
> you might revisit at any point -- explicitly import the packages you
> need into proper namespaces. As an example for me, this typically
> amounts to:
>
> import matplotlib.pyplot as plt
> import numpy as np
> import scipy.stats as stats
> import pandas #as pd
>
>
I still think Will's point is valid. What likely happened (and this is me
completely guessing) is that np.random.power didn't always exist. The
pylab module just blindly imports these namespaces. Now, I do think that
instead of np.power(), one should probably be using the "**" operator
instead, but this does raise the issue of knowing when there are changes in
the flatten namespace. Who's to say that something else won't collide in
the future? We might need some sort of testing for this.
Ben Root
From: Sterling S. <sm...@fu...> - 2012年11月15日 17:49:43
Claus,
I think you are looking for something in
http://matplotlib.org/api/colors_api.html
-Sterling
On Nov 15, 2012, at 8:24AM, Claus wrote:
> Hi,
> I have this issue, schematically:
> 
> import numpy as np
> import matplotlib.pyplot as plt 
> 
> x = np.linspace(0.0, a, b)
> 
> for i in range(d):
> 	y1 = f1(x, p1_i, p2_i)
> 	y2 = f2(x, p1_i, p2_i)
> 	plt.scatter(x, y1, c=color[i])
> 	plt.plot(x, y2, '-', c=color[i]
> 
> 
> my question:
> how can I setup color to be d colors from some colormap (like cm.copper or cm.jet), they should be somewhat "equally" spaced... maybe the loop is not ideal, but I don't know a better way (yet)...
> 
> Thanks for your help,
> Cheers,
> Claus
> 
> 
> 
> ------------------------------------------------------------------------------
> Monitor your physical, virtual and cloud infrastructure from a single
> web console. Get in-depth insight into apps, servers, databases, vmware,
> SAP, cloud infrastructure, etc. Download 30-day Free Trial.
> Pricing starts from 795ドル for 25 servers or applications!
> http://p.sf.net/sfu/zoho_dev2dev_nov
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
From: Paul H. <pmh...@gm...> - 2012年11月15日 17:07:05
Hey Will,
As a user, all I can tell you is that pylab is there for convenience when:
1) quickly and interactively exploring some new data
or
2) making the switch over from matlab or some other numerical analysis
framework.
In general, if you're doing some serious work -- especially work that
you might revisit at any point -- explicitly import the packages you
need into proper namespaces. As an example for me, this typically
amounts to:
import matplotlib.pyplot as plt
import numpy as np
import scipy.stats as stats
import pandas #as pd
On Thu, Nov 15, 2012 at 8:22 AM, Will Furnass <wi...@th...> wrote:
> On my machine these are rather confusingly different functions, with the
> latter corresponding to numpy.random.power. I appreciate that pylab
> imports everything from both the numpy and numpy.random modules but
> wouldn't it make sense if pylab.power were the oft-used power
> function rather than a means for sampling from the power distribution?
>
> Regards,
>
> Will Furnass
>
>
> ------------------------------------------------------------------------------
> Monitor your physical, virtual and cloud infrastructure from a single
> web console. Get in-depth insight into apps, servers, databases, vmware,
> SAP, cloud infrastructure, etc. Download 30-day Free Trial.
> Pricing starts from 795ドル for 25 servers or applications!
> http://p.sf.net/sfu/zoho_dev2dev_nov
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
From: Claus <cla...@gm...> - 2012年11月15日 16:24:57
Hi,
I have this issue, schematically:
import numpy as np
import matplotlib.pyplot as plt 
x = np.linspace(0.0, a, b)
for i in range(d):
	y1 = f1(x, p1_i, p2_i)
	y2 = f2(x, p1_i, p2_i)
	plt.scatter(x, y1, c=color[i])
	plt.plot(x, y2, '-', c=color[i]
my question:
how can I setup color to be d colors from some colormap (like cm.copper or cm.jet), they should be somewhat "equally" spaced... maybe the loop is not ideal, but I don't know a better way (yet)...
Thanks for your help,
Cheers,
Claus
From: Will F. <wi...@th...> - 2012年11月15日 16:23:07
On my machine these are rather confusingly different functions, with the
latter corresponding to numpy.random.power. I appreciate that pylab
imports everything from both the numpy and numpy.random modules but
wouldn't it make sense if pylab.power were the oft-used power
function rather than a means for sampling from the power distribution?
Regards,
Will Furnass
From: Ian T. <ian...@gm...> - 2012年11月15日 08:51:26
On 14 November 2012 21:05, Bror Jonsson <bro...@gm...> wrote:
> Dear all,
>
> I'm trying to to show where one set of values have NaN's on the contour
> plot of another set of values. I do this by creating a mask as such:
>
> fld = randn(4,4)
> fld[:2,:2] = np.nan
> mask[mask==0] = np.nan
> contourf(arange(4),arange(4),fld)
> contourf(arange(4),arange(4),mask)
>
> The problem is that the mask patch doesn't cover the empty space in the
> fld contour. Is there any way to make this happen?
>
> My ultimate goal is something like this:
>
> fld2 = randn(4,4)
> contourf(arange(4),arange(4),fld2)
> contourf(arange(4),arange(4),mask,[1,1], extend='both',
> colors='w', alpha=0.5)
>
> to present where fld has NaN's on the fld2 plot.
>
>
> Many thanks in advance!
>
> Bror Jonsson
>
Hello Bror,
It is not clear from your code snippets exactly what you are asking for.
Please can you post a full runnable example?
Ian Thomas
From: Michael D. <md...@st...> - 2012年11月15日 01:01:39
Thanks for reporting. It seems this file didn't make it over during the 
transition from Sourceforge to Github web hosting. It's been restored.
Mike
On 11/14/2012 04:45 PM, william ratcliff wrote:
> Hi! I was looking through the sample doc tutorial:
> http://matplotlib.org/sampledoc/
>
> and found that the link to the hard copy of the documentation is 
> missing. Is there a more recent link?
>
>
> Best,
> William
>
>
> ------------------------------------------------------------------------------
> Monitor your physical, virtual and cloud infrastructure from a single
> web console. Get in-depth insight into apps, servers, databases, vmware,
> SAP, cloud infrastructure, etc. Download 30-day Free Trial.
> Pricing starts from 795ドル for 25 servers or applications!
> http://p.sf.net/sfu/zoho_dev2dev_nov
>
>
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Showing 11 results of 11

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