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





Showing results of 315

1 2 3 .. 13 > >> (Page 1 of 13)
From: bhargav v. <coo...@gm...> - 2011年01月31日 17:58:40
Hello 
I am using matplotlib 1.0.0 version. and would like to use the imshow() to display my 2D image [512 X 1024]
so when I use the imshow() command as 
imshow(array,origin='lower',interpolation='bilinear')
xlables - [0,100,200,400,500]
ylabels - [0,200,400,600,800,1000]
which is correct as by default the imshow will set the grid number as the labels.
Now, physical size of this grid is [52 X 152] .... so to get that values, I use the following command
imshow(array,origin='lower',interpolation='bilinear',extend=[0.0,52.0,0.0,152.0])
and the image that I obtain is not correct. 
By not correct I mean that the important features in the image are not at the positions where I expect them to be while transforming from [512 X 1024] grid to
[52 X 152] physical grid. 
I presume this could be due to the fact that the extent just divides the axis in uniform grid ... however my grid is not uniform. 
But I do know the pixel width (dx and dy) at each position.
I have tried to use pcolor but somehow the pcolor() is too slow for such a large grid.
Can anyone help me in getting the X, and Y values correct on the axes , using imshow() and complete grid information, when I transform from [512 X 1024] grid to [52 X 152] physical grid.
Cheers
Bhargav Vaidya.
From: johanngoetz <jg...@uc...> - 2011年01月31日 16:05:39
Thanks guys! This is exactly what I was looking for. The axes_grid1 toolkit
works like a charm. I have attached a revised version of the example I had
before with a few minor modifications and some descriptive text at the top.
Is there a standard way for non-developers (i.e. users) to contribute
examples like these?
Thanks again!
http://old.nabble.com/file/p30807907/grid_histogram.py grid_histogram.py 
http://old.nabble.com/file/p30807907/grid_histogram.png 
-- 
View this message in context: http://old.nabble.com/zoomed-copy-of-axis-for-grid-of-subplots-tp30748088p30807907.html
Sent from the matplotlib - users mailing list archive at Nabble.com.
From: Jeff W. <js...@fa...> - 2011年01月31日 13:08:27
On 1/30/11 6:59 PM, Peter Smale wrote:
> Hi,
> I am using Basemap 1.0 and matplotlib 1.0 on Ubuntu 10.10. I would like
> to use the Hammer projection from the Basemap toolkit but when I use
>
> m = Basemap(resolution='c',projection='hammer',lon_0=180)
>
> I get an error (shown below).
>
> Does anyone know where the Hammer has gone?
>
> Thanks,
> Peter
Peter: hammer was added after 1.0.0 was released - so you have to 
update from svn to get it. I am planning on releasing 1.0.1 soon (in the 
next week or so).
-Jeff
>
>
> Traceback (most recent call last):
> File "md_sinPlot.py", line 37, in<module>
> m = Basemap(resolution='c',projection='hammer',lon_0=180)
> File
> "/usr/local/lib/python2.6/dist-packages/mpl_toolkits/basemap/__init__.py",
> line 700, in __init__
> raise ValueError(_unsupported_projection % projection)
> ValueError: 'hammer' is an unsupported projection.
> The supported projections are:
> aeqd Azimuthal Equidistant
> poly Polyconic
> gnom Gnomonic
> moll Mollweide
> tmerc Transverse Mercator
> nplaea North-Polar Lambert Azimuthal
> gall Gall Stereographic Cylindrical
> mill Miller Cylindrical
> merc Mercator
> stere Stereographic
> npstere North-Polar Stereographic
> geos Geostationary
> nsper Near-Sided Perspective
> vandg van der Grinten
> laea Lambert Azimuthal Equal Area
> mbtfpq McBryde-Thomas Flat-Polar Quartic
> sinu Sinusoidal
> spstere South-Polar Stereographic
> lcc Lambert Conformal
> npaeqd North-Polar Azimuthal Equidistant
> eqdc Equidistant Conic
> cyl Cylindrical Equidistant
> omerc Oblique Mercator
> aea Albers Equal Area
> spaeqd South-Polar Azimuthal Equidistant
> ortho Orthographic
> cass Cassini-Soldner
> splaea South-Polar Lambert Azimuthal
> robin Robinson
>
> ------------------------------------------------------------------------------
> Special Offer-- Download ArcSight Logger for FREE (a 49ドル USD value)!
> Finally, a world-class log management solution at an even better price-free!
> Download using promo code Free_Logger_4_Dev2Dev. Offer expires
> February 28th, so secure your free ArcSight Logger TODAY!
> http://p.sf.net/sfu/arcsight-sfd2d
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
From: Jae-Joon L. <lee...@gm...> - 2011年01月31日 07:05:54
Here is the axes_grid1 version. I only attach the *axins* part.
It is not identical to your original example and have difference scales.
-JJ
ax1 = ax[ybins-1,1]
from mpl_toolkits.axes_grid1.inset_locator import zoomed_inset_axes, \
 mark_inset
axins = zoomed_inset_axes(parent_axes=ax1, zoom=2, loc=8,
 bbox_to_anchor=(0.5, 0.),
 bbox_transform=ax1.transAxes,
 axes_kwargs=dict(sharex=ax1, sharey=ax1),
 borderpad=-1.5, #padding in fraction of font size
 )
pp, p1, p2 = mark_inset(parent_axes=ax1, inset_axes=axins, loc1=3, loc2=4.,
 linestyle="dotted")
pp.set_visible(False)
axins.axesPatch.set_alpha(0.)
# we want to draw the bottom spine only
axins.set_frame_on(True)
axins.spines['top'].set_visible(False)
axins.spines['left'].set_visible(False)
axins.spines['right'].set_visible(False)
# don't draw the y axis ticks or labels
axins.set_yticks([])
axins.set_yticklabels([])
# only draw the bottom (x) axes
axins.xaxis.set_ticks_position('bottom')
axins.xaxis.set_label_position('bottom')
axins.set_xlabel('z-coordinate')
On Mon, Jan 31, 2011 at 2:08 AM, Benjamin Root <ben...@ou...> wrote:
> On Monday, January 24, 2011, johanngoetz <jg...@uc...> wrote:
>>
>> Hello,
>> A common task I have is to histogram one variable of a multidimensional
>> dataset as a function of two (or more) variables. I have attached an example
>> which shows exactly what I would like to do.
>>
>> The problem I would like to solve is the zoomed in x-axis which is the last
>> part of the script attached. I start by copying one of the subplots with
>> Axes.twiny() and proceed to adjust it and label it. The results are quite
>> nice but as soon as I start adjusting the plotted window or any of the
>> subplot spacing parameters, this "copy of an axis" does not transform
>> properly. Could anyone make a suggestion as to which transformations I
>> should use to shift and zoom the new axes? Or perhaps there is a better
>> method for drawing a zoomed in version of an axis?
>>
>> I would like to submit this to the examples/gallery page but feel that these
>> details need to be addressed, and I am not sure I know how to fix them.
>> Hopefully, I have commented this example enough that someone could follow
>> what I am doing.
>>
>> Thank you,
>> Johann
>>
>> http://old.nabble.com/file/p30748088/grid_plot.png
>>
>> http://old.nabble.com/file/p30748088/grid_plot.py grid_plot.py
>>
>>
>> --
>> View this message in context: http://old.nabble.com/zoomed-copy-of-axis-for-grid-of-subplots-tp30748088p30748088.html
>> Sent from the matplotlib - users mailing list archive at Nabble.com.
>>
>>
>> ------------------------------------------------------------------------------
>> Special Offer-- Download ArcSight Logger for FREE (a 49ドル USD value)!
>> Finally, a world-class log management solution at an even better price-free!
>> Download using promo code Free_Logger_4_Dev2Dev. Offer expires
>> February 28th, so secure your free ArcSight Logger TODAY!
>> http://p.sf.net/sfu/arcsight-sfd2d
>> _______________________________________________
>> Matplotlib-users mailing list
>> Mat...@li...
>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>>
>
> Have you checked out the axes_grid1 toolkit? I have seen some neat
> features there such as zoomed in plots and such. Maybe it could help
> you?
>
> Ben Root
>
> ------------------------------------------------------------------------------
> Special Offer-- Download ArcSight Logger for FREE (a 49ドル USD value)!
> Finally, a world-class log management solution at an even better price-free!
> Download using promo code Free_Logger_4_Dev2Dev. Offer expires
> February 28th, so secure your free ArcSight Logger TODAY!
> http://p.sf.net/sfu/arcsight-sfd2d
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
From: Peter S. <pet...@gm...> - 2011年01月31日 01:59:33
Hi,
I am using Basemap 1.0 and matplotlib 1.0 on Ubuntu 10.10. I would like 
to use the Hammer projection from the Basemap toolkit but when I use
m = Basemap(resolution='c',projection='hammer',lon_0=180)
I get an error (shown below).
Does anyone know where the Hammer has gone?
Thanks,
Peter
Traceback (most recent call last):
 File "md_sinPlot.py", line 37, in <module>
 m = Basemap(resolution='c',projection='hammer',lon_0=180)
 File 
"/usr/local/lib/python2.6/dist-packages/mpl_toolkits/basemap/__init__.py", 
line 700, in __init__
 raise ValueError(_unsupported_projection % projection)
ValueError: 'hammer' is an unsupported projection.
The supported projections are:
 aeqd Azimuthal Equidistant
 poly Polyconic
 gnom Gnomonic
 moll Mollweide
 tmerc Transverse Mercator
 nplaea North-Polar Lambert Azimuthal
 gall Gall Stereographic Cylindrical
 mill Miller Cylindrical
 merc Mercator
 stere Stereographic
 npstere North-Polar Stereographic
 geos Geostationary
 nsper Near-Sided Perspective
 vandg van der Grinten
 laea Lambert Azimuthal Equal Area
 mbtfpq McBryde-Thomas Flat-Polar Quartic
 sinu Sinusoidal
 spstere South-Polar Stereographic
 lcc Lambert Conformal
 npaeqd North-Polar Azimuthal Equidistant
 eqdc Equidistant Conic
 cyl Cylindrical Equidistant
 omerc Oblique Mercator
 aea Albers Equal Area
 spaeqd South-Polar Azimuthal Equidistant
 ortho Orthographic
 cass Cassini-Soldner
 splaea South-Polar Lambert Azimuthal
 robin Robinson
From: Benjamin R. <ben...@ou...> - 2011年01月30日 17:08:27
On Monday, January 24, 2011, johanngoetz <jg...@uc...> wrote:
>
> Hello,
> A common task I have is to histogram one variable of a multidimensional
> dataset as a function of two (or more) variables. I have attached an example
> which shows exactly what I would like to do.
>
> The problem I would like to solve is the zoomed in x-axis which is the last
> part of the script attached. I start by copying one of the subplots with
> Axes.twiny() and proceed to adjust it and label it. The results are quite
> nice but as soon as I start adjusting the plotted window or any of the
> subplot spacing parameters, this "copy of an axis" does not transform
> properly. Could anyone make a suggestion as to which transformations I
> should use to shift and zoom the new axes? Or perhaps there is a better
> method for drawing a zoomed in version of an axis?
>
> I would like to submit this to the examples/gallery page but feel that these
> details need to be addressed, and I am not sure I know how to fix them.
> Hopefully, I have commented this example enough that someone could follow
> what I am doing.
>
> Thank you,
> Johann
>
> http://old.nabble.com/file/p30748088/grid_plot.png
>
> http://old.nabble.com/file/p30748088/grid_plot.py grid_plot.py
>
>
> --
> View this message in context: http://old.nabble.com/zoomed-copy-of-axis-for-grid-of-subplots-tp30748088p30748088.html
> Sent from the matplotlib - users mailing list archive at Nabble.com.
>
>
> ------------------------------------------------------------------------------
> Special Offer-- Download ArcSight Logger for FREE (a 49ドル USD value)!
> Finally, a world-class log management solution at an even better price-free!
> Download using promo code Free_Logger_4_Dev2Dev. Offer expires
> February 28th, so secure your free ArcSight Logger TODAY!
> http://p.sf.net/sfu/arcsight-sfd2d
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
Have you checked out the axes_grid1 toolkit? I have seen some neat
features there such as zoomed in plots and such. Maybe it could help
you?
Ben Root
On Tuesday, January 25, 2011, Daryl Herzmann <ak...@gm...> wrote:
> Hi Paul,
>
> Sorry for the delayed response....
>
> On Fri, Jan 21, 2011 at 5:20 PM, Paul Ivanov <piv...@gm...> wrote:
>> ok, much clearer now - what you want is for your text to not be
>> cut-off the way it is in the 8x8 80dpi plot? In other words,
>> there's not enough space left in the figure for the axis labels
>> to be completely displayed.
>
> Even if the text was displayed, it appears to be rather smaller than
> it could be.
>
>> At the moment, I don't think there's a simple way of doing it,
>> and the quick way I find myself doing is by adjusting the subplot
>> parameters using:
>
> Thanks for helping me so much with this. I'll continue to use my
> convert hack until better things come down the pipe. Sorry that I am
> not able to write patches to help this situation. :(
>
> daryl
>
> ------------------------------------------------------------------------------
> Special Offer-- Download ArcSight Logger for FREE (a 49ドル USD value)!
> Finally, a world-class log management solution at an even better price-free!
> Download using promo code Free_Logger_4_Dev2Dev. Offer expires
> February 28th, so secure your free ArcSight Logger TODAY!
> http://p.sf.net/sfu/arcsight-sfd2d
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
You might have more luck using a vectorized image format such as svg
or eps. In those formats, the text is saved as text and renderers can
scale the font properly based on the display size. Note that it won't
reflow your text or anything like that, but it will keep it somewhat
readable in smaller sizes.
Just my 2 cents.
Ben Root
From: Gael V. <gae...@no...> - 2011年01月30日 14:30:35
Hi list,
This is just a note that an extra track at FEMTEC, a conference for
computational methods in engineering and science, is open for open source
scientific software. The organisers have a taste for Python, so if you
want to submit a paper on numerical methods with Python, this is an
excellent venue. Abstract submission is open till end of February. To
submit you need to create an account and edit you profile.
Gael
________________________________________________________________________________
The 3rd International Conference on Finite Element Methods in Engineering
and Science (FEMTEC 2011, http://hpfem.org/events/femtec-2011/) will have
a track on Open-source projects and Python in scientific computing. 
FEMTEC 2011 is co-organized by the University of Nevada (Reno), Desert
Reseach Institute (Reno), Idaho National Laboratory (Idaho Falls, Idaho),
and U.S. Army Engineer Research and Development Center (Vicksburg,
Mississippi). The objective of the meeting is to strengthen the
interaction between researchers who develop new computational methods,
and scientists and engineers from various fields who employ numerical
methods in their research. Specific focus areas of FEMTEC 2011 include,
but are not limited to, the following: 
 * Computational methods in hydrology, atmospheric
 modeling, and other earth sciences.
 * Computational methods in nuclear, mechanical,
 civil, electrical, and other engineering fields.
 * Mesh generation and scientific visualization.
 * Open-source projects and Python in scientific computing.
Part of the conference will be a software afternoon featuring open source
projects of participants.
Proceedings
Proceedings of FEMTEC 2011 will appear as a special issue of Journal of
Computational and Applied Mathematics (2008 SCI impact factor 1.292), and
additional high-impact international journals as needed.
From: Peter B. <bu...@gm...> - 2011年01月30日 13:15:16
with a slight correction from the code proposed by Justin, it works
fine (tested on mpl 1.0.1).
On Wed, Dec 1, 2010 at 11:58 AM, Justin McCann <jneilm@...> wrote:
> Is there a straightforward way to limit the legend only to lines that
> appear within the current display limits? I have a plot that has too
> many separate data series to show on the legend at once, but once I
> zoom in it would be good to re-set the legend to show only the visible
> data points/lines.
[...]
from matplotlib import transforms
def add_legend_viewlim(ax, **kwargs):
 """ Reset the legend in ax to only display lines that are
currently visible in plot area """
 label_objs = []
 label_texts = []
 ## print "viewLim:", ax.viewLim
 for line in ax.lines:
 line_label = line.get_label()
 if line.get_visible() and line_label and not line_label.startswith("_"):
 line_bbox = transforms.Bbox.unit()
 line_bbox.update_from_data_xy(line.get_xydata())
 if ax.viewLim.overlaps(line_bbox):
 ## print line_label, line_bbox
 label_objs.append(line)
 label_texts.append(line_label)
 if label_objs:
 return ax.legend(label_objs, label_texts, **kwargs)
 elif ax.get_legend():
 ax.get_legend().set_visible(False)
-- 
thanks,
peter butterworth
From: Benjamin R. <ben...@ou...> - 2011年01月28日 20:31:15
On Friday, January 28, 2011, Thomas Lecocq <thl...@ms...> wrote:
>
>
>
>
>
>
> From: patbradf
> To: mat...@li...
> Date: 2011年1月26日 22:53:28 -0600
> Subject: [Matplotlib-users] Problem with "projection='3d'"
>
> Forgive me if this is an old question, but I just loaded mplot3d and was attempting to work through a couple of the examples on the Matplotlib website. The problem is that whenever I try to make a call to a function that requires an argument of projection=’3d’ (such as:  ax = fig.add_subplot(111, projection='3d')), Python gives me the following error: Traceback (most recent call last): File "<pyshell#12>", line 1, in <module>  ax = fig.add_subplot(111, projection='3d') File "C:\Python26\lib\site-packages\matplotlib\figure.py", line 677, in add_subplot  projection_class = get_projection_class(projection) File "C:\Python26\lib\site-packages\matplotlib\projections\__init__.py", line 61, in get_projection_class  raise ValueError("Unknown projection '%s'" % projection)ValueError: Unknown projection '3d'
>
> Check the version of matplotlib you have ! , I suspect a <=1.0
> HTH
> Thom
> 		 	 		
>
If your version is less than 1.0, the the 3D examples will not work as
is. Instead of gca() with the projection argument, you need to make
an Axes3D object instead.
fig = plt.figure()
ax = Axes3D(fig)
Or something like that (I am working off memory right now).
Ben Root
From: Nicolas B. <nbi...@gm...> - 2011年01月28日 18:42:26
Hi all,
I have a derived class that I copy-pasted from the web somewhere to hide
some tick labels:
class MinorLogTickFormatter(matplotlib.ticker.LogFormatter):
 # Format log scale with 10^ labels. Only if show one label over two.
 def __call__(self, val, pos=None):
 exponent =
int(numpy.floor(numpy.log(abs(val))/numpy.log(self._base)))
 base = int(val / 10.0**exponent)
 isDecade = self.is_decade(exponent)
 if not isDecade and self.labelOnlyBase:
 return ''
 if (not (base == 2 or base == 4 or base == 6 or base == 8)): # Only
show these ones.
 return ''
 label = r"$%d \times 10^{%d}$" % (base, exponent)
 return label
pylab.gca().xaxis.set_minor_formatter(MinorLogTickFormatter())
I've beend using this since many months, but with matplotlib 1.0.1 I can't
anymore. It complains about the is_decade() function:
isDecade = self.is_decade(exponent)
AttributeError: MinorLogTickFormatter instance has no attribute 'is_decade'
How can I fix that?
Thanks!
Nicolas
From: Philipp A. <fly...@we...> - 2011年01月28日 15:55:32
2011年1月28日 Mike Alger <ma...@ry...>
> Philip,
>
>
>
> A few questions before I give one possible solution,
>
>
>
> Does this plot need to be updated in real time ? or is this plot to be done
> in post processing?
>
>
>
> if you can do the plots with post processing you should be able to use
> pcolor function to do your tasks
>
> http://matplotlib.sourceforge.net/examples/pylab_examples/pcolor_demo.html
>
>
>
> i won’t go into details but just assign:
>
>
>
> X as 1d vector with your m/z values
>
> Y as 1d vector your time values
>
> And Z as a 2d array that will map counts/sec to both a "m/z" and "time"
> index
>
>
>
> You will have to find the location for your other marks and then plot them
> on top of pcolor graph but that shouldn’t be too hard just express your
> values (i am assuming 3dB cutoff points and peak power of some sort) in
> terms of X Y. I am almost certain there is probably a nice DSP way to solve
> for those X Y values once the data is in a 2d array but i am no expert on
> that mater.
>
>
>
> Good luck and hopefully this helps,
>
>
>
> Mike
>
hi mike,
thanks for the answer. it looks interesting, but will it work if the m/z
values are all different from each other? i mean: the m/z-ranges are
overlapping, but there are no duplicate values. this way, every column of
the array would only contain one value if i understood you correctly.
thanks,
philipp
From: Thomas L. <thl...@ms...> - 2011年01月28日 15:09:06
From: patbradf
To: mat...@li...
Date: 2011年1月26日 22:53:28 -0600
Subject: [Matplotlib-users] Problem with "projection='3d'"
Forgive me if this is an old question, but I just loaded mplot3d and was attempting to work through a couple of the examples on the Matplotlib website. The problem is that whenever I try to make a call to a function that requires an argument of projection=’3d’ (such as: ax = fig.add_subplot(111, projection='3d')), Python gives me the following error: Traceback (most recent call last): File "<pyshell#12>", line 1, in <module> ax = fig.add_subplot(111, projection='3d') File "C:\Python26\lib\site-packages\matplotlib\figure.py", line 677, in add_subplot projection_class = get_projection_class(projection) File "C:\Python26\lib\site-packages\matplotlib\projections\__init__.py", line 61, in get_projection_class raise ValueError("Unknown projection '%s'" % projection)ValueError: Unknown projection '3d'
Check the version of matplotlib you have ! , I suspect a <=1.0
HTH
Thom
 		 	 		 
From: Benjamin R. <ben...@ou...> - 2011年01月28日 13:27:47
On Wednesday, January 26, 2011, Soumyaroop Roy <sou...@gm...> wrote:
> Hi Ben:
>
> That's encouraging!
>
> I want to be able plot up to N data points (the points are in an
> ordered sequence) on a canvas and then zoom into the plot region
> enclosed within a subset sequence (e.g., T1 to T2 data points, 0 <= T1
> < T2 <=N) by putting two cursors - one on T1 and the other one on T2.
>
> regards,
> Soumyaroop
>
One way to do that would be to set the x and/or y limits based on the
min/max of the slice of data you want to view. For example:
import numpy as np
Import matplotlib.pyplot as plt
X = np.linspace(0, 5*np.pi, 100)
Y = np.sin(X)
plt.plot(X, Y)
iStart = 50
iEnd = 78
plt.xlim(X[iStart:iEnd].min(), X[iStart, iEnd].max())
plt.ylim(Y[iStart:iEnd].min(), Y[iStart, iEnd].max())
plt.show()
From: Mike A. <ma...@ry...> - 2011年01月28日 05:11:38
Philip, 
 
A few questions before I give one possible solution, 
 
Does this plot need to be updated in real time ? or is this plot to be done in post processing?
 
if you can do the plots with post processing you should be able to use pcolor function to do your tasks 
http://matplotlib.sourceforge.net/examples/pylab_examples/pcolor_demo.html 
 
i won’t go into details but just assign:
 
X as 1d vector with your m/z values 
Y as 1d vector your time values
And Z as a 2d array that will map counts/sec to both a "m/z" and "time" index
 
You will have to find the location for your other marks and then plot them on top of pcolor graph but that shouldn’t be too hard just express your values (i am assuming 3dB cutoff points and peak power of some sort) in terms of X Y. I am almost certain there is probably a nice DSP way to solve for those X Y values once the data is in a 2d array but i am no expert on that mater. 
 
Good luck and hopefully this helps, 
 
Mike 
 
 
From: Philipp A. [mailto:fly...@we...] 
Sent: January-27-11 5:15 PM
To: mat...@li...
Subject: [Matplotlib-users] 3D Data to 2d Plots
 
Hi list,
I want to visualize Plots over time.
 
This describes the data:
 3dplot.png <http://red-sheep.de/images/3dplot.png> 
 
a) and b) are single scans, the cutting at the red bars is no problem.
c) illustrates how they are done over time.
d) is what I want. I think this plot <http://matplotlib.sourceforge.net/examples/axes_grid/demo_axes_grid2.html> could be a starting point, but I don’t really understand what’s done there.
e) would be easier to do, like this plot <http://matplotlib.sourceforge.net/examples/mplot3d/polys3d_demo.html> , but information is lost this way (hidden behind higher values)
 
it would be best to do the following:
1. plot one horizontal line vertically above each other (gapless), one for each scan (so the vertical axis is the time axis)
2. each line is displayed as a series of gradients directly next to to each other (gapless)
3. the starting and ending point of each gradient are determined by the horizontal position of two adjacent data points in the current scan
4. the colors of each gradient are determined by the vertical position of the two adjacent data points in the current scan, relative to the total maximum
 
has anyone an idea how to do this? i am really a matplotlib noob.
Philipp
From: Jeff W. <js...@fa...> - 2011年01月28日 01:54:51
On 1/27/11 6:35 AM, Thomas Lecocq wrote:
> Hi all,
>
> I would like to contribute to a better readshapefile method, who 
> should I contact / where should I commit ?
>
> First improvement and partial solution :
>
> * returning a tuple of linecollections per "record", with its name and 
> other properties.
>
> Cheers,
>
> Thomas
>
> ps : example 
> http://www.geophysique.be/2011/01/27/matplotlib-basemap-tutorial-07-shapefiles-unleached/
>
> **********************
> Thomas Lecocq
> Geologist
> Ph.D.Student (Seismology)
> Royal Observatory of Belgium
> **********************
>
Thomas: If you could check out basemap from svn, add your changes, then 
create an svn diff, that would be ideal. You either send the diff 
directly to me, or post it on the list. Thanks.
-Jeff
From: Philipp A. <fly...@we...> - 2011年01月27日 22:14:45
Hi list,
I want to visualize Plots over time.
This describes the data:
[image: 3dplot.png]
a) and b) are single scans, the cutting at the red bars is no problem.
c) illustrates how they are done over time.
d) is what I want. I think this
plot<http://matplotlib.sourceforge.net/examples/axes_grid/demo_axes_grid2.html>could
be a starting point, but I don’t really understand what’s done there.
e) would be easier to do, like this
plot<http://matplotlib.sourceforge.net/examples/mplot3d/polys3d_demo.html>,
but information is lost this way (hidden behind higher values)
it would be best to do the following:
1. plot one horizontal line vertically above each other (gapless), one for
each scan (so the vertical axis is the time axis)
2. each line is displayed as a series of gradients directly next to to each
other (gapless)
3. the starting and ending point of each gradient are determined by the
horizontal position of two adjacent data points in the current scan
4. the colors of each gradient are determined by the vertical position of
the two adjacent data points in the current scan, relative to the total
maximum
has anyone an idea how to do this? i am really a matplotlib noob.
Philipp
From: C M <cmp...@gm...> - 2011年01月27日 21:37:44
> just make a numpy array out of your two lists, and you'll be able
> to subtract one from the other.
>
> import numpy as np
> top = np.array(top)
> bot = np.array(bot)
Thank you, Paul. That worked and I'm now able to display bar charts.
I appreciate it.
Best,
Che
From: Ian T. <ian...@gm...> - 2011年01月27日 20:52:11
Attachments: contour_test.py
Daniel,
Following on from Eric's comments, attached is the simplest example I could
come up with to do what you want. For non-filled contours, the 'segs' (last
few lines of the file) should be fairly self-explanatory, and this is
hopefully what you want. If you are after filled contours, you will need to
understand both the 'segs' and the 'kinds' - essentially the segs comprise
one or more discontinuous closed line loops and the corresponding kinds
indicate how the loops are split up, a 1 being a LINETO and a 2 being a
MOVETO. This can get a little awkward, and I think that sometimes you need
to deal with arrays of arrays but I can't completely remember all the
details.
You should bear in mind that this code delves into matplotlib internals and
you need to be careful as
1) it bypasses various sanity checks,
2) the underlying code could change at any point in the future (it has quite
a lot in the last year for example).
Otherwise, I hope it helps!
Ian
From: Paul I. <piv...@gm...> - 2011年01月27日 20:04:54
Benjamin Root, on 2011年01月27日 13:04, wrote:
> I believe he would rather call the core function that contour uses to
> do the heavy lifting. This was something that one can do in matlab,
> btw. I don't have access to the source right now. What does contour
> call to perform this calculation?
matplotlib.contour.QuadContourSet - which in turn uses
ContourSet, and both take ax as a required argument. They use
matplotlib.contour._cntr which is 
Daniel Fulger, on 2011年01月27日 20:21, wrote:
> no, I would like to suppress plotting entirely, avoid changing of 
> active figure and avoid handling figures or axis completely.
> I m only interested in the contourset. I wonder if my post was 
> somehow sloppy.
> 
> Yes, there are work-arounds like creating a dummy figure, similar to 
> your suggestion, and return focus to
> the previously active figure. But plotting takes time and memory, is 
> not needed and requires several code lines. Once might be ok but 
> speed and memory is important.
> Plotting with alpha=0 still requires figure and axis handling.
> 
> So how can I switch off all figure and axis related actions and 
> savely call contourset = contour(x,y,...) that does nothing else than 
> return the contours?
I understand better now, but as far as I could tell from poking
inside the QuadContourSet code, there isn't a simple way to
call the underlying machinery which generates the contours.
You'll have to look at what QuadContourSet._contour_args
does internally to see what what x, y, z should be, and then
create a contour using 
C = matplotlib.contour._cntr.Cntr(x,y,z) 
and then for each level, do something like what 
QuadContourSet._get_allsegs_and_allkinds does
C.trace(..) 
best,
-- 
Paul Ivanov
314 address only used for lists, off-list direct email at:
http://pirsquared.org | GPG/PGP key id: 0x0F3E28F7 
From: Eric F. <ef...@ha...> - 2011年01月27日 19:35:44
On 01/27/2011 09:21 AM, Daniel Fulger wrote:
>>
>> Dear all,
>>
>> contourset = pyplot.contour(..)
>>
>> calculates the contourset but also grabs whatever figure is currently
>> active *somewhere* in the entire code
>> and whichever scope it was created. The contours are plotted into it.
>>
>> While I could possibly live with that, I would really like to
>> suppress any plotting and grabbig of focus. Only the contourset
>> should be calculated.
>>
>> I can't find anything that describes this. Everybody wants the plot,
>> not me.
>>
>> I would like to avoid hte workaround to ask for the currently active
>> figure (if!! there is one at all), store the number, and later return
>> focus. Is there no switch parameter (in pyplot or for contour at
>> least) that turns plotting off?
>>
>> Regards
>> Daniel
>>
>>
>>>
>>> Hi Daniel,
>>>
>>> I'm not sure if this gets at what you're asking for, but if
>>> you just want the contours plotted on a figure other than the
>>> currently active one, grab a handle to some other axes and call
>>> contour from the axes itself (the parameters are the same).
>>> Here's what I mean:
>>>
>>> -----------
>>> f,ax =plt.subplots(1,1) #grab handles to figure and axes
>>> # or, if you're using an older version of matplotlib, do:
>>> # f=plt.figure();ax=plt.subplot(1,1,1)
>>>
>>>
>>> f2,ax2 =plt.subplots(1,1) # "f" no longer active figure
>>> ...
>>> contourset = ax.contour(...) # draw to the old figure "f"
>>> -----------
>>>
>>> You can read more about the difference between using pyplot and
>>> using the object-oriented api here:
>>>
>>> http://matplotlib.sourceforge.net/faq/usage_faq.html
>>>
>>> On the other hand, if you just want the contour to not show up,
>>> you can pass it alpha=0.0 to make it completely transparent and
>>> invisible (but it's still there)
>>>
>>> contourset = pyplot.contour(.., alpha=0.0)
>>> # later call contourset.set_alpha(1.0) to make visible again
>>>
>>> best,
>>> --
>>> Paul Ivanov
>
> Dear Paul,
>
> no, I would like to suppress plotting entirely, avoid changing of
> active figure and avoid handling figures or axis completely.
> I m only interested in the contourset. I wonder if my post was
> somehow sloppy.
>
> Yes, there are work-arounds like creating a dummy figure, similar to
> your suggestion, and return focus to
> the previously active figure. But plotting takes time and memory, is
> not needed and requires several code lines. Once might be ok but
> speed and memory is important.
> Plotting with alpha=0 still requires figure and axis handling.
>
> So how can I switch off all figure and axis related actions and
> savely call contourset = contour(x,y,...) that does nothing else than
> return the contours?
Look at contour.py, specifically QuadCountourSet._process_args. You 
will see the call to _cntr.Cntr. That is the core class, implemented in 
extension code. The contour generation is in the method 
_get_allsegs_and_allkinds, via the call to the Cntr.trace() method. You 
will have to put together your own function to instantiate Cntr and call 
Cntr.trace for each level.
A major refactoring could be done to separate the calculation from the 
plotting, maybe by making the ContourSet into a compound artist and 
putting the drawing into a draw() method instead of having it called in 
the __init__() method.
Eric
>
>
> Regards
> Daniel
>
From: Paul I. <piv...@gm...> - 2011年01月27日 19:33:44
C M, on 2011年01月27日 13:56, wrote:
> bars = self.subplot.bar(self.final_dates, top-bot, bottom=bot, align='center')
> 
> I get the error:
> 
> TypeError: unsupported operand type(s) for -: 'list' and 'list'
> 
> Because I am trying to subtract the "bots" list from the "tops" list.
> In the example code I gave, bot and times were not lists but were a
> 'numpy.ndarray' and a numpy.float64' object, respectfully, and I guess
> the - operand can be used on them.
> 
> How can I structure my data such that this can work? (For some reason
> I have not had nearly this much confusion with plotting lines, just
> bars).
Che, 
just make a numpy array out of your two lists, and you'll be able
to subtract one from the other.
import numpy as np
top = np.array(top)
bot = np.array(bot)
best, 
-- 
Paul Ivanov
314 address only used for lists, off-list direct email at:
http://pirsquared.org | GPG/PGP key id: 0x0F3E28F7 
From: Daniel F. <dan...@we...> - 2011年01月27日 19:22:31
>
> Dear all,
>
> contourset = pyplot.contour(..)
>
> calculates the contourset but also grabs whatever figure is currently
> active *somewhere* in the entire code
> and whichever scope it was created. The contours are plotted into it.
>
> While I could possibly live with that, I would really like to
> suppress any plotting and grabbig of focus. Only the contourset
> should be calculated.
>
> I can't find anything that describes this. Everybody wants the plot,
> not me.
>
> I would like to avoid hte workaround to ask for the currently active
> figure (if!! there is one at all), store the number, and later return
> focus. Is there no switch parameter (in pyplot or for contour at
> least) that turns plotting off?
>
> Regards
> Daniel
>
>
>>
>> Hi Daniel,
>>
>> I'm not sure if this gets at what you're asking for, but if
>> you just want the contours plotted on a figure other than the
>> currently active one, grab a handle to some other axes and call
>> contour from the axes itself (the parameters are the same).
>> Here's what I mean:
>>
>> -----------
>> f,ax =plt.subplots(1,1) #grab handles to figure and axes
>> # or, if you're using an older version of matplotlib, do:
>> # f=plt.figure();ax=plt.subplot(1,1,1)
>>
>>
>> f2,ax2 =plt.subplots(1,1) # "f" no longer active figure
>> ...
>> contourset = ax.contour(...) # draw to the old figure "f"
>> -----------
>>
>> You can read more about the difference between using pyplot and
>> using the object-oriented api here:
>>
>> http://matplotlib.sourceforge.net/faq/usage_faq.html
>>
>> On the other hand, if you just want the contour to not show up,
>> you can pass it alpha=0.0 to make it completely transparent and
>> invisible (but it's still there)
>>
>> contourset = pyplot.contour(.., alpha=0.0)
>> # later call contourset.set_alpha(1.0) to make visible again
>>
>> best,
>> -- 
>> Paul Ivanov
Dear Paul,
no, I would like to suppress plotting entirely, avoid changing of 
active figure and avoid handling figures or axis completely.
I m only interested in the contourset. I wonder if my post was 
somehow sloppy.
Yes, there are work-arounds like creating a dummy figure, similar to 
your suggestion, and return focus to
the previously active figure. But plotting takes time and memory, is 
not needed and requires several code lines. Once might be ok but 
speed and memory is important.
Plotting with alpha=0 still requires figure and axis handling.
So how can I switch off all figure and axis related actions and 
savely call contourset = contour(x,y,...) that does nothing else than 
return the contours?
Regards
Daniel
From: Benjamin R. <ben...@ou...> - 2011年01月27日 19:05:36
On Thursday, January 27, 2011, Paul Ivanov <piv...@gm...> wrote:
> Daniel Fulger, on 2011年01月27日 18:16, wrote:
>> Dear all,
>>
>> contourset = pyplot.contour(..)
>>
>> calculates the contourset but also grabs whatever figure is currently
>> active *somewhere* in the entire code
>> and whichever scope it was created. The contours are plotted into it.
>>
>> While I could possibly live with that, I would really like to
>> suppress any plotting and grabbig of focus. Only the contourset
>> should be calculated.
>>
>> I can't find anything that describes this. Everybody wants the plot,
>> not me.
>>
>> I would like to avoid hte workaround to ask for the currently active
>> figure (if!! there is one at all), store the number, and later return
>> focus. Is there no switch parameter (in pyplot or for contour at
>> least) that turns plotting off?
>
> Hi Daniel,
>
> I'm not sure if this gets at what you're asking for, but if
> you just want the contours plotted on a figure other than the
> currently active one, grab a handle to some other axes and call
> contour from the axes itself (the parameters are the same).
> Here's what I mean:
>
> -----------
> f,ax =plt.subplots(1,1) #grab handles to figure and axes
> # or, if you're using an older version of matplotlib, do:
> # f=plt.figure();ax=plt.subplot(1,1,1)
>
>
> f2,ax2 =plt.subplots(1,1) # "f" no longer active figure
> ...
> contourset = ax.contour(...) # draw to the old figure "f"
> -----------
>
> You can read more about the difference between using pyplot and
> using the object-oriented api here:
>
> http://matplotlib.sourceforge.net/faq/usage_faq.html
>
> On the other hand, if you just want the contour to not show up,
> you can pass it alpha=0.0 to make it completely transparent and
> invisible (but it's still there)
>
> contourset = pyplot.contour(.., alpha=0.0)
> # later call contourset.set_alpha(1.0) to make visible again
>
> best,
> --
> Paul Ivanov
> 314 address only used for lists, off-list direct email at:
> http://pirsquared.org | GPG/PGP key id: 0x0F3E28F7
>
I believe he would rather call the core function that contour uses to
do the heavy lifting. This was something that one can do in matlab,
btw. I don't have access to the source right now. What does contour
call to perform this calculation?
Ben Root
From: C M <cmp...@gm...> - 2011年01月27日 18:57:02
Hi Paul,
> The reason you were getting that error is because unless you
> specify otherwise, ax.bar will make the bottom of the bars at 0 -
> which isn't an allowed date, hence the error. Change your bar
> line to this (I also added align='center', but you can remove it
> if you want):
Aha, OK that makes sense. Thank you. I think the point #3 in my
previous email about the "Ordinal must be >= 1" has all been about
what is or isn't allowed as a proper date.
So your example worked of course, but I am still not able to get my
real code to plot a bar chart. If I tell you what the format of the
data is, maybe you can help me.
I would like to plot dates (on x axis) versus time intervals (on y).
I have a list of dates and I have a two lists (self.data[0] and
self.data[1]), one of the start times ("bots") and one of the stop
times ("tops"). But when I go to plot it, and do this (based on your
code...for now leaving out the round() step):
 bots = self.data[0]
 tops = self.data[1]
bars = self.subplot.bar(self.final_dates, top-bot, bottom=bot, align='center')
I get the error:
TypeError: unsupported operand type(s) for -: 'list' and 'list'
Because I am trying to subtract the "bots" list from the "tops" list.
In the example code I gave, bot and times were not lists but were a
'numpy.ndarray' and a numpy.float64' object, respectfully, and I guess
the - operand can be used on them.
How can I structure my data such that this can work? (For some reason
I have not had nearly this much confusion with plotting lines, just
bars).
Thanks for all the help,
Che (CM)
6 messages has been excluded from this view by a project administrator.

Showing results of 315

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