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




Showing results of 285

<< < 1 .. 3 4 5 6 7 .. 12 > >> (Page 5 of 12)
From: Damon M. <dam...@gm...> - 2012年07月20日 17:19:19
On Fri, Jul 20, 2012 at 10:12:43AM -0500, Benjamin Root wrote:
> On Fri, Jul 20, 2012 at 8:50 AM, Damon McDougall
> <dam...@gm...>wrote:
> 
> > Howdy all,
> >
> > Not sure if I'm being a giant noob, but is there any way to plot a
> > vector field (a la quiver) on the (x, y)-plane of an Axes3D object? The
> > behaviour I desire is exactly that of
> >
> > http://matplotlib.sourceforge.net/mpl_toolkits/mplot3d/tutorial.html#filled-contour-plots
> >
> > But instead of a contour plot on the (x, y)-plane, I want a quiver plot
> > there.
> >
> > Any ideas?
> > Thank you :)
> >
> >
> I just tried to see if it was possible with only a few tweaks, and it
> revealed some limitations in the mplot3d code with respect to handling
> collection objects subclassed from PolyCollections (and others).
> Unfortunately, I don't see any immediate work-around. Could you please
> file a feature request? I may or may not be able to address it this
> weekend.
>
Mate, you are a machine. I was thinking of tweaking myself, but it seems
like since you hit a brick wall I'll wait to see if you get a branch
going. When you do, I'll fork that bad boy.
Thanks for following up!
> 
> Ben Root
-- 
Damon McDougall
http://damon-is-a-geek.com
B2.39
Mathematics Institute
University of Warwick
Coventry
West Midlands
CV4 7AL
United Kingdom
From: Benjamin R. <ben...@ou...> - 2012年07月20日 15:13:13
On Fri, Jul 20, 2012 at 8:50 AM, Damon McDougall
<dam...@gm...>wrote:
> Howdy all,
>
> Not sure if I'm being a giant noob, but is there any way to plot a
> vector field (a la quiver) on the (x, y)-plane of an Axes3D object? The
> behaviour I desire is exactly that of
>
> http://matplotlib.sourceforge.net/mpl_toolkits/mplot3d/tutorial.html#filled-contour-plots
>
> But instead of a contour plot on the (x, y)-plane, I want a quiver plot
> there.
>
> Any ideas?
> Thank you :)
>
>
I just tried to see if it was possible with only a few tweaks, and it
revealed some limitations in the mplot3d code with respect to handling
collection objects subclassed from PolyCollections (and others).
Unfortunately, I don't see any immediate work-around. Could you please
file a feature request? I may or may not be able to address it this
weekend.
Ben Root
From: Benjamin R. <ben...@ou...> - 2012年07月20日 14:48:18
On Thu, Jul 19, 2012 at 3:17 PM, ObsessiveMathsFreak <
obs...@gm...> wrote:
> I used sagemath which uses matplotlib as its plotting interface. After
> extensive investigation I was extremely disappointed to find that
> matplotlib has no fundamental support for drawing arrows at the ends of
> axes.
>
> Is there no way that such basic functionality could be included in the
> next matplotlib release. Add-ons such as artistsaxis are not really
> appropriate as they require extensive refactoring of code using splines
> or axes.
>
> A simple "endarrow=True" option on either splines or axes would be a
> very useful addition to the axis interface. Many people would be very
> grateful if you could consider adding this feature in the next release.
>
>
>
Agreed, this would be a wonderful feature, and is often requested. The
AxesGrid toolkit does provide this functionality
http://matplotlib.sourceforge.net/examples/axes_grid/demo_axisline_style.html
but it would be nice to eventually move some of this into the standard
matplotlib axes object.
Two of the hurdles I foresee are:
 * API -- there are many kinds of arrows and I am sure once this ability
is added, users are going to want to tweak the appearance. We will need to
have an easy way to turn them on, select which axes to have them for, the
type of arrow and their size and other properties. Finally, I am sure this
will need to be at least partly accessible through rcparams.
 * Locating -- If we place the arrowhead at the very end of the axis
spine, we possibly run the risk of the arrowhead being clipped by the
bounding box rectangle. We would also need it to be taken into account for
tight_layout and for bbox_inches='tight'. On the other hand, one could
position the arrow head such that the tip of the arrow is at the end of the
spine, but one runs the risk of colliding with the tick and tick labels.
By no means should this discourage someone from attempting this. But I
wanted to outline some of the considerations one would need to take into
account while creating this feature.
Cheers!
Ben Root
From: Damon M. <dam...@gm...> - 2012年07月20日 13:50:37
Howdy all,
Not sure if I'm being a giant noob, but is there any way to plot a
vector field (a la quiver) on the (x, y)-plane of an Axes3D object? The
behaviour I desire is exactly that of
http://matplotlib.sourceforge.net/mpl_toolkits/mplot3d/tutorial.html#filled-contour-plots
But instead of a contour plot on the (x, y)-plane, I want a quiver plot
there.
Any ideas?
Thank you :)
-- 
Damon McDougall
http://damon-is-a-geek.com
B2.39
Mathematics Institute
University of Warwick
Coventry
West Midlands
CV4 7AL
United Kingdom
From: Benjamin R. <ben...@ou...> - 2012年07月20日 13:43:41
On Fri, Jul 20, 2012 at 5:39 AM, Damon McDougall
<dam...@gm...>wrote:
> On Fri, Jul 20, 2012 at 12:14:08PM +0200, Fabien Lafont wrote:
> > Hello everyone,
> >
> > Is it possible to have automaticaly more than 3 colors when Iplot a
> graph?
> > When I plot it put the first in blue the second in green the third in red
> > and the fourth in blue again. I want to use more colors to differenciate
> > the curves.
> >
>
> Strange, this is the default color cycle (colormaps are something
different).
['b','g','r','c','m','y','k']
You can modify this via the "axes.color_cycle" rcparam.
Cheers!
Ben Root
From: Damon M. <dam...@gm...> - 2012年07月20日 10:39:58
On Fri, Jul 20, 2012 at 12:14:08PM +0200, Fabien Lafont wrote:
> Hello everyone,
> 
> Is it possible to have automaticaly more than 3 colors when Iplot a graph?
> When I plot it put the first in blue the second in green the third in red
> and the fourth in blue again. I want to use more colors to differenciate
> the curves.
>
Sure. Here's an example I cooked up for you:
https://gist.github.com/3150091
Hope that helps.
> 
> Is it possible?
> 
> Fabien
-- 
Damon McDougall
http://damon-is-a-geek.com
B2.39
Mathematics Institute
University of Warwick
Coventry
West Midlands
CV4 7AL
United Kingdom
From: Fabien L. <laf...@gm...> - 2012年07月20日 10:14:19
Hello everyone,
Is it possible to have automaticaly more than 3 colors when Iplot a graph?
When I plot it put the first in blue the second in green the third in red
and the fourth in blue again. I want to use more colors to differenciate
the curves.
Is it possible?
Fabien
From: Benjamin R. <ben...@ou...> - 2012年07月20日 05:17:40
On Thu, Jul 19, 2012 at 11:34 PM, JonBL <jc....@bi...> wrote:
>
> I have a Python program which calls matplotlib's show() method to display a
> plot, but control does not return to my program until I close the displayed
> figure. I want control to immediately return to my program so that I can
> display additional figures as well.
>
> The doco (matplotlib 1.1.1) for the show() method mentions an experimental
> key word arg named 'block', that can be set to True or False. This looks
> promising, but plt.show(block = False) raises type error "got an unexpected
> keyword argument 'block'". A call to plt.show() works fine. The method
> appears to accept no arguments.
>
> Can anyone suggest how to bypass the blocking behaviour of the show()
> method?
>
> TIA,
> Jon
>
"The only thing worse than no comments are outdated comments"
IIRC, "block" was long removed from matplotlib. If you want non-blocking
behavior, just call "plt.ion()" to turn interactivity on. There are other
approaches to this problem that you would want to examine if you were truly
embedding into an application, but in the most simple cases, just turning
interactivity on should do the trick.
Cheers!
Ben Root
From: JonBL <jc....@bi...> - 2012年07月20日 05:01:48
Solved - just discovered methods ion() and ioff() which do the job.
JonBL wrote:
> 
> I have a Python program which calls matplotlib's show() method to display
> a plot, but control does not return to my program until I close the
> displayed figure. I want control to immediately return to my program so
> that I can display additional figures as well.
> 
> The doco (matplotlib 1.1.1) for the show() method mentions an experimental
> key word arg named 'block', that can be set to True or False. This looks
> promising, but plt.show(block = False) raises type error "got an
> unexpected keyword argument 'block'". A call to plt.show() works fine. The
> method appears to accept no arguments.
> 
> Can anyone suggest how to bypass the blocking behaviour of the show()
> method?
> 
> TIA,
> Jon
> 
-- 
View this message in context: http://old.nabble.com/How-to-Turn-Off-Blocking-by-Method-show%28%29-tp34188043p34188078.html
Sent from the matplotlib - users mailing list archive at Nabble.com.
From: JonBL <jc....@bi...> - 2012年07月20日 04:34:43
I have a Python program which calls matplotlib's show() method to display a
plot, but control does not return to my program until I close the displayed
figure. I want control to immediately return to my program so that I can
display additional figures as well.
The doco (matplotlib 1.1.1) for the show() method mentions an experimental
key word arg named 'block', that can be set to True or False. This looks
promising, but plt.show(block = False) raises type error "got an unexpected
keyword argument 'block'". A call to plt.show() works fine. The method
appears to accept no arguments.
Can anyone suggest how to bypass the blocking behaviour of the show()
method?
TIA,
 Jon
-- 
View this message in context: http://old.nabble.com/How-to-Turn-Off-Blocking-by-Method-show%28%29-tp34188043p34188043.html
Sent from the matplotlib - users mailing list archive at Nabble.com.
From: ObsessiveMathsFreak <obs...@gm...> - 2012年07月19日 23:10:21
I used sagemath which uses matplotlib as its plotting interface. After 
extensive investigation I was extremely disappointed to find that 
matplotlib has no fundamental support for drawing arrows at the ends of 
axes.
Is there no way that such basic functionality could be included in the 
next matplotlib release. Add-ons such as artistsaxis are not really 
appropriate as they require extensive refactoring of code using splines 
or axes.
A simple "endarrow=True" option on either splines or axes would be a 
very useful addition to the axis interface. Many people would be very 
grateful if you could consider adding this feature in the next release.
From: Francesco M. <fra...@gm...> - 2012年07月19日 20:45:32
2012年7月18日 Francesco Montesano <fra...@gm...>:
> 2012年7月18日 Jonathan Slavin <js...@cf...>:
>> Ben,
>>
>> Yes, you're right, but I doubt any solution that involves mimicking an
>> alpha channel will work for one case that I've been using. That is,
>> making the legend box partially transparent. I use that to allow the
>> box to fit in the plot without blocking the data and without the need to
>> make the upper y limit too large.
> My solution would probably work if you could, pixel by pixel (or patch
> by patch), mimic alpha in each layer using as background the resulting
> color of the previous layer.
>
> Do anyone know if it is possible to implement something like this in
> matplotlib when saving a eps or in a backend?
>
>>
>> I don't notice any problems with blockiness in the text or lines in the
>> raster image. I'll find out soon if the editors of the Astrophysical
>> Journal are okay with the figures.
> I guess that you produce the figures roughly of the right size (about
> 8 or 16 cms wide for single or double column figures) and then
> convert. So probably you see that the figure is a raster if you zoom
> in.
>
> Fra
>
>>
>> Jon
>>
>> On Tue, 2012年07月17日 at 15:34 -0500, Benjamin Root wrote:
>>>
>>>
>>> On Tue, Jul 17, 2012 at 3:01 PM, Jonathan Slavin
>>> <js...@cf...> wrote:
>>> Francesco,
>>>
>>> While I like your solution, there is an alternative that is
>>> simpler and
>>> works for me. That is 1) save matplotlib plot as a png, 2)
>>> convert to
>>> eps using either ImageMagick or GraphicsMagick. You do end up
>>> with
>>> relatively large files, but they look identical to the
>>> original plots.
>>>
>>> Regards,
>>> Jon
>>>
>>> No, it is not the same thing. Text in a vector-based format such as
>>> eps is scalable. ImageMagick and GraphicsMagick are inherently
>>> raster-based, and before that, PNGs are raster-based. Therefore, the
>>> text is not scaled and anti-aliased according to the display size.
>>>
>>> I will be looking over the proposed solution this evening.
>>>
>>> Cheers!
>>> Ben Root
>>>
>>>
Dear matplotlibers,
I've uploaded a new version which accepts also lists/tuple/numpy
arrays of colors and/or alphas and returns a list of RGB colors.
https://github.com/montefra/mimic_alpha
https://github.com/montefra/mimic_alpha/downloads
Cheers,
Francesco
From: Andre' Walker-L. <wal...@gm...> - 2012年07月19日 16:47:22
Hi Brad,
Have you have tried using the tabular environment?
I haven't tried using \vspace inside the figure, but I suspect that would also let you squeeze the figures closer together.
\begin{figure}
\begin{tabular}{cc} %for a two columns of figures
\includegraphics[width=0.48\textwidth]{figure_a}
&
\includegraphics[width=0.48\textwidth]{figure_b}
\\
$(a)$ & $(b)$
\\
\includegraphics[width=0.48\textwidth]{figure_c}
&
\includegraphics[width=0.48\textwidth]{figure_d}
\\
$(c)$ & $(d)$
\end{tabular}
\caption{\label{fig:your_label} your caption}
\end{figure}
Andre
On Jul 19, 2012, at 9:34 AM, Damon McDougall wrote:
> On Thu, Jul 19, 2012 at 07:56:29AM -0700, Brad Malone wrote:
>>> 
>>> 
>>> 
>>> Personally, I use the subfigure package and it works really well. Also,
>>> +1 for reusable figures. The downside of the subfigure package is your
>>> latex code looks that much worse, but if the journal doesn't mind you
>>> using the subfigure package, then I recommend it.
>>> 
>>> 
>> Thanks for the comments everyone. I am giving subfigure a try now, and it
>> seems relatively promising. The only problem is that apparently the
>> \caption package intereferes with RevTeX. This causes me to have to use
>> \usepackage[caption=false]{subcaption} which then apparently doesn't allow
>> me to label the individual plots (a), (b), (c), and (d). Instead,
>> attempting to do this creates new FIG labels at these locations (using
>> \caption* doesn't fix this either). But maybe I can figure a workaround to
>> this, and besides, this is a LaTeX question at this point anyway.
>> 
> 
> I know this is getting off topic, but is the journal you're submitting
> to insisting on the RevTex style file? Most of them have their own
> custom style. If so, I recommend using that over RevTex. That would
> potentially solve your package conflict.
> 
>> 
>> If this doesn't work I suppose there is always just manually creating a new
>> file with Inkscape and adding the a), b), c), and d) labels manually in
>> there.
>> 
>> Thanks for all the suggestions.
> 
> 
> -- 
> Damon McDougall
> http://damon-is-a-geek.com
> B2.39
> Mathematics Institute
> University of Warwick
> Coventry
> West Midlands
> CV4 7AL
> United Kingdom
> 
> ------------------------------------------------------------------------------
> Live Security Virtual Conference
> Exclusive live event will cover all the ways today's security and 
> threat landscape has changed and how IT managers can respond. Discussions 
> will include endpoint security, mobile security and the latest in malware 
> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
From: Damon M. <dam...@gm...> - 2012年07月19日 16:34:53
On Thu, Jul 19, 2012 at 07:56:29AM -0700, Brad Malone wrote:
> >
> >
> >
> > Personally, I use the subfigure package and it works really well. Also,
> > +1 for reusable figures. The downside of the subfigure package is your
> > latex code looks that much worse, but if the journal doesn't mind you
> > using the subfigure package, then I recommend it.
> >
> >
> Thanks for the comments everyone. I am giving subfigure a try now, and it
> seems relatively promising. The only problem is that apparently the
> \caption package intereferes with RevTeX. This causes me to have to use
> \usepackage[caption=false]{subcaption} which then apparently doesn't allow
> me to label the individual plots (a), (b), (c), and (d). Instead,
> attempting to do this creates new FIG labels at these locations (using
> \caption* doesn't fix this either). But maybe I can figure a workaround to
> this, and besides, this is a LaTeX question at this point anyway.
>
I know this is getting off topic, but is the journal you're submitting
to insisting on the RevTex style file? Most of them have their own
custom style. If so, I recommend using that over RevTex. That would
potentially solve your package conflict.
> 
> If this doesn't work I suppose there is always just manually creating a new
> file with Inkscape and adding the a), b), c), and d) labels manually in
> there.
> 
> Thanks for all the suggestions.
-- 
Damon McDougall
http://damon-is-a-geek.com
B2.39
Mathematics Institute
University of Warwick
Coventry
West Midlands
CV4 7AL
United Kingdom
From: Brad M. <bra...@gm...> - 2012年07月19日 14:56:41
>
>
>
> Personally, I use the subfigure package and it works really well. Also,
> +1 for reusable figures. The downside of the subfigure package is your
> latex code looks that much worse, but if the journal doesn't mind you
> using the subfigure package, then I recommend it.
>
>
Thanks for the comments everyone. I am giving subfigure a try now, and it
seems relatively promising. The only problem is that apparently the
\caption package intereferes with RevTeX. This causes me to have to use
\usepackage[caption=false]{subcaption} which then apparently doesn't allow
me to label the individual plots (a), (b), (c), and (d). Instead,
attempting to do this creates new FIG labels at these locations (using
\caption* doesn't fix this either). But maybe I can figure a workaround to
this, and besides, this is a LaTeX question at this point anyway.
If this doesn't work I suppose there is always just manually creating a new
file with Inkscape and adding the a), b), c), and d) labels manually in
there.
Thanks for all the suggestions.
From: Joshua K. <jjk...@gm...> - 2012年07月19日 13:47:51
Not a problem.
Hopefully it works for you. If you have tested it already would you mind posting what your results were? If you figured something else out as well that works for you I would also be appreciative if you posted your approach.
Regards,
Josh
On Jul 16, 2012, at 4:49 PM, Keith Jones wrote:
> Thanks Josh this is much appreciated. I will definitely have a look at this approach.
> 
> Just for clarification, my code does only create the figures when the frame is initialised. The plots are then updated/cleared as required.
> 
> Regards,
> Keith
> From: Joshua Koehler [mailto:jjk...@gm...] 
> Sent: Tuesday, 17 July 2012 12:12 a.m.
> To: mat...@li...
> Subject: Re: [Matplotlib-users] wxpython matplotlib figure resize
> 
> Yes, my apologies for being a bit vague. Hopefully the following can help you out, but I can't make promises. It did fix the issue for me.
> 
> First off, from reading other threads about handling figures, it might be better to use matplotlib.pylab.figure instead of matplotlib.figure. Apparently the former registers the figure with a manager which allows for better cleanup. 
> 
> Second, it looks to me from your code as if you are creating a figure every time a new plot is created. Is this correct? Or are these functions just called on startup? If you are creating a new figure each time for a plot, (which is what I was originally doing) you should redesign so you keep the same figure and then just update the subplots. Clear the figure and then add the appropriate subplots. Here is a segment from my code:
> 
> def plot(figure, rows, cols, graph, title):
> figure.clear()
> plt.figure(figure.number)
> pos_counter = 1
> for g in graph:
> g.axes = figure.add_subplot(rows, cols, pos_counter)
> if title:
> g.axes.set_title(g.plot_title)
> plot_nx(g, plot_options=g.plot_options)
> pos_counter = pos_counter + 1
> figure.canvas.draw()
> 
> plt is the pylab module from matplotlib and plot_nx is an internal call to networkx plotting capabiility (same as if you called the pyplot.plot). If you do use pylab, make sure to include the plt.figure(figure.number) call as this seems to be a bug (or perhaps this just is with networkx integration). 
> 
> This setup works for me rather well. I no longer have to manually resize anything. 
> 
> I hope that helps. If not, I am at a loss for what would be a good way to proceed. I, probably like you, spent a long time trying to figure this one out and found this to be the best solution. It might be good to go with the clunky mechanism since it works and wait until this is addressed later (if it is indeed a bug)
> 
> Regards,
> 
> Josh
> On Jul 14, 2012, at 4:13 AM, Keith Jones wrote:
> 
> 
> Hi Josh,
> I am not quite sure what information you need, but I have an application with several wx notebooks, each with pages carrying related but different 2D and 3D plots. I hope this overview covers what you want. In the code below I set up the axes and toolbar in each panel ready to accept plots as required. I use wxFormbuilder to create MyFrame1 and then this code to add graphs and other functionality. The 'tickle' function is called when a notebook is selected for display.
> 
> import wx
> from matplotlib.backends.backend_wxagg import FigureCanvasWxAgg as FigureCanvas
> from matplotlib.backends.backend_wxagg import NavigationToolbar2WxAgg
> from matplotlib.figure import Figure
> from mpl_toolkits.mplot3d import Axes3D
> 
> class ProjectFrame(bare_gui.MyFrame1):
> def __init__( self, parent):
> bare_gui.MyFrame1.__init__( self, parent)
> ...
> self.Create2DGraph(self.CT_graph_1, "Current / %")#CT notebook
> self.Create2DGraph(self.VT_graph_1, "Voltage/ %")#VT notebook
> ...
> self.Show(True)
> 
> def Create2DGraph(self, panel, xlabel):
> panel.figure = Figure(None)
> panel.canvas = FigureCanvas(panel, -1, panel.figure)
> panel.axes1 = panel.figure.add_subplot(2,1,1)
> panel.axes2 = panel.figure.add_subplot(2,1,2)
> panel.axes1.set_xlabel(xlabel)
> panel.axes1.set_ylabel('Error / %')
> panel.axes2.set_xlabel(xlabel)
> panel.axes2.set_ylabel('Phase / crad')
> panel.sizer = wx.BoxSizer(wx.VERTICAL)
> panel.sizer.Add(panel.canvas, 1, wx.LEFT | wx.TOP | wx.GROW)
> panel.SetSizer(panel.sizer)
> panel.Fit()
> self.add_2Dtoolbar(panel)
> 
> def add_2Dtoolbar(self, panel):
> panel.toolbar = NavigationToolbar2WxAgg(panel.canvas)
> panel.toolbar.Realize()
> tw, th = panel.toolbar.GetSizeTuple()
> fw, fh = panel.canvas.GetSizeTuple()
> panel.toolbar.SetSize(wx.Size(fw, th))
> panel.sizer.Add(panel.toolbar, 0, wx.LEFT | wx.EXPAND)
> # update the axes menu on the toolbar
> panel.toolbar.update()
> 
> def Create3DGraph(self, panel):
> panel.figure = Figure(None)
> panel.canvas = FigureCanvas(panel, -1, panel.figure)
> panel.ax = Axes3D(panel.figure)
> #these labels should be selected later for specific components
> panel.ax.set_xlabel('Current / %')
> panel.ax.set_ylabel('Phase / degree')
> panel.ax.set_zlabel('Error / %')
> panel.sizer = wx.BoxSizer(wx.VERTICAL)
> panel.sizer.Add(panel.canvas, 1, wx.LEFT | wx.TOP | wx.GROW)
> panel.SetSizer(panel.sizer)
> panel.Fit()
> self.add_2Dtoolbar(panel)
> From: Joshua Koehler [jjk...@gm...]
> Sent: Friday, 13 July 2012 10:45 p.m.
> To: mat...@li...
> Subject: Re: [Matplotlib-users] wxpython matplotlib figure resize
> 
> Hi Keith,
> 
> How are you storing the plot in the frame/panel?
> 
> Josh
> On Jul 12, 2012, at 11:59 PM, Keith Jones wrote:
> 
> 
> Hi Josh,
> Yes I too am using the wx backend.
> 
> Regards,
> Keith
> 
> From: Tony Yu [mailto:ts...@gm...] 
> Sent: Friday, 13 July 2012 3:16 p.m.
> To: Keith Jones
> Cc: Joshua Koehler; mat...@li...
> Subject: Re: [Matplotlib-users] wxpython matplotlib figure resize
> 
> 
> On Thu, Jul 12, 2012 at 9:27 PM, Keith Jones <K....@ir...> wrote:
> Hi,
> I am interested in a better solution to this problem, but I have used this simple method to force the right size.
> 
> def tickle(self):
> #gets frame to redraw and resize, not elegant.
> if self.IsMaximized(): #then needs a kick
> self.Restore()
> self.Maximize()
> else:
> x,y = self.GetSize()
> self.SetSize((x-1, y-1))
> self.SetSize((x, y))
> 
> Regards,
> Keith
> 
> From: Joshua Koehler [mailto:jjk...@gm...] 
> Sent: Saturday, 7 July 2012 1:51 a.m.
> To: mat...@li...
> Subject: [Matplotlib-users] wxpython matplotlib figure resize
> 
> Hi all,
> 
> I am currently trying to use matplotlib with wxPython and all is going well except for one annoying issue that I can't figure out. 
> 
> I initialize a wxcanvas object with a figure and then throughout the life of the program I want the canvas' figure to change and display the corresponding plot. I can get the change of figure, but when the program goes to plot, the figure isn't the right size. It changes to the right size only when I manually resize the figure (see attached images). Is there some command that I am missing? This is the update sequence I am using:
> 
> self.figure = figure
> 
> self.canvas.figure.clear()
> self.canvas.figure = self.figure
> self.canvas.draw()
> self.color_background()
> 
> #self.GetParent().Layout()
> #self.SetSizer(self.main_sizer)
> #self.Fit()
> self.SendSizeEvent()
> 
> As you can tell from the comments (there are more in my code), I have tried a variety of ways to update the figure off the bat.
> 
> Thanks!
> 
> Josh
> 
> 
> This may be similar to a Qt-backend bug, which didn't take the toolbar into account when resizing the figure:
> https://github.com/matplotlib/matplotlib/pull/756
> It doesn't quite fit, though, because Josh's original example shows a figure that's the correct size (but the axes doesn't fill the figure). The toolbar issue tended to squish the axes in the vertical direction (at least in the GUI window), whereas Josh's example is squished in the horizontal direction.
> 
> Keith: Are you also using the Wx-backend? I don't have Wx installed so I can't provide much help. I've been planning to take a look at a similar issue in the Tk backend, but haven't had time.
> 
> Best,
> -Tony
> 
> 
> 
> 
> This electronic transmission and any documents accompanying this electronic transmission contain confidential information belonging to the sender. This information may be legally privileged. The information is intended only for the use of the individual or entity named above. If you are not the intended recipient, you are hereby notified that any disclosure, copying, distribution or the taking of any action in reliance on or regarding the contents of this electronically transmitted information is strictly prohibited.
> 
> 
> 
From: Benjamin R. <ben...@ou...> - 2012年07月19日 13:40:49
On Thu, Jul 19, 2012 at 3:49 AM, Francesco Montesano <
fra...@gm...> wrote:
> 2012年7月19日 Nicolas Rougier <Nic...@in...>:
> >
> >
> > What size/format do you need and would that be an option to
> transform/use Tango icons ?
> >
> > http://tango.freedesktop.org/
> > http://commons.wikimedia.org/wiki/Tango_icons
> >
> >
> > Tango (for fullscreen but might suit tight-layout)
> > Nicolas
> >
> >
> > On Jul 19, 2012, at 0:47 , Benjamin Root wrote:
> >
> >> Hello all!
> >>
> >> I have just about completed a PR that would add a new button to the
> navigation toolbar for the tight_layout() action. I am hardly an artist
> and have no clue how to graphically represent the tight_layout action in a
> tiny icon. I would greatly welcome any graphics artist out there who could
> provide such an icon for matplotlib.
> >>
> >> Thanks!
> >> Ben Root
> >>
> ------------------------------------------------------------------------------
> >> Live Security Virtual Conference
> >> Exclusive live event will cover all the ways today's security and
> >> threat landscape has changed and how IT managers can respond.
> Discussions
> >> will include endpoint security, mobile security and the latest in
> malware
> >> threats.
> http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/_______________________________________________
> >> Matplotlib-users mailing list
> >> Mat...@li...
> >> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
> >
> >
> >
> ------------------------------------------------------------------------------
> > Live Security Virtual Conference
> > Exclusive live event will cover all the ways today's security and
> > threat landscape has changed and how IT managers can respond. Discussions
> > will include endpoint security, mobile security and the latest in malware
> > threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
> > _______________________________________________
> > Matplotlib-users mailing list
> > Mat...@li...
> > https://lists.sourceforge.net/lists/listinfo/matplotlib-users
> >
>
> What about modify the icon suggested by Nicolas with a small square
> inside the arrows?
> Francesco
>
I like that idea. For anybody interested, the current set of icon files
resides in matplotlib/lib/matplotlib/mpl-data/images. We just have to make
sure we follow the terms of their share-alike license.
Ben Root
From: Benjamin R. <ben...@ou...> - 2012年07月19日 13:13:33
On Thu, Jul 19, 2012 at 4:30 AM, Damon McDougall
<dam...@gm...>wrote:
> On Thu, Jul 19, 2012 at 10:23:09AM +0200, Alexander Eberspaecher wrote:
> > On 2012年7月18日 15:50:50 -0700
> > Brad Malone <bra...@gm...> wrote:
> >
> > > Hi, I have a collection of 4 plots that I spent some time in
> > > constructing. They themselves include modifications of the axes
> > > labels, have rotated subplots next to them, etc. I need to be able to
> > > take these 4 plots and consolidate them into a single plot (referee
> > > suggestion to save space).
> >
> > Assuming you are using LaTeX to write your paper, you could use a LaTeX
> > solution. Here are some links:
> >
> >
> http://en.wikibooks.org/wiki/LaTeX/Floats,_Figures_and_Captions#Subfloats
> > ftp://ctan.tug.org/tex-archive/macros/latex/contrib/subfig/subfig.pdf
> >
> > This might be easier - and would also make your figures more reusable
> > (for e.g. presentations).
> >
>
> Personally, I use the subfigure package and it works really well. Also,
> +1 for reusable figures. The downside of the subfigure package is your
> latex code looks that much worse, but if the journal doesn't mind you
> using the subfigure package, then I recommend it.
>
>
I <3 the subfigure package, and I don't think it looks "worse". What is
nice about subfigure is that I can attach labels for each subfigure, which
can be referenced from the text. No, the problem with subfigure isn't that
it clutters the latex, which I don't think it does, the problem is that
some journals -- ametsoc, I am looking at you! -- will still count each
subfigure as a separate image in the calculation for the cost of publishing.
Unfortunately, there is no (easy) way in matplotlib to re-combine axes
objects into a new figure, which is what I think you are trying to do.
Your best bet is to break down your code a bit into separate functions for
each of the two plots that take an "ax" argument as well as pertinent input
parameters. Then create your gridspec for the new configuration and loop
over the subplots with an index like "for i in range(0, N*2, 2)" calling
"ax = subplot(gs[i])" and "ax2 = subplot(gs[i+1])".
I hope that helps!
Ben Root
From: Francesco M. <fra...@gm...> - 2012年07月19日 11:43:17
done: https://github.com/matplotlib/matplotlib/issues/1024
Fra
2012年7月19日 Phil Elson <pel...@gm...>:
> I can confirm the bad link.
> Would you mind opening a new issue on github for this?
>
> github.com/matplotlib/matplotlib/issues/new
>
> Thanks,
>
> On 19 July 2012 10:15, Francesco Montesano <fra...@gm...> wrote:
>> Hi,
>>
>> roaming through the gallery I've found that in
>> http://matplotlib.sourceforge.net/examples/pylab_examples/demo_tight_layout_00.html
>> http://matplotlib.sourceforge.net/examples/pylab_examples/demo_tight_layout_01.html
>> http://matplotlib.sourceforge.net/examples/axes_grid/demo_axes_divider_01.html
>> and maybe others do not work
>>
>> error:
>> 1. Server: matplotlib.sourceforge.net
>> 2. URL path: /examples/pylab_examples/demo_tight_layout_00.html
>> 3. Error notes: NONE
>> 4. Error type: 404
>> 5. Request method: GET
>> 6. Request query string: NONE
>> 7. Time: 2012年07月19日 09:12:32 UTC (1342689152)
>>
>> http://matplotlib.sourceforge.net/examples/pylab_examples/demo_tight_layout.html
>> works fine
>>
>> Cheers,
>>
>> Francesco
>>
>> ------------------------------------------------------------------------------
>> Live Security Virtual Conference
>> Exclusive live event will cover all the ways today's security and
>> threat landscape has changed and how IT managers can respond. Discussions
>> will include endpoint security, mobile security and the latest in malware
>> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
>> _______________________________________________
>> Matplotlib-users mailing list
>> Mat...@li...
>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
From: Phil E. <pel...@gm...> - 2012年07月19日 10:35:49
I can confirm the bad link.
Would you mind opening a new issue on github for this?
github.com/matplotlib/matplotlib/issues/new
Thanks,
On 19 July 2012 10:15, Francesco Montesano <fra...@gm...> wrote:
> Hi,
>
> roaming through the gallery I've found that in
> http://matplotlib.sourceforge.net/examples/pylab_examples/demo_tight_layout_00.html
> http://matplotlib.sourceforge.net/examples/pylab_examples/demo_tight_layout_01.html
> http://matplotlib.sourceforge.net/examples/axes_grid/demo_axes_divider_01.html
> and maybe others do not work
>
> error:
> 1. Server: matplotlib.sourceforge.net
> 2. URL path: /examples/pylab_examples/demo_tight_layout_00.html
> 3. Error notes: NONE
> 4. Error type: 404
> 5. Request method: GET
> 6. Request query string: NONE
> 7. Time: 2012年07月19日 09:12:32 UTC (1342689152)
>
> http://matplotlib.sourceforge.net/examples/pylab_examples/demo_tight_layout.html
> works fine
>
> Cheers,
>
> Francesco
>
> ------------------------------------------------------------------------------
> Live Security Virtual Conference
> Exclusive live event will cover all the ways today's security and
> threat landscape has changed and how IT managers can respond. Discussions
> will include endpoint security, mobile security and the latest in malware
> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
From: Damon M. <dam...@gm...> - 2012年07月19日 09:30:58
On Thu, Jul 19, 2012 at 10:23:09AM +0200, Alexander Eberspaecher wrote:
> On 2012年7月18日 15:50:50 -0700
> Brad Malone <bra...@gm...> wrote:
> 
> > Hi, I have a collection of 4 plots that I spent some time in
> > constructing. They themselves include modifications of the axes
> > labels, have rotated subplots next to them, etc. I need to be able to
> > take these 4 plots and consolidate them into a single plot (referee
> > suggestion to save space). 
> 
> Assuming you are using LaTeX to write your paper, you could use a LaTeX
> solution. Here are some links:
> 
> http://en.wikibooks.org/wiki/LaTeX/Floats,_Figures_and_Captions#Subfloats
> ftp://ctan.tug.org/tex-archive/macros/latex/contrib/subfig/subfig.pdf
> 
> This might be easier - and would also make your figures more reusable
> (for e.g. presentations).
>
Personally, I use the subfigure package and it works really well. Also,
+1 for reusable figures. The downside of the subfigure package is your
latex code looks that much worse, but if the journal doesn't mind you
using the subfigure package, then I recommend it.
> 
> Hope that helps,
> 
> Alex
> 
> ------------------------------------------------------------------------------
> Live Security Virtual Conference
> Exclusive live event will cover all the ways today's security and 
> threat landscape has changed and how IT managers can respond. Discussions 
> will include endpoint security, mobile security and the latest in malware 
> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
-- 
Damon McDougall
http://damon-is-a-geek.com
B2.39
Mathematics Institute
University of Warwick
Coventry
West Midlands
CV4 7AL
United Kingdom
From: Francesco M. <fra...@gm...> - 2012年07月19日 09:16:39
2012年7月19日 Nicolas Rougier <Nic...@in...>:
>
>
> What size/format do you need and would that be an option to transform/use Tango icons ?
>
> http://tango.freedesktop.org/
> http://commons.wikimedia.org/wiki/Tango_icons
>
>
> Tango (for fullscreen but might suit tight-layout)
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> Nicolas
>
>
> On Jul 19, 2012, at 0:47 , Benjamin Root wrote:
>
>> Hello all!
>>
>> I have just about completed a PR that would add a new button to the navigation toolbar for the tight_layout() action. I am hardly an artist and have no clue how to graphically represent the tight_layout action in a tiny icon. I would greatly welcome any graphics artist out there who could provide such an icon for matplotlib.
>>
>> Thanks!
>> Ben Root
>> ------------------------------------------------------------------------------
>> Live Security Virtual Conference
>> Exclusive live event will cover all the ways today's security and
>> threat landscape has changed and how IT managers can respond. Discussions
>> will include endpoint security, mobile security and the latest in malware
>> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/_______________________________________________
>> Matplotlib-users mailing list
>> Mat...@li...
>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>
> ------------------------------------------------------------------------------
> Live Security Virtual Conference
> Exclusive live event will cover all the ways today's security and
> threat landscape has changed and how IT managers can respond. Discussions
> will include endpoint security, mobile security and the latest in malware
> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
Hi
What about modify the icon suggested by Nicolas with a small square
inside the arrows?
Francesco
From: Francesco M. <fra...@gm...> - 2012年07月19日 09:15:46
Hi,
roaming through the gallery I've found that in
http://matplotlib.sourceforge.net/examples/pylab_examples/demo_tight_layout_00.html
http://matplotlib.sourceforge.net/examples/pylab_examples/demo_tight_layout_01.html
http://matplotlib.sourceforge.net/examples/axes_grid/demo_axes_divider_01.html
and maybe others do not work
error:
1. Server: matplotlib.sourceforge.net
2. URL path: /examples/pylab_examples/demo_tight_layout_00.html
3. Error notes: NONE
4. Error type: 404
5. Request method: GET
6. Request query string: NONE
7. Time: 2012年07月19日 09:12:32 UTC (1342689152)
http://matplotlib.sourceforge.net/examples/pylab_examples/demo_tight_layout.html
works fine
Cheers,
Francesco
From: Francesco M. <fra...@gm...> - 2012年07月19日 09:11:35
Hi Brad,
2012年7月19日 Alexander Eberspaecher <ale...@ov...>:
> On 2012年7月18日 15:50:50 -0700
> Brad Malone <bra...@gm...> wrote:
>
>> Hi, I have a collection of 4 plots that I spent some time in
>> constructing. They themselves include modifications of the axes
>> labels, have rotated subplots next to them, etc. I need to be able to
>> take these 4 plots and consolidate them into a single plot (referee
>> suggestion to save space).
>
> Assuming you are using LaTeX to write your paper, you could use a LaTeX
> solution. Here are some links:
>
> http://en.wikibooks.org/wiki/LaTeX/Floats,_Figures_and_Captions#Subfloats
> ftp://ctan.tug.org/tex-archive/macros/latex/contrib/subfig/subfig.pdf
>
> This might be easier - and would also make your figures more reusable
> (for e.g. presentations).
The solution from Alex might work, but not being optimal in saving
space, in particular if you can share axis.
The labels (a),(b),... can be inserted in the figures with
a.text(x,y,'(a)', ... ). I know that some journals want them in the
figure and not made with latex, so you probably have to rerun your
script with the text added.
If you want to make a unique figure you can try to declare the axis
directly, insead of using subplot, and play with the rect keyword:
http://matplotlib.sourceforge.net/api/pyplot_api.html#matplotlib.pyplot.axes
.
You can also play with gridspec
(http://matplotlib.sourceforge.net/users/gridspec.html), but I've
never used myself
Cheers,
Francesco
From: Alexander E. <ale...@ov...> - 2012年07月19日 08:40:06
On 2012年7月18日 15:50:50 -0700
Brad Malone <bra...@gm...> wrote:
> Hi, I have a collection of 4 plots that I spent some time in
> constructing. They themselves include modifications of the axes
> labels, have rotated subplots next to them, etc. I need to be able to
> take these 4 plots and consolidate them into a single plot (referee
> suggestion to save space). 
Assuming you are using LaTeX to write your paper, you could use a LaTeX
solution. Here are some links:
http://en.wikibooks.org/wiki/LaTeX/Floats,_Figures_and_Captions#Subfloats
ftp://ctan.tug.org/tex-archive/macros/latex/contrib/subfig/subfig.pdf
This might be easier - and would also make your figures more reusable
(for e.g. presentations).
Hope that helps,
Alex
10 messages has been excluded from this view by a project administrator.

Showing results of 285

<< < 1 .. 3 4 5 6 7 .. 12 > >> (Page 5 of 12)
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 によって変換されたページ (->オリジナル) /