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




Showing 7 results of 7

From: Gökhan S. <gok...@gm...> - 2010年11月30日 17:35:10
On Mon, Nov 29, 2010 at 3:01 PM, Matthew W. Priddy <mwp...@gm...> wrote:
> Matplotlib developers,
>
> I really like using matplotlib to create quality plots, and it seems to have an option for just about everything. However, one thing that is not easy to change is the location of minor tick marks. To set major tick mark locations, one can simply use the "xticks" command. And now we can atleast turn on the minor tick marks with the "minorticks_on()" command.
>
> But, is there any way to implement something similar to "xticks" for minor tick marks? Even better would be a feature that allowed the user to simply specify the number of minor tick marks that are evenly spaced between the major tick marks?
>
> Thanks.
>
> --Matthew
It is easy with MultipleLocator class.
I[1]: y = np.random.randn(100)
I[2]: plt.plot(y)
O[2]: [<matplotlib.lines.Line2D object at 0xa82ea6c>]
I[3]: from matplotlib.ticker import MultipleLocator
I[4]: ax = plt.gca()
I[5]: ax.xaxis.set_minor_locator(MultipleLocator(5))
-- 
Gökhan
From: Ryan M. <rm...@gm...> - 2010年11月30日 17:23:38
On Tue, Nov 30, 2010 at 10:44 AM, C M <cmp...@gm...> wrote:
>
>
> On Sun, Nov 28, 2010 at 8:52 PM, C M <cmp...@gm...> wrote:
>>
>> How can I correctly subclass AutoDateFormatter and use it in my code?
>>
>> What I am doing is copying the code from matplotlib's AutoDateFormatter
>> and changing the strings for how the dates are represented and making that a
>> class, MyAutoDateFormatter. AutoDateFormatter expects a locator, and I
>> think (?) the default is AutoDateLocator. So in my code I am doing this:
>>
>>     adl = AutoDateLocator()
>>     myformatter = MyAutoDateFormatter(adl)
>>     axis.xaxis.set_major_formatter(myformatter)
>>
>> But when I run it, no matter the level of zoom, it says "2010" (when it
>> should change depending on zoom level).
>>
>> However, if I go into the matplotlib dates.py code itself and save the
>> same changes to the date strings there, and I comment out the above code,
>> then it works: the date strings change depending on level of zoom.
>
> I've also just noticed that if I use the above code after the lines have
> been plotted, but then I click on one of the points (which causes a
> point-picking routine that ultimately plots a highlighting marker over that
> point), the x axis suddenly changes to use MyAutoDateFormatter's format
> strings. (If I call it before I plot anything, it doesn't help, though).
>
> Is the act of plotting somehow "refreshing" things? What can I call in
> order to force this to happen without actually plotting any additional
> points after my lines are plotted?
It's difficult to tell without seeing the code that's producing the
problem. If you can boil your problem down to a simple, self-contained
script and post it here, then we can take a look and see what's going
on.
Ryan
-- 
Ryan May
Graduate Research Assistant
School of Meteorology
University of Oklahoma
From: C M <cmp...@gm...> - 2010年11月30日 16:44:38
On Sun, Nov 28, 2010 at 8:52 PM, C M <cmp...@gm...> wrote:
> How can I correctly subclass AutoDateFormatter and use it in my code?
>
> What I am doing is copying the code from matplotlib's AutoDateFormatter and
> changing the strings for how the dates are represented and making that a
> class, MyAutoDateFormatter. AutoDateFormatter expects a locator, and I
> think (?) the default is AutoDateLocator. So in my code I am doing this:
>
> adl = AutoDateLocator()
> myformatter = MyAutoDateFormatter(adl)
> axis.xaxis.set_major_formatter(myformatter)
>
> But when I run it, no matter the level of zoom, it says "2010" (when it
> should change depending on zoom level).
>
> However, if I go into the matplotlib dates.py code itself and save the same
> changes to the date strings there, and I comment out the above code, then it
> works: the date strings change depending on level of zoom.
>
I've also just noticed that if I use the above code after the lines have
been plotted, but then I click on one of the points (which causes a
point-picking routine that ultimately plots a highlighting marker over that
point), the x axis suddenly changes to use MyAutoDateFormatter's format
strings. (If I call it before I plot anything, it doesn't help, though).
Is the act of plotting somehow "refreshing" things? What can I call in
order to force this to happen without actually plotting any additional
points after my lines are plotted?
Thanks,
Che
From: Benjamin R. <ben...@ou...> - 2010年11月30日 16:29:01
On Sun, Nov 28, 2010 at 7:48 PM, Jae-Joon Lee <lee...@gm...> wrote:
> If you want the whole background to disappear, simply call set_axis_off
> method.
>
> ax.set_axis_off()
>
> To control the visibility of each element, use something like below.
>
> for axis in ax.w_xaxis, ax.w_yaxis, ax.w_zaxis:
> for elt in axis.get_ticklines() + axis.get_ticklabels():
> elt.set_visible(False)
>
> axis.pane.set_visible(False)
> axis.gridlines.set_visible(False)
> axis.line.set_visible(False)
>
> IHTH,
>
> -JJ
>
> On Mon, Nov 29, 2010 at 9:08 AM, Nicolas Pinto <nic...@gm...>
> wrote:
> > Thanks for the quick reply Ben. Let me know how I can help.
> >
> > Regards,
> >
> > N
> >
> > On Sun, Nov 28, 2010 at 6:54 PM, Benjamin Root <ben...@ou...> wrote:
> >> On Sunday, November 28, 2010, Nicolas Pinto <nic...@gm...>
> wrote:
> >>> Dear all,
> >>>
> >>> I'm trying to get rid of the mplot3d background (in vain, see below),
> >>> how can I do this?
> >>>
> >>> Thanks for your help.
> >>>
> >>> Best,
> >>>
> >>> Nicolas
> >>>
> >>> demo:
> >>>
> >>> from mpl_toolkits.mplot3d import axes3d, axis3d
> >>> import matplotlib.pyplot as plt
> >>> import numpy as np
> >>>
> >>> fig = plt.figure()
> >>> ax = axes3d.Axes3D(fig)
> >>>
> >>> for axis in ax.w_xaxis, ax.w_yaxis, ax.w_zaxis:
> >>> for elt in axis.get_ticklines() + axis.get_ticklabels():
> >>> elt.set_visible(False)
> >>>
> >>> myAXINFO = {
> >>> 'x': {'i': 0, 'tickdir': 1, 'juggled': (1, 0, 2),
> >>> 'color': (0, 0, 0, 0, 0)},
> >>> 'y': {'i': 1, 'tickdir': 0, 'juggled': (0, 1, 2),
> >>> 'color': (0, 0, 0, 0, 0)},
> >>> 'z': {'i': 2, 'tickdir': 0, 'juggled': (0, 2, 1),
> >>> 'color': (0, 0, 0, 0, 0)},
> >>> }
> >>>
> >>> ax.w_xaxis._AXINFO = myAXINFO
> >>> ax.w_yaxis._AXINFO = myAXINFO
> >>> ax.w_zaxis._AXINFO = myAXINFO
> >>>
> >>> plt.show()
> >>>
> >>>
> ------------------------------------------------------------------------------
> >>> Increase Visibility of Your 3D Game App & Earn a Chance To Win 500ドル!
> >>> Tap into the largest installed PC base & get more eyes on your game by
> >>> optimizing for Intel(R) Graphics Technology. Get started today with the
> >>> Intel(R) Software Partner Program. Five 500ドル cash prizes are up for
> grabs.
> >>> http://p.sf.net/sfu/intelisp-dev2dev
> >>> _______________________________________________
> >>> Matplotlib-users mailing list
> >>> Mat...@li...
> >>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
> >>>
> >>
> >> Unfortunately, I doubt you will be able to in the current state of
> >> mplot3d's code. The background objects get remade at every change of
> >> viewing angle or change in the figure window. I am working on some
> >> refactoring, but it will be a while before I tackle the drawing
> >> behavior.
> >>
> >> Let me take a look in the next couple of days on a possible workaround
> >>
> >> Ben Root
> >>
> >
> >
> >
> > --
> > Nicolas Pinto
> > Ph.D. Candidate, Brain & Computer Sciences
> > Massachusetts Institute of Technology, USA
> > http://web.mit.edu/pinto
>
>
Indeed, Jae-Joon is correct. I now see why Nicolas's code did not work.
The assignment of _AXINFO occurred after the initial creation of the axes
panels. While the code does reuse the _AXINFO data for some things in later
redraws, it does not re-use the color information. I should also point out
that changing the _AXINFO data has the side affect of being applicable to
all future instantiations of 3D axes within that process run. That could be
a bug or a feature, but it is something to be aware of in the future.
Ben Root
From: Matthias M. <Mat...@gm...> - 2010年11月30日 16:23:23
On Monday November 29 2010 22:01:29 Matthew W. Priddy wrote:
> Matplotlib developers,
> 
> I really like using matplotlib to create quality plots, and it seems to
> have an option for just about everything. However, one thing that is not
> easy to change is the location of minor tick marks. To set major tick
> mark locations, one can simply use the "xticks" command. And now we can
> atleast turn on the minor tick marks with the "minorticks_on()" command.
> 
> But, is there any way to implement something similar to "xticks" for minor
> tick marks? Even better would be a feature that allowed the user to
> simply specify the number of minor tick marks that are evenly spaced
> between the major tick marks?
Hi Matthew,
one thing, which should work is the following. If you want to set the 
positions of minor ticks of an axes 'ax', you can use
ax.set_xticks([0.02, 0.04, 0.06, 0.08, 0.1], minor=True)
but I'm not an expert and I'm not sure if something like you mentioned is 
already supported (namely providing the number of minor tick marks).
Kind regards,
Matthias
From: Benjamin R. <ben...@ou...> - 2010年11月30日 15:00:11
On Tue, Nov 30, 2010 at 2:49 AM, David Pine <dp...@ny...> wrote:
> Is there a simple way to make a plot with axes that look like those in
> test1.png rather than like those in test.png? Here is the code that
> produced test.png. Thanks.
>
> Dave Pine
>
> import numpy as np
> import matplotlib.pyplot as plt
>
> t = np.linspace(0., 20., 100)
> y = np.sin(t)
>
> fig = plt.figure(1, figsize=(6,3) )
> fig.subplots_adjust(bottom=0.2)
>
> ax = fig.add_subplot(1,1,1)
> ax.plot(t, y)
> ax.set_xlabel('t')
> ax.set_ylabel('y')
>
> plt.savefig('test.png')
>
> plt.show()
>
>
>
Dave, I believe that the axis spine feature is what you are looking for:
http://matplotlib.sourceforge.net/users/whats_new.html#axis-spine-placement
I hope that helps!
Ben Root
From: David P. <dp...@ny...> - 2010年11月30日 08:49:30
Attachments: test.png test1.png
Is there a simple way to make a plot with axes that look like those in test1.png rather than like those in test.png? Here is the code that produced test.png. Thanks.
Dave Pine
import numpy as np
import matplotlib.pyplot as plt
t = np.linspace(0., 20., 100)
y = np.sin(t)
fig = plt.figure(1, figsize=(6,3) )
fig.subplots_adjust(bottom=0.2)
ax = fig.add_subplot(1,1,1)
ax.plot(t, y)
ax.set_xlabel('t')
ax.set_ylabel('y')
plt.savefig('test.png')
plt.show()

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