SourceForge logo
SourceForge logo
Menu

matplotlib-devel — matplotlib developers

You can subscribe to this list here.

2003 Jan
Feb
Mar
Apr
May
Jun
Jul
Aug
Sep
Oct
(1)
Nov
(33)
Dec
(20)
2004 Jan
(7)
Feb
(44)
Mar
(51)
Apr
(43)
May
(43)
Jun
(36)
Jul
(61)
Aug
(44)
Sep
(25)
Oct
(82)
Nov
(97)
Dec
(47)
2005 Jan
(77)
Feb
(143)
Mar
(42)
Apr
(31)
May
(93)
Jun
(93)
Jul
(35)
Aug
(78)
Sep
(56)
Oct
(44)
Nov
(72)
Dec
(75)
2006 Jan
(116)
Feb
(99)
Mar
(181)
Apr
(171)
May
(112)
Jun
(86)
Jul
(91)
Aug
(111)
Sep
(77)
Oct
(72)
Nov
(57)
Dec
(51)
2007 Jan
(64)
Feb
(116)
Mar
(70)
Apr
(74)
May
(53)
Jun
(40)
Jul
(519)
Aug
(151)
Sep
(132)
Oct
(74)
Nov
(282)
Dec
(190)
2008 Jan
(141)
Feb
(67)
Mar
(69)
Apr
(96)
May
(227)
Jun
(404)
Jul
(399)
Aug
(96)
Sep
(120)
Oct
(205)
Nov
(126)
Dec
(261)
2009 Jan
(136)
Feb
(136)
Mar
(119)
Apr
(124)
May
(155)
Jun
(98)
Jul
(136)
Aug
(292)
Sep
(174)
Oct
(126)
Nov
(126)
Dec
(79)
2010 Jan
(109)
Feb
(83)
Mar
(139)
Apr
(91)
May
(79)
Jun
(164)
Jul
(184)
Aug
(146)
Sep
(163)
Oct
(128)
Nov
(70)
Dec
(73)
2011 Jan
(235)
Feb
(165)
Mar
(147)
Apr
(86)
May
(74)
Jun
(118)
Jul
(65)
Aug
(75)
Sep
(162)
Oct
(94)
Nov
(48)
Dec
(44)
2012 Jan
(49)
Feb
(40)
Mar
(88)
Apr
(35)
May
(52)
Jun
(69)
Jul
(90)
Aug
(123)
Sep
(112)
Oct
(120)
Nov
(105)
Dec
(116)
2013 Jan
(76)
Feb
(26)
Mar
(78)
Apr
(43)
May
(61)
Jun
(53)
Jul
(147)
Aug
(85)
Sep
(83)
Oct
(122)
Nov
(18)
Dec
(27)
2014 Jan
(58)
Feb
(25)
Mar
(49)
Apr
(17)
May
(29)
Jun
(39)
Jul
(53)
Aug
(52)
Sep
(35)
Oct
(47)
Nov
(110)
Dec
(27)
2015 Jan
(50)
Feb
(93)
Mar
(96)
Apr
(30)
May
(55)
Jun
(83)
Jul
(44)
Aug
(8)
Sep
(5)
Oct
Nov
(1)
Dec
(1)
2016 Jan
Feb
Mar
(1)
Apr
May
Jun
(2)
Jul
Aug
(3)
Sep
(1)
Oct
(3)
Nov
Dec
2017 Jan
Feb
(5)
Mar
Apr
May
Jun
Jul
(3)
Aug
Sep
(7)
Oct
Nov
Dec
2018 Jan
Feb
Mar
Apr
May
Jun
Jul
(2)
Aug
Sep
Oct
Nov
Dec
S M T W T F S
1
2
(6)
3
(6)
4
(9)
5
(3)
6
(4)
7
8
(8)
9
(4)
10
11
(4)
12
(2)
13
(4)
14
(3)
15
(1)
16
(1)
17
(6)
18
(3)
19
20
(2)
21
(3)
22
(4)
23
(2)
24
(5)
25
(1)
26
27
(3)
28
(3)
29
(3)
30
(1)
31
(2)




Showing 2 results of 2

From: Ted D. <ted...@jp...> - 2005年05月20日 22:22:36
Ahhh - Thanks! I was wondering if both axes would scale when doing a=20
zooming operation but I hadn't had time to try it out. Thanks for the=20
example, that's exactly what I was looking for.
Ted
ps: I too am on the list.
At 03:12 PM 5/20/2005, Baptiste Carvello wrote:
>Ted Drain a =E9crit :
>>I was playing with twinx() a little tonight from the pylab.py file and=20
>>have a small suggestion. I think twinx() should call (before creating=20
>>the new axes):
>>gca().yaxis.tick_left()
>>Currently, after calling twinx(), then new axis tick marks correctly=20
>>appear on the right side of the plot. However, the major tick marks from=
=20
>>the left hand side Y axis also appear on the right side of the plot which=
=20
>>is a little confusing.
>indeed, this should be fixed.
>
>>Also, since we have twinx(), it would be nice to have twiny():
>>def twiny(ax=3DNone):
>> """
>> Make a second axes overlay ax (or the current axes if ax is None)
>> sharing the yaxis. The ticks for ax2 will be placed on the top,
>> and the ax2 instance is returned. See examples/two_scales.py
>> """
>> if ax is None:
>> ax=3Dgca()
>> ax.xaxis.tick_bottom()
>>
>> ax2 =3D gcf().add_axes(ax.get_position(), sharey=3Dax, frameon=3DFals=
e)
>> ax2.xaxis.tick_top()
>> ax2.xaxis.set_label_position('top')
>> draw_if_interactive()
>> return ax2
>We could do that. The only reason we didn't yet is because nobody thought=
=20
>of a clear use case. If you have one, it can be done. However, see below.
>
>>The case I'm thinking of where twiny() would would be useful is one that=
=20
>>we hit a lot at work. Time is represented on the X axis and we want=20
>>multiple label types. So we'd like to have the bottom axis be time in=20
>>UTC and the upper axis to be PST or some other local time frame. I'm not=
=20
>>sure whether or not it would be best to replot the data using twiny() or=
=20
>>to try and set up a custom formatter on the second X scale since in my=20
>>scenario there aren't two sets of data.
>I wouldn't do that. The 2 x axes won't stay in sync if you do a zoom or a=
=20
>rescale. What twiny is for would be if you need a different scale.
>
>On the contrary, you should use twinx for that, as follows:
>
> >>> from pylab import *
> >>> from pytz import timezone
> >>> from datetime import datetime
> >>> from matplotlib.dates import DateFormatter, HourLocator, DayLocator,=
=20
> date2num
> >>> from matplotlib.axis import Ticker
>
> >>> tz=3Dtimezone('US/Pacific')
> >>> utc=3Dtimezone('UTC')
> >>> start=3Ddate2num(datetime( 2005, 05, 20, 21, 12 ,tzinfo=3Dtz))
> >>> T=3Darange(0,1.5,0.01)
> >>> V=3Drand(len(T))
>
> >>> plot(start+T,V)
> >>> ax=3Dgca()
> >>> ax2=3Dtwinx()
> >>> gcf().sca(ax)
>
> >>> ax2.yaxis.set_visible(False)
>
> >>> ax.xaxis.set_major_locator(DayLocator(tz=3Dtz))
> >>> ax.xaxis.set_major_formatter(DateFormatter('%d %b',tz=3Dtz))
> >>> ax.xaxis.set_minor_locator(HourLocator(range(0,25,6), tz=3Dtz))
> >>> ax.xaxis.set_minor_formatter(DateFormatter('%H:%M',tz=3Dtz))
> >>> ax.xaxis.tick_bottom()
> >>> ax.set_xlabel('US/Pacific')
>
>
> >>> ax2.xaxis.major=3DTicker()
> >>> ax2.xaxis.minor=3DTicker()
> >>> ax2.xaxis.set_major_locator(DayLocator(tz=3Dutc))
> >>> ax2.xaxis.set_major_formatter(DateFormatter('%d %b',tz=3Dutc))
> >>> ax2.xaxis.set_minor_locator(HourLocator(range(0,25,6), tz=3Dutc))
> >>> ax2.xaxis.set_minor_formatter(DateFormatter('%H:%M',tz=3Dutc))
> >>> ax2.xaxis.tick_top()
> >>> ax2.set_xlabel('UTC')
> >>> ax2.xaxis.set_label_position('top')
>
> >>> draw_if_interactive()
> >>> show()
>
>note that if you do not track cvs, the minor tick labels on the top axis=20
>will not print, due to a known bug, fixed in cvs.
>
>Cheers,
>Baptiste
>
>PS: don't CC me in replies, I'm subscribed to the list. If you also are,=20
>please say so.
From: Ted D. <ted...@jp...> - 2005年05月20日 03:42:38
I was playing with twinx() a little tonight from the pylab.py file and have 
a small suggestion. I think twinx() should call (before creating the new 
axes):
gca().yaxis.tick_left()
Currently, after calling twinx(), then new axis tick marks correctly appear 
on the right side of the plot. However, the major tick marks from the left 
hand side Y axis also appear on the right side of the plot which is a 
little confusing.
Also, since we have twinx(), it would be nice to have twiny():
def twiny(ax=None):
 """
 Make a second axes overlay ax (or the current axes if ax is None)
 sharing the yaxis. The ticks for ax2 will be placed on the top,
 and the ax2 instance is returned. See examples/two_scales.py
 """
 if ax is None:
 ax=gca()
 ax.xaxis.tick_bottom()
	
 ax2 = gcf().add_axes(ax.get_position(), sharey=ax, frameon=False)
 ax2.xaxis.tick_top()
 ax2.xaxis.set_label_position('top')
 draw_if_interactive()
 return ax2
The case I'm thinking of where twiny() would would be useful is one that we 
hit a lot at work. Time is represented on the X axis and we want multiple 
label types. So we'd like to have the bottom axis be time in UTC and the 
upper axis to be PST or some other local time frame. I'm not sure whether 
or not it would be best to replot the data using twiny() or to try and set 
up a custom formatter on the second X scale since in my scenario there 
aren't two sets of data.
Ted

Showing 2 results of 2

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