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 3 results of 3

From: Rob B. <rdb...@mu...> - 2011年09月02日 16:48:48
Attachments: scoreVSpaleoHsite.png
Hello, 
I'm not sure of the correct way to ask this question.....I'm trying to
create a plot that has a number of layers. I plot a standard plot, then
a scatterplot over that. See attachment. I expected the scatter plot to
'render/draw' after the standard plot command, but the scatter plot data
is buried under the standard command.
I tried changing the order, i.e. scatterplot first but that had no
effect. How do I ensure the scatterplot data is plotted above/over the
other data?
The following code extract is after all the data has been read and
sorted. 
# start plotting
plt.close()
# first EAIS data
stitle = 'plot showing cumulative paleoHmodel and paleoHscore for EAIS'
# set up index range for plotting
il=0 # index for lower bound to plot 
iu=idx_splt # index for upper bound to plot
fig = plt.figure(5,figsize=(18,12))
ax1 = fig.add_subplot(111)
plt.title(stitle, fontsize=16)
plt.xlabel("paleoH data point")
plt.ylabel("thickness [m]")
ii=np.empty(num_rows)
# plot the model results
for i in range(il,iu):
 ii[:] = i+1
 plt.plot(ii,a[:,i],'o',color='0.9')
# set axis limits
ymin=-1800
ymin=-500
ax1.set_xlim(il,iu+1)
top = 3000
bottom=-500
ax1.set_ylim(bottom, top)
# plot the labels
for i in range(il,iu): 
 plt.text(i+1,ymin,datn[i], horizontalalignment='center',
fontsize=10,rotation='vertical', verticalalignment='bottom')
#cmap = cm.get_cmap('PRGn', 10)
#cmap = cm.get_cmap('autumn_r', 100)
#cmap = cm.get_cmap('gray', 100)
#plt.scatter(obs[il:iu,0],obs[il:iu,1],c=time[il:iu],marker='s',s=50,cmap=cmap)
plt.scatter(obs[il:iu,0], obs[il:iu,1], c=time[il:iu],marker='s',s=100)
plt.colorbar()
# plot the observation dp with error bars 
#plt.errorbar(obs[il:iu,0], obs[il:iu,1], yerr=obs[il:iu,2], fmt='r.')
plt.grid(which='both')
fname="scoreVSpaleoHsite.png"
plt.savefig(fname)
plt.show()
Regards
Rob 
This electronic communication is governed by the terms and conditions at
http://www.mun.ca/cc/policies/electronic_communications_disclaimer_2011.php
From: Benjamin R. <ben...@ou...> - 2011年09月02日 14:42:22
On Wed, Aug 31, 2011 at 5:34 AM, galorencom <gal...@gm...> wrote:
>
> Hello
> I have an animation which shows 3D diffusion
> I added color bar at the side
> during the animation the colors changing but the scale at the colorbar of
> the graph stay asame.
> please help with that soon as you can!
> Thanks!
> Gal:working:
>
This entirely depends on how you create your colorbar and how you update
your graphs. Generally, colorbars that are created use (implicitly or
explicitly) a ScalarMappable such as a ContourSet (from contour()) or
AxesImage (from imshow()). If you then create new objects instead of
modifying the existing objects, then the colorbar will still be referencing
the original scalarmappable.
If you are still confuse, post a stand-alone example of what you have and we
can help you out.
Ben Root
From: R. O'G. <ron...@ya...> - 2011年09月02日 14:28:10
Attachments: clabels.png
Jae-Joon, thanks for your reply.
There is a combination of effects that make my contour labels placed in unfortunate positions. Here is a self-contained example (somewhat different from issue I originally explained, but illustrates the fact clabels are not where I'd like them to be)
import numpy as np
import matplotlib as mpl
ff = 10
params = {
  'text.usetex': True,
  'axes.labelsize': ff,
  'axes.fontsize': ff,
  'legend.fontsize' : ff,
  'xtick.labelsize' : ff,
  'ytick.labelsize' : ff,
  'figure.dpi': 150,
  'figure.figsize' : [5,2],
}
mpl.rcParams.update(params)
import matplotlib.pyplot as plt
import matplotlib.gridspec as gridspec
gs = gridspec.GridSpec(1,2)
ax = plt.subplot(gs[0])
xi = np.linspace(0,0.4,100)
yi = np.linspace(0,0.4,100)
xx,yy = np.meshgrid(xi,yi)
zi = np.sin(5*xx*yy)
v = np.arange(0.0, 0.5, 0.1)
cplot = ax.contour(xi, yi, zi, v, linewidths=0.5, colors='k')
ax.clabel(cplot, v,
  fontsize = 8,
  inline=True,
  fmt = "%0.2f",
)
ax.axis([np.min(xi),np.max(xi),np.min(yi),np.max(yi)])
plt.show()
The end result is that contour labels are placed almost outside of the grid, with most of the area in the center being blank. I am pretty sure it has to do with the way rcParams are set, but I have no idea why. Params I do need to set are text.usetex, figure.dpi, and figure.figsize. I am using matplotlib 1.0.1.
Thanks for your help,
----- Original Message -----
From: Jae-Joon Lee <lee...@gm...>
To: R. O'Gara <ron...@ya...>
Cc: "mat...@li..." <mat...@li...>
Sent: Monday, August 22, 2011 11:56 PM
Subject: Re: [Matplotlib-users] contour's clabels overlap each other in an ImageGrid
Can you post an simple self-contained script that reproduces your problem?
I just tried something similar but could not reproduces your problem.
Here is what I did,
Also, what version of matplotlb are you using?
Regards,
-JJ
import matplotlib.pyplot as plt
import numpy as np
from mpl_toolkits.axes_grid1 import ImageGrid
fig = plt.figure(1)
arr = np.arange(100).reshape((10, 10))
grid = ImageGrid(fig, 111, (2, 2))
cntr0 = grid[0].contour(arr)
cntr1 = grid[1].contour(arr)
cntr2 = grid[2].contour(arr)
cntr3 = grid[3].contour(arr)
plt.clabel(cntr0, manual=True)
plt.clabel(cntr1, manual=True)
plt.clabel(cntr2, manual=True)
plt.clabel(cntr3, manual=True)
On Thu, Aug 18, 2011 at 1:10 PM, R. O'Gara <ron...@ya...> wrote:
> Hey guys,
>
>
> I was hoping someone could provide a hint for how I should go about correcting this. As you can see, locations for the inline labels for
> contours in this image are unfortunately chosen, and they overlap with one another. If I set manual to 'True' then I get this weird behavior
> where I can only choose labels in the top left grid and nothing is shownin any of the other grids.
>
> I am using a 2x2 Image Grid (I get the same problem when using gridspec instead of image grid), and loadingcontour data (2x2 array) from a file.
>
> Thanks for your help,
> Ron
> ------------------------------------------------------------------------------
> Get a FREE DOWNLOAD! and learn more about uberSVN rich system,
> user administration capabilities and model configuration. Take
> the hassle out of deploying and managing Subversion and the
> tools developers use with it. http://p.sf.net/sfu/wandisco-d2d-2
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>

Showing 3 results of 3

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