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

Showing 8 results of 8

From: John H. <jd...@gm...> - 2008年05月26日 17:14:32
On Mon, May 26, 2008 at 10:08 AM, John Hunter <jd...@gm...> wrote:
> On Mon, May 26, 2008 at 7:01 AM, New2Python <new...@li...> wrote:
>
>> I hope someone can give me a simple solution to my problem. I have a line
>> plotted and I need to be able to mark selected data points on the line. I am
>
> If you are frequently changing the zoom level, as it looks like you
> are, the copy background/restore region/blit idiom is probably not the
> right one for you, since the background is assumed fixed. You can
> simply force a draw at any time by doing fig.canvas.draw() w/o having
> to zoom out or resize to trigger a draw. So after doing the
> self.marker.set_data call, I would do fig.canvas.draw
I thought this would be a generally useful thing to do (maintain a
list of toggleable selected vertices) so I added some support. Here is
some example code to highlight the selected markers:
"""
The matplotlib.lines.VertexSelector maintains a list of selected line
vertices using the line picker property. If an unselected vertex is
clicked, it is selected, and if a selected vertex is clicked, it is
unselectedit.
Classes which inherit from the VertexSelector should override the
process_selected method to do something with the selected vertex. This
example just highlights them with red markers. If you don't have
access to svn, I can send you a free-standing example.
"""
The matplotlib.lines.VertexSelector maintains a list of selected line
vertices using the line picker property. If an unselected vertex is
clicked, it is selected, and if a selected vertex is clicked, it is
unselectedit.
Classes which inherit from the VertexSelector should override the
process_selected method to do something with the selected vertex. This
example just highlights them with red markers.
"""
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.lines as lines
class HighlightSelected(lines.VertexSelector):
 """
 Highlight the selected vertices with a marker plot
 """
 def __init__(self, line, fmt='ro', **kwargs):
 """
 highlight the selected vertices of line with a marker plot.
 The plot format string are given by fmt and the kwargs are additional
 line properties
 """
 lines.VertexSelector.__init__(self, line)
 self.markers, = self.axes.plot([], [], fmt, **kwargs)
 def process_selected(self, ind, xs, ys):
 """
 ind are the indices of the selected vertices. xs and ys are
 the coordinates of the selected vertices.
 """
 self.markers.set_data(xs, ys)
 self.canvas.draw()
fig = plt.figure()
ax = fig.add_subplot(111)
x, y = np.random.rand(2, 30)
line, = ax.plot(x, y, 'bs-', picker=5)
selector = HighlightSelected(line)
plt.show()
From: John H. <jd...@gm...> - 2008年05月26日 15:15:06
On Mon, May 26, 2008 at 8:32 AM, Florent Fayette <fa...@lp...> wrote:
> Hello,
>
> I am using matplotlib under Fedora 8 and since an updaet I just realised
> that the default font seems to be serif raher than the previously roman
> font used in LaTeX, as some people observed it also ?
>
> How can I come back to the previous font using the simplest solution ?
I am not sure what font you used previously, but you can use the
font.family setting in the matplotlibrc file (copy this file from
site-packages/matplotlib/mpl-data/matplotlibrc you your home directory
in the ~/.matplotlib directory and edit it. Eg.
 font.family : sans-serif # for san serif
Since you mentioned latex, you can use latex to generate all the fonts
in matplotlib by enabling usetex in matplotlibrc , provided you have
latex and dvipng installed.
 text.usetex : True
Finally, if you run your matplotlib test script with --verbose-debug
you will get lots of extra information about what settings are used
and what fonts are loaded.
JDH
From: John H. <jd...@gm...> - 2008年05月26日 15:08:33
On Mon, May 26, 2008 at 7:01 AM, New2Python <new...@li...> wrote:
> I hope someone can give me a simple solution to my problem. I have a line
> plotted and I need to be able to mark selected data points on the line. I am
If you are frequently changing the zoom level, as it looks like you
are, the copy background/restore region/blit idiom is probably not the
right one for you, since the background is assumed fixed. You can
simply force a draw at any time by doing fig.canvas.draw() w/o having
to zoom out or resize to trigger a draw. So after doing the
self.marker.set_data call, I would do fig.canvas.draw
If you have a lot of data and only a little in the viewport and
efficiency is a concern, you can use a "clipped line" class, as in the
example http://matplotlib.sf.net/examples/clippedline.py
Let me know if this helps,
JDH
From: John H. <jd...@gm...> - 2008年05月26日 14:52:27
On Mon, May 26, 2008 at 7:26 AM, telemeister <st...@ve...> wrote:
>
> Further to my original post...
> I forgot to note that I have specified Tkagg as the backend in the
> matplotlibrc file.
> I have Tkinter installed and it works OK in other apps independent of
> matplotlib
Let's see if we can narrow tis down to a specific backend. Try
running http://matplotlib.sf.net/examples/simple_plot.py with
a few different backends:
> python simple_plot.py --verbose-debug -dAgg
> python simple_plot.py --verbose-debug -dPS
> python simple_plot.py --verbose-debug -dTkAgg
> python simple_plot.py --verbose-debug -dGTK
Do they all segfault, if not which ones do and post the debug output
for one that does.
JDH
From: Florent F. <fa...@lp...> - 2008年05月26日 14:10:49
Hello,
I am using matplotlib under Fedora 8 and since an updaet I just realised 
that the default font seems to be serif raher than the previously roman 
font used in LaTeX, as some people observed it also ?
How can I come back to the previous font using the simplest solution ?
Thanks in advance for your help,
FF
From: telemeister <st...@ve...> - 2008年05月26日 12:26:37
Further to my original post...
I forgot to note that I have specified Tkagg as the backend in the
matplotlibrc file.
I have Tkinter installed and it works OK in other apps independent of
matplotlib.
telemeister wrote:
> 
> I've been using matplotlib successfully for some time on Win XP and think
> it is great. I would like to use on my linux box (Slackware 12 +
> python2.5)
> 
> Either interactively, or in script, when the "show()" command is reached,
> the plot seems to come up momentarily, but then vanishes and I get a
> segmentation fault. This seems to be happen no matter what I am trying
> to plot. It is always when it attempts to put the plot on the screen that
> it fails.
> 
> A possibly similar fault has been listed earlier in this forum:
> http://www.nabble.com/segfault-with-TkAgg-and-any-GUI-in-2.5-td9700130.html#a9712842
> 
> I have been working through some of the suggestions made in that case by
> John Hunter:
> 
> Firstly I did following:
> rm -rf the site-packages/matplotlib and build subdirs and did a clean
> install of matplotlib.
> 
> I am upoading files with the outputs from the build and install. I can't
> see any obvious errors in these but
> perhaps someone can.
> 
> http://www.nabble.com/file/p17470177/build.log build.log 
> http://www.nabble.com/file/p17470177/install.log install.log 
> 
> As suggested by John H. I Tried importing these packages individually,
> with results as shown.
> 
> import matplotlib._image (no problems)
> import matplotlib._transforms (no problems)
> 
> import matplotlib.backends._ns_backend_agg # for numpy (Failed: no
> module named ns_backend_agg)
> 
> (I'm using numpy)
> 
> import matplotlib.backends._tkagg (no problems)
> import matplotlib._agg (no problems)
> 
> 
> Greatly appreciate any suggestions as to what I could try from here or
> what other diagnostics I can provide.
> 
-- 
View this message in context: http://www.nabble.com/linux%3A-seg-fault-on-show%28%29-tp17470177p17471022.html
Sent from the matplotlib - users mailing list archive at Nabble.com.
From: New2Python <new...@li...> - 2008年05月26日 12:01:06
Hi All,
I hope someone can give me a simple solution to my problem. I have a line
plotted and I need to be able to mark selected data points on the line. I am
using the mpl_connect function to detect the mouseclick on the line and then
to place a marker at the selected datapoint. My data is 0.2s apart on a
1hour plot, so to click on a single data point i need to zoom into the
graph. Once I zoom in and select the data point, the marker doesn't appear
until the graph is resized or refreshed by the home button. Also, if I click
on an existing datapoint, is is removed in the array however when the graph
is redrawn or refreshed the marker is not deleted. Below is an exert of the
code. I am using embedded_wx4.py as a template. So the question is, how can
i show the marker at the zoomed level, it is apain to have to zoom out to
home view every time and why won't my redraw work. If there is any ambiguity
please let me know and I'll try to re-explain myself.
 def _on_addmarker(self, evt): #defined from toolbar button
 datamarker = self.canvas.mpl_connect('pick_event', self.onpick1)
 evt.Skip()
 
 def onpick1(self, event):
 self.background_marker=self.canvas.copy_from_bbox(self.axes.bbox)
 self.marker, = self.axes.plot(x,y, 'go',markersize=8)
 
 if isinstance(event.artist, Line2D):
 thisline=event.artist
 xdata = thisline.get_xdata()
 ydata = thisline.get_ydata()
 ind = event.ind
 tempx = xdata[ind]
 tempy = ydata[ind]
 print '------------'
 print 'onpick1 line X:' ,tempx
 print 'onpick1 line ind:' ,ind
 print 'onpick1 line Y:' ,tempy
 if xdata[ind] in x:
 x.remove(tempx)
 y.remove(tempy)
 print '------------'
 print 'you removed ' ,ind ,tempx ,tempy
 print 'X=' ,x
 print 'Y=' ,y
 print '------------'
 
 else:
 x.append(tempx)
 y.append(tempy)
 print 'you clicked ' ,x ,y
 print '------------'
 time.sleep(0.1) 
#----------------------------------------------------------------------------------------- 
 self.canvas.restore_region(self.background_marker) 
 self.marker.set_data(x,y) 
 self.axes.draw_artist(self.marker)
 self.canvas.blit(self.axes.bbox) 
and
class CanvasFrame(Frame):
 global line, background
 def __init__(self):
 Frame.__init__(self,None,-1,
 'CanvasFrame',size=(550,350))
 self.SetBackgroundColour(NamedColor("WHITE"))
 self.figure = Figure(figsize=(5,4), dpi=100)
 self.axes = self.figure.add_subplot(111)
 picker = 5
 self.line, = self.axes.plot(cx,cy,picker=picker, linewidth=1)
etc..etc...
-- 
View this message in context: http://www.nabble.com/Plotting-single-marker-point-at-zoomed-level-tp17470649p17470649.html
Sent from the matplotlib - users mailing list archive at Nabble.com.
From: telemeister <st...@ve...> - 2008年05月26日 11:24:03
I've been using matplotlib successfully for some time on Win XP and think it
is great. I would like to use on my linux box (Slackware 12 + python2.5)
Either interactively, or in script, when the "show()" command is reached,
the plot seems to come up momentarily, but then vanishes and I get a
segmentation fault. This seems to be happen no matter what I am trying to
plot. It is always when it attempts to put the plot on the screen that it
fails.
A possibly similar fault has been listed earlier in this forum:
http://www.nabble.com/segfault-with-TkAgg-and-any-GUI-in-2.5-td9700130.html#a9712842
I have been working through some of the suggestions made in that case by
John Hunter:
Firstly I did following:
rm -rf the site-packages/matplotlib and build subdirs and did a clean
install of matplotlib.
I am upoading files with the outputs from the build and install. I can't see
any obvious errors in these but
perhaps someone can.
http://www.nabble.com/file/p17470177/build.log build.log 
http://www.nabble.com/file/p17470177/install.log install.log 
As suggested by John H. I Tried importing these packages individually, with
results as shown.
 import matplotlib._image (no problems)
 import matplotlib._transforms (no problems)
 import matplotlib.backends._ns_backend_agg # for numpy (Failed: no module
named ns_backend_agg)
(I'm using numpy)
 import matplotlib.backends._tkagg (no problems)
 import matplotlib._agg (no problems)
Greatly appreciate any suggestions as to what I could try from here or what
other diagnostics I can provide.
-- 
View this message in context: http://www.nabble.com/linux%3A-seg-fault-on-show%28%29-tp17470177p17470177.html
Sent from the matplotlib - users mailing list archive at Nabble.com.

Showing 8 results of 8

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