SourceForge logo
SourceForge logo
Menu

matplotlib-users — Discussion related to using matplotlib

You can subscribe to this list here.

2003 Jan
Feb
Mar
Apr
May
(3)
Jun
Jul
Aug
(12)
Sep
(12)
Oct
(56)
Nov
(65)
Dec
(37)
2004 Jan
(59)
Feb
(78)
Mar
(153)
Apr
(205)
May
(184)
Jun
(123)
Jul
(171)
Aug
(156)
Sep
(190)
Oct
(120)
Nov
(154)
Dec
(223)
2005 Jan
(184)
Feb
(267)
Mar
(214)
Apr
(286)
May
(320)
Jun
(299)
Jul
(348)
Aug
(283)
Sep
(355)
Oct
(293)
Nov
(232)
Dec
(203)
2006 Jan
(352)
Feb
(358)
Mar
(403)
Apr
(313)
May
(165)
Jun
(281)
Jul
(316)
Aug
(228)
Sep
(279)
Oct
(243)
Nov
(315)
Dec
(345)
2007 Jan
(260)
Feb
(323)
Mar
(340)
Apr
(319)
May
(290)
Jun
(296)
Jul
(221)
Aug
(292)
Sep
(242)
Oct
(248)
Nov
(242)
Dec
(332)
2008 Jan
(312)
Feb
(359)
Mar
(454)
Apr
(287)
May
(340)
Jun
(450)
Jul
(403)
Aug
(324)
Sep
(349)
Oct
(385)
Nov
(363)
Dec
(437)
2009 Jan
(500)
Feb
(301)
Mar
(409)
Apr
(486)
May
(545)
Jun
(391)
Jul
(518)
Aug
(497)
Sep
(492)
Oct
(429)
Nov
(357)
Dec
(310)
2010 Jan
(371)
Feb
(657)
Mar
(519)
Apr
(432)
May
(312)
Jun
(416)
Jul
(477)
Aug
(386)
Sep
(419)
Oct
(435)
Nov
(320)
Dec
(202)
2011 Jan
(321)
Feb
(413)
Mar
(299)
Apr
(215)
May
(284)
Jun
(203)
Jul
(207)
Aug
(314)
Sep
(321)
Oct
(259)
Nov
(347)
Dec
(209)
2012 Jan
(322)
Feb
(414)
Mar
(377)
Apr
(179)
May
(173)
Jun
(234)
Jul
(295)
Aug
(239)
Sep
(276)
Oct
(355)
Nov
(144)
Dec
(108)
2013 Jan
(170)
Feb
(89)
Mar
(204)
Apr
(133)
May
(142)
Jun
(89)
Jul
(160)
Aug
(180)
Sep
(69)
Oct
(136)
Nov
(83)
Dec
(32)
2014 Jan
(71)
Feb
(90)
Mar
(161)
Apr
(117)
May
(78)
Jun
(94)
Jul
(60)
Aug
(83)
Sep
(102)
Oct
(132)
Nov
(154)
Dec
(96)
2015 Jan
(45)
Feb
(138)
Mar
(176)
Apr
(132)
May
(119)
Jun
(124)
Jul
(77)
Aug
(31)
Sep
(34)
Oct
(22)
Nov
(23)
Dec
(9)
2016 Jan
(26)
Feb
(17)
Mar
(10)
Apr
(8)
May
(4)
Jun
(8)
Jul
(6)
Aug
(5)
Sep
(9)
Oct
(4)
Nov
Dec
2017 Jan
(5)
Feb
(7)
Mar
(1)
Apr
(5)
May
Jun
(3)
Jul
(6)
Aug
(1)
Sep
Oct
(2)
Nov
(1)
Dec
2018 Jan
Feb
Mar
Apr
(1)
May
Jun
Jul
Aug
Sep
Oct
Nov
Dec
2020 Jan
Feb
Mar
Apr
May
(1)
Jun
Jul
Aug
Sep
Oct
Nov
Dec
2025 Jan
(1)
Feb
Mar
Apr
May
Jun
Jul
Aug
Sep
Oct
Nov
Dec
S M T W T F S


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



Showing 6 results of 6

From: Benjamin R. <ben...@ou...> - 2011年11月04日 23:39:24
On Friday, November 4, 2011, Tony Yu <ts...@gm...> wrote:
>
>
> On Fri, Nov 4, 2011 at 4:49 PM, Rahul Mahajan <aer...@gm...> wrote:
>>
>> Hi,
>> I am trying to put 1 colorbar on 2 subplots, but failing miserably.
>>
>> I have tried multiple approaches, involving subplot2grid, add_axes,
AxesGrid etc.
>>
>> If anyone has a "canned" routine or knows what to do, your help is
greatly appreciated.
>>
>> Here is my code block:
>>
>> fig = pyplot.figure()
>>
>> ax1 = pyplot.subplot2grid((2,2),(0,0))
>> cx1 =
pyplot.contourf(x,y,var1,var_cint,origin='lower',extend='both')
>>
>> ax2 = pyplot.subplot2grid((2,2),(0,1))
>> cx2 =
pyplot.contourf(x,y,var2,var_cint,origin='lower',extend='both')
>>
>> Now I want to put 1 colorbar to these subplots.
>
> This example seems to be a very simple example of what you want:
>
http://matplotlib.sourceforge.net/examples/pylab_examples/subplots_adjust.html
>
> Basically, you need to create an axes specifically for the colorbar (e.g.
`colorbar_ax`) and call pyplot.colorbar(cax=colorbar_ax); or you can let
mpl automatically take space from one of your existing axes: for example,
pyplot.colorbar(ax=ax2).
>
> You can also pass a mappable to pyplot.colorbar (in your example, cx1 or
cx2), but by default, it will grab the most recently created one. Note,
using the single colorbar for both subplots *only* makes sense if var_cint
(in your code) is defining the *values* of the contour levels (as opposed
to the *number* of contour levels). Otherwise, the colorbar will only be
accurate for one of the two plots.
>
> HTH,
> -Tony
>
Even easier is to use the axes_grid1 module and create an AxesGrid object.
In the constructor, you can specify the colorbar mode as 'single'. Then,
the AxesGrid object has the axes for plots, and a separate list for any
axes for use for colobars.
Does that help?
Ben Root
From: Stan W. <sta...@nr...> - 2011年11月04日 22:04:14
From: questions anon [mailto:que...@gm...] 
Sent: Wednesday, November 02, 2011 17:17
 
Thanks, I think you are right about the datetimes for the x axis causing the
problem.
Does anyone have any ideas how to resolve this?
Does it help to call ax.xaxis_date() before your calls to plt.plot()?
From: Tony Yu <ts...@gm...> - 2011年11月04日 21:29:20
On Fri, Nov 4, 2011 at 4:49 PM, Rahul Mahajan <aer...@gm...> wrote:
> Hi,
> I am trying to put 1 colorbar on 2 subplots, but failing miserably.
>
> I have tried multiple approaches, involving subplot2grid, add_axes,
> AxesGrid etc.
>
> If anyone has a "canned" routine or knows what to do, your help is greatly
> appreciated.
>
> Here is my code block:
>
> fig = pyplot.figure()
>
> ax1 = pyplot.subplot2grid((2,2),(0,0))
> cx1 = pyplot.contourf(x,y,var1,var_cint,origin='lower',extend='both')
>
> ax2 = pyplot.subplot2grid((2,2),(0,1))
> cx2 = pyplot.contourf(x,y,var2,var_cint,origin='lower',extend='both')
>
> Now I want to put 1 colorbar to these subplots.
>
This example seems to be a very simple example of what you want:
http://matplotlib.sourceforge.net/examples/pylab_examples/subplots_adjust.html
Basically, you need to create an axes specifically for the colorbar (e.g.
`colorbar_ax`) and call pyplot.colorbar(cax=colorbar_ax); or you can let
mpl automatically take space from one of your existing axes: for example,
pyplot.colorbar(ax=ax2).
You can also pass a mappable to pyplot.colorbar (in your example, cx1 or
cx2), but by default, it will grab the most recently created one. Note,
using the single colorbar for both subplots *only* makes sense if var_cint
(in your code) is defining the *values* of the contour levels (as opposed
to the *number* of contour levels). Otherwise, the colorbar will only be
accurate for one of the two plots.
HTH,
-Tony
From: Rahul M. <aer...@gm...> - 2011年11月04日 20:49:33
Hi,
I am trying to put 1 colorbar on 2 subplots, but failing miserably.
I have tried multiple approaches, involving subplot2grid, add_axes,
AxesGrid etc.
If anyone has a "canned" routine or knows what to do, your help is greatly
appreciated.
Here is my code block:
 fig = pyplot.figure()
 ax1 = pyplot.subplot2grid((2,2),(0,0))
 cx1 = pyplot.contourf(x,y,var1,var_cint,origin='lower',extend='both')
 ax2 = pyplot.subplot2grid((2,2),(0,1))
 cx2 = pyplot.contourf(x,y,var2,var_cint,origin='lower',extend='both')
Now I want to put 1 colorbar to these subplots.
Thanks!
From: Elmar W. <el...@ne...> - 2011年11月04日 11:12:01
On 03.11.2011 22:28, Joe Kington wrote:
> The link on Nabble is broken, so here's (I think) a fixed version. It
> looks like the name of the branch was changed slightly at some point.
>
> https://github.com/kdavies4/matplotlib/compare/master...ternary2
>
> Cheers,
> -Joe
>
>
>
> On Thu, Nov 3, 2011 at 3:14 PM, Benjamin Root
> <ben...@ou...
> <mailto:ben...@ou...>> wrote:
>
>
>
> On Thu, Nov 3, 2011 at 2:58 PM, elmar werling
> <el...@ne...
> <mailto:el...@ne...>> wrote:
>
> Hi,
>
> could not found anything like plot_ternary() in the matplotlib
> documentation. Is there an easy to use method to plot data
> points and
> lines in a ternary plot using matplotlib?
>
> Any hint is wellcome
>
> Elmar
>
>
> This is a requested feature, but has not been implemented yet within
> matplotlib. However, some other users have created a hack to do this:
>
> http://old.nabble.com/Ternary-or-triangle-plots-td32506324.html
>
> Ben Root
>
>
> ------------------------------------------------------------------------------
> RSA(R) Conference 2012
> Save 700ドル by Nov 18
> Register now
> http://p.sf.net/sfu/rsa-sfdev2dev1
>
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> <mailto:Mat...@li...>
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>
>
>
> ------------------------------------------------------------------------------
> RSA(R) Conference 2012
> Save 700ドル by Nov 18
> Register now
> http://p.sf.net/sfu/rsa-sfdev2dev1
>
>
>
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
thanks - hope it will help
elmar
From: Stuart M. <st...@mu...> - 2011年11月04日 09:34:37
Hello,
Thanks for your help.
Do you need the colorbar scale to change with each frame? If not, you can
> create a wholly independent colorbar like so:
>
Yes, I do need the colour bar to update with each frame unfortunately!
What I would do is "prime the pump" by creating the first frame. Then
> create a func animator that calls a function that loads the cached results
> based on an index number and directly update the imshow()'s object using
> the set_data() method.
I see what you mean here, the problem is that while I could do it I think
it would take more memory because each frame is a composite if a few data
sets, and also I quite like the separation of the data and the animation.
Just a thought, would it be possible to combine the two, to create a list
of artists that stores the AxesImage and Line2D object I have for each
subplot and then create a FuncAnimate to add a colorbar and animate them?
Or (continuing thinking this up) to create a list of axes objects
(subplots) then add colorbars to them and just add them to a figure??
> That way, the original colorbar sees the changes from the ScalarMappable
> object that was originally assigned to it. It also results in faster
> rendering, in my experience since imshow() has many extra steps to take to
> prepare the data for display.
>
Not really sure what you mean by faster rendering in this context, surely
the rendering done when you draw the Artist in ArtistAnimate is the same
speed as drawing out of a FuncAnimate?
>
> Note, this won't work if the domain changes over time.
>
What the size of the domain or the Vlim's??
Thanks again
Stuart

Showing 6 results of 6

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