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






Showing results of 83

<< < 1 2 3 4 > >> (Page 2 of 4)
From: Werner <wer...@gm...> - 2014年08月27日 09:55:33
Just FYI,
I tried to install with pip but got the following error.
C:\Python34\Scripts>pip install -U matplotlib
Downloading/unpacking matplotlib
 Hash of the package 
https://pypi.python.org/packages/source/m/matplotlib/matplotlib-1.4.0.tar.gz#md5=1daf7f2123d94745f
eac1a30b210940c (from https://pypi.python.org/simple/matplotlib/) 
(b3547692387bce383d7a001a8e03ce87) doesn't match the e
xpected hash 1daf7f2123d94745feac1a30b210940c!
Cleaning up...
Werner
P.S.
I installed using the .exe installer without problems.
From: ChaoYue <cha...@gm...> - 2014年08月27日 09:41:43
Hi Michelle,
I might not fully understand your problem, could you have a look at this
thread and see if it helps?
http://matplotlib.1069221.n5.nabble.com/Fwd-Strange-behaviour-on-plotting-data-on-Ronbinson-projection-using-Basemap-td43222.html#a43233
Cheers,
Chao
On Wed, Aug 27, 2014 at 9:58 AM, mmc [via matplotlib] <
ml-...@n5...> wrote:
> Hi All,
>
> I am having problems plotting data in Basemap. I have tried some of the
> different projections such as Robinson and Equidistant Cylindrical, however
> kept running into the error
>
> WARNING: x coordinate not monotonically increasing - contour plot
> may not be what you expect. If it looks odd, your can either
> adjust the map projection region to be consistent with your data, or
> (if your data is on a global lat/lon grid) use the shiftgrid
> function to adjust the data to be consistent with the map projection
> region (see examples/contour_demo.py).
>
>
> Having read some other forums, I see that it is due to the fact that the
> longitude is based on 0-360 rather that -180 to 180. I have been trying to
> rectify this with shiftgrid.
>
> I have used shiftgrid and have moved my longitudes to -180 to 180 however
> I keep running up with the error:
>
>
> ValueError: lon0 outside of range of lonsin
>
>
> I also manage to get one plot out, which has the right projection I want
> (I am looking over the Atlantic) however the data isnt shifting in line
> with the longitudes. Would anyone know why this is the case?
>
> I have am using shiftgrid as below and the Basemap projection of
> Equidistant cylindrical (I have also tried Robinson however end up with
> similar result of data not moving in line with the longitude)
>
> MSLP = aso_mslp.data
> MSLP_background = np.mean(MSLP, axis = 0)
>
> # shifting grid to run from -180 to 180 rather than 0-360
> MSLP_background,lon = shiftgrid(180., MSLP_background, lon,
> start=False)
>
> #setting the map in order to plot the data
> map = Basemap(projection ='cyl', llcrnrlat=-90, urcrnrlat=90,
> llcrnrlon=-180, urcrnrlon=180, resolution='c')
>
> Thanks
> Michelle
>
> ------------------------------
> If you reply to this email, your message will be added to the discussion
> below:
> http://matplotlib.1069221.n5.nabble.com/Basemap-shiftgrid-tp43851.html
> To start a new topic under matplotlib - users, email
> ml-...@n5...
> To unsubscribe from matplotlib, click here
> <http://matplotlib.1069221.n5.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=2&code=Y2hhb3l1ZWpveUBnbWFpbC5jb218MnwxMzg1NzAzMzQx>
> .
> NAML
> <http://matplotlib.1069221.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>
-- 
please visit:
http://www.globalcarbonatlas.org/
***********************************************************************************
Chao YUE
Laboratoire des Sciences du Climat et de l'Environnement (LSCE-IPSL)
UMR 1572 CEA-CNRS-UVSQ
Batiment 712 - Pe 119
91191 GIF Sur YVETTE Cedex
Tel: (33) 01 69 08 29 02; Fax:01.69.08.77.16
************************************************************************************
--
View this message in context: http://matplotlib.1069221.n5.nabble.com/Basemap-shiftgrid-tp43851p43853.html
Sent from the matplotlib - users mailing list archive at Nabble.com.
From: smeyer <ste...@vo...> - 2014年08月27日 08:29:05
I solved the problem by converting the z-value list to a np.array
/Sten
--
View this message in context: http://matplotlib.1069221.n5.nabble.com/z-as-colour-on-Basemap-plot-line-tp43827p43852.html
Sent from the matplotlib - users mailing list archive at Nabble.com.
From: mmc <mi...@ba...> - 2014年08月27日 07:58:41
Hi All, 
I am having problems plotting data in Basemap. I have tried some of the
different projections such as Robinson and Equidistant Cylindrical, however
kept running into the error
WARNING: x coordinate not monotonically increasing - contour plot
may not be what you expect. If it looks odd, your can either
adjust the map projection region to be consistent with your data, or
(if your data is on a global lat/lon grid) use the shiftgrid
function to adjust the data to be consistent with the map projection
region (see examples/contour_demo.py).
Having read some other forums, I see that it is due to the fact that the
longitude is based on 0-360 rather that -180 to 180. I have been trying to
rectify this with shiftgrid. 
I have used shiftgrid and have moved my longitudes to -180 to 180 however I
keep running up with the error:
ValueError: lon0 outside of range of lonsin
I also manage to get one plot out, which has the right projection I want (I
am looking over the Atlantic) however the data isnt shifting in line with
the longitudes. Would anyone know why this is the case?
I have am using shiftgrid as below and the Basemap projection of Equidistant
cylindrical (I have also tried Robinson however end up with similar result
of data not moving in line with the longitude)
MSLP = aso_mslp.data
MSLP_background = np.mean(MSLP, axis = 0)
 # shifting grid to run from -180 to 180 rather than 0-360
 MSLP_background,lon = shiftgrid(180., MSLP_background, lon, start=False)
 
 #setting the map in order to plot the data
 map = Basemap(projection ='cyl', llcrnrlat=-90, urcrnrlat=90,
llcrnrlon=-180, urcrnrlon=180, resolution='c')
Thanks
Michelle
--
View this message in context: http://matplotlib.1069221.n5.nabble.com/Basemap-shiftgrid-tp43851.html
Sent from the matplotlib - users mailing list archive at Nabble.com.
From: Thomas C. <tca...@gm...> - 2014年08月26日 15:41:31
We are pleased to announce the release of matplotlib 1.4.0!
This release has contributions from ~170 authors
(http://matplotlib.org/users/github_stats.html).
This release contains many bug fixes as will as a number of new
features. For the full list see
http://matplotlib.org/users/whats_new.html#new-in-matplotlib-1-4.
Some highlights are:
 - style module : experimental package to make managing the style of
matplotlib figures easier
 - nbagg : interactive figures in ipython notebooks backed by the AGG renderer
 - full python 3 support (including cairo backends)
 - Qt5 support (for python 3 only)
 - violin plots and 3D quiver plots (projects done for a course at
University of Toronto, Scarborough)
 - new box plot interface (as bxp)
The release can be installed via pip (but requires local compilation)
Tarballs are available at:
 - http://sourceforge.net/projects/matplotlib/files/matplotlib/matplotlib-1.4.0/matplotlib-1.4.0.tar.gz
 - https://github.com/matplotlib/matplotlib/archive/v1.4.0.tar.gz
 - https://pypi.python.org/packages/source/m/matplotlib/matplotlib-1.4.0.tar.gz
Windows install binaries and wheels are available (thanks to Christoph
Gohlke) at http://sourceforge.net/projects/matplotlib/files/matplotlib/matplotlib-1.4.0/
.
Mac OSX wheels are available (thanks to Matthew Brett) from
http://wheels.scikit-image.org .
The Matplotlib Team
From: Benjamin R. <ben...@ou...> - 2014年08月25日 15:59:12
I am glad that solution worked for you. As for an alternative to pickling,
no there is no current mechanism to do what you want easily. It is by
design to start destroying everything upon close. We get enough complaints
about "memory" leaks as it is. What you are asking for is essentially
serialization, you just don't want it written to disk. The good news is
that you don't have to write to disk. The pickle module accepts a file-like
object, so you could dump to a cStringIO object, rewind that stream and
then reload that data from the cStringIO object.
Now, maybe some work could be done to improve things, but as it stands
right now, this is the only method I can think of to do what you want.
Maybe one of the other devs has a better idea.
I hope that helps!
Ben
On Mon, Aug 25, 2014 at 11:50 AM, Maciej Kurnicki <kur...@gm...>
wrote:
> Ben,
>
> The adjusting and aspect solution works just perfect, thanks for your fast
> answer. Although i still want to ask for another solution for reloading a
> plot, because i don't like the idea of serialization and writing to disk.
> From what i've found even if i have a variables handling figure and axis
> when i quit the window some part of it probably form the window framework
> are deleted anyway. In this case i think i can redraw all the artists on
> the newly created figure somehow but is there a relatively simple way to
> just set up new window and attach the old figure there?
>
> Maciej
>
> W dniu 25.08.2014 o 16:00, Benjamin Root pisze:
>
> Maciej,
>
> When you close a figure, just about everything gets destroyed (this is
> why you should always savefig() prior to doing a show()). There is a
> mechanism for "reloading" a plot using python pickles:
>
> http://stackoverflow.com/questions/7290370/store-and-reload-matplotlib-pyplot-object
>
> As for setting the aspect ratio to 'equal', there is a second optional
> argument that indicates which thing should get adjusted to achieve an equal
> aspect. By default, it is 'datalim', I think, which adjusts the limits of
> the axes. I think if you set it to 'box', it will do what you want (you
> might need 'box-forced' if you are sharing axes). Fiddle around with these
> settings to get what you want.
> http://matplotlib.org/api/axes_api.html#matplotlib.axes.Axes.set_aspect
>
> To have the axes extended on the whole figure area, there are multiple
> ways to do that. In particular, you can set the margins for the figure:
>
> http://matplotlib.org/api/pyplot_api.html?highlight=subplots_adjust#matplotlib.pyplot.subplots_adjust
>
> All of this would work just fine with autoscale.
>
> I hope that helps!
> Ben Root
>
>
>
> On Mon, Aug 25, 2014 at 7:00 AM, Maciej Kurnicki <kur...@gm...>
> wrote:
>
>> I'm using matplotlib for drawing lines, points and circles basically. I
>> have 2 problems i can't solve by myself and it's hard to solve them not
>> digging into source i think.
>> First problem: I got an instance of figure class and i want to preserve
>> it during closing and reopening the output window. I'm curious what is
>> happening after clicking on close button on the main widow and is there
>> any way to reopen previously saved figure, and if yes how to save that
>> figure for future reopenings.
>> Second problem: I want to achieve 3 things simultaneously,
>> a) have the axes extended on the whole figure area
>> b) unit distance on y axis has to be the same as unit distance on x axis
>> c) all above has to work well with autoscale(), i want to have a lot of
>> artists on the axes
>> The best thing i have is setting aspect as equal and using autoscale,
>> but it fix axes to be same lenght and i don't want axes to be same
>> length i want the unit distance to be the same
>>
>> Thanks for any help,
>> Maciek
>>
>>
>> ------------------------------------------------------------------------------
>> Slashdot TV.
>> Video for Nerds. Stuff that matters.
>> http://tv.slashdot.org/
>> _______________________________________________
>> Matplotlib-users mailing list
>> Mat...@li...
>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>>
>
>
>
From: Maciej K. <kur...@gm...> - 2014年08月25日 15:50:39
Ben,
The adjusting and aspect solution works just perfect, thanks for your 
fast answer. Although i still want to ask for another solution for 
reloading a plot, because i don't like the idea of serialization and 
writing to disk. From what i've found even if i have a variables 
handling figure and axis when i quit the window some part of it probably 
form the window framework are deleted anyway. In this case i think i can 
redraw all the artists on the newly created figure somehow but is there 
a relatively simple way to just set up new window and attach the old 
figure there?
Maciej
W dniu 25.08.2014 o 16:00, Benjamin Root pisze:
> Maciej,
>
> When you close a figure, just about everything gets destroyed (this is 
> why you should always savefig() prior to doing a show()). There is a 
> mechanism for "reloading" a plot using python pickles:
> http://stackoverflow.com/questions/7290370/store-and-reload-matplotlib-pyplot-object
>
> As for setting the aspect ratio to 'equal', there is a second optional 
> argument that indicates which thing should get adjusted to achieve an 
> equal aspect. By default, it is 'datalim', I think, which adjusts the 
> limits of the axes. I think if you set it to 'box', it will do what 
> you want (you might need 'box-forced' if you are sharing axes). Fiddle 
> around with these settings to get what you want.
> http://matplotlib.org/api/axes_api.html#matplotlib.axes.Axes.set_aspect
>
> To have the axes extended on the whole figure area, there are multiple 
> ways to do that. In particular, you can set the margins for the figure:
> http://matplotlib.org/api/pyplot_api.html?highlight=subplots_adjust#matplotlib.pyplot.subplots_adjust
>
> All of this would work just fine with autoscale.
>
> I hope that helps!
> Ben Root
>
>
>
> On Mon, Aug 25, 2014 at 7:00 AM, Maciej Kurnicki <kur...@gm... 
> <mailto:kur...@gm...>> wrote:
>
> I'm using matplotlib for drawing lines, points and circles
> basically. I
> have 2 problems i can't solve by myself and it's hard to solve
> them not
> digging into source i think.
> First problem: I got an instance of figure class and i want to
> preserve
> it during closing and reopening the output window. I'm curious what is
> happening after clicking on close button on the main widow and is
> there
> any way to reopen previously saved figure, and if yes how to save that
> figure for future reopenings.
> Second problem: I want to achieve 3 things simultaneously,
> a) have the axes extended on the whole figure area
> b) unit distance on y axis has to be the same as unit distance on
> x axis
> c) all above has to work well with autoscale(), i want to have a
> lot of
> artists on the axes
> The best thing i have is setting aspect as equal and using autoscale,
> but it fix axes to be same lenght and i don't want axes to be same
> length i want the unit distance to be the same
>
> Thanks for any help,
> Maciek
>
> ------------------------------------------------------------------------------
> Slashdot TV.
> Video for Nerds. Stuff that matters.
> http://tv.slashdot.org/
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> <mailto:Mat...@li...>
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>
From: Benjamin R. <ben...@ou...> - 2014年08月25日 14:00:55
Maciej,
When you close a figure, just about everything gets destroyed (this is why
you should always savefig() prior to doing a show()). There is a mechanism
for "reloading" a plot using python pickles:
http://stackoverflow.com/questions/7290370/store-and-reload-matplotlib-pyplot-object
As for setting the aspect ratio to 'equal', there is a second optional
argument that indicates which thing should get adjusted to achieve an equal
aspect. By default, it is 'datalim', I think, which adjusts the limits of
the axes. I think if you set it to 'box', it will do what you want (you
might need 'box-forced' if you are sharing axes). Fiddle around with these
settings to get what you want.
http://matplotlib.org/api/axes_api.html#matplotlib.axes.Axes.set_aspect
To have the axes extended on the whole figure area, there are multiple ways
to do that. In particular, you can set the margins for the figure:
http://matplotlib.org/api/pyplot_api.html?highlight=subplots_adjust#matplotlib.pyplot.subplots_adjust
All of this would work just fine with autoscale.
I hope that helps!
Ben Root
On Mon, Aug 25, 2014 at 7:00 AM, Maciej Kurnicki <kur...@gm...>
wrote:
> I'm using matplotlib for drawing lines, points and circles basically. I
> have 2 problems i can't solve by myself and it's hard to solve them not
> digging into source i think.
> First problem: I got an instance of figure class and i want to preserve
> it during closing and reopening the output window. I'm curious what is
> happening after clicking on close button on the main widow and is there
> any way to reopen previously saved figure, and if yes how to save that
> figure for future reopenings.
> Second problem: I want to achieve 3 things simultaneously,
> a) have the axes extended on the whole figure area
> b) unit distance on y axis has to be the same as unit distance on x axis
> c) all above has to work well with autoscale(), i want to have a lot of
> artists on the axes
> The best thing i have is setting aspect as equal and using autoscale,
> but it fix axes to be same lenght and i don't want axes to be same
> length i want the unit distance to be the same
>
> Thanks for any help,
> Maciek
>
>
> ------------------------------------------------------------------------------
> Slashdot TV.
> Video for Nerds. Stuff that matters.
> http://tv.slashdot.org/
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
From: Maciej K. <kur...@gm...> - 2014年08月25日 11:00:40
I'm using matplotlib for drawing lines, points and circles basically. I 
have 2 problems i can't solve by myself and it's hard to solve them not 
digging into source i think.
First problem: I got an instance of figure class and i want to preserve 
it during closing and reopening the output window. I'm curious what is 
happening after clicking on close button on the main widow and is there 
any way to reopen previously saved figure, and if yes how to save that 
figure for future reopenings.
Second problem: I want to achieve 3 things simultaneously,
a) have the axes extended on the whole figure area
b) unit distance on y axis has to be the same as unit distance on x axis
c) all above has to work well with autoscale(), i want to have a lot of 
artists on the axes
The best thing i have is setting aspect as equal and using autoscale, 
but it fix axes to be same lenght and i don't want axes to be same 
length i want the unit distance to be the same
Thanks for any help,
Maciek
From: Vlastimil B. <vla...@gm...> - 2014年08月24日 22:43:35
2014年08月25日 0:03 GMT+02:00 Johan Ekh <ekh...@gm...>:
> Hi all
>
> I try to use yticks as
>
> plt.yticks(y_pos, projDescr)
>
> where projDescr is a list of strings that contains some swedish letters,
> i.e. åäö, but they are not printed correctly. I have googled but can not
> fins a solution. Can someone point me in the right direction?
>
> Best regards,
> Johan
>
Hi,
I am not sure, whether this is the same problem I encountered with
Czech diacritics in matplotlib some time ago, but it definitively
looks similar to me.
You can check the respective thread and the mentioned workaround there:
http://matplotlib.1069221.n5.nabble.com/font-setting-in-matplotlib-1-3-1-td42662.html
Basically, it seems to be a problem with font selection with regard to
Bitstream Vera;
a workaround consist in manipulating rcParams and removing this item
from the list of usable fonts.
hth,
 vbr
From: Johan E. <ekh...@gm...> - 2014年08月24日 22:03:26
Hi all
I try to use yticks as
plt.yticks(y_pos, projDescr)
where projDescr is a list of strings that contains some swedish letters,
i.e. åäö, but they are not printed correctly. I have googled but can not
fins a solution. Can someone point me in the right direction?
Best regards,
Johan
From: Nathan G. <nat...@gm...> - 2014年08月22日 20:25:04
Hi all,
I'm trying to customize the minor tick marks on a matplotlib colorbar. I've
posted a question on StackOverflow about this:
http://stackoverflow.com/questions/25454532/logarithmically-scaled-minor-tick-marks-on-a-matplotlib-colorbar
Thanks in advance for your help!
-Nathan
From: Michael K. <kau...@or...> - 2014年08月21日 19:30:28
I think there is: for a zoom/pan, the mouse must move a certain distance 
to be considered the start of a zoom or pan (button down -> drag -> 
button up). A pick can be just a click (button down -> button up, no or 
minimal change in mouse position <1,2 pts?).
M
On 8/21/14 3:22 PM, Benjamin Root wrote:
> Pick events, by default, won't fire while the zoom/pan tool is active,
> because there is no way to distinguish between a "pick" click, and a
> click for performing a zoom/pan.
From: Benjamin R. <ben...@ou...> - 2014年08月21日 19:23:17
Pick events, by default, won't fire while the zoom/pan tool is active,
because there is no way to distinguish between a "pick" click, and a click
for performing a zoom/pan. So, the question is really, is it sensible to
keep the tools active after their action. I think it is, particularly when
considering the panning tool, as it may take multiple "pans" before I
finding what I want.
You can easily turn the various tools on and off via keyboard shortcuts:
http://matplotlib.org/users/navigation_toolbar.html#navigation-keyboard-shortcuts
Command Keyboard Shortcut(s) Home/Reset *h* or *r* or *home* Back *c* or *left
arrow* or *backspace* Forward *v* or *right arrow* Pan/Zoom *p* Zoom-to-rect
*o* Save *ctrl* + *s* Toggle fullscreen *ctrl* + *f* Close plot *ctrl*
+ *w* Constrain
pan/zoom to x axis hold *x* when panning/zooming with mouse Constrain
pan/zoom to y axis hold *y* when panning/zooming with mouse Preserve aspect
ratio hold *CONTROL* when panning/zooming with mouse Toggle grid *g* when
mouse is over an axes Toggle x axis scale (log/linear) *L* or *k* when
mouse is over an axes Toggle y axis scale (log/linear) *l* when mouse is
over an axes
Does this solve the issue, or do we need something more configurable?
Cheers!
Ben Root
On Thu, Aug 21, 2014 at 3:02 PM, Joe Kington <jof...@gm...> wrote:
> I think the OP's desire is to have pick events fire after the zoom has
> been triggered.
>
> Currently, after you zoom (or pan), the zoom tool is still active until
> you click it again. Pick events won't fire while the zoom tool is the
> selected tool, and you have to manually de-select it (i.e. click the zoom
> button again for pick events to work).
>
> The current behavior is the right default choice, i.m.o., but it's
> counter-intuitive when combined with pick events.
>
> When you're building a gui to interact with data (or, for example, when
> using mpldatacursor -- this is a question I get a lot), a common
> expectation is that after you zoom once, the zoom tool is no longer
> active. Pick events should work again.
>
> Currently, you have to subclass (or monkey-patch) the toolbar to make this
> happen. It's a bit of a pain. (It's more complicated that just setting
> `fig.canvas.toolbar._active`.) (If I'm wrong about that, please let me
> know!!!)
>
> It would be nice to have an easier way to "deactivate" the zoom/pan tool.
> I think the "new" toolbar might have that, but I haven't checked.
>
> Cheers,
> -Joe
>
>
> On Thu, Aug 21, 2014 at 1:41 PM, Benjamin Root <ben...@ou...> wrote:
>
>> Imagine someone creates some event that would modify an artist upon
>> picking, or do some expensive calculation, or some other action. But, I
>> seriously doubt anybody would want those actions to fire while using the
>> zoom/pan tool. Especially since the mouse cursor looks totally different. I
>> am curious why you would expect pick events to fire while using pan/zoom.
>> What is the user-story that compels that expectation? Perhaps I could be
>> convinced otherwise to offer some sort of toggle.
>>
>>
>>
>> On Thu, Aug 21, 2014 at 2:33 PM, Michael Kaufman <kau...@or...>
>> wrote:
>>
>>> What kind of bad stuff happens if we were to allow that?
>>>
>>> M
>>>
>>>
>>> On 8/21/14 2:29 PM, Benjamin Root wrote:
>>>
>>>> Yes, those tools do "snarf" up pick events via the widgetlock mechanism,
>>>> IIRC. This is entirely intentional, and I an not sure there is a bug
>>>> here to fix.
>>>>
>>>>
>>>> On Thu, Aug 21, 2014 at 12:01 PM, Thomas Caswell <tca...@gm...
>>>> <mailto:tca...@gm...>> wrote:
>>>>
>>>> On Thu, Aug 21, 2014 at 9:44 AM, Michael Kaufman <
>>>> kau...@or...
>>>> <mailto:kau...@or...>> wrote:
>>>> >
>>>> > # plot axvlines here... etc.
>>>> >
>>>> > global cids
>>>> >
>>>> > # remove any previous connections
>>>> > for i in cids:
>>>> > gcf().canvas.mpl_disconnect(i)
>>>> > cids = []
>>>> >
>>>> > cids.append(gcf().canvas.mpl_connect('pick_event',self.pick))
>>>> >
>>>> cids.append(gcf().canvas.mpl_connect('button_press_event',
>>>> self.click))
>>>> >
>>>> > draw()
>>>> >
>>>> > def pick(self, event):
>>>> > thisline = event.artist
>>>> > xdata, ydata = thisline.get_data()
>>>> > print xdata[0]
>>>> >
>>>> > def click(self, event):
>>>> > print "clicked"
>>>>
>>>>
>>>> See this minimal example
>>>>
>>>> ```
>>>> import matplotlib.pyplot as plt
>>>> fig, ax = plt.subplots()
>>>>
>>>> ax.axvline(.5, picker=6)
>>>> ax.plot(range(3))
>>>> cids = []
>>>>
>>>> plt.draw()
>>>>
>>>> def pick(event):
>>>> thisline = event.artist
>>>> xdata, ydata = thisline.get_data()
>>>> print xdata[0]
>>>>
>>>> def click(event):
>>>> print "clicked"
>>>>
>>>>
>>>> cids.append(fig.canvas.mpl_connect('pick_event', pick))
>>>> cids.append(fig.canvas.mpl_connect('button_press_event', click))
>>>>
>>>> ```
>>>>
>>>> If you turn the zoom/pan tool off the picker works again. I suspect
>>>> that there is some logic underneath those tools that are snarfing
>>>> events when the are turned on to avoid messy conflicts. There is
>>>> some
>>>> work going on (MEP22 iirc) to update the toolbar and make our tool
>>>> handling saner.
>>>>
>>>> Tom
>>>> --
>>>> Thomas Caswell
>>>> tca...@gm... <mailto:tca...@gm...>
>>>>
>>>>
>>>> ------------------------------------------------------------
>>>> ------------------
>>>> Slashdot TV.
>>>> Video for Nerds. Stuff that matters.
>>>> http://tv.slashdot.org/
>>>> _______________________________________________
>>>> Matplotlib-users mailing list
>>>> Mat...@li...
>>>> <mailto:Mat...@li...>
>>>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>>>>
>>>>
>>>>
>>>
>>
>>
>> ------------------------------------------------------------------------------
>> Slashdot TV.
>> Video for Nerds. Stuff that matters.
>> http://tv.slashdot.org/
>> _______________________________________________
>> Matplotlib-users mailing list
>> Mat...@li...
>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>>
>>
>
From: Michael K. <kau...@or...> - 2014年08月21日 19:19:51
Hmm, maybe my expectations are not common. Generally when I'm zooming in 
on data, I want to zoom multiple times one right after another.
You always want this behavior when you're panning: you don't want the 
pan tool to deselect after you release the button. I'm not quite sure 
why anyone would want a different behavior with zoom (so I guess I'm 
agreeing that the current behavior with respect to keeping zoom tool 
selected is the right choice).
I'm just bit confused on what the big deal is. Click to pick, Click and 
drag to get your zoom box.
My suggestion would be something similar to the Inkscape tool interface. 
The spacebar switches between the select tool and the last-used tool.
M
On 8/21/14 3:02 PM, Joe Kington wrote:
> I think the OP's desire is to have pick events fire after the zoom has
> been triggered.
>
> Currently, after you zoom (or pan), the zoom tool is still active until
> you click it again. Pick events won't fire while the zoom tool is the
> selected tool, and you have to manually de-select it (i.e. click the
> zoom button again for pick events to work).
>
> The current behavior is the right default choice, i.m.o., but it's
> counter-intuitive when combined with pick events.
>
> When you're building a gui to interact with data (or, for example, when
> using mpldatacursor -- this is a question I get a lot), a common
> expectation is that after you zoom once, the zoom tool is no longer
> active. Pick events should work again.
>
> Currently, you have to subclass (or monkey-patch) the toolbar to make
> this happen. It's a bit of a pain. (It's more complicated that just
> setting `fig.canvas.toolbar._active`.) (If I'm wrong about that, please
> let me know!!!)
>
> It would be nice to have an easier way to "deactivate" the zoom/pan
> tool. I think the "new" toolbar might have that, but I haven't checked.
>
> Cheers,
> -Joe
>
From: Brendan B. <bre...@br...> - 2014年08月21日 19:15:05
On 2014年08月21日 11:55, Michael Kaufman wrote:> My user-story is that I 
have say several axvlines very close together in
 > bunches in the standard xlim(). Take for example spectral lines (or 
fits
 > to spectral lines). I want to pick a line and have the program tell me
 > the x-location of that line. Since they're close together I need to 
zoom
 > in to discriminate them. I don't want to have to zoom in, then move the
 > mouse to unselect the zoom tool before moving the mouse back to do the
 > pick or multiple picks.
	It sounds like a possible solution would be keyboard shortcuts for 
the toolbar tools, so that zoom could be activated/deactivated without 
moving the mouse.
-- 
Brendan Barnwell
"Do not follow where the path may lead. Go, instead, where there is 
no path, and leave a trail."
 --author unknown
From: Joe K. <jof...@gm...> - 2014年08月21日 19:02:30
I think the OP's desire is to have pick events fire after the zoom has been
triggered.
Currently, after you zoom (or pan), the zoom tool is still active until you
click it again. Pick events won't fire while the zoom tool is the selected
tool, and you have to manually de-select it (i.e. click the zoom button
again for pick events to work).
The current behavior is the right default choice, i.m.o., but it's
counter-intuitive when combined with pick events.
When you're building a gui to interact with data (or, for example, when
using mpldatacursor -- this is a question I get a lot), a common
expectation is that after you zoom once, the zoom tool is no longer
active. Pick events should work again.
Currently, you have to subclass (or monkey-patch) the toolbar to make this
happen. It's a bit of a pain. (It's more complicated that just setting
`fig.canvas.toolbar._active`.) (If I'm wrong about that, please let me
know!!!)
It would be nice to have an easier way to "deactivate" the zoom/pan tool.
I think the "new" toolbar might have that, but I haven't checked.
Cheers,
-Joe
On Thu, Aug 21, 2014 at 1:41 PM, Benjamin Root <ben...@ou...> wrote:
> Imagine someone creates some event that would modify an artist upon
> picking, or do some expensive calculation, or some other action. But, I
> seriously doubt anybody would want those actions to fire while using the
> zoom/pan tool. Especially since the mouse cursor looks totally different. I
> am curious why you would expect pick events to fire while using pan/zoom.
> What is the user-story that compels that expectation? Perhaps I could be
> convinced otherwise to offer some sort of toggle.
>
>
>
> On Thu, Aug 21, 2014 at 2:33 PM, Michael Kaufman <kau...@or...>
> wrote:
>
>> What kind of bad stuff happens if we were to allow that?
>>
>> M
>>
>>
>> On 8/21/14 2:29 PM, Benjamin Root wrote:
>>
>>> Yes, those tools do "snarf" up pick events via the widgetlock mechanism,
>>> IIRC. This is entirely intentional, and I an not sure there is a bug
>>> here to fix.
>>>
>>>
>>> On Thu, Aug 21, 2014 at 12:01 PM, Thomas Caswell <tca...@gm...
>>> <mailto:tca...@gm...>> wrote:
>>>
>>> On Thu, Aug 21, 2014 at 9:44 AM, Michael Kaufman <kau...@or...
>>> <mailto:kau...@or...>> wrote:
>>> >
>>> > # plot axvlines here... etc.
>>> >
>>> > global cids
>>> >
>>> > # remove any previous connections
>>> > for i in cids:
>>> > gcf().canvas.mpl_disconnect(i)
>>> > cids = []
>>> >
>>> > cids.append(gcf().canvas.mpl_connect('pick_event',self.pick))
>>> >
>>> cids.append(gcf().canvas.mpl_connect('button_press_event',
>>> self.click))
>>> >
>>> > draw()
>>> >
>>> > def pick(self, event):
>>> > thisline = event.artist
>>> > xdata, ydata = thisline.get_data()
>>> > print xdata[0]
>>> >
>>> > def click(self, event):
>>> > print "clicked"
>>>
>>>
>>> See this minimal example
>>>
>>> ```
>>> import matplotlib.pyplot as plt
>>> fig, ax = plt.subplots()
>>>
>>> ax.axvline(.5, picker=6)
>>> ax.plot(range(3))
>>> cids = []
>>>
>>> plt.draw()
>>>
>>> def pick(event):
>>> thisline = event.artist
>>> xdata, ydata = thisline.get_data()
>>> print xdata[0]
>>>
>>> def click(event):
>>> print "clicked"
>>>
>>>
>>> cids.append(fig.canvas.mpl_connect('pick_event', pick))
>>> cids.append(fig.canvas.mpl_connect('button_press_event', click))
>>>
>>> ```
>>>
>>> If you turn the zoom/pan tool off the picker works again. I suspect
>>> that there is some logic underneath those tools that are snarfing
>>> events when the are turned on to avoid messy conflicts. There is
>>> some
>>> work going on (MEP22 iirc) to update the toolbar and make our tool
>>> handling saner.
>>>
>>> Tom
>>> --
>>> Thomas Caswell
>>> tca...@gm... <mailto:tca...@gm...>
>>>
>>>
>>> ------------------------------------------------------------
>>> ------------------
>>> Slashdot TV.
>>> Video for Nerds. Stuff that matters.
>>> http://tv.slashdot.org/
>>> _______________________________________________
>>> Matplotlib-users mailing list
>>> Mat...@li...
>>> <mailto:Mat...@li...>
>>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>>>
>>>
>>>
>>
>
>
> ------------------------------------------------------------------------------
> Slashdot TV.
> Video for Nerds. Stuff that matters.
> http://tv.slashdot.org/
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>
From: Michael K. <kau...@or...> - 2014年08月21日 18:55:23
My user-story is that I have say several axvlines very close together in 
bunches in the standard xlim(). Take for example spectral lines (or fits 
to spectral lines). I want to pick a line and have the program tell me 
the x-location of that line. Since they're close together I need to zoom 
in to discriminate them. I don't want to have to zoom in, then move the 
mouse to unselect the zoom tool before moving the mouse back to do the 
pick or multiple picks.
M
PS: In GTKAgg at least, the zoom tool has a cross-hair pointer which in 
my opinion is even better than the arrow.
On 8/21/14 2:41 PM, Benjamin Root wrote:
> Imagine someone creates some event that would modify an artist upon
> picking, or do some expensive calculation, or some other action. But, I
> seriously doubt anybody would want those actions to fire while using the
> zoom/pan tool. Especially since the mouse cursor looks totally
> different. I am curious why you would expect pick events to fire while
> using pan/zoom. What is the user-story that compels that expectation?
> Perhaps I could be convinced otherwise to offer some sort of toggle.
>
>
>
> On Thu, Aug 21, 2014 at 2:33 PM, Michael Kaufman <kau...@or...
> <mailto:kau...@or...>> wrote:
>
> What kind of bad stuff happens if we were to allow that?
>
> M
>
>
> On 8/21/14 2:29 PM, Benjamin Root wrote:
>
> Yes, those tools do "snarf" up pick events via the widgetlock
> mechanism,
> IIRC. This is entirely intentional, and I an not sure there is a bug
> here to fix.
>
>
> On Thu, Aug 21, 2014 at 12:01 PM, Thomas Caswell
> <tca...@gm... <mailto:tca...@gm...>
> <mailto:tca...@gm... <mailto:tca...@gm...>>> wrote:
>
> On Thu, Aug 21, 2014 at 9:44 AM, Michael Kaufman
> <kau...@or... <mailto:kau...@or...>
> <mailto:kau...@or... <mailto:kau...@or...>>> wrote:
> >
> > # plot axvlines here... etc.
> >
> > global cids
> >
> > # remove any previous connections
> > for i in cids:
> > gcf().canvas.mpl_disconnect(i)
> > cids = []
> >
> >
> cids.append(gcf().canvas.mpl___connect('pick_event',self.__pick))
> >
>
> cids.append(gcf().canvas.mpl___connect('button_press_event',__self.click))
> >
> > draw()
> >
> > def pick(self, event):
> > thisline = event.artist
> > xdata, ydata = thisline.get_data()
> > print xdata[0]
> >
> > def click(self, event):
> > print "clicked"
>
>
> See this minimal example
>
> ```
> import matplotlib.pyplot as plt
> fig, ax = plt.subplots()
>
> ax.axvline(.5, picker=6)
> ax.plot(range(3))
> cids = []
>
> plt.draw()
>
> def pick(event):
> thisline = event.artist
> xdata, ydata = thisline.get_data()
> print xdata[0]
>
> def click(event):
> print "clicked"
>
>
> cids.append(fig.canvas.mpl___connect('pick_event', pick))
> cids.append(fig.canvas.mpl___connect('button_press_event',
> click))
>
> ```
>
> If you turn the zoom/pan tool off the picker works again.
> I suspect
> that there is some logic underneath those tools that are
> snarfing
> events when the are turned on to avoid messy conflicts.
> There is some
> work going on (MEP22 iirc) to update the toolbar and make
> our tool
> handling saner.
>
> Tom
> --
> Thomas Caswell
> tca...@gm... <mailto:tca...@gm...>
> <mailto:tca...@gm... <mailto:tca...@gm...>>
>
>
>
> ------------------------------__------------------------------__------------------
> Slashdot TV.
> Video for Nerds. Stuff that matters.
> http://tv.slashdot.org/
> _________________________________________________
> Matplotlib-users mailing list
> Matplotlib-users@lists.__sourceforge.net
> <mailto:Mat...@li...>
> <mailto:Matplotlib-users@__lists.sourceforge.net
> <mailto:Mat...@li...>>
> https://lists.sourceforge.net/__lists/listinfo/matplotlib-__users <https://lists.sourceforge.net/lists/listinfo/matplotlib-users>
>
>
>
>
From: Benjamin R. <ben...@ou...> - 2014年08月21日 18:41:30
Imagine someone creates some event that would modify an artist upon
picking, or do some expensive calculation, or some other action. But, I
seriously doubt anybody would want those actions to fire while using the
zoom/pan tool. Especially since the mouse cursor looks totally different. I
am curious why you would expect pick events to fire while using pan/zoom.
What is the user-story that compels that expectation? Perhaps I could be
convinced otherwise to offer some sort of toggle.
On Thu, Aug 21, 2014 at 2:33 PM, Michael Kaufman <kau...@or...> wrote:
> What kind of bad stuff happens if we were to allow that?
>
> M
>
>
> On 8/21/14 2:29 PM, Benjamin Root wrote:
>
>> Yes, those tools do "snarf" up pick events via the widgetlock mechanism,
>> IIRC. This is entirely intentional, and I an not sure there is a bug
>> here to fix.
>>
>>
>> On Thu, Aug 21, 2014 at 12:01 PM, Thomas Caswell <tca...@gm...
>> <mailto:tca...@gm...>> wrote:
>>
>> On Thu, Aug 21, 2014 at 9:44 AM, Michael Kaufman <kau...@or...
>> <mailto:kau...@or...>> wrote:
>> >
>> > # plot axvlines here... etc.
>> >
>> > global cids
>> >
>> > # remove any previous connections
>> > for i in cids:
>> > gcf().canvas.mpl_disconnect(i)
>> > cids = []
>> >
>> > cids.append(gcf().canvas.mpl_connect('pick_event',self.pick))
>> >
>> cids.append(gcf().canvas.mpl_connect('button_press_event',
>> self.click))
>> >
>> > draw()
>> >
>> > def pick(self, event):
>> > thisline = event.artist
>> > xdata, ydata = thisline.get_data()
>> > print xdata[0]
>> >
>> > def click(self, event):
>> > print "clicked"
>>
>>
>> See this minimal example
>>
>> ```
>> import matplotlib.pyplot as plt
>> fig, ax = plt.subplots()
>>
>> ax.axvline(.5, picker=6)
>> ax.plot(range(3))
>> cids = []
>>
>> plt.draw()
>>
>> def pick(event):
>> thisline = event.artist
>> xdata, ydata = thisline.get_data()
>> print xdata[0]
>>
>> def click(event):
>> print "clicked"
>>
>>
>> cids.append(fig.canvas.mpl_connect('pick_event', pick))
>> cids.append(fig.canvas.mpl_connect('button_press_event', click))
>>
>> ```
>>
>> If you turn the zoom/pan tool off the picker works again. I suspect
>> that there is some logic underneath those tools that are snarfing
>> events when the are turned on to avoid messy conflicts. There is some
>> work going on (MEP22 iirc) to update the toolbar and make our tool
>> handling saner.
>>
>> Tom
>> --
>> Thomas Caswell
>> tca...@gm... <mailto:tca...@gm...>
>>
>>
>> ------------------------------------------------------------
>> ------------------
>> Slashdot TV.
>> Video for Nerds. Stuff that matters.
>> http://tv.slashdot.org/
>> _______________________________________________
>> Matplotlib-users mailing list
>> Mat...@li...
>> <mailto:Mat...@li...>
>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>>
>>
>>
>
From: Michael K. <kau...@or...> - 2014年08月21日 18:33:17
What kind of bad stuff happens if we were to allow that?
M
On 8/21/14 2:29 PM, Benjamin Root wrote:
> Yes, those tools do "snarf" up pick events via the widgetlock mechanism,
> IIRC. This is entirely intentional, and I an not sure there is a bug
> here to fix.
>
>
> On Thu, Aug 21, 2014 at 12:01 PM, Thomas Caswell <tca...@gm...
> <mailto:tca...@gm...>> wrote:
>
> On Thu, Aug 21, 2014 at 9:44 AM, Michael Kaufman <kau...@or...
> <mailto:kau...@or...>> wrote:
> >
> > # plot axvlines here... etc.
> >
> > global cids
> >
> > # remove any previous connections
> > for i in cids:
> > gcf().canvas.mpl_disconnect(i)
> > cids = []
> >
> > cids.append(gcf().canvas.mpl_connect('pick_event',self.pick))
> >
> cids.append(gcf().canvas.mpl_connect('button_press_event',self.click))
> >
> > draw()
> >
> > def pick(self, event):
> > thisline = event.artist
> > xdata, ydata = thisline.get_data()
> > print xdata[0]
> >
> > def click(self, event):
> > print "clicked"
>
>
> See this minimal example
>
> ```
> import matplotlib.pyplot as plt
> fig, ax = plt.subplots()
>
> ax.axvline(.5, picker=6)
> ax.plot(range(3))
> cids = []
>
> plt.draw()
>
> def pick(event):
> thisline = event.artist
> xdata, ydata = thisline.get_data()
> print xdata[0]
>
> def click(event):
> print "clicked"
>
>
> cids.append(fig.canvas.mpl_connect('pick_event', pick))
> cids.append(fig.canvas.mpl_connect('button_press_event', click))
>
> ```
>
> If you turn the zoom/pan tool off the picker works again. I suspect
> that there is some logic underneath those tools that are snarfing
> events when the are turned on to avoid messy conflicts. There is some
> work going on (MEP22 iirc) to update the toolbar and make our tool
> handling saner.
>
> Tom
> --
> Thomas Caswell
> tca...@gm... <mailto:tca...@gm...>
>
> ------------------------------------------------------------------------------
> Slashdot TV.
> Video for Nerds. Stuff that matters.
> http://tv.slashdot.org/
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> <mailto:Mat...@li...>
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>
From: Benjamin R. <ben...@ou...> - 2014年08月21日 18:29:37
Yes, those tools do "snarf" up pick events via the widgetlock mechanism,
IIRC. This is entirely intentional, and I an not sure there is a bug here
to fix.
On Thu, Aug 21, 2014 at 12:01 PM, Thomas Caswell <tca...@gm...> wrote:
> On Thu, Aug 21, 2014 at 9:44 AM, Michael Kaufman <kau...@or...>
> wrote:
> >
> > # plot axvlines here... etc.
> >
> > global cids
> >
> > # remove any previous connections
> > for i in cids:
> > gcf().canvas.mpl_disconnect(i)
> > cids = []
> >
> > cids.append(gcf().canvas.mpl_connect('pick_event',self.pick))
> > cids.append(gcf().canvas.mpl_connect('button_press_event',self.click))
> >
> > draw()
> >
> > def pick(self, event):
> > thisline = event.artist
> > xdata, ydata = thisline.get_data()
> > print xdata[0]
> >
> > def click(self, event):
> > print "clicked"
>
>
> See this minimal example
>
> ```
> import matplotlib.pyplot as plt
> fig, ax = plt.subplots()
>
> ax.axvline(.5, picker=6)
> ax.plot(range(3))
> cids = []
>
> plt.draw()
>
> def pick(event):
> thisline = event.artist
> xdata, ydata = thisline.get_data()
> print xdata[0]
>
> def click(event):
> print "clicked"
>
>
> cids.append(fig.canvas.mpl_connect('pick_event', pick))
> cids.append(fig.canvas.mpl_connect('button_press_event', click))
>
> ```
>
> If you turn the zoom/pan tool off the picker works again. I suspect
> that there is some logic underneath those tools that are snarfing
> events when the are turned on to avoid messy conflicts. There is some
> work going on (MEP22 iirc) to update the toolbar and make our tool
> handling saner.
>
> Tom
> --
> Thomas Caswell
> tca...@gm...
>
>
> ------------------------------------------------------------------------------
> Slashdot TV.
> Video for Nerds. Stuff that matters.
> http://tv.slashdot.org/
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
From: Thomas C. <tca...@gm...> - 2014年08月21日 16:02:05
On Thu, Aug 21, 2014 at 9:44 AM, Michael Kaufman <kau...@or...> wrote:
>
> # plot axvlines here... etc.
>
> global cids
>
> # remove any previous connections
> for i in cids:
> gcf().canvas.mpl_disconnect(i)
> cids = []
>
> cids.append(gcf().canvas.mpl_connect('pick_event',self.pick))
> cids.append(gcf().canvas.mpl_connect('button_press_event',self.click))
>
> draw()
>
> def pick(self, event):
> thisline = event.artist
> xdata, ydata = thisline.get_data()
> print xdata[0]
>
> def click(self, event):
> print "clicked"
See this minimal example
```
import matplotlib.pyplot as plt
fig, ax = plt.subplots()
ax.axvline(.5, picker=6)
ax.plot(range(3))
cids = []
plt.draw()
def pick(event):
 thisline = event.artist
 xdata, ydata = thisline.get_data()
 print xdata[0]
def click(event):
 print "clicked"
cids.append(fig.canvas.mpl_connect('pick_event', pick))
cids.append(fig.canvas.mpl_connect('button_press_event', click))
```
If you turn the zoom/pan tool off the picker works again. I suspect
that there is some logic underneath those tools that are snarfing
events when the are turned on to avoid messy conflicts. There is some
work going on (MEP22 iirc) to update the toolbar and make our tool
handling saner.
Tom
-- 
Thomas Caswell
tca...@gm...
From: Thomas R. <tho...@gm...> - 2014年08月21日 15:38:13
Hello,
I am interested in using the Matplotlib transformation framework to
transform a rectangle into a different coordinate system. I am therefore
defining a Rectangle patch and setting the transform to what I want. If
I apply a non-linear transformation, the edges of the rectangle should
no longer necessarily be straight lines. Consider the following example:
---
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.transforms import Affine2D
from matplotlib.patches import Rectangle, Polygon
fig = plt.figure()
ax = fig.add_subplot(1,1,1)
transform = Affine2D().rotate_deg(2) + ax.transData
# Add rectangle
r = Rectangle((0.5,0.5),width=10,height=10,
 transform=transform,
 edgecolor='red', facecolor='none')
ax.add_patch(r)
# Add oversampled rectangle
x = np.array([0.5, 10.5, 10.5, 0.5, 0.5])
y = np.array([0.5, 0.5, 10.5, 10.5, 0.51])
x_i = np.interp(np.linspace(0., 4., 10000), np.arange(5), x)
y_i = np.interp(np.linspace(0., 4., 10000), np.arange(5), y)
p = Polygon(list(zip(x_i, y_i)),
 transform=transform,
 edgecolor='green', facecolor='none')
ax.add_patch(p)
ax.set_xscale('log')
ax.set_yscale('log')
fig.savefig('test.png')
---
The green lines show what I would expect the rectangle to look like, and
the red is what it ends up looking like if I use the Rectangle patch.
What must be happening is that only the vertices of the rectangle get
transformed and then are connected by straight lines.
So my question is, is there a way to make the Rectangle patch behave
like the custom polygon I'm creating here?
Thanks for any advice,
Cheers,
Tom
From: Michael K. <kau...@or...> - 2014年08月21日 13:44:30
Hi,
ipython 3.0.0-dev
matplotlib 1.3.1
GTKAgg backend
mac osx 10.9
If I create a pick_event on an axvline (with picker=6), there is no 
problem triggering the pick event the first time the figure is shown (or 
many times if I _don't_ zoom or pan). But if I then zoom in or pan 
(using the toolbar tools) the pick_event function stops triggering.
The button_press_event that I also created still works after 
zooming/panning. The pick_event still doesn't work even if I disconnect 
all the events and recreate them (by creating a new object).
I have to close the figure and make a new one to make the pick work 
again. The button_press_event always works.
This is the bottom of the plotting function:
 # plot axvlines here... etc.
 global cids
 # remove any previous connections
 for i in cids:
 gcf().canvas.mpl_disconnect(i)
 cids = []
 cids.append(gcf().canvas.mpl_connect('pick_event',self.pick))
 cids.append(gcf().canvas.mpl_connect('button_press_event',self.click))
 draw()
def pick(self, event):
 thisline = event.artist
 xdata, ydata = thisline.get_data()
 print xdata[0]
def click(self, event):
 print "clicked"
Anybody got a clue what's going on? Does the Line2D get deleted and 
recreated without the picker enabled?
M
From: Ted To <rai...@th...> - 2014年08月16日 00:22:23
Many thanks! The 'pad=25' property worked great.
I also tried prepending '\n' to the minor labels but it threw an error
-- I'll confess that I did not try very hard since 'pad=25' worked.
On 08/15/2014 05:28 PM, Thomas Caswell wrote:
> Use the `pad` property which sets how far the tick labels are from the axis.
> 
> ax1.tick_params(axis='x',which='minor',bottom='off',top='off', pad=25)
> 
> iirc, the units on pad are font-points
> 
> Tom
> 
> On Fri, Aug 15, 2014 at 5:21 PM, Sterling Smith <sm...@fu...> wrote:
>> How about prepending '\n' to your minor labels?
>>
>> On Aug 15, 2014, at 1:38PM, Ted To wrote:
>>
>>> Hi,
>>>
>>> I'm trying to set two lines of xtick_labels But I can't figure out how
>>> to get them on separate lines. These are for errorbars where I have two
>>> variables for each of four categories. Using the following code, I'm
>>> able to create the attached figure. How does one move the "minor"
>>> xtick_labels to a 2nd line? A minor problem that maybe someone knows
>>> the answer to is, how do I increase the width of the x axis so that
>>> there is some space before and after the first and last ticks?
>>> (ax1.set_xlim(-.5,7.5) does not seem to work.)
>>>
>>> Many thanks,
>>> Ted
>>>
>>> fig,ax1=plt.subplots()
>>> ax1.errorbar(wageAllTypes.index,wageAllTypes['mean'],yerr=wageAllTypes['sd'],fmt='bo')
>>> xticks=[0,1,2,3,4,5,6,7]
>>> xticks_minor=[.5,2.5,4.5,6.5]
>>> ax1.set_xticks(xticks)
>>> ax1.set_xticks(xticks_minor, minor=True)
>>> ax1.set_xticklabels(['All Jobs','Job 1','Job 2','Job 3'],minor=True)
>>> ax1.set_xticklabels([r'$w$',r'$\xi$',r'$w$',r'$\xi$',r'$w$',r'$\xi$',r'$w$',r'$\xi$]')
>>>
>>> ax1.tick_params(axis='x',which='major')
>>> ax1.tick_params(axis='x',which='minor',bottom='off',top='off')
>>> ax1.set_ylabel(r'$\ln w$',ha='right',rotation='horizontal')
>>>
>>> ax2 = ax1.twinx()
>>> ax2.errorbar(xiAllTypes.index,xiAllTypes['mean'],yerr=xiAllTypes['sd'],fmt='ro')
>>> ax2.set_ylabel(r'$\xi$',ha='left',rotation='horizontal')
>>> <figure_1.png>------------------------------------------------------------------------------
>>> _______________________________________________
>>> Matplotlib-users mailing list
>>> Mat...@li...
>>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>>
>>
>> ------------------------------------------------------------------------------
>> _______________________________________________
>> Matplotlib-users mailing list
>> Mat...@li...
>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
> 
> 
> 

Showing results of 83

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