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



Showing 9 results of 9

From: C M <cmp...@gm...> - 2011年11月28日 20:45:41
As related to another question(s) I've posted, can someone help with this
custom formatter? This is for use in a FunctionFormatter to be used on the
y axis to format the ticks (in particular, to remove them when not
wanted). Example:
def CustomFormatter(self,y,i):
 if y < 0:
 return ''
This says if the value of y < 0, put nothing on the axis tick.
QUESTION: How can I implement the following two sorts of rules in
Matplotlib's (OO) API?
def CustomFormatter(self,y,i):
 if y falls in the bottom 50 pixels' worth of height of this plot:
 return ''
or
def CustomFormatter(self,y,i):
 if y falls in the bottom 10% of the height of this plot:
 return ''
Thanks,
Che
From: Shankararaman R. <Sha...@Tr...> - 2011年11月28日 20:04:04
Hello,
 
I am fairly new to Matplotlib and appreciate your help with my question:
 
I am looking to generate a time series trend plots and include as my
xtick labels a selective list of strings. For ex: Month/Year label for
data corresponding to the 1st day of each month. I may be plotting 365
days of data but want to show only 12 xtick labels. 
 
Would it be possible to specify grid lines for every 7 days of data for
instance? This makes the grid line locations different from the xtick
label locations. 
 
I am sure there is support for such a feature in Matplotlib. I did look
through the docs/forums but could not find much help.
Any suggestions will be much appreciated. 
 
Thanks,
Shankar
From: Sterling S. <sm...@fu...> - 2011年11月28日 19:40:50
> 
> From: "Marianne C." <mar...@gm...>
> Date: November 24, 2011 6:48:34 AM PST
> To: mat...@li...
> Subject: [Matplotlib-users] Removing ticks and frame (imshow)
> 
> 
> Hi all,
> 
> My name is Marianne, I am a beginner user of matplotlib.
> I am using imshow in pyplot. I am desperate to get rid of
> the ticks on both x and y axes (see attached picture). I
> do not need the black box around the data either. Should
> I use imshow in axes.Axes instead, to be able to call
> set_ticks_position("none")?
> Thank you for your help,
> Marianne
> 
> Here is the code so far:
> 
> import numpy
> from matplotlib import pyplot
> 
> q=numpy.loadtxt('field.txt')
> 
> myfield = pyplot.imshow(q,aspect=1)
> myfield.set_clim(vmin=0, vmax=0.6)
> 
> pyplot.colorbar()
> 
> pyplot.savefig('field_1.eps')
> 
> <field_1.pdf>
Marianne,
Try
myfield.get_axes().axis('off')
-Sterling
From: Tony Yu <ts...@gm...> - 2011年11月28日 16:09:53
On Thu, Nov 24, 2011 at 9:48 AM, Marianne C. <mar...@gm...> wrote:
> Hi all,
>
> My name is Marianne, I am a beginner user of matplotlib.
> I am using imshow in pyplot. I am desperate to get rid of
> the ticks on both x and y axes (see attached picture). I
> do not need the black box around the data either. Should
> I use imshow in axes.Axes instead, to be able to call
>
> set_ticks_position("none")?
>
> Thank you for your help,
> Marianne
>
> Here is the code so far:
>
> import numpy
> from matplotlib import pyplot
>
> q=numpy.loadtxt('field.txt')
>
> myfield = pyplot.imshow(q,aspect=1)
> myfield.set_clim(vmin=0, vmax=0.6)
>
> pyplot.colorbar()
>
> pyplot.savefig('field_1.eps')
>
There are a number of ways to accomplish this, but the one I use is to make
the x and y axes invisible (gets rid of the ticks) and also make the spines
invisible (gets rid of the lines). I just throw these changes into a
utility function (`clear_frame` below) and put that in a module that's on
my python path so that it's easily reusable.
Hope that helps,
-Tony
#~~~
import numpy as np
import matplotlib.pyplot as plt
def clear_frame(ax=None):
 if ax is None:
 ax = plt.gca()
 ax.xaxis.set_visible(False)
 ax.yaxis.set_visible(False)
 for spine in ax.spines.itervalues():
 spine.set_visible(False)
img = np.random.random((100,100))
plt.imshow(img)
clear_frame()
plt.colorbar()
plt.show()
#~~~
From: Jeff W. <js...@fa...> - 2011年11月28日 15:52:20
On 11/22/11 12:51 PM, Dave Xia wrote:
> Hi,
>
> I am a new user of matplotlib Basemap. I tried to draw the latitude 
> with interval 0.1 degree using drawparallels, but failed. I wonder if 
> the drawparallels can draw latitude lines with small interval instead 
> of integer values. (drawmeridian can work with small interval 0.1).
>
> Does anyone have any idea to fix this issue?
>
> Thanks!
>
> Dave
Confirmed. This is now fixed in github master. It's a one-liner, so 
you can manually patch your source if you prefer.
Just change line 2067 in lib/mpl_toolkits/basemap/__init__.py from
if t is not None: linecolls[int(lat)][1].append(t)
to
if t is not None: linecolls[lat][1].append(t)
Regards,
Jeff
From: Jae-Joon L. <lee...@gm...> - 2011年11月28日 13:50:20
On Mon, Nov 28, 2011 at 9:39 PM, Markus Baden <mar...@gm...> wrote:
> anno_args = {
>   'annotation_clip': False,
>   'arrowprops': dict(arrowstyle='-', relpos=(0, 1)),
>   }
> plt.annotate('Good relpos', (3, 3), xytext = (3, 2), **anno_args)
> plt.annotate('Bad relpos', (6, 6), xytext = (6, 5), **anno_args)
This is a bug. In the current implementation, "annotate" has a
side-effect that modifies the arrowprops dictionary.
As a workaround, you may do,
arrowprops = dict(arrowstyle='-', relpos=(0, 1))
plt.annotate('Good relpos', (3, 3), xytext = (3, 2),
 annotation_clip=False, arrowprops=arrowprops.copy())
> plt.annotate('No ha/va', (5, 5), xytext = (5, 4),
> arrowprops=dict(arrowstyle='-'),
>       ha='left', va='top')
>
ha and va controls the location of the text relative to the xytext,
and I believe it does work as expected. It has nothing to do with the
starting point of the arrow, which should be controlled by the relpos
parameter.
Regards,
-JJ
From: Markus B. <mar...@gm...> - 2011年11月28日 12:39:23
Hi list,
I'm trying to annotate points on a graph by drawing a simple line from the
point on the axis to the top left corner of the text. I can't figure out,
how to use pyplot.annotate so that it turns of the arrow head and I can use
horizontalalignment (ha) and verticalalignment (va). When I use
arrowstyle='-' in the arrowprops dictionary ha and va don't work. Instead I
use relpos=(0, 1) in the arrowprops dictionary, which works, but only when
I call the annotate function the first time. Below is a minimal example.
I'm using mpl version 1.0. as part of EPD 7.1 on Mac OS X 10.5.
Any hints on how to achieve my goal would be greatly appreciated!
Best regards,
Markus
---
The following code reproduces my problem
import numpy as np
import matplotlib.pyplot as plt
data = np.linspace(1,10)
plt.plot(data, data)
anno_args = {
 'annotation_clip': False,
 'arrowprops': dict(arrowstyle='-', relpos=(0, 1)),
 }
plt.annotate('Good relpos', (3, 3), xytext = (3, 2), **anno_args)
plt.annotate('Bad relpos', (6, 6), xytext = (6, 5), **anno_args)
plt.annotate('No ha/va', (5, 5), xytext = (5, 4),
arrowprops=dict(arrowstyle='-'),
 ha='left', va='top')
plt.show()
From: Eric F. <ef...@ha...> - 2011年11月28日 06:01:12
On 11/27/2011 05:30 PM, Tom Bennett wrote:
> Hi,
> I am new to Matplotlib. I am using matplotlib under ipython. A
> function script generates a figure that has three subplots. The thing is
> that I would like to continue to interact with a specific subplot under
> the interactive prompt through pylab after I run that function. However,
> gca() returns the last subplot which is not what I want.
> The question is if there is any way to tell gca() which Axes is the
> current Axes.
> Thanks,
> Tom
>
If you keep a reference to the Axes when you create it, or if you use 
gca() to return a reference before creating the next one, then you can 
use sca(ax) to make ax the current axes.
Eric
>
>
> ------------------------------------------------------------------------------
> All the data continuously generated in your IT infrastructure
> contains a definitive record of customers, application performance,
> security threats, fraudulent activity, and more. Splunk takes this
> data and makes sense of it. IT sense. And common sense.
> http://p.sf.net/sfu/splunk-novd2d
>
>
>
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
From: Tom B. <tom...@ma...> - 2011年11月28日 03:59:46
Hi,
I am new to Matplotlib. I am using matplotlib under ipython. A
function script generates a figure that has three subplots. The thing is
that I would like to continue to interact with a specific subplot under the
interactive prompt through pylab after I run that function. However, gca()
returns the last subplot which is not what I want.
The question is if there is any way to tell gca() which Axes is the current
Axes.
Thanks,
Tom

Showing 9 results of 9

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