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






Showing 5 results of 5

From: Thomas C. <tca...@gm...> - 2015年05月24日 18:58:55
To get the index of the grid you clicked on requires some knowledge of what
artist you are working with.
See https://github.com/matplotlib/matplotlib/pull/3989 for some brand new
code which makes this easier to implement in a general way.
While we catch up with that you will need to implement your own mapping of
x/y in data space -> i, j See
http://matplotlib.org/examples/api/image_zcoord.html for an example.
Tom
On Tue, May 12, 2015 at 2:21 AM GoogleWind <goo...@16...> wrote:
> Hi everyone!
> It is cool to use the pcolormesh in matplotlib. However, is there a way to
> get the i, j indexes of the clicked cell? I have try
> event.mouseevent.xdata
> and event.mouseevent.x. But they did not return the index I need.
>
> Thanks in advanced for your help.
>
> Dr. Jiacong Huang
> Nanjing Institute of Geography & Limnology
> Chinese Academy of Sciences
> 73 East Beijing Road, Nanjing 210008, China
> Tel./Fax: +86-25-86882127
> Homepage: http://www.escience.cn/people/elake/index.html
>
>
>
> ---Code to generate pcolormesh-------------------------------
> import numpy as np
> from matplotlib.pyplot import figure, show
> from numpy import ma
>
> n = 12
> x = np.linspace(-1.5,1.5,n)
> y = np.linspace(-1.5,1.5,n*2)
> X,Y = np.meshgrid(x,y);
> Qx = np.cos(Y) - np.cos(X)
> Qz = np.sin(Y) + np.sin(X)
> Qx = (Qx + 1.1)
> Z = np.sqrt(X**2 + Y**2)/5;
> Z = (Z - Z.min()) / (Z.max() - Z.min())
>
> # The color array can include masked values:
> Zm = ma.masked_where(np.fabs(Z) > 100, Z)
>
> fig = figure()
> ax = fig.add_subplot(111)
> col = ax.pcolormesh(Qx[:5,:4],Qz[:5,:4],Zm[:4,:3])
> show()
> -------------------------
>
>
>
> --
> View this message in context:
> http://matplotlib.1069221.n5.nabble.com/How-to-get-the-value-of-a-cell-in-pcolormesh-tp45499.html
> Sent from the matplotlib - users mailing list archive at Nabble.com.
>
>
> ------------------------------------------------------------------------------
> One dashboard for servers and applications across Physical-Virtual-Cloud
> Widest out-of-the-box monitoring support with 50+ applications
> Performance metrics, stats and reports that give you Actionable Insights
> Deep dive visibility with transaction tracing using APM Insight.
> http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
From: Thomas C. <tca...@gm...> - 2015年05月24日 18:20:40
Shawn,
This might better be sent to the IPython mailing lists.
Tom
On Tue, May 19, 2015 at 5:56 PM Yuxiang Wang <yw...@vi...> wrote:
> Here is what I did:
>
> Put a 00_matplotlib_rc.py in ipython's profile_default/startup folder
> (you might need to run ipython profile create, or ipython profile
> locate to create/find them), and in the file specify my matplotlib rc
> parameters. For example:
>
> import matplotlib as mpl
>
>
> # Figure formatting
> mpl.rcParams['savefig.dpi'] = 300
> mpl.rcParams['figure.figsize'] = (3.27, 3.27)
>
> # Font setting
> mpl.rcParams['mathtext.default'] = 'regular'
> mpl.rcParams['font.family'] = ['sans-serif']
> mpl.rcParams['font.sans-serif'] = ['Arial']
> mpl.rcParams['font.size'] = 8
> mpl.rcParams['pdf.fonttype'] = 42
> mpl.rcParams['ps.fonttype'] = 42
>
> # Line properties
> mpl.rcParams['lines.linewidth'] = 1.
> mpl.rcParams['lines.markersize'] = 4
>
> # Legends
> mpl.rcParams['legend.frameon'] = False
> mpl.rcParams['legend.fontsize'] = 8
> mpl.rcParams['legend.handlelength'] = 3
>
> # Subplot frame line
> mpl.rcParams['axes.linewidth'] = .5
>
>
>
> I would be happy to know if there's a better/different way to do it.
>
> Shawn
>
> On Tue, May 19, 2015 at 5:49 PM, mato <mat...@ya...> wrote:
> > This might be the case (I'm running Anaconda/Spyder/Ipython) however so
> far I
> > haven't been able to locate the appropriate settings file...
> >
> >
> > Yuxiang Wang wrote
> >> Are you using IPython QtConsole / Notebook? I think they have their
> >> own settings on their backend.
> >>
> >> Shawn
> >
> >
> >
> >
> >
> > --
> > View this message in context:
> http://matplotlib.1069221.n5.nabble.com/matplotlibrc-has-no-effect-on-the-plot-windows7-tp45573p45575.html
> > Sent from the matplotlib - users mailing list archive at Nabble.com.
> >
> >
> ------------------------------------------------------------------------------
> > One dashboard for servers and applications across Physical-Virtual-Cloud
> > Widest out-of-the-box monitoring support with 50+ applications
> > Performance metrics, stats and reports that give you Actionable Insights
> > Deep dive visibility with transaction tracing using APM Insight.
> > http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
> > _______________________________________________
> > Matplotlib-users mailing list
> > Mat...@li...
> > https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>
>
> --
> Yuxiang "Shawn" Wang
> Gerling Research Lab
> University of Virginia
> yw...@vi...
> +1 (434) 284-0836
> https://sites.google.com/a/virginia.edu/yw5aj/
>
>
> ------------------------------------------------------------------------------
> One dashboard for servers and applications across Physical-Virtual-Cloud
> Widest out-of-the-box monitoring support with 50+ applications
> Performance metrics, stats and reports that give you Actionable Insights
> Deep dive visibility with transaction tracing using APM Insight.
> http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
From: Thomas C. <tca...@gm...> - 2015年05月24日 18:05:38
Bryan,
If you subscribe to the list you will be able to post with out moderation.
Does this happen with any of the other sample data?
I don't think that `get_sample_data` is doing you any good here as you are
passing it an absolute path (from `os.getcwd()`) which is passed into
`os.path.join` which when it encounters and absolute path discards
everything to the left so that line is just returning back your input.
Does it work to open any other png or does _only_ this png have issues?
You are reaching into the nominally private parts of the mpl api here, I
would suggest using `mpl.image.imread` instead.
It might be worth using something like PIL/pillow, imread (
https://pypi.python.org/pypi/imread), imageio (https://imageio.github.io/)
or scikit-image for alternate implementations of png readers.
None of the core developers have access to a Solaris machine so it is very
difficult for us to provide much better help on this.
Tom
On Sun, May 24, 2015 at 1:38 PM Bryan Williams <bry...@gm...>
wrote:
> Good afternoon,
>
>
>
> My name is Bryan Williams. I work for the Florida Forest Service in their
> Forest Logistics and Support Bureau.
>
>
>
> I’m working on a program that takes weather data and visualizes it using
> matplotlib and Basemap. I’m currently having an issue with matplotlib 1.4.3
> for Python 3.4.3 running under Solaris 5.10. I am getting a Runtime Error
> whenever I try calling the read_png file from matplotlib._png. (I’m using
> this to add a small .png file of the Forest Service’s sheld to the
> picture). The error is the following:
>
>
>
> Traceback (most recent call last):
>
> File "drawmaps.py", line 845, in <module>
>
> arr_lena = read_png(fn)
>
> RuntimeError: Error closing dupe file handle
>
>
>
> I don’t quite understand the error I’m getting, and as you can see, the
> traceback gives very little information. I also tried Google for help, but
> to no avail; entering the error message as is into Google doesn’t return
> anything relating to the problem, and putting quotes around "Error closing
> dupe file handle" yields about 10 results, with one of them being an
> unanswered question from 2014 regarding the same issue.
>
>
>
> As per your request on the website, here’s what I get from uname –a:
>
>
>
> SunOS [server name withheld] 5.10 Generic_141444-09 sun4v sparc
> SUNW,SPARC-Enterprise-T5220
>
>
>
> I built Python 3.4.3 from source and installed matplotlib through pip, and
> didn’t make any changes to the matplotlibrc file.
>
>
>
> I was able to reproduce the problem again running these commands in the
> Python interactive prompt, which emulates the snippet of script that causes
> the error:
>
>
>
> Python 3.4.3 (default, May 15 2015, 13:52:23)
>
> [GCC 4.9.2] on sunos5
>
> Type "help", "copyright", "credits" or "license" for more information.
>
> >>> from matplotlib._png import read_png
>
> >>> from matplotlib.cbook import get_sample_data
>
> >>> import os; path=os.getcwd()
>
> >>> fn = get_sample_data(path + '/resources/shield.png', asfileobj=False)
>
> >>> arr_lena = read_png(fn)
>
> Traceback (most recent call last):
>
> File "<stdin>", line 1, in <module>
>
> RuntimeError: Error closing dupe file handle
>
>
>
>
>
> If you’d like a copy of the problem script, please let me know. Any and
> all help is greatly appreciated.
>
>
>
> Thank you in advance!
>
>
>
> -- BMW
>
> ------------------------------------------------------------------------------
> One dashboard for servers and applications across Physical-Virtual-Cloud
> Widest out-of-the-box monitoring support with 50+ applications
> Performance metrics, stats and reports that give you Actionable Insights
> Deep dive visibility with transaction tracing using APM Insight.
> http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
From: Benjamin R. <ben...@ou...> - 2015年05月24日 18:04:35
Bryan,
First off, avoid importing things from modules that start with an
underscore. Because Python doesn't have semantics for public/private APIs
like C++ and Java does, the underscore is treated as an indicator to
developers that it is to be treated as private. The implication is that we
are free to change the API of "private" modules and functions between
releases, without warning or recourse, which would lead to breakage of your
scripts if you use them. So, use it at your peril.
I would recommend using plt.imread() instead, or use the Pillow package to
read your data as a numpy array that you can then plot.
Now, onto your issue. I suspect it might be related to changes we made in
1.4 to have a cross-platform file-handle. However, the solaris platform is
not regularly tested by anybody, so it is quite likely we broke something
there. Now, in the master branch on github, we completely rewrote nearly
all of the C++ code, so I while it may still be broken there, perhaps we
might get a more useful error message or something different entirely? Can
you try building from the master branch and letting us know?
Cheers!
Ben Root
P.S. - The script in question wasn't perhaps written originally by a former
Meteorologist colleague from the University of Oklahoma? ;-) If it was, he
was my officemate!
On Thu, May 21, 2015 at 4:08 PM, Bryan Williams <
bry...@gm...> wrote:
> Good afternoon,
>
>
>
> My name is Bryan Williams. I work for the Florida Forest Service in their
> Forest Logistics and Support Bureau.
>
>
>
> I’m working on a program that takes weather data and visualizes it using
> matplotlib and Basemap. I’m currently having an issue with matplotlib 1.4.3
> for Python 3.4.3 running under Solaris 5.10. I am getting a Runtime Error
> whenever I try calling the read_png file from matplotlib._png. (I’m using
> this to add a small .png file of the Forest Service’s sheld to the
> picture). The error is the following:
>
>
>
> Traceback (most recent call last):
>
> File "drawmaps.py", line 845, in <module>
>
> arr_lena = read_png(fn)
>
> RuntimeError: Error closing dupe file handle
>
>
>
> I don’t quite understand the error I’m getting, and as you can see, the
> traceback gives very little information. I also tried Google for help, but
> to no avail; entering the error message as is into Google doesn’t return
> anything relating to the problem, and putting quotes around "Error closing
> dupe file handle" yields about 10 results, with one of them being an
> unanswered question from 2014 regarding the same issue.
>
>
>
> As per your request on the website, here’s what I get from uname –a:
>
>
>
> SunOS [server name withheld] 5.10 Generic_141444-09 sun4v sparc
> SUNW,SPARC-Enterprise-T5220
>
>
>
> I built Python 3.4.3 from source and installed matplotlib through pip, and
> didn’t make any changes to the matplotlibrc file.
>
>
>
> I was able to reproduce the problem again running these commands in the
> Python interactive prompt, which emulates the snippet of script that causes
> the error:
>
>
>
> Python 3.4.3 (default, May 15 2015, 13:52:23)
>
> [GCC 4.9.2] on sunos5
>
> Type "help", "copyright", "credits" or "license" for more information.
>
> >>> from matplotlib._png import read_png
>
> >>> from matplotlib.cbook import get_sample_data
>
> >>> import os; path=os.getcwd()
>
> >>> fn = get_sample_data(path + '/resources/shield.png', asfileobj=False)
>
> >>> arr_lena = read_png(fn)
>
> Traceback (most recent call last):
>
> File "<stdin>", line 1, in <module>
>
> RuntimeError: Error closing dupe file handle
>
>
>
>
>
> If you’d like a copy of the problem script, please let me know. Any and
> all help is greatly appreciated.
>
>
>
> Thank you in advance!
>
>
>
> -- BMW
>
>
> ------------------------------------------------------------------------------
> One dashboard for servers and applications across Physical-Virtual-Cloud
> Widest out-of-the-box monitoring support with 50+ applications
> Performance metrics, stats and reports that give you Actionable Insights
> Deep dive visibility with transaction tracing using APM Insight.
> http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>
From: Thomas C. <tca...@gm...> - 2015年05月24日 17:44:56
Jan,
If you subscribe to the user list you will be able to post with out
moderation.
Can you point us to which example you are running? From what you have sent
is is very hard to sort out what is going wrong as we have to guess what
you are doing.
Tom
On Sun, May 24, 2015 at 1:38 PM Albrecht, Jan <
Jan...@en...> wrote:
> Hi dear all,
>
>
>
> I have installed matplot and also six.py and so on.
>
>
>
> If i start an example from matplot i get the following eror message:
>
>
>
> File "C:\Python26\lib\site-packages\matplotlib\pyplot.py", line 1087, in
> subplots
>
> ax0 = fig.add_subplot(gs[0, 0], **subplot_kw)
>
> File "C:\Python26\lib\site-packages\matplotlib\figure.py", line 964, in
> add_subplot
>
> a = subplot_class_factory(projection_class)(self, *args, **kwargs)
>
> File "C:\Python26\lib\site-packages\matplotlib\axes\_subplots.py", line
> 75, in __init__
>
> self.update_params()
>
> File "C:\Python26\lib\site-packages\matplotlib\axes\_subplots.py", line
> 115, in update_params
>
> return_all=True)
>
> File "C:\Python26\lib\site-packages\matplotlib\gridspec.py", line 425, in
> get_position
>
> gridspec.get_grid_positions(fig)
>
> File "C:\Python26\lib\site-packages\matplotlib\gridspec.py", line 86, in
> get_grid_positions
>
> subplot_params = self.get_subplot_params(fig)
>
> File "C:\Python26\lib\site-packages\matplotlib\gridspec.py", line 271,
> in get_subplot_params
>
> subplotpars.update(**update_kw)
>
> TypeError: update() keywords must be strings
>
>
>
> Maybe someone can help me, thanks a lot
>
> JAn
>
> ------------------------------------------------------------------------------
> One dashboard for servers and applications across Physical-Virtual-Cloud
> Widest out-of-the-box monitoring support with 50+ applications
> Performance metrics, stats and reports that give you Actionable Insights
> Deep dive visibility with transaction tracing using APM Insight.
> http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>

Showing 5 results of 5

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