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

Showing 8 results of 8

From: Neal B. <ndb...@gm...> - 2011年09月11日 19:38:07
Jae-Joon Lee wrote:
> On Sun, Sep 11, 2011 at 10:16 PM, Neal Becker <ndb...@gm...> wrote:
>> Yes, that's very helpful. Just one thing. How would I get a bit more bottom
>> margin on the main figure to leave more room for the extra axis?
>>
>> I'm using this as an example. I experimented with plt.subplots_adjust, which
>> seems like it might do the right thing. Is this the 'best' approach?
>> (I really don't know what all these methods do, just guessing)
> 
> Yes, you need to fiddle with subplots_adjust command. The current
> development branch of matplotlib (not yet released) has a new function
> "tight_layout", which does this automatically for you.
> Regards,
> 
> -JJ
Looking forward to that. Any idea of an ETA for a release?
From: Daniel H. <dh...@gm...> - 2011年09月11日 18:20:58
Mpl 1.0.0
The way Annotation.draw (in text.py) is implemented, if an annotation
is created with an annotation point (x,y) and text located at (tx,ty)
and then the you pan around on the graph such that (x,y) is no longer
visible, the annotation suddenly disappears.
I would suggest the following modification to Annotation.draw in
text.py. All it does is set a clip box so that the annotation and
arrow is still drawn, but the arrow is clipped at the axes boundary.
It is a much nicer effect than the annotation disappearing. I have
made this modification in my source locally, and it works very well,
but I thought I would suggest here for inclusion into the main code
base.
Modified lines are marked with a CHANGEME. It is only a four line change.
 @allow_rasterization
 def draw(self, renderer):
 """
 Draw the :class:`Annotation` object to the given *renderer*.
 """
 if renderer is not None:
 self._renderer = renderer
 if not self.get_visible(): return
 xy_pixel = self._get_position_xy(renderer)
 #if not self._check_xy(renderer, xy_pixel): CHANGEME (commented out)
 # return
CHANGEME (commented out)
 self._update_position_xytext(renderer, xy_pixel)
 self.update_bbox_position_size(renderer)
 if self.arrow is not None:
 if self.arrow.figure is None and self.figure is not None:
 self.arrow.figure = self.figure
 self.arrow.set_clip_box(self.axes.bbox) # CHANGEME (new line)
 self.arrow.draw(renderer)
 if self.arrow_patch is not None:
 if self.arrow_patch.figure is None and self.figure is not None:
 self.arrow_patch.figure = self.figure
 self.arrow_patch.set_clip_box(self.axes.bbox) # CHANGEME (new line)
 self.arrow_patch.draw(renderer)
 Text.draw(self, renderer)
--
Daniel Hyams
dh...@gm...
From: Jae-Joon L. <lee...@gm...> - 2011年09月11日 15:20:02
On Sun, Sep 11, 2011 at 10:16 PM, Neal Becker <ndb...@gm...> wrote:
> Yes, that's very helpful. Just one thing. How would I get a bit more bottom
> margin on the main figure to leave more room for the extra axis?
>
> I'm using this as an example. I experimented with plt.subplots_adjust, which
> seems like it might do the right thing. Is this the 'best' approach?
> (I really don't know what all these methods do, just guessing)
Yes, you need to fiddle with subplots_adjust command. The current
development branch of matplotlib (not yet released) has a new function
"tight_layout", which does this automatically for you.
Regards,
-JJ
From: Jae-Joon L. <lee...@gm...> - 2011年09月11日 15:16:35
Just in case, here is a version with "axes_grid1" toolkit. Note that
axes_grid is kind of deprecated.
Regards,
-JJ
import numpy as np
import matplotlib.pyplot as plt
import mpl_toolkits.axes_grid1 as axes_grid1
host = axes_grid1.host_subplot(111)
hplt, = host.plot(np.random.rand(100))
from matplotlib.transforms import Affine2D
transfrom_from_parx_to_host = Affine2D().scale(1000, 1)
parx = host.twin(transfrom_from_parx_to_host)
if 1: # adjust axis postion etc.
 parx.axis["right"].toggle(ticklabels=False)
 parx.axis["top"].toggle(ticklabels=False)
 parx.axis["bottom"].toggle(ticklabels=True)
 parx.axis["bottom"].line.set_visible(True)
 parx.spines["bottom"].set_position(('outward',20))
plt.show()
On Sat, Sep 10, 2011 at 6:14 AM, Gökhan Sever <gok...@gm...> wrote:
> Hi,
> The code below should create a properly placed 2nd x-axis. You might need to
> adjust the placement of the figure canvas to match into the window.
> import numpy as np
> import matplotlib.pyplot as plt
> from mpl_toolkits.axes_grid.parasite_axes import SubplotHost
> fig = plt.figure(figsize=(10,8))
> host = SubplotHost(fig, 111)
> fig.add_subplot(host)
> parx = host.twiny()
> parx.axis["top"].set_visible(False)
> offset = 0, -50
> new_axisline = parx.get_grid_helper().new_fixed_axis
> parx.axis["bottom"] = new_axisline(loc="bottom", axes=parx, offset=offset)
> parx.axis["bottom"].label.set_visible(True)
> hplt, = host.plot(np.random.rand(100))
> p2, = parx.plot(np.linspace(0,20,100), np.random.rand(100)*5.0,
> color='green')
> plt.show()
>
> There is also another example at:
> http://matplotlib.sourceforge.net/mpl_toolkits/axes_grid/users/overview.html#axisartist-with-parasiteaxes
> Hope this helps.
> On Fri, Sep 9, 2011 at 12:50 PM, Neal Becker <ndb...@gm...> wrote:
>>
>> Neal Becker wrote:
>>
>> > I have a semilog plot. I'd like to add a second x axis (maybe below the
>> > existing one, or else maybe on top of graph). This second x axis is
>> > simply
>> > describing the same existing data, in different units.
>> >
>> > For example imagine a plot of
>> >
>> > x - time in seconds
>> > y - velocity
>> >
>> > x2 - time in minutes
>> >
>> >
>>
>> This almost works:
>>  fig = plt.figure()
>>  ax = fig.add_subplot(111)
>> ...
>>  ax2 = ax.twiny()
>>  min_x, max_x = ax.get_xlim()
>>  ax2.set_xlim (min_x-1, max_x-1)
>>
>> except the 2nd x axis is on the top, and prints right on top of the title
>>
>>
>>
>> ------------------------------------------------------------------------------
>> Why Cloud-Based Security and Archiving Make Sense
>> Osterman Research conducted this study that outlines how and why cloud
>> computing security and archiving is rapidly being adopted across the IT
>> space for its ease of implementation, lower cost, and increased
>> reliability. Learn more. http://www.accelacomm.com/jaw/sfnl/114/51425301/
>> _______________________________________________
>> Matplotlib-users mailing list
>> Mat...@li...
>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>
>
> --
> Gökhan
>
> ------------------------------------------------------------------------------
> Why Cloud-Based Security and Archiving Make Sense
> Osterman Research conducted this study that outlines how and why cloud
> computing security and archiving is rapidly being adopted across the IT
> space for its ease of implementation, lower cost, and increased
> reliability. Learn more. http://www.accelacomm.com/jaw/sfnl/114/51425301/
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>
From: Neal B. <ndb...@gm...> - 2011年09月11日 13:16:29
Gökhan Sever wrote:
> Hi,
> 
> The code below should create a properly placed 2nd x-axis. You might need to
> adjust the placement of the figure canvas to match into the window.
> 
> import numpy as np
> import matplotlib.pyplot as plt
> from mpl_toolkits.axes_grid.parasite_axes import SubplotHost
> 
> fig = plt.figure(figsize=(10,8))
> host = SubplotHost(fig, 111)
> fig.add_subplot(host)
> parx = host.twiny()
> 
> parx.axis["top"].set_visible(False)
> offset = 0, -50
> new_axisline = parx.get_grid_helper().new_fixed_axis
> parx.axis["bottom"] = new_axisline(loc="bottom", axes=parx, offset=offset)
> parx.axis["bottom"].label.set_visible(True)
> 
> hplt, = host.plot(np.random.rand(100))
> p2, = parx.plot(np.linspace(0,20,100), np.random.rand(100)*5.0,
> color='green')
> 
> plt.show()
> 
> 
> There is also another example at:
> 
http://matplotlib.sourceforge.net/mpl_toolkits/axes_grid/users/overview.html#axisartist-
with-parasiteaxes
> 
> Hope this helps.
Yes, that's very helpful. Just one thing. How would I get a bit more bottom 
margin on the main figure to leave more room for the extra axis?
I'm using this as an example. I experimented with plt.subplots_adjust, which 
seems like it might do the right thing. Is this the 'best' approach?
(I really don't know what all these methods do, just guessing)
import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.axes_grid.parasite_axes import SubplotHost
from matplotlib.backends.backend_pdf import PdfPages
pdf = PdfPages('results.pdf')
fig = plt.figure(figsize=(10,8))
host = SubplotHost(fig, 111)
ax = fig.add_subplot(host)
plt.subplots_adjust (bottom=0.1)
parx = host.twiny()
parx.axis["top"].set_visible(False)
offset = 0, -30
new_axisline = parx.get_grid_helper().new_fixed_axis
parx.axis["bottom"] = new_axisline(loc="bottom", axes=parx, offset=offset)
parx.axis["bottom"].label.set_visible(True)
hplt, = host.plot(np.linspace(0,20,100), np.random.rand(100))
plt.xlabel ('Es/No')
p2, = parx.plot(np.linspace(0,20,100)-5, np.random.rand(100)*5.0, color='green')
parx.set_xlabel ('$Eb_{i}/No$')
#plt.show()
pdf.savefig (fig)
plt.close()
pdf.close()
From: xyz <mi...@op...> - 2011年09月11日 12:09:15
Sorry, this is the correct link 
http://pcp.oxfordjournals.org/content/52/2/274/F2.expansion.html (Fig2).
Thank you in advance,
On 09/11/2011 04:33 PM, Eric Firing wrote:
> On 09/10/2011 07:57 PM, xyz wrote:
>> Hello,
>> How is it possible to paint this kind graph
>> http://pcp.oxfordjournals.org/content/52/2/274 with Matplotlib?
> Your link leads to a journal abstract, not to a graph. There are
> several figures in the paper. It looks like any of them could be made
> with matplotlib--all are 2-D figures, and mpl is a capable 2-D plotting
> library--but each would require some programming using that library.
>
> Eric
>
>> Thank you in advance.
>>
>> Cheers,
>>
>> Michal
> ------------------------------------------------------------------------------
> Using storage to extend the benefits of virtualization and iSCSI
> Virtualization increases hardware utilization and delivers a new level of
> agility. Learn what those decisions are and how to modernize your storage
> and backup environments for virtualization.
> http://www.accelacomm.com/jaw/sfnl/114/51434361/
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
From: Eric F. <ef...@ha...> - 2011年09月11日 06:33:32
On 09/10/2011 07:57 PM, xyz wrote:
> Hello,
> How is it possible to paint this kind graph
> http://pcp.oxfordjournals.org/content/52/2/274 with Matplotlib?
Your link leads to a journal abstract, not to a graph. There are 
several figures in the paper. It looks like any of them could be made 
with matplotlib--all are 2-D figures, and mpl is a capable 2-D plotting 
library--but each would require some programming using that library.
Eric
>
> Thank you in advance.
>
> Cheers,
>
> Michal
From: xyz <mi...@op...> - 2011年09月11日 06:01:09
Hello,
How is it possible to paint this kind graph 
http://pcp.oxfordjournals.org/content/52/2/274 with Matplotlib?
Thank you in advance.
Cheers,
Michal

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