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






Showing results of 154

1 2 3 .. 7 > >> (Page 1 of 7)
From: Eric F. <ef...@ha...> - 2014年11月27日 18:08:28
On 2014年11月27日, 4:55 AM, Bala subramanian wrote:
> Friends,
>
> I want to make multiple graphs on a single axes. As an example, i am
> pasting below an article where it has been shown.
>
> http://www.ncbi.nlm.nih.gov/pubmed/23403925
>
> My plot of interest is *Figure7B*, where multiple distribution are
> depicted in single plot. I want to make a similar one. Kindly give me
> some insights on how i can make it with mpl, if anyone have achieved
> making it with mpl.
Fig 7b is just a set of curves with sequential offsets in x, right? A 
LineCollection can be nice for this. See the last panel in 
http://matplotlib.org/examples/api/collections_demo.html.
Eric
>
> Thanks in advance,
> Bala
>
>
> --
> C. Balasubramanian
>
From: Francesco M. <fra...@gm...> - 2014年11月27日 17:17:33
Hi,
put all them into a list
ps = [p1, p2, ..., pn]
and then unpack them
path.Path.make_compound_path(*ps)
Cheers,
Fra
ps: this is standard python unpacking
2014年11月27日 18:12 GMT+01:00 Evan Mason <eva...@gm...>:
> Hi, I have several path objects that I want to join together with
> make_compound_path.
>
> For example, with p1 and p2:
>
> In [136]: p1
> Out[136]:
> Path(array([[-29.85721973, -30. ],
> [-29.84752676, -29.77715877],
> [-29.88734508, -29.55431755],
> [-29.97470553, -29.33147632],
> [-30. , -29.28831083]]), None)
>
> In [138]: p2
> Out[138]:
> Path(array([[-30. , 45.0000166 ],
> [-29.94756898, 45.09749304],
> [-29.87227011, 45.32033426],
> [-29.84525888, 45.54317549],
> [-29.86787108, 45.76601671],
> [-29.93898847, 45.98885794],
> [-30. , 46.10595725]]), None)
>
> I can do path.Path.make_compound_path(p1, p2) which joins them
> successfully.
> If I have a another path, p3, I can do:
> path.Path.make_compound_path(p1, p2,p3), and so on.
>
> However, in my script I never know how many paths I will have, so I'd like
> to put them into some sort of container, and pass that to
> make_compound_path. I've tried lists:
>
>
> In [140]: p1p2 = [p1, p2]
>
> In [141]: path.Path.make_compound_path(p1p2)
> ---------------------------------------------------------------------------
> AttributeError Traceback (most recent call last)
> <ipython-input-141-eb62de9fcada> in <module>()
> ----> 1 path.Path.make_compound_path(p1p2)
>
> /usr/lib64/python2.7/site-packages/matplotlib-1.4.2-py2.7-linux-x86_64.egg
> /matplotlib/path.py
> in make_compound_path(cls, *args)
> 330 total_length = sum(lengths)
> 331
> --> 332 vertices = np.vstack([x.vertices for x in args])
> 333 vertices.reshape((total_length, 2))
> 334
>
> AttributeError: 'list' object has no attribute 'vertices'
>
>
> without success. Can anybody suggest a way to do this?
>
> Thanks, Evan
>
>
>
> ------------------------------------------------------------------------------
> Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
> from Actuate! Instantly Supercharge Your Business Reports and Dashboards
> with Interactivity, Sharing, Native Excel Exports, App Integration & more
> Get technology previously reserved for billion-dollar corporations, FREE
>
> http://pubads.g.doubleclick.net/gampad/clk?id=157005751&iu=/4140/ostg.clktrk
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
From: Evan M. <eva...@gm...> - 2014年11月27日 17:12:23
Hi, I have several path objects that I want to join together with
make_compound_path.
For example, with p1 and p2:
In [136]: p1
Out[136]: 
Path(array([[-29.85721973, -30. ],
 [-29.84752676, -29.77715877],
 [-29.88734508, -29.55431755],
 [-29.97470553, -29.33147632],
 [-30. , -29.28831083]]), None)
In [138]: p2
Out[138]: 
Path(array([[-30. , 45.0000166 ],
 [-29.94756898, 45.09749304],
 [-29.87227011, 45.32033426],
 [-29.84525888, 45.54317549],
 [-29.86787108, 45.76601671],
 [-29.93898847, 45.98885794],
 [-30. , 46.10595725]]), None)
I can do path.Path.make_compound_path(p1, p2) which joins them successfully.
If I have a another path, p3, I can do:
 path.Path.make_compound_path(p1, p2,p3), and so on.
However, in my script I never know how many paths I will have, so I'd like
 to put them into some sort of container, and pass that to
 make_compound_path. I've tried lists:
In [140]: p1p2 = [p1, p2]
In [141]: path.Path.make_compound_path(p1p2)
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-141-eb62de9fcada> in <module>()
----> 1 path.Path.make_compound_path(p1p2)
/usr/lib64/python2.7/site-packages/matplotlib-1.4.2-py2.7-linux-x86_64.egg
/matplotlib/path.py
in make_compound_path(cls, *args)
 330 total_length = sum(lengths)
 331 
--> 332 vertices = np.vstack([x.vertices for x in args])
 333 vertices.reshape((total_length, 2))
 334 
AttributeError: 'list' object has no attribute 'vertices'
without success. Can anybody suggest a way to do this?
Thanks, Evan
From: Paul H. <pmh...@gm...> - 2014年11月27日 17:05:55
Check out the third example in the gallery:
Gallery Link:
http://matplotlib.org/gallery.html
Direct Link:
http://matplotlib.org/examples/lines_bars_and_markers/fill_demo_features.html
On Thu, Nov 27, 2014 at 6:55 AM, Bala subramanian <bal...@gm...
> wrote:
> Friends,
>
> I want to make multiple graphs on a single axes. As an example, i am
> pasting below an article where it has been shown.
>
> http://www.ncbi.nlm.nih.gov/pubmed/23403925
>
> My plot of interest is *Figure7B*, where multiple distribution are
> depicted in single plot. I want to make a similar one. Kindly give me some
> insights on how i can make it with mpl, if anyone have achieved making it
> with mpl.
>
> Thanks in advance,
> Bala
>
>
> --
> C. Balasubramanian
>
>
> ------------------------------------------------------------------------------
> Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
> from Actuate! Instantly Supercharge Your Business Reports and Dashboards
> with Interactivity, Sharing, Native Excel Exports, App Integration & more
> Get technology previously reserved for billion-dollar corporations, FREE
>
> http://pubads.g.doubleclick.net/gampad/clk?id=157005751&iu=/4140/ostg.clktrk
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>
From: Shahar Shani-K. <ka...@po...> - 2014年11月27日 17:04:27
you could go with something like this:
import matplotlib.pyplot as plt
import numpy as np
fig, ax = plt.subplots(1, 10, figsize=(10,3))
fig.subplots_adjust(wspace=0)
for i,axi in enumerate(ax):
 axi.axis((0,1,0,1))
 axi.xaxis.set_ticks([])
 axi.yaxis.set_ticks([])
 if i is 0:
 axi.xaxis.tick_bottom()
 axi.yaxis.tick_left()
 axi.spines['right'].set_visible(False)
 axi.spines['top'].set_visible(False)
 axi.spines['left'].set_bounds(0, 1)
 axi.spines['bottom'].set_bounds(0, 1)
 axi.yaxis.set_ticks(np.linspace(0,1,5))
 axi.yaxis.set_ticklabels(np.linspace(0,1,5))
 axi.xaxis.set_ticks(np.linspace(0,1,3))
 axi.xaxis.set_ticklabels(np.linspace(0,1,3))
 if i > 0:
 axi.set_frame_on(False)
 
 axi.plot(np.random.rand(10), np.random.rand(10))
 
On Nov 27, 2014, at 4:55 PM, Bala subramanian <bal...@gm...> wrote:
> Friends,
> 
> I want to make multiple graphs on a single axes. As an example, i am pasting below an article where it has been shown.
> 
> http://www.ncbi.nlm.nih.gov/pubmed/23403925
> 
> My plot of interest is Figure7B, where multiple distribution are depicted in single plot. I want to make a similar one. Kindly give me some insights on how i can make it with mpl, if anyone have achieved making it with mpl.
> 
> Thanks in advance,
> Bala
> 
> 
> -- 
> C. Balasubramanian
> ------------------------------------------------------------------------------
> Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
> from Actuate! Instantly Supercharge Your Business Reports and Dashboards
> with Interactivity, Sharing, Native Excel Exports, App Integration & more
> Get technology previously reserved for billion-dollar corporations, FREE
> http://pubads.g.doubleclick.net/gampad/clk?id=157005751&iu=/4140/ostg.clktrk_______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
From: Bala s. <bal...@gm...> - 2014年11月27日 14:56:00
Friends,
I want to make multiple graphs on a single axes. As an example, i am
pasting below an article where it has been shown.
http://www.ncbi.nlm.nih.gov/pubmed/23403925
My plot of interest is *Figure7B*, where multiple distribution are depicted
in single plot. I want to make a similar one. Kindly give me some insights
on how i can make it with mpl, if anyone have achieved making it with mpl.
Thanks in advance,
Bala
-- 
C. Balasubramanian
From: Thomas C. <tca...@gm...> - 2014年11月26日 14:28:28
Please put in a pull request to add your file to the rest of the style
files.
Tom
On Tue, Nov 25, 2014, 22:58 Itay Livni <liv...@gm...> wrote:
> Hi - I am Itay and brand new here. Still to receive any sort of mails.
> Actually quite new to git also. In any case I have a 90% complete .*mplstyle
> *Solarized Light style sheet, based on ggplot2 that I posted on Github. (
> https://github.com/ilivni/thegrbox) .
>
> Things to be done (but don't know how)
>
> - Title padding
> - Title color
> - Minor grid width
> - Alpha for graphs with a "fill"
>
>
> Basically I wanted to do a pull request for the file(?), but that seemed
> excessive -maybe make a download link for people to post and share
> styles.. (is there one already?)
>
> Anyway take a look and critique away if it suits.
>
>
> Itay Livni
>
> theGraybox <http://www.thegrbox.com/#about>
> 312 235 2318
> ------------------------------------------------------------
> ------------------
> Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
> from Actuate! Instantly Supercharge Your Business Reports and Dashboards
> with Interactivity, Sharing, Native Excel Exports, App Integration & more
> Get technology previously reserved for billion-dollar corporations, FREE
> http://pubads.g.doubleclick.net/gampad/clk?id=157005751&
> iu=/4140/ostg.clktrk_______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
From: Phil E. <pel...@gm...> - 2014年11月26日 11:04:08
There will be an open source Python sprint, hosted by Bloomberg, this
weekend in London. The event will be attended by core developers of many of
the major scientific Python packages (IPython, numpy, scipy, pandas,
scikit-learn) who will act as mentors to those who would like to get
involved in the development of these important scientific tools.
I will be attending as a mentor for matplotlib (if there are any other core
developers who may be able to attend, the more the merrier!) and am hoping
there will be many attendees who want to get a helping hand getting started
with matplotlib development. We've got lots of room for improvement, from
the obvious documentation enhancements right through to the nitty-gritty of
improving backends such as nbagg.
If you want to come along to the event, please sign-up at
http://go.bloomberg.com/promo/invite/bloomberg-open-source-day-scientific-python/
.
Hope you see some of you there,
Phil
From: Itay L. <liv...@gm...> - 2014年11月26日 03:57:18
Hi - I am Itay and brand new here. Still to receive any sort of mails.
Actually quite new to git also. In any case I have a 90% complete .*mplstyle
*Solarized Light style sheet, based on ggplot2 that I posted on Github. (
https://github.com/ilivni/thegrbox) .
Things to be done (but don't know how)
 - Title padding
 - Title color
 - Minor grid width
 - Alpha for graphs with a "fill"
Basically I wanted to do a pull request for the file(?), but that seemed
excessive -maybe make a download link for people to post and share
styles.. (is there one already?)
Anyway take a look and critique away if it suits.
Itay Livni
theGraybox <http://www.thegrbox.com/#about>
312 235 2318
From: Ken M. <ma...@gm...> - 2014年11月24日 22:31:35
* On 2014年11月24日 at 09:46, Ken Mankoff wrote:
> How can I flush/update/whatever the plot in code so that I can access
> the spine locations?
plt.draw() instead of plt.show()
 -k.
 
From: Ken M. <ma...@gm...> - 2014年11月24日 14:47:04
Hi.
The following code reports a location for the axis spines due to the
print command in the last statement. If I re-run that last print command
immediately after running everything else, it reports different values.
Do other people experience this? I thought that the plt.show() command
is sort-of like a 'flush' command, but it does not appear to work that
way.
How can I flush/update/whatever the plot in code so that I can access
the spine locations?
Thanks,
 -k.
 
im = np.arange(256).reshape(16,16)
fig = plt.figure(1)
fig.clf()
ax = fig.add_subplot(211)
ax.imshow(im)
plt.show()
print ax.spines['left'].get_verts()
From: Ian T. <ian...@gm...> - 2014年11月22日 19:49:35
From: Maria L. <li...@us...> - 2014年11月21日 22:21:02
Thank you for the note, but it is definitely many more extra cells than just one around the border. Especially bounding area on the east side of the state is affected the most.
Thanks,
Masha
On Nov 21, 2014, at 11:31 AM, Benjamin Root <ben...@ou...<mailto:ben...@ou...>> wrote:
How many cells past the state boundary are you seeing? If it is never more than one cell past the boundary, it might be an offset issue.
On Fri, Nov 21, 2014 at 1:30 PM, Maria Liukis <li...@us...<mailto:li...@us...>> wrote:
Eric,
Yes, my data is exactly how you understood it. I thought, as you are suggesting, to create a masked array for rectangle that bounds state of CA, to be used with pcolormesh(). The only existing functionality that I could find is griddata(), but it also interpolates data to extra cells outside of my CA grid (even with method=‘nearest’ to extra cells within the convex hull). It looks like I have to "map" my CA grid to larger rectangular grid manually, I just wanted to check if such functionality already exists within matplotlib, numpy or scipy packages, and I am just not aware of it.
I also could plot each cell with ax.add_patch(), but would imagine that it would be much slower.
And thank you for mentioning basemap, I am using it for my maps :)
Thank you very much for your response!
Masha
On Nov 21, 2014, at 6:54 AM, Eric Firing <ef...@ha...<mailto:ef...@ha...>> wrote:
> On 2014年11月20日, 7:11 PM, Maria Liukis wrote:
>> Hello,
>>
>> I have a problem plotting data which is defined on a grid other than
>> rectangular mesh, and would greatly appreciate any advise. My data is
>> defined for 0.1degree grid for the state of California, and I don’t
>> want to interpolate my data outside of the defined grid when plotting
>> it. I used pcolormesh() function for rectangular area maps, but it
>> only accepts rectangular grid and I was wondering if there is a
>> simple solution to my problem.
>
> Masha,
>
> When you say your data "is defined for a 0.1 degree grid", that makes it
> sound like it is on a quadrilateral grid, so there should be no problem
> with using pcolormesh. Is it on 0.1 degree lon by 0.1 degree lat
> points, but only for points within California? Then you can make a
> masked array with this grid for a rectangle in which the points outside
> California are masked, and the ones inside are set to your data values.
> Your X and Y inputs to pcolormesh should be 2-D arrays with the
> boundary values rather than the centers. It sounds like you would want
> to do all this via mpl_toolkits.basemap.Basemap so that you will end up
> with a properly proportioned and labeled map.
>
> Maybe I am misinterpreting your description of your data, however.
>
> Eric
>
>>
>> The only solution I could find was to use
>> scipy.interpolate,griddata() to "map" my grid to a bounding
>> rectangular grid (bounding rectangle around CA state), but that would
>> also interpolate my data to grid cells outside of CA state, which I
>> don’t want to do.
>>
>> Many thanks for any hints! Masha -- li...@us...<mailto:li...@us...>
>>
>>
>>
>
>> ------------------------------------------------------------------------------
>> Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
>> from Actuate! Instantly Supercharge Your Business Reports and Dashboards
>> with Interactivity, Sharing, Native Excel Exports, App Integration & more
>> Get technology previously reserved for billion-dollar corporations, FREE
>> http://pubads.g.doubleclick.net/gampad/clk?id=157005751&iu=/4140/ostg.clktrk
>> _______________________________________________
>> Matplotlib-users mailing list
>> Mat...@li...<mailto:Mat...@li...>
>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>>
>
>
> ------------------------------------------------------------------------------
> Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
> from Actuate! Instantly Supercharge Your Business Reports and Dashboards
> with Interactivity, Sharing, Native Excel Exports, App Integration & more
> Get technology previously reserved for billion-dollar corporations, FREE
> http://pubads.g.doubleclick.net/gampad/clk?id=157005751&iu=/4140/ostg.clktrk
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...<mailto:Mat...@li...>
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
------------------------------------------------------------------------------
Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
from Actuate! Instantly Supercharge Your Business Reports and Dashboards
with Interactivity, Sharing, Native Excel Exports, App Integration & more
Get technology previously reserved for billion-dollar corporations, FREE
http://pubads.g.doubleclick.net/gampad/clk?id=157005751&iu=/4140/ostg.clktrk
_______________________________________________
Matplotlib-users mailing list
Mat...@li...<mailto:Mat...@li...>
https://lists.sourceforge.net/lists/listinfo/matplotlib-users
From: Benjamin R. <ben...@ou...> - 2014年11月21日 19:32:06
How many cells past the state boundary are you seeing? If it is never more
than one cell past the boundary, it might be an offset issue.
On Fri, Nov 21, 2014 at 1:30 PM, Maria Liukis <li...@us...> wrote:
> Eric,
>
> Yes, my data is exactly how you understood it. I thought, as you are
> suggesting, to create a masked array for rectangle that bounds state of CA,
> to be used with pcolormesh(). The only existing functionality that I could
> find is griddata(), but it also interpolates data to extra cells outside of
> my CA grid (even with method=‘nearest’ to extra cells within the convex
> hull). It looks like I have to "map" my CA grid to larger rectangular grid
> manually, I just wanted to check if such functionality already exists
> within matplotlib, numpy or scipy packages, and I am just not aware of it.
>
> I also could plot each cell with ax.add_patch(), but would imagine that it
> would be much slower.
>
> And thank you for mentioning basemap, I am using it for my maps :)
>
> Thank you very much for your response!
> Masha
>
>
> On Nov 21, 2014, at 6:54 AM, Eric Firing <ef...@ha...> wrote:
>
> > On 2014年11月20日, 7:11 PM, Maria Liukis wrote:
> >> Hello,
> >>
> >> I have a problem plotting data which is defined on a grid other than
> >> rectangular mesh, and would greatly appreciate any advise. My data is
> >> defined for 0.1degree grid for the state of California, and I don’t
> >> want to interpolate my data outside of the defined grid when plotting
> >> it. I used pcolormesh() function for rectangular area maps, but it
> >> only accepts rectangular grid and I was wondering if there is a
> >> simple solution to my problem.
> >
> > Masha,
> >
> > When you say your data "is defined for a 0.1 degree grid", that makes it
> > sound like it is on a quadrilateral grid, so there should be no problem
> > with using pcolormesh. Is it on 0.1 degree lon by 0.1 degree lat
> > points, but only for points within California? Then you can make a
> > masked array with this grid for a rectangle in which the points outside
> > California are masked, and the ones inside are set to your data values.
> > Your X and Y inputs to pcolormesh should be 2-D arrays with the
> > boundary values rather than the centers. It sounds like you would want
> > to do all this via mpl_toolkits.basemap.Basemap so that you will end up
> > with a properly proportioned and labeled map.
> >
> > Maybe I am misinterpreting your description of your data, however.
> >
> > Eric
> >
> >>
> >> The only solution I could find was to use
> >> scipy.interpolate,griddata() to "map" my grid to a bounding
> >> rectangular grid (bounding rectangle around CA state), but that would
> >> also interpolate my data to grid cells outside of CA state, which I
> >> don’t want to do.
> >>
> >> Many thanks for any hints! Masha -- li...@us...
> >>
> >>
> >>
> >
> >>
> ------------------------------------------------------------------------------
> >> Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
> >> from Actuate! Instantly Supercharge Your Business Reports and Dashboards
> >> with Interactivity, Sharing, Native Excel Exports, App Integration &
> more
> >> Get technology previously reserved for billion-dollar corporations, FREE
> >>
> http://pubads.g.doubleclick.net/gampad/clk?id=157005751&iu=/4140/ostg.clktrk
> >> _______________________________________________
> >> Matplotlib-users mailing list
> >> Mat...@li...
> >> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
> >>
> >
> >
> >
> ------------------------------------------------------------------------------
> > Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
> > from Actuate! Instantly Supercharge Your Business Reports and Dashboards
> > with Interactivity, Sharing, Native Excel Exports, App Integration & more
> > Get technology previously reserved for billion-dollar corporations, FREE
> >
> http://pubads.g.doubleclick.net/gampad/clk?id=157005751&iu=/4140/ostg.clktrk
> > _______________________________________________
> > Matplotlib-users mailing list
> > Mat...@li...
> > https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>
>
> ------------------------------------------------------------------------------
> Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
> from Actuate! Instantly Supercharge Your Business Reports and Dashboards
> with Interactivity, Sharing, Native Excel Exports, App Integration & more
> Get technology previously reserved for billion-dollar corporations, FREE
>
> http://pubads.g.doubleclick.net/gampad/clk?id=157005751&iu=/4140/ostg.clktrk
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
From: Maria L. <li...@us...> - 2014年11月21日 18:30:11
Eric,
Yes, my data is exactly how you understood it. I thought, as you are suggesting, to create a masked array for rectangle that bounds state of CA, to be used with pcolormesh(). The only existing functionality that I could find is griddata(), but it also interpolates data to extra cells outside of my CA grid (even with method=‘nearest’ to extra cells within the convex hull). It looks like I have to "map" my CA grid to larger rectangular grid manually, I just wanted to check if such functionality already exists within matplotlib, numpy or scipy packages, and I am just not aware of it.
I also could plot each cell with ax.add_patch(), but would imagine that it would be much slower. 
And thank you for mentioning basemap, I am using it for my maps :)
Thank you very much for your response!
Masha
On Nov 21, 2014, at 6:54 AM, Eric Firing <ef...@ha...> wrote:
> On 2014年11月20日, 7:11 PM, Maria Liukis wrote:
>> Hello,
>> 
>> I have a problem plotting data which is defined on a grid other than
>> rectangular mesh, and would greatly appreciate any advise. My data is
>> defined for 0.1degree grid for the state of California, and I don’t
>> want to interpolate my data outside of the defined grid when plotting
>> it. I used pcolormesh() function for rectangular area maps, but it
>> only accepts rectangular grid and I was wondering if there is a
>> simple solution to my problem.
> 
> Masha,
> 
> When you say your data "is defined for a 0.1 degree grid", that makes it 
> sound like it is on a quadrilateral grid, so there should be no problem 
> with using pcolormesh. Is it on 0.1 degree lon by 0.1 degree lat 
> points, but only for points within California? Then you can make a 
> masked array with this grid for a rectangle in which the points outside 
> California are masked, and the ones inside are set to your data values. 
> Your X and Y inputs to pcolormesh should be 2-D arrays with the 
> boundary values rather than the centers. It sounds like you would want 
> to do all this via mpl_toolkits.basemap.Basemap so that you will end up 
> with a properly proportioned and labeled map.
> 
> Maybe I am misinterpreting your description of your data, however.
> 
> Eric
> 
>> 
>> The only solution I could find was to use
>> scipy.interpolate,griddata() to "map" my grid to a bounding
>> rectangular grid (bounding rectangle around CA state), but that would
>> also interpolate my data to grid cells outside of CA state, which I
>> don’t want to do.
>> 
>> Many thanks for any hints! Masha -- li...@us...
>> 
>> 
>> 
> 
>> ------------------------------------------------------------------------------
>> Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
>> from Actuate! Instantly Supercharge Your Business Reports and Dashboards
>> with Interactivity, Sharing, Native Excel Exports, App Integration & more
>> Get technology previously reserved for billion-dollar corporations, FREE
>> http://pubads.g.doubleclick.net/gampad/clk?id=157005751&iu=/4140/ostg.clktrk
>> _______________________________________________
>> Matplotlib-users mailing list
>> Mat...@li...
>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>> 
> 
> 
> ------------------------------------------------------------------------------
> Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
> from Actuate! Instantly Supercharge Your Business Reports and Dashboards
> with Interactivity, Sharing, Native Excel Exports, App Integration & more
> Get technology previously reserved for billion-dollar corporations, FREE
> http://pubads.g.doubleclick.net/gampad/clk?id=157005751&iu=/4140/ostg.clktrk
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
From: Maria L. <li...@us...> - 2014年11月21日 18:18:09
Thank you for the suggestion, unfortunately "nearest" method for interpolation still does interpolation to some extra cells outside of my CA grid which fall within the convex hull.
I thought I check if there is existing functionality for that within matplotlib, but it seems that I have to manually "map" my grid to larger rectangular grid for plotting.
Many thanks for your response!
Masha
--
li...@us...<mailto:li...@us...>
On Nov 21, 2014, at 12:15 AM, Shahar Shani Kadmiel <ka...@po...<mailto:ka...@po...>> wrote:
When using scipy.interpolate.griddada, you could use 'nearest' if your data is sufficiently dense. This will 'map' your grid onto whatever rectangular grid leaving grid points outside the convex hull of the original grid empty. Well, not empty but nan.
If you do wish to interpolate your dada, you could mask the resulting rectangular grid post interpolation.
—
Sent from Mailbox<https://www.dropbox.com/mailbox>
On Fri, Nov 21, 2014 at 2:12 AM, Maria Liukis <li...@us...<mailto:li...@us...>> wrote:
Hello,
I have a problem plotting data which is defined on a grid other than rectangular mesh, and would greatly appreciate any advise. My data is defined for 0.1degree grid for the state of California, and I don’t want to interpolate my data outside of the defined grid when plotting it. I used pcolormesh() function for rectangular area maps, but it only accepts rectangular grid and I was wondering if there is a simple solution to my problem.
The only solution I could find was to use scipy.interpolate,griddata() to "map" my grid to a bounding rectangular grid (bounding rectangle around CA state), but that would also interpolate my data to grid cells outside of CA state, which I don’t want to do.
Many thanks for any hints!
Masha
--
li...@us...<mailto:li...@us...>
------------------------------------------------------------------------------
Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
from Actuate! Instantly Supercharge Your Business Reports and Dashboards
with Interactivity, Sharing, Native Excel Exports, App Integration & more
Get technology previously reserved for billion-dollar corporations, FREE
http://pubads.g.doubleclick.net/gampad/clk?id=157005751&iu=/4140/ostg.clktrk
_______________________________________________
Matplotlib-users mailing list
Mat...@li...<mailto:Mat...@li...>
https://lists.sourceforge.net/lists/listinfo/matplotlib-users
From: Joe K. <jof...@gm...> - 2014年11月21日 17:51:46
Attachments: figure_1.png figure_1.png
>
> On Fri, Nov 21, 2014 at 10:42 AM, Pedro Marcal <ped...@gm...>
> wrote:
> @MariaLukis, I had to go through contortions to plot an arbitrary
> quadrilateral mesh, in 3D. I resolved it by storing every line plotted and
> retracing the best set to take me to the starting point of the quad I was
> plotting. It would have been much easier if I had the function of lifting
> my pen and move while not plotting. But then I did not know how to get
> intpo matplotlib to perform what is a simple mod.
>
<...snip...>
>
First off, ``pcolormesh`` will happily plot arbitrary quadrilateral meshes,
so long as you can describe the points in a regular manner. For example:
import matplotlib.pyplot as plt
import numpy as np
shape = (10, 10)
y, x = np.mgrid[:shape[0], :shape[1]]
# Distort the grid so that it's no longer regular
x = x + np.random.normal(0, 0.2, shape)
y = y + np.random.normal(0, 0.2, shape)
z = np.random.random(shape)
fig, ax = plt.subplots()
ax.pcolormesh(x, y, z)
plt.show()
​Also, "lifting the pen while not plotting" is the basis of how paths are
handled in matplotlib. Normally, you wouldn't drop down to this
lower-level API very often, but it underpins a lot of higher-level
matplotlib artists. For example, let's draw 4 squares with one path:
import matplotlib.pyplot as plt
from matplotlib.path import Path
from matplotlib.patches import PathPatch
codes = Path.LINETO * np.ones(5, dtype=np.uint8)
codes[0] = Path.MOVETO
x = np.array([0, 1, 1, 0, 0])
y = np.array([0, 0, 1, 1, 0])
numsquares = 4
x = np.hstack([x + 2*i for i in range(numsquares)])
y = np.hstack([y + 2*i for i in range(numsquares)])
codes = np.hstack(numsquares * [codes])
path = Path(np.c_[x, y], codes)
patch = PathPatch(path, facecolor='red')
fig, ax = plt.subplots()
ax.add_patch(patch)
ax.autoscale()
ax.axis('equal')
ax.margins(0.05)
plt.show()
​Hopefully those examples help a bit (or at least give food for thought).
Cheers,
-Joe
From: Pedro M. <ped...@gm...> - 2014年11月21日 16:42:34
@MariaLukis, I had to go through contortions to plot an arbitrary
quadrilateral mesh, in 3D. I resolved it by storing every line plotted and
retracing the best set to take me to the starting point of the quad I was
plotting. It would have been much easier if I had the function of lifting
my pen and move while not plotting. But then I did not know how to get
intpo matplotlib to perform what is a simple mod.
On Fri, Nov 21, 2014 at 6:54 AM, <
mat...@li...> wrote:
> Send Matplotlib-users mailing list submissions to
> mat...@li...
>
> To subscribe or unsubscribe via the World Wide Web, visit
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
> or, via email, send a message with subject or body 'help' to
> mat...@li...
>
> You can reach the person managing the list at
> mat...@li...
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of Matplotlib-users digest..."
>
>
> Today's Topics:
>
> 1. How to plot other than rectangular grid? (Maria Liukis)
> 2. Re: How to plot other than rectangular grid? (Thomas Caswell)
> 3. Re: How to plot other than rectangular grid?
> (Shahar Shani Kadmiel)
> 4. Re: How to plot other than rectangular grid? (Oliver)
> 5. Re: How to plot other than rectangular grid? (Eric Firing)
>
>
> ----------------------------------------------------------------------
>
> Message: 1
> Date: 2014年11月21日 00:11:31 +0000
> From: Maria Liukis <li...@us...>
> Subject: [Matplotlib-users] How to plot other than rectangular grid?
> To: "mat...@li..."
> <mat...@li...>
> Message-ID: <503...@us...>
> Content-Type: text/plain; charset="Windows-1252"
>
> Hello,
>
> I have a problem plotting data which is defined on a grid other than
> rectangular mesh, and would greatly appreciate any advise. My data is
> defined for 0.1degree grid for the state of California, and I don?t want to
> interpolate my data outside of the defined grid when plotting it. I used
> pcolormesh() function for rectangular area maps, but it only accepts
> rectangular grid and I was wondering if there is a simple solution to my
> problem.
>
> The only solution I could find was to use scipy.interpolate,griddata() to
> ?map? my grid to a bounding rectangular grid (bounding rectangle around CA
> state), but that would also interpolate my data to grid cells outside of CA
> state, which I don?t want to do.
>
> Many thanks for any hints!
> Masha
> --
> li...@us...
>
>
>
>
>
>
> ------------------------------
>
> Message: 2
> Date: 2014年11月21日 04:38:21 +0000
> From: Thomas Caswell <tca...@gm...>
> Subject: Re: [Matplotlib-users] How to plot other than rectangular
> grid?
> To: Maria Liukis <li...@us...>,
> "mat...@li..."
> <mat...@li...>
> Message-ID:
> <CAA48SF86omwetH6jxKDbqo++TW=
> JUw...@ma...>
> Content-Type: text/plain; charset="utf-8"
>
> There are also triangular mesh plotting (I think tricolormesh is the
> function name).
>
> The really brute force solution is to use poly collection and draw what
> ever shape you want.
>
> Tom
> -------------- next part --------------
> An HTML attachment was scrubbed...
>
> ------------------------------
>
> Message: 3
> Date: 2014年11月21日 00:15:58 -0800 (PST)
> From: "Shahar Shani Kadmiel" <ka...@po...>
> Subject: Re: [Matplotlib-users] How to plot other than rectangular
> grid?
> To: "Maria Liukis" <li...@us...>
> Cc: mat...@li...
> Message-ID: <1416557758097.b2298d67@Nodemailer>
> Content-Type: text/plain; charset="utf-8"
>
> When using scipy.interpolate.griddada, you could use 'nearest' if your
> data is sufficiently dense. This will 'map' your grid onto whatever
> rectangular grid leaving grid points outside the convex hull of the
> original grid empty. Well, not empty but nan.?If you do wish to interpolate
> your dada, you could mask the resulting rectangular grid post
> interpolation.?
>
>
> ?
> Sent from Mailbox
>
> On Fri, Nov 21, 2014 at 2:12 AM, Maria Liukis <li...@us...> wrote:
>
> > Hello,
> > I have a problem plotting data which is defined on a grid other than
> rectangular mesh, and would greatly appreciate any advise. My data is
> defined for 0.1degree grid for the state of California, and I don?t want to
> interpolate my data outside of the defined grid when plotting it. I used
> pcolormesh() function for rectangular area maps, but it only accepts
> rectangular grid and I was wondering if there is a simple solution to my
> problem.
> > The only solution I could find was to use scipy.interpolate,griddata()
> to ?map? my grid to a bounding rectangular grid (bounding rectangle around
> CA state), but that would also interpolate my data to grid cells outside of
> CA state, which I don?t want to do.
> > Many thanks for any hints!
> > Masha
> > --
> > li...@us...
> >
> ------------------------------------------------------------------------------
> > Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
> > from Actuate! Instantly Supercharge Your Business Reports and Dashboards
> > with Interactivity, Sharing, Native Excel Exports, App Integration & more
> > Get technology previously reserved for billion-dollar corporations, FREE
> >
> http://pubads.g.doubleclick.net/gampad/clk?id=157005751&iu=/4140/ostg.clktrk
> > _______________________________________________
> > Matplotlib-users mailing list
> > Mat...@li...
> > https://lists.sourceforge.net/lists/listinfo/matplotlib-users
> -------------- next part --------------
> An HTML attachment was scrubbed...
>
> ------------------------------
>
> Message: 4
> Date: 2014年11月21日 14:13:03 +0100
> From: Oliver <oli...@gm...>
> Subject: Re: [Matplotlib-users] How to plot other than rectangular
> grid?
> To: Shahar Shani Kadmiel <ka...@po...>
> Cc: "mat...@li..."
> <mat...@li...>
> Message-ID:
> <CAEqQaNBqU4dDxQD0PTQXh=
> J23...@ma...>
> Content-Type: text/plain; charset="utf-8"
>
> As Thomas Caswell said, check out the "tri..." functions. No need for
> interpolation. This question recently reappeared on Stackoverflow and was
> answered there as well:
>
> https://stackoverflow.com/questions/27004422/contour-imshow-plot-for-irregular-x-y-z-data
>
> 2014年11月21日 9:15 GMT+01:00 Shahar Shani Kadmiel <ka...@po...>:
>
> > When using scipy.interpolate.griddada, you could use 'nearest' if your
> > data is sufficiently dense. This will 'map' your grid onto whatever
> > rectangular grid leaving grid points outside the convex hull of the
> > original grid empty. Well, not empty but nan.
> > If you do wish to interpolate your dada, you could mask the resulting
> > rectangular grid post interpolation.
> >
> > ?
> > Sent from Mailbox <https://www.dropbox.com/mailbox>
> >
> >
> > On Fri, Nov 21, 2014 at 2:12 AM, Maria Liukis <li...@us...> wrote:
> >
> >> Hello,
> >>
> >> I have a problem plotting data which is defined on a grid other than
> >> rectangular mesh, and would greatly appreciate any advise. My data is
> >> defined for 0.1degree grid for the state of California, and I don?t
> want to
> >> interpolate my data outside of the defined grid when plotting it. I used
> >> pcolormesh() function for rectangular area maps, but it only accepts
> >> rectangular grid and I was wondering if there is a simple solution to my
> >> problem.
> >>
> >> The only solution I could find was to use scipy.interpolate,griddata()
> to
> >> ?map? my grid to a bounding rectangular grid (bounding rectangle around
> CA
> >> state), but that would also interpolate my data to grid cells outside
> of CA
> >> state, which I don?t want to do.
> >>
> >> Many thanks for any hints!
> >> Masha
> >> --
> >> li...@us...
> >>
> >>
> >>
> >>
> >>
> ------------------------------------------------------------------------------
> >>
> >> Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
> >> from Actuate! Instantly Supercharge Your Business Reports and Dashboards
> >> with Interactivity, Sharing, Native Excel Exports, App Integration &
> more
> >> Get technology previously reserved for billion-dollar corporations, FREE
> >>
> >>
> http://pubads.g.doubleclick.net/gampad/clk?id=157005751&iu=/4140/ostg.clktrk
> >> _______________________________________________
> >> Matplotlib-users mailing list
> >> Mat...@li...
> >> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
> >>
> >
> >
> >
> >
> ------------------------------------------------------------------------------
> > Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
> > from Actuate! Instantly Supercharge Your Business Reports and Dashboards
> > with Interactivity, Sharing, Native Excel Exports, App Integration & more
> > Get technology previously reserved for billion-dollar corporations, FREE
> >
> >
> http://pubads.g.doubleclick.net/gampad/clk?id=157005751&iu=/4140/ostg.clktrk
> > _______________________________________________
> > Matplotlib-users mailing list
> > Mat...@li...
> > https://lists.sourceforge.net/lists/listinfo/matplotlib-users
> >
> >
> -------------- next part --------------
> An HTML attachment was scrubbed...
>
> ------------------------------
>
> Message: 5
> Date: 2014年11月21日 09:54:29 -0500
> From: Eric Firing <ef...@ha...>
> Subject: Re: [Matplotlib-users] How to plot other than rectangular
> grid?
> To: mat...@li...
> Message-ID: <546...@ha...>
> Content-Type: text/plain; charset=windows-1252; format=flowed
>
> On 2014年11月20日, 7:11 PM, Maria Liukis wrote:
> > Hello,
> >
> > I have a problem plotting data which is defined on a grid other than
> > rectangular mesh, and would greatly appreciate any advise. My data is
> > defined for 0.1degree grid for the state of California, and I don?t
> > want to interpolate my data outside of the defined grid when plotting
> > it. I used pcolormesh() function for rectangular area maps, but it
> > only accepts rectangular grid and I was wondering if there is a
> > simple solution to my problem.
>
> Masha,
>
> When you say your data "is defined for a 0.1 degree grid", that makes it
> sound like it is on a quadrilateral grid, so there should be no problem
> with using pcolormesh. Is it on 0.1 degree lon by 0.1 degree lat
> points, but only for points within California? Then you can make a
> masked array with this grid for a rectangle in which the points outside
> California are masked, and the ones inside are set to your data values.
> Your X and Y inputs to pcolormesh should be 2-D arrays with the
> boundary values rather than the centers. It sounds like you would want
> to do all this via mpl_toolkits.basemap.Basemap so that you will end up
> with a properly proportioned and labeled map.
>
> Maybe I am misinterpreting your description of your data, however.
>
> Eric
>
> >
> > The only solution I could find was to use
> > scipy.interpolate,griddata() to ?map? my grid to a bounding
> > rectangular grid (bounding rectangle around CA state), but that would
> > also interpolate my data to grid cells outside of CA state, which I
> > don?t want to do.
> >
> > Many thanks for any hints! Masha -- li...@us...
> >
> >
> >
>
> >
> ------------------------------------------------------------------------------
> > Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
> > from Actuate! Instantly Supercharge Your Business Reports and Dashboards
> > with Interactivity, Sharing, Native Excel Exports, App Integration & more
> > Get technology previously reserved for billion-dollar corporations, FREE
> >
> http://pubads.g.doubleclick.net/gampad/clk?id=157005751&iu=/4140/ostg.clktrk
> > _______________________________________________
> > Matplotlib-users mailing list
> > Mat...@li...
> > https://lists.sourceforge.net/lists/listinfo/matplotlib-users
> >
>
>
>
>
> ------------------------------
>
>
> ------------------------------------------------------------------------------
> Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
> from Actuate! Instantly Supercharge Your Business Reports and Dashboards
> with Interactivity, Sharing, Native Excel Exports, App Integration & more
> Get technology previously reserved for billion-dollar corporations, FREE
>
> http://pubads.g.doubleclick.net/gampad/clk?id=157005751&iu=/4140/ostg.clktrk
>
> ------------------------------
>
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>
> End of Matplotlib-users Digest, Vol 102, Issue 39
> *************************************************
>
From: Eric F. <ef...@ha...> - 2014年11月21日 14:54:38
On 2014年11月20日, 7:11 PM, Maria Liukis wrote:
> Hello,
>
> I have a problem plotting data which is defined on a grid other than
> rectangular mesh, and would greatly appreciate any advise. My data is
> defined for 0.1degree grid for the state of California, and I don’t
> want to interpolate my data outside of the defined grid when plotting
> it. I used pcolormesh() function for rectangular area maps, but it
> only accepts rectangular grid and I was wondering if there is a
> simple solution to my problem.
Masha,
When you say your data "is defined for a 0.1 degree grid", that makes it 
sound like it is on a quadrilateral grid, so there should be no problem 
with using pcolormesh. Is it on 0.1 degree lon by 0.1 degree lat 
points, but only for points within California? Then you can make a 
masked array with this grid for a rectangle in which the points outside 
California are masked, and the ones inside are set to your data values. 
 Your X and Y inputs to pcolormesh should be 2-D arrays with the 
boundary values rather than the centers. It sounds like you would want 
to do all this via mpl_toolkits.basemap.Basemap so that you will end up 
with a properly proportioned and labeled map.
Maybe I am misinterpreting your description of your data, however.
Eric
>
> The only solution I could find was to use
> scipy.interpolate,griddata() to "map" my grid to a bounding
> rectangular grid (bounding rectangle around CA state), but that would
> also interpolate my data to grid cells outside of CA state, which I
> don’t want to do.
>
> Many thanks for any hints! Masha -- li...@us...
>
>
>
> ------------------------------------------------------------------------------
> Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
> from Actuate! Instantly Supercharge Your Business Reports and Dashboards
> with Interactivity, Sharing, Native Excel Exports, App Integration & more
> Get technology previously reserved for billion-dollar corporations, FREE
> http://pubads.g.doubleclick.net/gampad/clk?id=157005751&iu=/4140/ostg.clktrk
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
From: Oliver <oli...@gm...> - 2014年11月21日 13:13:16
As Thomas Caswell said, check out the "tri..." functions. No need for
interpolation. This question recently reappeared on Stackoverflow and was
answered there as well:
https://stackoverflow.com/questions/27004422/contour-imshow-plot-for-irregular-x-y-z-data
2014年11月21日 9:15 GMT+01:00 Shahar Shani Kadmiel <ka...@po...>:
> When using scipy.interpolate.griddada, you could use 'nearest' if your
> data is sufficiently dense. This will 'map' your grid onto whatever
> rectangular grid leaving grid points outside the convex hull of the
> original grid empty. Well, not empty but nan.
> If you do wish to interpolate your dada, you could mask the resulting
> rectangular grid post interpolation.
>
> —
> Sent from Mailbox <https://www.dropbox.com/mailbox>
>
>
> On Fri, Nov 21, 2014 at 2:12 AM, Maria Liukis <li...@us...> wrote:
>
>> Hello,
>>
>> I have a problem plotting data which is defined on a grid other than
>> rectangular mesh, and would greatly appreciate any advise. My data is
>> defined for 0.1degree grid for the state of California, and I don’t want to
>> interpolate my data outside of the defined grid when plotting it. I used
>> pcolormesh() function for rectangular area maps, but it only accepts
>> rectangular grid and I was wondering if there is a simple solution to my
>> problem.
>>
>> The only solution I could find was to use scipy.interpolate,griddata() to
>> "map" my grid to a bounding rectangular grid (bounding rectangle around CA
>> state), but that would also interpolate my data to grid cells outside of CA
>> state, which I don’t want to do.
>>
>> Many thanks for any hints!
>> Masha
>> --
>> li...@us...
>>
>>
>>
>>
>> ------------------------------------------------------------------------------
>>
>> Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
>> from Actuate! Instantly Supercharge Your Business Reports and Dashboards
>> with Interactivity, Sharing, Native Excel Exports, App Integration & more
>> Get technology previously reserved for billion-dollar corporations, FREE
>>
>> http://pubads.g.doubleclick.net/gampad/clk?id=157005751&iu=/4140/ostg.clktrk
>> _______________________________________________
>> Matplotlib-users mailing list
>> Mat...@li...
>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>>
>
>
>
> ------------------------------------------------------------------------------
> Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
> from Actuate! Instantly Supercharge Your Business Reports and Dashboards
> with Interactivity, Sharing, Native Excel Exports, App Integration & more
> Get technology previously reserved for billion-dollar corporations, FREE
>
> http://pubads.g.doubleclick.net/gampad/clk?id=157005751&iu=/4140/ostg.clktrk
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>
From: Shahar S. K. <ka...@po...> - 2014年11月21日 09:13:52
When using scipy.interpolate.griddada, you could use 'nearest' if your data is sufficiently dense. This will 'map' your grid onto whatever rectangular grid leaving grid points outside the convex hull of the original grid empty. Well, not empty but nan. If you do wish to interpolate your dada, you could mask the resulting rectangular grid post interpolation. 
—
Sent from Mailbox
On Fri, Nov 21, 2014 at 2:12 AM, Maria Liukis <li...@us...> wrote:
> Hello,
> I have a problem plotting data which is defined on a grid other than rectangular mesh, and would greatly appreciate any advise. My data is defined for 0.1degree grid for the state of California, and I don’t want to interpolate my data outside of the defined grid when plotting it. I used pcolormesh() function for rectangular area maps, but it only accepts rectangular grid and I was wondering if there is a simple solution to my problem.
> The only solution I could find was to use scipy.interpolate,griddata() to "map" my grid to a bounding rectangular grid (bounding rectangle around CA state), but that would also interpolate my data to grid cells outside of CA state, which I don’t want to do.
> Many thanks for any hints!
> Masha
> --
> li...@us...
> ------------------------------------------------------------------------------
> Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
> from Actuate! Instantly Supercharge Your Business Reports and Dashboards
> with Interactivity, Sharing, Native Excel Exports, App Integration & more
> Get technology previously reserved for billion-dollar corporations, FREE
> http://pubads.g.doubleclick.net/gampad/clk?id=157005751&iu=/4140/ostg.clktrk
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users 
From: Thomas C. <tca...@gm...> - 2014年11月21日 04:38:28
There are also triangular mesh plotting (I think tricolormesh is the
function name).
The really brute force solution is to use poly collection and draw what
ever shape you want.
Tom
From: Maria L. <li...@us...> - 2014年11月21日 00:11:41
Hello,
I have a problem plotting data which is defined on a grid other than rectangular mesh, and would greatly appreciate any advise. My data is defined for 0.1degree grid for the state of California, and I don’t want to interpolate my data outside of the defined grid when plotting it. I used pcolormesh() function for rectangular area maps, but it only accepts rectangular grid and I was wondering if there is a simple solution to my problem.
The only solution I could find was to use scipy.interpolate,griddata() to "map" my grid to a bounding rectangular grid (bounding rectangle around CA state), but that would also interpolate my data to grid cells outside of CA state, which I don’t want to do.
Many thanks for any hints!
Masha
--
li...@us...
From: Eric F. <ef...@ha...> - 2014年11月20日 20:14:35
On 2014年11月19日, 1:03 PM, Benjamin Root wrote:
> What you are seeing is the fact that the adjacent cells share the same
> coordinates, so neighboring cells overlap by one pixel. This is only
> visible when alpha != 1. This is a tricky issue to solve, but I could
> have sworn we made some progress on that front by setting "snap" to
> False somewhere. There have been past discussions about it, for sure...
I don't think we ever made any progress; it seems like a problem with 
the renderer itself, agg in this case, and one that differs from one 
renderer to another (e.g., if the plot is saved as pdf and then rendered 
by different libraries). Try turning off antialiasing.
Eric
>
> Ben Root
>
> On Wed, Nov 19, 2014 at 12:57 PM, Loïc Estève <loi...@in...
> <mailto:loi...@in...>> wrote:
>
> Thanks for the suggestions, I have tried the easiest one for now,
> namely pcolormesh, see attached plot. The alpha colormap look great
> but I can't seem to figure out how to prevent the edges of the cells
> from being visible. I tried using edgecolors='none' to no avail. I
> guess retrospectively that is similar to the lines we see in the
> colormap on the right.
>
> The snippet I am using:
>
> import numpy as np
>
> import matplotlib.pyplot as plt
> from matplotlib.colors import LinearSegmentedColormap
>
> import matplotlib
>
> matplotlib.rcParams['figure.__facecolor'] = 'white'
>
> cm_dict = {'red': ((0.0, 1.0, 1.0),
> (1.0, 1.0, 1.0)),
> 'green': ((0.0, 0.0, 0.0),
> (1.0, 0.0, 0.0)),
> 'blue': ((0.0, 0.0, 0.0),
> (1.0, 0.0, 0.0)),
> 'alpha': ((0.0, 0.0, 0.0),
> (1.0, 1.0, 1.0))
> }
>
> my_cm = LinearSegmentedColormap('my___cm', cm_dict)
>
> vals = np.tile(np.linspace(-1, 1, 30), (20, 1))
>
> fig = plt.figure()
> ax = plt.pcolormesh(vals, cmap=my_cm)
> plt.colorbar()
> plt.show()
>
> Cheers,
> Loïc
>
>
>
>
> ------------------------------------------------------------------------------
> Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
> from Actuate! Instantly Supercharge Your Business Reports and Dashboards
> with Interactivity, Sharing, Native Excel Exports, App Integration & more
> Get technology previously reserved for billion-dollar corporations, FREE
> http://pubads.g.doubleclick.net/gampad/clk?id=157005751&iu=/4140/ostg.clktrk
>
>
>
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
From: Ken M. <ma...@gm...> - 2014年11月20日 13:58:16
I'm using mpl 1.4.2.
I posted this question onto StackOverflow and got a nice reply/tutorial.
https://stackoverflow.com/questions/26985210/
Thanks,
 -k.

Showing results of 154

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