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






Showing 11 results of 11

From: Jae-Joon L. <lee...@gm...> - 2008年08月19日 19:19:40
Hi Jochen,
Yes. I also can see some misalignment. I personally think that it is
very hard to get a perfect baseline alignment if you have usetex=True.
And as far as I know, if you have something like $\frac{1}{2}$ in your
string, then the baseline is not well respected.
Anyhow, The current misalignment we see seems mostly due to being
"top"-alignment. And I don't think the current matplotlib has an easy
way to adjust the alignment. The attached is a custom Axes class you
may use to get baseline-aligned xticklabels. If I use this class,
their baselines seems to align well as far as I can see. An example to
use this axes class is included in the file, and for your script, you
may add following lines before your plot() command.
from BaselineAlignedXticklabelsAxes import Subplot
ax = Subplot(h_f1, 1, 1, 1)
h_f1.add_subplot(ax)
I hope this solves your problem, but if not, I'm afraid there is
nothing I can help.
Regards,
-JJ
On Tue, Aug 19, 2008 at 1:22 PM, Jochen Schaab
<sc...@fs...> wrote:
> Hi,
> your fix solves my problem mostly.
>
> Attached is my pdf output, now created with the fixed pdf-backend. The fix
> works, however the label "Heavy" is still a tiny little bit misaligned (you
> need to zoom in to see the misalignment). All other labels seem to share a
> common baseline now. Can you reproduce that with the script I posted
> earlier?
>
> If xticklabels are "top"-aligned by default, is there an option to make them
> "baseline"-aligned?
>
> Thanks for your help.
>
> Regards
> Jochen
>
>
> Am 19.08.2008 um 18:44 schrieb Jae-Joon Lee:
>
>> Hi,
>>
>> As far as I know, xticklabels in matplotlib are "top"-aligned, so you
>> may see misaligned baseline sometimes. Still, the problem you reported
>> seems to be a bug in the pdf-backend. I posted a simple bug fix of the
>> pdf backend
>>
>> http://article.gmane.org/gmane.comp.python.matplotlib.general/14041
>>
>> and I guess this will also solve your problem. Although this fix is
>> not yet picked up by matplotlib developers, can you apply it by
>> yourself and see how it works?
>>
>> Regards,
>>
>> -JJ
>>
>>
>>
>>
>>
>> On Wed, Aug 13, 2008 at 3:56 AM, Jochen Schaab
>> <sc...@fs...> wrote:
>>>
>>> Hello
>>>
>>> I have a problem with manually set plot labels.
>>> The baseline of the labels is not aligned when using the PDF output. It
>>> works fine for PS or PNG.
>>> Attached is a script which demonstrates my problem.
>>>
>>> Running
>>> python test_baseline.py -dPDF
>>> gives me a corrupted baseline for the x-labels.
>>>
>>> I am using
>>> py25-matplotlib @0.98.3_0+tkinter
>>> installed using MacPorts.
>>> The config file matplotlibrc is unchanged.
>>>
>>> Thanks
>>> Jochen
>>>
>>> -------------------------------------------------------------------------
>>> This SF.Net email is sponsored by the Moblin Your Move Developer's
>>> challenge
>>> Build the coolest Linux based applications with Moblin SDK & win great
>>> prizes
>>> Grand prize is a trip for two to an Open Source event anywhere in the
>>> world
>>> http://moblin-contest.org/redirect.php?banner_id=100&url=/
>>> _______________________________________________
>>> Matplotlib-users mailing list
>>> Mat...@li...
>>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>>>
>>>
>
>
> —
> Dipl.-Ing. Jochen Schaab
>
> Technische Universität Darmstadt
> Institute of Flight Systems and Automatic Control
> Petersenstraße 30, 64287 Darmstadt, Germany
>
> Phone: +49 (0) 6151 16-2290
> Fax: +49 (0) 6151 16-5434
> E-Mail: sc...@fs...
> URL: www.fsr.maschinenbau.tu-darmstadt.de
>
From: Jochen S. <sc...@fs...> - 2008年08月19日 17:22:41
Attachments: test_baseline.pdf
Hi,
your fix solves my problem mostly.
Attached is my pdf output, now created with the fixed pdf-backend. The 
fix works, however the label "Heavy" is still a tiny little bit 
misaligned (you need to zoom in to see the misalignment). All other 
labels seem to share a common baseline now. Can you reproduce that 
with the script I posted earlier?
If xticklabels are "top"-aligned by default, is there an option to 
make them "baseline"-aligned?
Thanks for your help.
Regards
Jochen
Am 19.08.2008 um 18:44 schrieb Jae-Joon Lee:
> Hi,
>
> As far as I know, xticklabels in matplotlib are "top"-aligned, so you
> may see misaligned baseline sometimes. Still, the problem you reported
> seems to be a bug in the pdf-backend. I posted a simple bug fix of the
> pdf backend
>
> http://article.gmane.org/gmane.comp.python.matplotlib.general/14041
>
> and I guess this will also solve your problem. Although this fix is
> not yet picked up by matplotlib developers, can you apply it by
> yourself and see how it works?
>
> Regards,
>
> -JJ
>
>
>
>
>
> On Wed, Aug 13, 2008 at 3:56 AM, Jochen Schaab
> <sc...@fs...> wrote:
>> Hello
>>
>> I have a problem with manually set plot labels.
>> The baseline of the labels is not aligned when using the PDF 
>> output. It
>> works fine for PS or PNG.
>> Attached is a script which demonstrates my problem.
>>
>> Running
>> python test_baseline.py -dPDF
>> gives me a corrupted baseline for the x-labels.
>>
>> I am using
>> py25-matplotlib @0.98.3_0+tkinter
>> installed using MacPorts.
>> The config file matplotlibrc is unchanged.
>>
>> Thanks
>> Jochen
>>
>> -------------------------------------------------------------------------
>> This SF.Net email is sponsored by the Moblin Your Move Developer's 
>> challenge
>> Build the coolest Linux based applications with Moblin SDK & win 
>> great
>> prizes
>> Grand prize is a trip for two to an Open Source event anywhere in 
>> the world
>> http://moblin-contest.org/redirect.php?banner_id=100&url=/
>> _______________________________________________
>> Matplotlib-users mailing list
>> Mat...@li...
>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>>
>>
—
Dipl.-Ing. Jochen Schaab
Technische Universität Darmstadt
Institute of Flight Systems and Automatic Control
Petersenstraße 30, 64287 Darmstadt, Germany
Phone: +49 (0) 6151 16-2290
Fax: +49 (0) 6151 16-5434
E-Mail: sc...@fs...
URL: www.fsr.maschinenbau.tu-darmstadt.de
From: Jae-Joon L. <lee...@gm...> - 2008年08月19日 16:44:11
Hi,
As far as I know, xticklabels in matplotlib are "top"-aligned, so you
may see misaligned baseline sometimes. Still, the problem you reported
seems to be a bug in the pdf-backend. I posted a simple bug fix of the
pdf backend
 http://article.gmane.org/gmane.comp.python.matplotlib.general/14041
and I guess this will also solve your problem. Although this fix is
not yet picked up by matplotlib developers, can you apply it by
yourself and see how it works?
Regards,
-JJ
On Wed, Aug 13, 2008 at 3:56 AM, Jochen Schaab
<sc...@fs...> wrote:
> Hello
>
> I have a problem with manually set plot labels.
> The baseline of the labels is not aligned when using the PDF output. It
> works fine for PS or PNG.
> Attached is a script which demonstrates my problem.
>
> Running
> python test_baseline.py -dPDF
> gives me a corrupted baseline for the x-labels.
>
> I am using
> py25-matplotlib @0.98.3_0+tkinter
> installed using MacPorts.
> The config file matplotlibrc is unchanged.
>
> Thanks
> Jochen
>
> -------------------------------------------------------------------------
> This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
> Build the coolest Linux based applications with Moblin SDK & win great
> prizes
> Grand prize is a trip for two to an Open Source event anywhere in the world
> http://moblin-contest.org/redirect.php?banner_id=100&url=/
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>
From: Jae-Joon L. <lee...@gm...> - 2008年08月19日 16:29:09
You may use the "errorbar" function to draw lines (including
errorbars) and then hide (and show again) errorbars.
From the errorbar documentation,
 Return value is a length 3 tuple. The first element is the
 :class:`~matplotlib.lines.Line2D` instance for the *y* symbol
 lines. The second element is a list of error bar cap lines,
 the third element is a list of
 :class:`~matplotlib.collections.LineCollection` instances for
 the horizontal and vertical error ranges.
so, something like below will work.
 l, ec, el = errorbar(x, y, yerr, marker='s')
 setp(ec, visible=False)
 setp(el, visible=False)
 # when you want to show the errorbars again
 setp(ec, visible=True)
 setp(el, visible=True)
-JJ
On Tue, Aug 19, 2008 at 3:30 AM, Søren Nielsen
<sor...@gm...> wrote:
> Is it possible to add errorbars to existing line2D plots? I'd like the user
> to be able to enable/disable errorbars by pushing a button.
>
> Cheers,
> Soren
>
> -------------------------------------------------------------------------
> This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
> Build the coolest Linux based applications with Moblin SDK & win great
> prizes
> Grand prize is a trip for two to an Open Source event anywhere in the world
> http://moblin-contest.org/redirect.php?banner_id=100&url=/
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>
From: Tony S Yu <to...@MI...> - 2008年08月19日 16:27:04
On Aug 19, 2008, at 11:37 AM, Ben Axelrod wrote:
> When I try using axes.add_artist() to add an Annotation object, it 
> does not work. Adding a Text object in this manner works fine. 
> Shouldn’t Annotation also work since it inherits from Text? The 
> sample code below demonstrates. I am using version 0.98.3.
>
> from matplotlib.pyplot import figure, show
> from matplotlib.text import Text
> from matplotlib.text import Annotation
>
> fig = figure()
> ax = fig.add_subplot(111)
>
> text = Text(0, 0, 'This is Text')
> ann = Annotation('This is an Annotation', (1, 1))
> ax.annotate('This is another Annotation', (2, 2))
I looked at the annotate method in axes.py and the key difference is 
that it sets the transform keyword arg to the IdentityTransform. In 
otherwords, you can add something like this:
 >>> import matplotlib.transforms as mtransforms
 >>> ann = Annotation('This is an Annotation', (1, 1),
... transform=mtransforms.IdentityTransform())
Strangely, `ann.get_transform()` returns `IdentityTransform()` even if 
you *don't specify the transform keyword*. I don't understand why this 
(setting the transform kwarg) works, but it does change *final* 
transform. In other words, if you check the artist transforms *after 
adding the artists*, you'll notice when the transform is explicitly 
set (as above), the transform remains the IdentityTransform; otherwise 
it will be changed to the same transform as the Text instance.
I don't understand why the IdentityTransform would be the correct 
transform for annotations or why Text and Annotation should have 
different transforms. Maybe a developer could enlighten us.
Best,
-Tony
>
> ax.add_artist(text)
> ax.add_artist(ann) #this does not work
PS. To check the final transform, add the following code after adding 
artists:
 >>> for a in ax.artists:
... print a
... print a.get_transform()
>
> ax.set_xlim(-1, 5)
> ax.set_ylim(-1, 5)
> show()
>
> -------------------------------------------------------------------------
> This SF.Net email is sponsored by the Moblin Your Move Developer's 
> challenge
> Build the coolest Linux based applications with Moblin SDK & win 
> great prizes
> Grand prize is a trip for two to an Open Source event anywhere in 
> the world
> http://moblin-contest.org/redirect.php?banner_id=100&url=/_______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
From: Ben A. <bax...@co...> - 2008年08月19日 15:45:28
I thought of a way to side step the problem. Is it possible to have a Line2D object that only has a marker on one end?
________________________________
From: mat...@li... [mailto:mat...@li...] On Behalf Of Ben Axelrod
Sent: Thursday, August 14, 2008 5:54 PM
To: Matplotlib
Subject: [Matplotlib-users] Arrow Questions
I am trying to implement a dynamic graph in mpl, where users can drag around the nodes, and the edges follow the nodes like rubber bands. I have this working with regular edges, but I want to give the option of putting arrows on the edges. I am running into some issues with the Arrow classes.
With my Text, Rectangle, and Line2D objects I can get and set their locations with methods such as get_position(), get_x(), and get_xdata() respectively. But there are no such methods for any of the Arrow classes. (By the way, it seems like these sorts of things would be in the base classes, and much more standard).
What is the difference between Arrow, YAArrow, and FancyArrow anyway? (Besides drastically different scales).
Some other features of the Arrow class that I would like very much are:
 * double headed arrows (one line with an arrow head on each end)
 * the ability to turn the arrow head on and off easily (Boolean parameter function)
Does anyone have any ideas on how to work around these issues?
Thanks,
-Ben
From: Ben A. <bax...@co...> - 2008年08月19日 15:37:26
When I try using axes.add_artist() to add an Annotation object, it does not work. Adding a Text object in this manner works fine. Shouldn't Annotation also work since it inherits from Text? The sample code below demonstrates. I am using version 0.98.3.
from matplotlib.pyplot import figure, show
from matplotlib.text import Text
from matplotlib.text import Annotation
fig = figure()
ax = fig.add_subplot(111)
text = Text(0, 0, 'This is Text')
ann = Annotation('This is an Annotation', (1, 1))
ax.annotate('This is another Annotation', (2, 2))
ax.add_artist(text)
ax.add_artist(ann) #this does not work
ax.set_xlim(-1, 5)
ax.set_ylim(-1, 5)
show()
From: Mathieu L. <lep...@gm...> - 2008年08月19日 11:05:07
> but font style dosen't effect while other properties set properly.
> what is the problem??
Did you try using a font name ?
From: S. N. <sor...@gm...> - 2008年08月19日 07:30:13
Is it possible to add errorbars to existing line2D plots? I'd like the user
to be able to enable/disable errorbars by pushing a button.
Cheers,
Soren
From: sa6113 <s.p...@gm...> - 2008年08月19日 06:49:56
I use this code to set plot legend font :
 font = FontProperties(family ='monospace',style = 'italic',size='large',
weight='bold')
 self.ax.legend( line, label, legend , prop = font )
but font style dosen't effect while other properties set properly.
what is the problem??
-- 
View this message in context: http://www.nabble.com/font-style-problem%21-tp19045196p19045196.html
Sent from the matplotlib - users mailing list archive at Nabble.com.
From: Jae-Joon L. <lee...@gm...> - 2008年08月19日 01:24:42
RendererPdf.get_text_width_height_descent() uses dviread to figure out
the text extent. It seems that the text height returned by dviread is
a height with descent not being included. Therefore, by manually
adding the amount of the descent to its height, problem seems to be
solved.
At line 1652 of "lib/backends/backend_pdf.py"
- return page.width, page.height, page.descent
+ return page.width, page.height+page.descent, page.descent
By the way, agg and ps backends do not respect baselines when
usetex=True. get_text_width_height_descent() method in these backends
just returns 0 for the descent value and baseline alignment is not
properly done. It seems that this can be fixed with the same method as
in the pdf backend (using the dviread module). Is there any reason not
doing this? While using the dviread seems to slow things down a bit, I
guess it is better being correct than being fast.
Regards,
-JJ
On Mon, Aug 18, 2008 at 6:09 PM, Jae-Joon Lee <lee...@gm...> wrote:
> Hi,
>
> The pdf backend seems to return incorrect window extent (i.e., return
> value of get_window_extent()) when usetex==True.
> I'm attaching a small script to test this.
>
>> python test_text_window_extent.py -dPdf
>
> Its results for the pdf backend with usetex==True is attached. For
> comparison, results for the Agg backend with usetex==False (which
> seems correct) is also attached.
>
> I guess this bug is related with
>
> http://article.gmane.org/gmane.comp.python.matplotlib.general/13997
>
> -JJ
>

Showing 11 results of 11

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