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
(2) |
|
2
(4) |
3
(9) |
4
(12) |
5
(12) |
6
(7) |
7
(8) |
8
(4) |
|
9
(2) |
10
(9) |
11
(6) |
12
(1) |
13
(20) |
14
(13) |
15
(9) |
|
16
(3) |
17
(12) |
18
(16) |
19
(14) |
20
(12) |
21
(15) |
22
(11) |
|
23
(5) |
24
(7) |
25
(7) |
26
(8) |
27
(11) |
28
(10) |
29
(1) |
|
30
(3) |
31
(6) |
|
|
|
|
|
|
From: Стоян В. <sto...@ma...> - 2011-10-08 17:22:55
|
Memory leak - canvas.draw() + pyqt4 Hi, my name is Stoyan. I use the following packages: python 2.6 , PyQt 4.8.5-1, numpy 1.6 and matplotlib 1.0.1. In my program Matplotlib library I have used a GUI application created by "PyQt". In the program there is a loop that updates a graph by calling: self.fig.canvas.draw() But every time the graph is updated, the memory usage goes up.I the address listed bellow there is an explanation of the reason for the issue however, even though https://github.com/matplotlib/matplotlib/pull/89 I have followed all instructions that have been specified in link,there is still a flaw in the programme due to a memory leak, though not a big one. I wondere whether there is alternative way to discharge this leak of memory and if so could you assist in solving it. |
|
From: Jouni K. S. <jk...@ik...> - 2011-10-08 15:41:05
|
s kemp <6b6...@gm...> writes:
> The output i get from this code is two identical pages of PDF where
> the x limits are set to 3,5. I understand this is because I am simply
> making two identical references to the figure object in the list and
> by modifying fig1 i also affect the fig1 that is 'stored' in the first
> position of the array. My question is how do I avoid this?
My recommendation is to construct multiple figure objects. Factor the
shared code into a function so it is easier to modify just what you want
to be different between the figures:
------------------------------------------------------------------------
import matplotlib.figure as fig
from matplotlib.backends.backend_pdf import PdfPages, FigureCanvasPdf
def plot_data(xdata, ydata):
"""Returns pair of figure and axis"""
f = fig.Figure(figsize=(2,2))
ax = f.add_subplot(111)
ax.plot(xdata, ydata)
return f, ax
xdata = [1,2,3,4,5]
ydata = [5,4,3,2,1]
fig1, ax1 = plot_data(xdata, ydata)
fig2, ax2 = plot_data(xdata, ydata)
figures = []
ax1.set_xlim([0,3])
figures.append(fig1)
ax2.set_xlim([3,5])
figures.append(fig2)
pdf = PdfPages('output.pdf')
for figure in figures:
canvas = FigureCanvasPdf(figure)
figure.savefig(pdf, format="pdf")
pdf.close()
------------------------------------------------------------------------
--
Jouni K. Seppänen
http://www.iki.fi/jks
|
|
From: Isidora <is...@ju...> - 2011-10-07 23:10:16
|
Hi,
I am trying to create a chart using a given file as background, drawing some curves on the map, and saving an 800x600 PNG.
Code Snipet:
map = Basemap( ................)
pilImg=Image.open('mybkgmap.gif')
rgba = pil_to_array(pilImg)
map.imshow(rgba,interpolation='nearest') # showing background map
..... # Plot some paths on top of background maps
# Add some text explaining map symbols
....
(plt.gcf()).set_size_inches(8,6)
(plt.gcf()).set_dpi(100)
plt.savefig('my.png',format='PNG',bbox_inches='tight',pad_inches=0) # Obtain an 620x480 image without a border
plt.savefig('my.png',format='PNG') # Obtain an 800x600 image with a white border I don't want
Any idea on how can I get the 800x600 without the white border? Any hint will be appreciated.
Thank you
|
|
From: Daniel H. <dh...@gm...> - 2011-10-07 22:57:27
|
I'm wanting to highlight the artist under the cursor with a transparent Rectangle patch. To do this, I have very, roughly, in a mouse motion handler, under = self.figure.hitlist(ev) if under: artist = under[0] bbox = artist.get_window_extent() highlight = matplotlib.patches.Rectangle(xy=bbox.min,width=bbox.width,height=bbox.height,alpha=0.2,color='yellow') # further code to blit the last captured graph region with highlight drawn on top The main problem is that all artists don't implement get_window_extent(); a Text object does, and a legend object does, but the Axis objects do not. So is there a general way to get the bounding box of an artist? I looked through the API and didn't see anything there. I thought this would be easy to get to, since almost (every?) artist implements contains(). But it looks like in the case of XAxis, anyway, that the "hitbox" is being calculated on the fly in XAxis.contains(). -- Daniel Hyams dh...@gm... |
|
From: Paul H. <pmh...@gm...> - 2011-10-07 20:40:22
|
Hey folks,
I'm working on a patch to axes.boxplot that will allow the user to
manually specify the median and confidence intervals (notches) on a
boxplot. My need for this arises since I compute the notch locations
using the BCa-method, which depends on Scipy.
My question relates to how to best have users input their predefined
median and its confidence interval. In my use case, I'm always calling
boxplot one data set at a time and so it has made sense for me pass
the values as a dictionary to my locally-modified boxplot function.
This is probably a quite unique use case.
In the more general use case where an arbitrary number of boxplots
will be generated on a single axes object, what would be the best
method of input? My initial though is to specify a list-of-tuples in
the form: [(lower1, median1, upper1), (lower2, median2, upper2), ...,
(lowerN, medianN, upperN)]. The modified function signature would be:
def boxplot(self, x, notch=0, sym='b+', vert=1, whis=1.5,
positions=None, widths=None, patch_artist=False,
bootstrap=None, manualVals=None):
The other best option that comes to mind would be to pass each value
as an individual numpy array with dimensions that are compatible with
the data (x), i.e.,
def boxplot(self, x, notch=0, sym='b+', vert=1, whis=1.5,
positions=None, widths=None, patch_artist=False,
bootstrap=None, lowerCIs=None, medians=None, upperCIs=None):
This seems a bit cumbersome both to use and implement, though quite
flexible as the user would not be forced to supply all three arrays.
Any advice, requests, or general input would be much appreciated.
Cheers,
-Paul H.
|
|
From: Gökhan S. <gok...@gm...> - 2011-10-07 19:42:33
|
Hello, I have two questions regarding to the positioning of a mpl window (using WXAgg backend) 1-) How to create a maximized window, instead of me clicking on window to maximize it each time? 2-) I have two screens. Interestingly, my mpl windows tend to open on my small screen. How can I force mpl/ipython/WX/X-windows to open mpl windows on my 2nd and bigger monitor? Thanks. -- Gökhan |
|
From: Pau <vim...@go...> - 2011-10-07 18:51:12
|
I am trying to make a 2D density plot (from some simulation data) with
matplotlib. My x and y data are defined as the log10 of some
quantities. How can I get logarithmic axes (with log minor ticks)?
Here is an exemple of my code:
import numpy as np
import matplotlib.pyplot as plt
Data = np.genfromtxt("data") # A 2-column data file
x = np.log10(Data[:,0])
y = np.log10(Data[:,1])
xmin = x.min()
xmax = x.max()
ymin = y.min()
ymax = y.max()
fig = plt.figure()
ax = fig.add_subplot(111)
hist = ax.hexbin(x,y,bins='log', gridsize=(30,30), cmap=cm.Reds)
ax.axis([xmin, xmax, ymin, ymax])
plt.savefig('plot.pdf')
|
|
From: Sudheer J. <sjo...@gm...> - 2011-10-07 11:42:21
|
Dear Users,
I am trying to add module matplotlib-1.0.1 to
my Python 2.7.2 on an IBM power6 with Aix 5.3 . I get the below error when I
issue the command
python setip.py build did any one faced same issue or can I get any expert
suggestion for fixing this issue.
with best regards,
Sudheer
xlc++ xlc -bI:/gpfs1/sjo/pkgs/local/lib/python2.7/config/python.exp
build/temp.aix-5.3-2.7/src/ft2font.o build/temp.aix-5.3-2.7/src/mplutils.o
build/temp.aix-5.3-2.7/CXX/cxx_extensions.o
build/temp.aix-5.3-2.7/CXX/cxxsupport.o
build/temp.aix-5.3-2.7/CXX/IndirectPythonInterface.o
build/temp.aix-5.3-2.7/CXX/cxxextensions.o -L/opt/freeware/lib
-L/usr/local/lib -lfreetype -lz -lstdc++ -lm -o
build/lib.aix-5.3-2.7/matplotlib/ft2font.so
sjo@f2n1login1>xlc++
-bI:/gpfs1/sjo/pkgs/local/lib/python2.7/config/python.exp
build/temp.aix-5.3-2.7/src/ft2font.o build/temp.aix-5.3-2.7/src/mplutils.o
build/temp.aix-5.3-2.7/CXX/cxx_extensions.o
build/temp.aix-5.3-2.7/CXX/cxxsupport.o
build/temp.aix-5.3-2.7/CXX/IndirectPythonInterface.o
build/temp.aix-5.3-2.7/CXX/cxxextensions.o -L/opt/freeware/lib
-L/usr/local/lib -lfreetype -lz -lstdc++ -lm -o
build/lib.aix-5.3-2.7/matplotlib/ft2font.so
ld: 0711-317 ERROR: Undefined symbol: .main
ld: 0711-345 Use the -bloadmap or -bnoquiet option to obtain more
information.
i compiled with -bnoquiet option and get below details
(ld): setopt 64
(ld): halt 4
(ld): setfflag 4
(ld): savename build/lib.aix-5.3-2.7/matplotlib/ft2font.so
(ld): filelist 15 2
(ld): i /lib/crt0_64.o
(ld): i build/temp.aix-5.3-2.7/src/ft2font.o
(ld): i build/temp.aix-5.3-2.7/src/mplutils.o
(ld): i build/temp.aix-5.3-2.7/CXX/cxx_extensions.o
(ld): i build/temp.aix-5.3-2.7/CXX/cxxsupport.o
(ld): i build/temp.aix-5.3-2.7/CXX/IndirectPythonInterface.o
(ld): i build/temp.aix-5.3-2.7/CXX/cxxextensions.o
(ld): lib /opt/freeware/lib/libfreetype.a
(ld): lib /opt/freeware/lib/libz.a
(ld): lib /opt/freeware/lib/libstdc++.a
(ld): lib /usr/lib/libm.a
(ld): lib /usr/vac/lib/libxlopt.a
(ld): lib /usr/vac/lib/libxl.a
(ld): lib /usr/vacpp/lib/libC.a
(ld): lib /usr/lib/libc.a
LIBRARY: Shared object libfreetype.a[libfreetype.so.6]: 343 symbols
imported.
LIBRARY: Shared object libz.a[libz.so.1]: 72 symbols imported.
LIBRARY: Symbols imported from import file
/usr/vacpp/lib/libC.a[shr_32.imp]: 0
LIBRARY: Symbols imported from import file
/usr/vacpp/lib/libC.a[shr2_32.imp]: 0
LIBRARY: Symbols imported from import file
/usr/vacpp/lib/libC.a[shr3_32.imp]: 0
LIBRARY: Symbols imported from import file
/usr/vacpp/lib/libC.a[ansi_32.imp]: 0
LIBRARY: Symbols imported from import file
/usr/vacpp/lib/libC.a[shr_64.imp]: 383
LIBRARY: Symbols imported from import file
/usr/vacpp/lib/libC.a[shr2_64.imp]: 24
LIBRARY: Symbols imported from import file
/usr/vacpp/lib/libC.a[shr3_64.imp]: 27
LIBRARY: Symbols imported from import file
/usr/vacpp/lib/libC.a[ansi_64.imp]: 2448
LIBRARY: Shared object libC.a[ansi_64.o]: 2658 symbols imported.
LIBRARY: Shared object libc.a[shr_64.o]: 2669 symbols imported.
LIBRARY: Shared object libc.a[posix_aio_64.o]: 20 symbols imported.
LIBRARY: Shared object libc.a[aio_64.o]: 18 symbols imported.
LIBRARY: Shared object libc.a[pse_64.o]: 5 symbols imported.
LIBRARY: Shared object libc.a[dl_64.o]: 4 symbols imported.
LIBRARY: Shared object libc.a[pty_64.o]: 1 symbols imported.
FILELIST: Number of previously inserted files processed: 15
(ld): imports /gpfs1/sjo/pkgs/local/lib/python2.7/config/python.exp
IMPORTS: Symbols imported from import file
/gpfs1/sjo/pkgs/local/lib/python2.7/config/python.exp: 1206
(ld): resolve
RESOLVE: 63 of 18106 symbols were kept.
(ld): addgl /usr/lib/glink64.o
ADDGL: Glink code added for 11 symbols.
(ld): er full
ld: 0711-318 ERROR: Undefined symbols were found.
The following symbols are in error:
Symbol Inpndx TY CL Source-File(Object-File) OR
Import-File{Shared-object}
RLD: Address Section Rld-type Referencing
Symbol
----------------------------------------------------------------------------------------------
.main [10] ER PR crt0_64.s(/lib/crt0_64.o)
00000098 .text R_RBR [34]
.__start
ER: The return code is 8.
ld: 0711-317 ERROR: Undefined symbol: .main
--
with best regards
Sudheer
**********************************************************************************
Sudheer Joseph
Scientist
INDIAN NATIONAL CENTRE FOR OCEAN INFORMATION SERVICES (INCOIS)
MINISTRY OF EARTH SCIENCES, GOVERNMENT OF INDIA
"OCEAN VALLEY" PRAGATHI NAGAR (BO)
OPP.JNTU, NIZAMPET SO
Andhra Pradesh, India. PIN- 500 090.
TEl:+91-40-23044600(R),Tel:+91-9440832534(Mobile)
Tel:+91-40-23886047(O),Fax:+91-40-23892910(O)
E-mail: <E-mail%3A...@re...> sud...@ya...;
sj...@in....
Web- http://oppamthadathil.tripod.com
--------------* ---------------
"The ultimate measure of a man is
not where he stands in moments of
comfort and convenience, but where
he stands at times of challenge and
controversy."
Martin Luther King, Jr.
"What we have done for ourselves alone dies with us.
What we have done for others and the world remains and is immortal."
- Albert Pines
|
|
From: s k. <6b6...@gm...> - 2011-10-07 08:29:39
|
Hi,
I am attempting to build a set of Figure objects (based on
matplotlib.figure) which are essentially the same chart with different
x-axis limits. I would like to do this in a function that returns the
figures in a list so that i can choose to write some or all of the
figures to a multipage PDF at a later date.
I attempted to do the following:
========================================================
import matplotlib.figure as fig
from matplotlib.backends.backend_pdf import PdfPages, FigureCanvasPdf
xdata = [1,2,3,4,5]
ydata = [5,4,3,2,1]
fig1 = fig.Figure(figsize=(2,2))
ax1 = fig.Figure.add_subplot(fig1,111)
ax1.plot(xdata,ydata)
figures = []
ax1.set_xlim([0,3])
figures.append(fig1)
ax1.set_xlim([3,5])
figures.append(fig1)
pdf = PdfPages('output.pdf')
for figure in figures:
canvas = FigureCanvasPdf(figure)
figure.savefig(pdf, format="pdf")
pdf.close()
========================================================
In the actual code the list of figures is returned from a function to
another part of the code, but this is roughly equivalent. I realise in
this example i can just write directly to the pdf file after appending
fig1, but in the actual code i do not wish to write the data to a file
until later on.
The output i get from this code is two identical pages of PDF where
the x limits are set to 3,5. I understand this is because I am simply
making two identical references to the figure object in the list and
by modifying fig1 i also affect the fig1 that is 'stored' in the first
position of the array. My question is how do I avoid this? I have
tried to use copy.copy() and copy.deepcopy(). The former does not work
correctly (for fairly obvious reasons) and the latter does not work
with the figure object giving me an error: "NotImplementedError:
TransformNode instances can not be copied. Consider using frozen()
instead."
So, how can i go about making a list of 'charts' and then output them
selectively to a PDF at a later time?
Many thanks and apologies for any information I have left out.
Stephen
P.S. as an aside, can anyone confirm whether it is possible to write a
multipage PDF using the cairo backend?
|
|
From: Michael C. <fat...@ya...> - 2011-10-07 00:20:45
|
Hi Ryan
More very interesting information! I will give these methods a try!
Thanks once again,
Mike
rcnelson wrote:
>
> Mike,
>
> You may want to look into the matplotlib.cm and matplotlib.colors modules.
> I've had good success with matplotlib.colors.LinearSegmentedColormap and
> its
> 'from_list' method. The documentation is the best location for information
> on this topic. If you have a large number of locations, then the color
> differences will be pretty small, unless you use a colormap with lots of
> different colors. Below is your example using the 'from_list' method and
> the
> built-in colormap 'hsv' (you'll just have to flip around the comments).
> For
> the matplotlib.cm colormaps, be sure to passed in normalized values (which
> is why the call to the colormap is slightly complex).
>
> Maybe this is a bit more help.
>
> Ryan
>
> import numpy as np
> import matplotlib.pyplot as plt
> import matplotlib.colors as plc
> import matplotlib.cm as mcm
>
> IDs = np.array([47, 33, 47, 12, 50, 50, 27, 27, 16, 27])
> locations = np.array(['201', '207', '207', '205', '204', '201', '209',
> '209', \
> '207','207'])
> dates = np.array([ 733315.83240741, 733315.83521991, 733315.83681713,
> 733315.83788194, 733336.54554398, 733336.54731481,
> 733337.99842593, 733337.99943287, 733338.00070602,
> 733338.00252315])
>
> fig = plt.figure()
> ax = fig.add_subplot(111)
> locs_un = np.unique(locations)
> # The variable assignment below can be removed if you use the mcm module.
> cs = plc.LinearSegmentedColormap.from_list('Colormap name', ['r', 'g',
> 'b'],
> N=len(locs_un) )
> for n, i in enumerate(locs_un):
> # Reverse the comments here to use the mcm module 'hsv' colormap.
> ax.plot(dates[locations==i],IDs[locations==i],'d', c=cs(n), label=i)
> #ax.plot(dates[locations==i],IDs[locations==i],'d',
> # c=mcm.hsv( float(n)/(len(locs_un)-1) ), label=i)
> ax.xaxis_date()
> fig.autofmt_xdate()
> plt.legend(numpoints=1)
> plt.grid(True)
> plt.show()
>
>
> On Tue, Oct 4, 2011 at 5:25 PM, Michael Castleton
> <fat...@ya...>wrote:
>
>>
>> Ryan,
>> I should clarify my color issue. Your code is smart enough to generate
>> however many colors are needed but I want to make sure the colors are all
>> unique.
>> Thanks again!
>>
>> Mike
>>
>>
>>
>> Mike, sorry to send this twice... I should have sent it to the list as
>> well...
>> _______________________________
>> Mike,
>>
>> If your locations were integers or floats rather than strings, you could
>> just change the scatter call to the following:
>> ax.scatter(dates,IDs,c=
>> locations,marker='d')
>> I don't know about a legend... I don't know if that is possible with a
>> scatter plot (?). Because scatter plots get their colors based off of a
>> color map, you could generate a color bar for your data. You may need to
>> capture the collection object returned from the scatter plot function
>> call,
>> though. Here's your code with these modifications:
>>
>> # Of course, you need to change your locations list to integers rather
>> than
>> strings.
>>
>> fig = plt.figure()
>> ax = fig.add_subplot(111)
>> sc = ax.scatter(dates,IDs,c=locations,marker='d')
>> ax.xaxis_date()
>> fig.autofmt_xdate()
>> plt.colorbar(sc)
>> plt.grid(True)
>> plt.show()
>>
>> If you really need a legend, then you could do a loop of plot commands
>> for
>> each set of unique locations. Using some fancy Numpy masking makes the
>> process easier...
>>
>> import numpy as np
>> import matplotlib.pyplot as plt
>>
>> IDs = np.array([47, 33, 47, 12, 50, 50, 27, 27, 16, 27])
>> locations = np.array(['201', '207', '207', '205', '204', '201', '209',
>> '209', \
>> '207','207'])
>> dates = np.array([ 733315.83240741, 733315.83521991, 733315.83681713,
>>
>> 733315.83788194, 733336.54554398, 733336.54731481,
>> 733337.99842593, 733337.99943287, 733338.00070602,
>> 733338.00252315])
>>
>>
>> fig = plt.figure()
>> ax = fig.add_subplot(111)
>> cs = ['r', 'b', 'g', 'k', 'c']
>> for n, i in enumerate(np.unique(locations)):
>> ax.plot(dates[locations==i],IDs[locations==i],'d', c=cs[n%len(cs)],
>> label=i)
>> ax.xaxis_date()
>> fig.autofmt_xdate()
>> plt.legend(numpoints=1)
>> plt.grid(True)
>> plt.show()
>>
>> Not sure if this is exactly what you wanted, but I hope it helps a
>> little.
>>
>> Ryan
>>
>>
>>
>> --
>> View this message in context:
>> http://old.nabble.com/color-problems-in-scatter-plot-tp32584727p32592799.html
>> Sent from the matplotlib - users mailing list archive at Nabble.com.
>>
>>
>>
>> ------------------------------------------------------------------------------
>> All the data continuously generated in your IT infrastructure contains a
>> definitive record of customers, application performance, security
>> threats, fraudulent activity and more. Splunk takes this data and makes
>> sense of it. Business sense. IT sense. Common sense.
>> http://p.sf.net/sfu/splunk-d2dcopy1
>> _______________________________________________
>> Matplotlib-users mailing list
>> Mat...@li...
>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>>
>
> ------------------------------------------------------------------------------
> All the data continuously generated in your IT infrastructure contains a
> definitive record of customers, application performance, security
> threats, fraudulent activity and more. Splunk takes this data and makes
> sense of it. Business sense. IT sense. Common sense.
> http://p.sf.net/sfu/splunk-d2dcopy1
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>
--
View this message in context: http://old.nabble.com/color-problems-in-scatter-plot-tp32584727p32603057.html
Sent from the matplotlib - users mailing list archive at Nabble.com.
|
|
From: Benjamin R. <ben...@ou...> - 2011-10-06 20:37:05
|
On Thu, Oct 6, 2011 at 2:56 PM, David Pine <dj...@gm...> wrote: > I need help on how to remove the ticks and axes lines on a 3d plot. I got > rid of the tick labels using > ax.w_xaxis.set_ticklabels(['']) but I haven't been able to figure out how > to do the ticks themselves. > > Also, is there a way to remove the gray background & grid to have a free > standing 3d plot? > > > In v1.0.1, there is no easy way to do this. However, when v1.1.0 gets officially released and the documentation is uploaded, I will post some links to show how to do this. Cheers! Ben Root |
|
From: David P. <dj...@gm...> - 2011-10-06 19:56:55
|
I need help on how to remove the ticks and axes lines on a 3d plot. I got rid of the tick labels using ax.w_xaxis.set_ticklabels(['']) but I haven't been able to figure out how to do the ticks themselves. Also, is there a way to remove the gray background & grid to have a free standing 3d plot? David Pine |
|
From: Jeff W. <js...@fa...> - 2011-10-06 18:50:15
|
On 9/29/11 9:44 AM, Filipe Pires Alvarenga Fernandes wrote: > Hi I noticed that Basemap 1.0.2 will replace the old pyshapelib with > the pure python shapelib.py. However, that did break some of my > scripts when I use custom shapefiles. > > Here is a picture from Basemap 1.0.1, > > http://imageshack.us/photo/my-images/69/basemap101.png/ > > and here the same script under Basemap 1.0.2, > > http://imageshack.us/photo/my-images/854/basemap102.png/ > > and here is the script: > http://pastebin.com/WfePCFJi > > It probably has something to do with the way shapelib.py handle the > lines, As soon as I have some time I'll take a better look into that, > but I would like to ask if anyone has seen this before and/or if you > have a suggestion/solution for it. > > Thanks, Filipe Filipe: Were you able to resolve this? I just updated shapefile.py in the git repository, so you might try again on the off chance a bug was fixed. If the problem still persists, please point me to a shapefile that triggers the problem. -Jeff -- Jeffrey S. Whitaker Phone : (303)497-6313 Meteorologist FAX : (303)497-6449 NOAA/OAR/PSD R/PSD1 Email : Jef...@no... 325 Broadway Office : Skaggs Research Cntr 1D-113 Boulder, CO, USA 80303-3328 Web : http://tinyurl.com/5telg |
|
From: Benjamin R. <ben...@ou...> - 2011-10-06 18:24:53
|
On Wed, Oct 5, 2011 at 7:15 PM, Andrew C <cha...@ho...> wrote:
> Hello List Server,
>
> I am trying to take a raster dataset, getting the center points, and the z
> value and trying to graph it in a 3D bar chart quite unsuccessfully.
>
> My data looks like this:
> XCoord = [1,2,3,4]
> YCoord = [1,2,3,4]
> ZCoord = [12,14,4,26]
>
> Those are the known locations, but there will be lots of more points when
> using actual data that forms a continuous surface over a small area.
>
> How do I create a 3D bar chart to represent the Z Value at each of those
> locations? I saw in the help that you need to create a mesh grid, but I
> don't understand how to do that. The help documents are vague on what the
> X,Y,Z values formats are as well.
>
The call signature of bar3d is:
bar3d(x, y, z, dx, dy, dz, color='b', kwargs**)
x, y, and z must be 1-D arrays of equivalent shapes. The values in these
arrays represent the location of a corner point of the bottom of each bar
being plotted. This is why you see a "+ 0.25" to shift the bar over so that
the bars (should be) centered, because the bars are 0.5 wide. The width of
the bars are given by dx, dy and the height given by dz.
For the data you have given, I would do the following:
from mpl_toolkits.mplot3d import Axes3D
import matplotlib.pyplot as plt
import numpy as np
fig = plt.figure()
ax = fig.gca(projection='3d')
XCoord = np.array([1,2,3,4])
YCoord = np.array([1,2,3,4])
ZCoord = np.array([12,14,4,26])
ax.bar3d(XCoord - 0.25, YCoord - 0.25, [0, 0, 0, 0],
0.5, 0.5, ZCoord)
plt.show()
Cheers!
Ben Root
|
|
From: Nils W. <nw...@ia...> - 2011-10-06 11:56:32
|
Hi all, I have played around with the "edit curves line and axes parameters" button. I have modified the label but the legend is not refreshed in the figure. >>> matplotlib.__version__ '1.0.1' Am I missing something ? Nils |
|
From: Jae-Joon L. <lee...@gm...> - 2011-10-06 01:00:36
|
On Wed, Oct 5, 2011 at 11:50 AM, mdekauwe <mde...@gm...> wrote:
> Still haven't worked out the bold but I am sure there will be something on
> that page
>
Try
ax.axis["bottom"].label.set_text("Test")
ax.axis["bottom"].label.set_weight("bold")
IHTH,
-JJ
|
|
From: Andrew C <cha...@ho...> - 2011-10-06 00:15:49
|
Hello List Server, I am trying to take a raster dataset, getting the center points, and the z value and trying to graph it in a 3D bar chart quite unsuccessfully. My data looks like this: XCoord = [1,2,3,4] YCoord = [1,2,3,4] ZCoord = [12,14,4,26] Those are the known locations, but there will be lots of more points when using actual data that forms a continuous surface over a small area. How do I create a 3D bar chart to represent the Z Value at each of those locations? I saw in the help that you need to create a mesh grid, but I don't understand how to do that. The help documents are vague on what the X,Y,Z values formats are as well. |
|
From: Feng Yu <rai...@gm...> - 2011-10-05 22:40:05
|
Dear Lists,
I tried to draw a white block with alpha-channel gradient on top of black.
The result appears to be non-linear, and I think it is problematic.
image = ones((255, 255, 4), dtype='u1')
image[:, :, 0:3] = 255
image[:, :, 3] = arange(0, 255)[:, newaxis]
gca().set_axis_bgcolor('k')
imshow(image)
The color of the pixel with alpha = 128 is about (30, 30, 30).
We can confirm this with
cla()
image[:, :, 3] = 128
imshow(image)
On Inkscape, a white block with alpha = 128 on top of a black box gives a
final color of r,g,b=128, 128, 128.
I did a rough fit and apparently matplotlib is calculating the final pixel
brightness with (notice the original pixel is 0)
r = cr * (alpha / 255.) ** 3 , (same for g and b)
shouldn't it be r = cr * alpha / 255?
This affects matplotlib-1.0.1 and a not so recent copy of the git
master(ba4043a35d4c2).
Regards,
Yu
|
|
From: Ethan G. <eth...@gm...> - 2011-10-05 20:23:32
|
Holger, for what it is worth, you can hack this fairly easily. Run the code twice once with colors, once with shading. Take the output from both as images, the convert both images to HSV, the recombine the HS components from the color version with the V component of the shaded version. I haven't done this in matplotlib, but it worked great for me in IDL. On Oct 5, 2011, at 1:23 PM, Holger Brandsmeier <hol...@sa...> wrote: > Ben, > > I would be very happy to have this functionality. I think this would > also make the 3D plots in the examples that matplot provides look a > good deal nicer. > > Let me know if you have any updates on this. > > -Holger > > On Mon, Oct 3, 2011 at 21:18, Benjamin Root <ben...@ou...> wrote: >> >> >> On Fri, Sep 30, 2011 at 11:33 AM, Holger Brandsmeier >> <hol...@sa...> wrote: >>> >>> Ben, >>> >>> On Fri, Sep 30, 2011 at 17:06, Benjamin Root <ben...@ou...> wrote: >>>> What values for rstride and cstride are you using? By default, >>>> plot_surface() will sample every 10th point of the data array (for >>>> performance reasons). Also, color interpoltion can be turned on by >>>> setting >>>> shade to True. >>> >>> I beleive I start to understand the underlying logic. If no color map >>> is set and shading and antialiazing is set, then indeed the surface >>> is nicely and smoothly displayed. When I provide a color map, then I >>> seem to be able to assign one color for the whole polygon. I also find >>> something like that in the code. >>> >>> In my case I want the z-coordinate to determine the color. I want to >>> use a colormap like jet and no transparency. If I don't use the >>> colormap argument, then I get shading, however everything is blue with >>> shading depending on a lightsource.I don't really need a lightsource, >>> but I would like non-constant colors per polygon. >>> >> >> Yes, you have the logic correct (and probably better explained than I could >> have done). This actually was an issue raised a couple of months ago in a >> bit of a different context, but the solution wasn't entirely clear at that >> point. However, looking at the code again (remember, I didn't write it >> originally, and it had next to no comments), I think I see a fairly simple >> solution. If I allow for the user to specify a light source of None, then I >> could feed the data through a different function to "shade" the surface. I >> will look into doing that, but it won't make it into the v1.1.0 release >> (slated for tomorrow). >> >> Cheers! >> Ben Root >> >> > > > > -- > Holger Brandsmeier, SAM, ETH Zürich > http://www.sam.math.ethz.ch/people/bholger > > ------------------------------------------------------------------------------ > All the data continuously generated in your IT infrastructure contains a > definitive record of customers, application performance, security > threats, fraudulent activity and more. Splunk takes this data and makes > sense of it. Business sense. IT sense. Common sense. > http://p.sf.net/sfu/splunk-d2dcopy1 > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users |
|
From: Holger B. <hol...@sa...> - 2011-10-05 18:21:43
|
Ben, I would be very happy to have this functionality. I think this would also make the 3D plots in the examples that matplot provides look a good deal nicer. Let me know if you have any updates on this. -Holger On Mon, Oct 3, 2011 at 21:18, Benjamin Root <ben...@ou...> wrote: > > > On Fri, Sep 30, 2011 at 11:33 AM, Holger Brandsmeier > <hol...@sa...> wrote: >> >> Ben, >> >> On Fri, Sep 30, 2011 at 17:06, Benjamin Root <ben...@ou...> wrote: >> > What values for rstride and cstride are you using? By default, >> > plot_surface() will sample every 10th point of the data array (for >> > performance reasons). Also, color interpoltion can be turned on by >> > setting >> > shade to True. >> >> I beleive I start to understand the underlying logic. If no color map >> is set and shading and antialiazing is set, then indeed the surface >> is nicely and smoothly displayed. When I provide a color map, then I >> seem to be able to assign one color for the whole polygon. I also find >> something like that in the code. >> >> In my case I want the z-coordinate to determine the color. I want to >> use a colormap like jet and no transparency. If I don't use the >> colormap argument, then I get shading, however everything is blue with >> shading depending on a lightsource.I don't really need a lightsource, >> but I would like non-constant colors per polygon. >> > > Yes, you have the logic correct (and probably better explained than I could > have done). This actually was an issue raised a couple of months ago in a > bit of a different context, but the solution wasn't entirely clear at that > point. However, looking at the code again (remember, I didn't write it > originally, and it had next to no comments), I think I see a fairly simple > solution. If I allow for the user to specify a light source of None, then I > could feed the data through a different function to "shade" the surface. I > will look into doing that, but it won't make it into the v1.1.0 release > (slated for tomorrow). > > Cheers! > Ben Root > > -- Holger Brandsmeier, SAM, ETH Zürich http://www.sam.math.ethz.ch/people/bholger |
|
From: Leidner, M. <mle...@ae...> - 2011-10-05 13:50:20
|
Ben, I am finally replying to your most helpful post about shapefile generation. Indeed, we found that turning off multipolygon path simplification just before the call to_polygons() did the trick: we find that multipolygons now preserve all of the vertices that define them -- in some cases in excess of 10K points. Thanks so much for pointing us in the right direction. Mark On 09/13/11, Benjamin Root <ben...@ou...> wrote: > > > On Tue, Sep 13, 2011 at 1:02 PM, Leidner, Mark <mle...@ae...> wrote: > > > > > > Ben, > > > > > > Good to hear from you. > > > > > > We are using matplotlib v1.0.1_5 on an install from Macports. > > > > > > Hearing that there is simplification logic is very intriguing. > > > > > > > > Mark > > > > > > > > > > > > > > > > > > > > > > > Try this and tell me if the results are better. Right before the line where you call to_polygons(), add this line: > > multipolygon.should_simplify = False > > The simplification logic gets triggered automatically if the rcParam['path.simplify'] is True and if there are more them 128 vertices and those vertices are all simple LINETO segments. I think in your situation, this is true. So, we can force a non-simplification directly like above, or set your rcParams file with path.simplify to False (but this may make graph rendering significantly slower and more resource intensive overall). > > The path simplification logic is designed so that one does not see any visual differences, however, there might need to be some additional logic for those who are accessing the path directly. > > I hope this helps! > Ben Root > > > > > |
|
From: questions a. <que...@gm...> - 2011-10-05 04:21:08
|
thank you! of course!
On Wed, Oct 5, 2011 at 3:08 PM, Eric Firing <ef...@ha...> wrote:
> On 10/04/2011 05:40 PM, questions anon wrote:
> > Excellent, thank you. That works for both quiver and barb.
> > In regards to the shape that has to do with the netcdf file, wind
> > direction variable also has lat and lon. I ended up needing to slice so
> > I could skip a few points otherwise there was too many arrows on the map.
> > Below is the code that worked in case someone else needs help.
>
> Are you sure it worked correctly? I don't think so. See below.
>
> > Thanks again
> >
> > from netCDF4 import Dataset
> > import numpy as N
> > import pylab as plt
> > from numpy import ma as MA
> > from mpl_toolkits.basemap import Basemap
> > import os
> >
> > ncfile=Dataset('E:/temp_winddir/IDZ00026_VIC_ADFD_Wind_Dir_SFC.nc',
> > 'r+', 'NETCDF4')
> > WDIR=ncfile.variables['Wind_Dir_SFC'][20,0::5,0::5]
>
> Don't you need to convert from degrees to radians? sin and cos (used
> below) expect radians, not degrees. You can use N.deg2rad(WDIR) to
> convert.
>
> > LAT=ncfile.variables['latitude'][0::5]
> > LON=ncfile.variables['longitude'][0::5]
> > TIME=ncfile.variables['time'][20]
> > ncfile.close()
> >
> > map = Basemap(projection='merc',llcrnrlat=-40,urcrnrlat=-33,
> > llcrnrlon=139.0,urcrnrlon=151.0,lat_ts=0,resolution='i')
> > x,y=map(*N.meshgrid(LON,LAT))
> > u=1*N.sin(WDIR)
> > v=1*N.cos(WDIR)
> > map.quiver(x,y,u, v)
>
> Assuming you do convert to radians the above will work for your mercator
> projection but it will not align the vectors correctly with respect to
> the parallels and meridians for other projections, so you should use
> map.rotate_vector as in the basemap quiver demo.
>
> Eric
>
>
> >
> > # otherwise use the barb tool - map.barbs(x,y,u, v)
> >
> > plt.title('Wind Direction')
> > plt.show()
>
>
> ------------------------------------------------------------------------------
> All the data continuously generated in your IT infrastructure contains a
> definitive record of customers, application performance, security
> threats, fraudulent activity and more. Splunk takes this data and makes
> sense of it. Business sense. IT sense. Common sense.
> http://p.sf.net/sfu/splunk-d2dcopy1
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
|
|
From: Eric F. <ef...@ha...> - 2011-10-05 04:09:03
|
On 10/04/2011 05:40 PM, questions anon wrote:
> Excellent, thank you. That works for both quiver and barb.
> In regards to the shape that has to do with the netcdf file, wind
> direction variable also has lat and lon. I ended up needing to slice so
> I could skip a few points otherwise there was too many arrows on the map.
> Below is the code that worked in case someone else needs help.
Are you sure it worked correctly? I don't think so. See below.
> Thanks again
>
> from netCDF4 import Dataset
> import numpy as N
> import pylab as plt
> from numpy import ma as MA
> from mpl_toolkits.basemap import Basemap
> import os
>
> ncfile=Dataset('E:/temp_winddir/IDZ00026_VIC_ADFD_Wind_Dir_SFC.nc',
> 'r+', 'NETCDF4')
> WDIR=ncfile.variables['Wind_Dir_SFC'][20,0::5,0::5]
Don't you need to convert from degrees to radians? sin and cos (used
below) expect radians, not degrees. You can use N.deg2rad(WDIR) to convert.
> LAT=ncfile.variables['latitude'][0::5]
> LON=ncfile.variables['longitude'][0::5]
> TIME=ncfile.variables['time'][20]
> ncfile.close()
>
> map = Basemap(projection='merc',llcrnrlat=-40,urcrnrlat=-33,
> llcrnrlon=139.0,urcrnrlon=151.0,lat_ts=0,resolution='i')
> x,y=map(*N.meshgrid(LON,LAT))
> u=1*N.sin(WDIR)
> v=1*N.cos(WDIR)
> map.quiver(x,y,u, v)
Assuming you do convert to radians the above will work for your mercator
projection but it will not align the vectors correctly with respect to
the parallels and meridians for other projections, so you should use
map.rotate_vector as in the basemap quiver demo.
Eric
>
> # otherwise use the barb tool - map.barbs(x,y,u, v)
>
> plt.title('Wind Direction')
> plt.show()
|
|
From: questions a. <que...@gm...> - 2011-10-05 03:40:32
|
Excellent, thank you. That works for both quiver and barb.
In regards to the shape that has to do with the netcdf file, wind direction
variable also has lat and lon. I ended up needing to slice so I could skip a
few points otherwise there was too many arrows on the map.
Below is the code that worked in case someone else needs help.
Thanks again
from netCDF4 import Dataset
import numpy as N
import pylab as plt
from numpy import ma as MA
from mpl_toolkits.basemap import Basemap
import os
ncfile=Dataset('E:/temp_winddir/IDZ00026_VIC_ADFD_Wind_Dir_SFC.nc', 'r+',
'NETCDF4')
WDIR=ncfile.variables['Wind_Dir_SFC'][20,0::5,0::5]
LAT=ncfile.variables['latitude'][0::5]
LON=ncfile.variables['longitude'][0::5]
TIME=ncfile.variables['time'][20]
ncfile.close()
map = Basemap(projection='merc',llcrnrlat=-40,urcrnrlat=-33,
llcrnrlon=139.0,urcrnrlon=151.0,lat_ts=0,resolution='i')
x,y=map(*N.meshgrid(LON,LAT))
u=1*N.sin(WDIR)
v=1*N.cos(WDIR)
map.quiver(x,y,u, v)
# otherwise use the barb tool - map.barbs(x,y,u, v)
plt.title('Wind Direction')
plt.show()
On Wed, Oct 5, 2011 at 2:00 PM, Ethan Gutmann <eth...@gm...>wrote:
> Anon,
> I don't know the quiver routine, but u and v are usually vectors for the
> wind speed in the east-west and north south directions. As such they should
> not be equal to lat and lon (*10), as you are doing, but rather should be
> windspeed * sin(direction) and windspeed*cos(direction). If you don't have
> windspeed or want them all to be the same size arrows, just substitute 1 for
> windspeed (or 10 if you want longer arrows)
>
> You shouldn't have to "set" north,south,east,west, etc. generally North is
> 0, South is 180, etc, so that should all be assigned already.
>
> It also looks like you have an array size mis-match, can you print
> LAT.shape, LON.shape,TIME.shape,WDIR.shape it may be that your lat,lon
> variables also need to be subset to [-50]?
>
> hope this helps,
> Ethan
>
> On Oct 4, 2011, at 5:58 PM, questions anon wrote:
>
> Thanks for responding. I believe quiver is more appropriate because I am
> only using wind direction (at this stage) and this results in arrows.
> I have had a look at the demos and still do not understand how to plot my
> degrees in arrows. How do I define which angle is north, south, west, east,
> etc?
> Any suggestions? Thanks
>
> from netCDF4 import Dataset
> import numpy as N
> import pylab as plt
> from numpy import ma as MA
> from mpl_toolkits.basemap import Basemap
> import os
>
> ncfile=Dataset('E:/temp_winddir/IDZ00026_VIC_ADFD_Wind_Dir_SFC.nc', 'r+',
> 'NETCDF4')
> WDIR=ncfile.variables['Wind_Dir_SFC'][-50]
> LAT=ncfile.variables['latitude'][:]
> LON=ncfile.variables['longitude'][:]
> TIME=ncfile.variables['time'][-50]
> ncfile.close()
>
> map = Basemap(projection='merc',llcrnrlat=-40,urcrnrlat=-33,
> llcrnrlon=139.0,urcrnrlon=151.0,lat_ts=0,resolution='i')
> x,y=LON,LAT
> u=10*x
> v=10*y
> map.quiver(x,y,u, v, WDIR)
> plt.title('Wind Direction')
> plt.show()
>
>
> Traceback (most recent call last):
> File "d:/plot_winddirection.py", line 22, in <module>
> map.quiver(x,y,u, v, WDIR)
> File "C:\Python27\lib\site-packages\mpl_toolkits\basemap\__init__.py",
> line 3102, in quiver
> ret = ax.quiver(x,y,u,v,*args,**kwargs)
> File "C:\Python27\lib\site-packages\matplotlib\axes.py", line 6320, in
> quiver
> q = mquiver.Quiver(self, *args, **kw)
> File "C:\Python27\lib\site-packages\matplotlib\quiver.py", line 395, in
> __init__
> self.XY = np.hstack((X[:,np.newaxis], Y[:,np.newaxis]))
> File "C:\Python27\lib\site-packages\numpy\core\shape_base.py", line 270,
> in hstack
> return _nx.concatenate(map(atleast_1d,tup),1)
> ValueError: array dimensions must agree except for d_0
>
>
>
> On Tue, Oct 4, 2011 at 12:54 PM, Eric Firing <ef...@ha...> wrote:
>
>> On 10/03/2011 03:00 PM, Benjamin Root wrote:
>> > On Mon, Oct 3, 2011 at 6:51 PM, questions anon <
>> que...@gm...
>> > <mailto:que...@gm...>> wrote:
>> >
>> > Hi All,
>> > Is there a simple way to plot a directional arrow to represent a
>> degree?
>> > I have a netcdf file containing wind direction as degrees and I
>> > would like to make a plot with all little arrows representing the
>> > wind direction.
>> > Below is the code I am using currently to plot wind direction but am
>> > not sure where/how to add directional arrows.
>> > Thanks
>> >
>> >
>> > from netCDF4 import Dataset
>> > import numpy as N
>> > import pylab as plt
>> > from numpy import ma as MA
>> > from mpl_toolkits.basemap import Basemap
>> > import os
>> >
>> > ncfile=Dataset('E:/WINDDIR/IDZ00026_VIC_ADFD_Wind_Dir_SFC.nc', 'r+',
>> > 'NETCDF4')
>> > WDIR=ncfile.variables['Wind_Dir_SFC'][-50]
>> > LAT=ncfile.variables['latitude'][:]
>> > LON=ncfile.variables['longitude'][:]
>> > TIME=ncfile.variables['time'][-50]
>> > fillvalue=ncfile.variables['Wind_Dir_SFC']._FillValue
>> > WDIR=MA.masked_values(WDIR, fillvalue)
>> > ncfile.close()
>> >
>> > map = Basemap(projection='merc',llcrnrlat=-40,urcrnrlat=-33,
>> >
>> llcrnrlon=139.0,urcrnrlon=151.0,lat_ts=0,resolution='i')
>> > x,y=map(*N.meshgrid(LON,LAT))
>> > map.drawstates()
>> > map.drawcoastlines()
>> > plt.title('Wind Direction')
>> > CS = map.contourf(x,y,WDIR,15, cmap=plt.cm.jet)
>> > l,b,w,h =0.1,0.1,0.8,0.8
>> > cax = plt.axes([l+w+0.025, b, 0.025, h])
>> > plt.colorbar(CS,cax=cax,drawedges=True)
>> > plt.savefig((os.path.join('E:/WINDDIR/', 'WDIRSFC.png')))
>> > plt.show()
>> >
>> >
>> > Would the barb() command do what you want?
>> >
>> >
>> http://matplotlib.sourceforge.net/api/pyplot_api.html#matplotlib.pyplot.barbs
>> >
>> http://matplotlib.sourceforge.net/examples/pylab_examples/barb_demo.html
>> >
>> > They aren't arrows, but they are commonly used in meteorology to plot
>> > windfields.
>> >
>> > Cheers,
>> > Ben Root
>>
>> There is also quiver, both in matplotlib and in basemap. See the
>> quiver_demo.py and barb_demo.py in the basemap examples directory.
>>
>> Eric
>>
>> >
>> >
>> >
>> >
>> ------------------------------------------------------------------------------
>> > All the data continuously generated in your IT infrastructure contains a
>> > definitive record of customers, application performance, security
>> > threats, fraudulent activity and more. Splunk takes this data and makes
>> > sense of it. Business sense. IT sense. Common sense.
>> > http://p.sf.net/sfu/splunk-d2dcopy1
>> >
>> >
>> >
>> > _______________________________________________
>> > Matplotlib-users mailing list
>> > Mat...@li...
>> > https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>>
>>
>>
>> ------------------------------------------------------------------------------
>> All the data continuously generated in your IT infrastructure contains a
>> definitive record of customers, application performance, security
>> threats, fraudulent activity and more. Splunk takes this data and makes
>> sense of it. Business sense. IT sense. Common sense.
>> http://p.sf.net/sfu/splunk-d2dcopy1
>> _______________________________________________
>> Matplotlib-users mailing list
>> Mat...@li...
>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>>
>
>
> ------------------------------------------------------------------------------
> All the data continuously generated in your IT infrastructure contains a
> definitive record of customers, application performance, security
> threats, fraudulent activity and more. Splunk takes this data and makes
> sense of it. Business sense. IT sense. Common sense.
>
> http://p.sf.net/sfu/splunk-d2dcopy1_______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>
>
|
|
From: Ryan N. <rne...@gm...> - 2011-10-05 03:14:38
|
Mike,
You may want to look into the matplotlib.cm and matplotlib.colors modules.
I've had good success with matplotlib.colors.LinearSegmentedColormap and its
'from_list' method. The documentation is the best location for information
on this topic. If you have a large number of locations, then the color
differences will be pretty small, unless you use a colormap with lots of
different colors. Below is your example using the 'from_list' method and the
built-in colormap 'hsv' (you'll just have to flip around the comments). For
the matplotlib.cm colormaps, be sure to passed in normalized values (which
is why the call to the colormap is slightly complex).
Maybe this is a bit more help.
Ryan
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.colors as plc
import matplotlib.cm as mcm
IDs = np.array([47, 33, 47, 12, 50, 50, 27, 27, 16, 27])
locations = np.array(['201', '207', '207', '205', '204', '201', '209',
'209', \
'207','207'])
dates = np.array([ 733315.83240741, 733315.83521991, 733315.83681713,
733315.83788194, 733336.54554398, 733336.54731481,
733337.99842593, 733337.99943287, 733338.00070602,
733338.00252315])
fig = plt.figure()
ax = fig.add_subplot(111)
locs_un = np.unique(locations)
# The variable assignment below can be removed if you use the mcm module.
cs = plc.LinearSegmentedColormap.from_list('Colormap name', ['r', 'g', 'b'],
N=len(locs_un) )
for n, i in enumerate(locs_un):
# Reverse the comments here to use the mcm module 'hsv' colormap.
ax.plot(dates[locations==i],IDs[locations==i],'d', c=cs(n), label=i)
#ax.plot(dates[locations==i],IDs[locations==i],'d',
# c=mcm.hsv( float(n)/(len(locs_un)-1) ), label=i)
ax.xaxis_date()
fig.autofmt_xdate()
plt.legend(numpoints=1)
plt.grid(True)
plt.show()
On Tue, Oct 4, 2011 at 5:25 PM, Michael Castleton <fat...@ya...>wrote:
>
> Ryan,
> I should clarify my color issue. Your code is smart enough to generate
> however many colors are needed but I want to make sure the colors are all
> unique.
> Thanks again!
>
> Mike
>
>
>
> Mike, sorry to send this twice... I should have sent it to the list as
> well...
> _______________________________
> Mike,
>
> If your locations were integers or floats rather than strings, you could
> just change the scatter call to the following:
> ax.scatter(dates,IDs,c=
> locations,marker='d')
> I don't know about a legend... I don't know if that is possible with a
> scatter plot (?). Because scatter plots get their colors based off of a
> color map, you could generate a color bar for your data. You may need to
> capture the collection object returned from the scatter plot function call,
> though. Here's your code with these modifications:
>
> # Of course, you need to change your locations list to integers rather than
> strings.
>
> fig = plt.figure()
> ax = fig.add_subplot(111)
> sc = ax.scatter(dates,IDs,c=locations,marker='d')
> ax.xaxis_date()
> fig.autofmt_xdate()
> plt.colorbar(sc)
> plt.grid(True)
> plt.show()
>
> If you really need a legend, then you could do a loop of plot commands for
> each set of unique locations. Using some fancy Numpy masking makes the
> process easier...
>
> import numpy as np
> import matplotlib.pyplot as plt
>
> IDs = np.array([47, 33, 47, 12, 50, 50, 27, 27, 16, 27])
> locations = np.array(['201', '207', '207', '205', '204', '201', '209',
> '209', \
> '207','207'])
> dates = np.array([ 733315.83240741, 733315.83521991, 733315.83681713,
>
> 733315.83788194, 733336.54554398, 733336.54731481,
> 733337.99842593, 733337.99943287, 733338.00070602,
> 733338.00252315])
>
>
> fig = plt.figure()
> ax = fig.add_subplot(111)
> cs = ['r', 'b', 'g', 'k', 'c']
> for n, i in enumerate(np.unique(locations)):
> ax.plot(dates[locations==i],IDs[locations==i],'d', c=cs[n%len(cs)],
> label=i)
> ax.xaxis_date()
> fig.autofmt_xdate()
> plt.legend(numpoints=1)
> plt.grid(True)
> plt.show()
>
> Not sure if this is exactly what you wanted, but I hope it helps a little.
>
> Ryan
>
>
>
> --
> View this message in context:
> http://old.nabble.com/color-problems-in-scatter-plot-tp32584727p32592799.html
> Sent from the matplotlib - users mailing list archive at Nabble.com.
>
>
>
> ------------------------------------------------------------------------------
> All the data continuously generated in your IT infrastructure contains a
> definitive record of customers, application performance, security
> threats, fraudulent activity and more. Splunk takes this data and makes
> sense of it. Business sense. IT sense. Common sense.
> http://p.sf.net/sfu/splunk-d2dcopy1
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
|