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
(1) |
3
|
4
(1) |
|
5
|
6
(1) |
7
(12) |
8
(6) |
9
(16) |
10
(2) |
11
|
|
12
|
13
|
14
(1) |
15
|
16
|
17
(1) |
18
(1) |
|
19
|
20
(2) |
21
|
22
(4) |
23
(2) |
24
|
25
|
|
26
(1) |
27
(6) |
28
(1) |
29
(6) |
30
(3) |
31
(4) |
|
|
From: Benjamin R. <ben...@ou...> - 2014-01-22 14:44:07
|
On Wed, Jan 22, 2014 at 9:21 AM, Daryl Herzmann <ak...@gm...> wrote:
> Hello,
>
> I'm wondering why stuff plotted with ax.text() does not get "clipped" by
> the axes bounds on the plot. Here's a simple example, run with 1.3.1:
>
> import matplotlib.pyplot as plt
>
> (fig, ax) = plt.subplots(1,1)
>
> for i in range(5):
> for j in range(5):
> ax.text(i,j, "%sx%s" % (i,j), ha='center', va='center')
> ax.plot([0,8],[0,8])
> ax.set_xlim(0,2.8)
> ax.set_ylim(0,2.8)
> fig.savefig('test.png')
>
> and attached output. This causes me lots of grief with basemap as well.
> Is there a non-brute-force trick to get these values plotted outside the
> axes bounds removed?
>
> daryl
>
>
I can't quite remember what the original issue was, but I do seem to recall
that this behavior was made intentional for some reason. I honestly can't
remember why, though, and I can't fathom what circumstances that this would
be desirable...
Ben Root
|
|
From: Daryl H. <ak...@gm...> - 2014-01-22 14:21:35
|
Hello,
I'm wondering why stuff plotted with ax.text() does not get "clipped" by
the axes bounds on the plot. Here's a simple example, run with 1.3.1:
import matplotlib.pyplot as plt
(fig, ax) = plt.subplots(1,1)
for i in range(5):
for j in range(5):
ax.text(i,j, "%sx%s" % (i,j), ha='center', va='center')
ax.plot([0,8],[0,8])
ax.set_xlim(0,2.8)
ax.set_ylim(0,2.8)
fig.savefig('test.png')
and attached output. This causes me lots of grief with basemap as well.
Is there a non-brute-force trick to get these values plotted outside the
axes bounds removed?
daryl
|
|
From: Luis M. García-C. G. <lui...@gm...> - 2014-01-20 11:57:02
|
El Lunes, 20 de enero de 2014 09:23:59 Mauricio Calvao escribió:
> Your suggestion did work (when adding a colon after pgf.preamble, in the
> matplotlibrc file)
Ouch!
> 1) in the main tex file I added some surrounding text, to be able to check
> the matching of the fonts and it looked as if the family font were ok, but
> the size of the labels (xlabel and ylabel) as well as of the tick marker
> labels (numbers) were distinct (bigger) than of the surrounding main body
> text...
Oh, I'd forgotten that:
matplotlibrc contents:
[...]
backend : Qt4Agg
font.size : 10.0
pgf.rcfonts : False
pgf.texsystem : pdflatex
pgf.preamble : \usepackage{/dev/shm/foo/foo}
[...]
Yes, you have to set the same basic font size as you are going to use in your
document, it is not fully automatic. If you are using something like
\documentclass[12pt]{article}, you have to set font.size : 12.0. You can
programmatically change font.size from within the python script after parsing
the main tex file:
#!/usr/bin/env python
import matplotlib.pyplot as plt
import matplotlib as mpl
import numpy as np
import re
with open('foo.tex') as f:
for line in f:
if 'documentclass' in line:
try:
match = re.search('[0-9]+pt', line).group(0)
font_size = float(match.replace('pt', ''))
except:
font_size = 10.
mpl.rcParams.update({'font.size': font_size})
x = np.linspace(0, 4. * np.pi)
y = np.sin(x) ** 2
fig = plt.figure(figsize=(3, 3))
ax = plt.gca()
ax.plot(x, y)
ax.set_xlabel(r'$x$')
ax.set_ylabel(r'$\sin \left( x \right) ^ 2$')
plt.savefig('/path_to_your_project/foo.pgf')
This code reads your tex file (foo.tex), searches for a line containing
\documentclass, searches for the font size (10pt, 9pt, 12pt, whatever) and
uses it as the plot standard font size. If no font size parameter is found in
foo.tex, it defaults to 10pt.
> 2) since no separate file, with only the text objects (letters, numbers,
> labels, annotations, legends, etc) is generated, I am not able to change
> them accordingly, later, via Latex itself. That's what gnuplot and inkscape
> allow us to do, through the generation of an explicit separate file for the
> text objects...
Indeed, you can change the text. It is in the pgf file, inside \pgftext
environments. The example script I've used generates, among other things, the
following line in foo.pgf:
\pgftext[x=0.072574in,y=1.500000in,,bottom,rotate=90.000000]
{{\sffamily\fontsize{10.000000}{12.000000}\selectfont \(\displaystyle \sin
\left( x \right) ^ 2\)}}%
which is the y label.
It is far from ideal, whith its lack of resizing capabilities, but maybe in
future versions the pgf code gets some improvements so it uses tikz and allows
to use things like tikzscale (which, as far as i know, can't be used now to
scale a figure generated by matplotlib).
--
Luis Miguel García-Cuevas González
|
|
From: Luis M. García-C. G. <lui...@gm...> - 2014-01-20 10:44:35
|
El Sábado, 18 de enero de 2014 17:09:30 Mauricio Calvao escribió:
> Hi
>
> I would like to know whether it is possible to save a simple (or complex,
> for that matter) figure in 2 files, such that one of them contains, for
> instance, the lines or points or surfaces ("graphics") typically in pdf
> format and the other contains the whole text of the figure (labels,
> numbers, title, annotations, etc). This is achievable in gnuplot via its
> epslatex terminal and is highly convenient, in the sense that the fonts of
> the figure match exactly the fonts (size, family, etc) of the main text in
> which it will be embedded; even if we resize the figure, the corresponding
> text, in perfect beautiful Latex, will match the surrounding main body text
> of the master document. This is also possible with Inkscape and its
> PDF+Latex saving option.
>
> Is this possible with matplotlib or are there any workarounds?
If you only want to get a figure where the rendering of the text is done with
latex, you can use savefig in pgf format. As an example:
Contents of matplotlibrc:
[...]
backend : Qt4Agg
pgf.rcfonts : False
pgf.texsystem : pdflatex
pgf.preamble \usepackage{path_to_your_document/foo}
[...]
Script to create the figure:
#!/usr/bin/env python
import matplotlib.pyplot as plt
import numpy as np
x = np.linspace(0, 4. * np.pi)
y = np.sin(x) ** 2
fig = plt.figure(figsize=(3, 3))
ax = plt.gca()
ax.plot(x, y)
ax.set_xlabel(r'$x$')
ax.set_ylabel(r'$\sin \left( x \right) ^ 2$')
plt.savefig('path_to_your_document/foo.pgf')
Main document:
\documentclass{article}
\usepackage{foo}
\begin{document}
\begin{figure}[H]
\input{foo.pgf}
\end{figure}
\end{document}
Style file (foo.sty):
\usepackage{amsmath}
\usepackage{float}
\usepackage{fouriernc}
\usepackage{graphicx}
\usepackage{pgf}
The main problem with this, is that you can not resize the figure (i.e., with
a resizebox) without also resizing the text. If you want to get the figure
with a bigger or smaller size, you have to regenerate the file changing its
figsize. The benefit of this method is that all the drawing is made by latex,
so you have perfectly matched fonts, colors...
--
Luis Miguel García-Cuevas González |
|
From: Mauricio C. <moc...@gm...> - 2014-01-18 19:09:37
|
Hi
I would like to know whether it is possible to save a simple (or complex,
for that matter) figure in 2 files, such that one of them contains, for
instance, the lines or points or surfaces ("graphics") typically in pdf
format and the other contains the whole text of the figure (labels,
numbers, title, annotations, etc). This is achievable in gnuplot via its
epslatex terminal and is highly convenient, in the sense that the fonts of
the figure match exactly the fonts (size, family, etc) of the main text in
which it will be embedded; even if we resize the figure, the corresponding
text, in perfect beautiful Latex, will match the surrounding main body text
of the master document. This is also possible with Inkscape and its
PDF+Latex saving option.
Is this possible with matplotlib or are there any workarounds?
--
#######################################
Prof. Mauricio Ortiz Calvao
Federal University of Rio de Janeiro
Institute of Physics, P O Box 68528
CEP 21941-972 Rio de Janeiro, RJ
Brazil
Email: or...@if...
Phone: (55)(21)25627483
Homepage: http://www.if.ufrj.br/~orca
#######################################
|
|
From: OCuanachain, O. (Oisin) <Ois...@ls...> - 2014-01-17 13:43:58
|
Hi,
I am having problems with a script. It runs a number of iterations and plots and saves a number of plots on each iteration. After the plots have been saved I issue the pyplot.close('all') command so despite many plots being created only 4 should be open at any given time which should not cause any memory problems. When I run the script however I see the RAM usage gradually growing without bound and eventually causing the script to crash. Interestingly I have found if I comment out the pyplot.ion() and pyplot.ioff() the problem vanishes. So I do have a workaround but it would still be good to have this fixed.
My OS is Windows XP Service Pack 3
Python 2.6
Matplotlib 1.3.1
The code below is a stripped down version of my script which still exhibits the problem. Interestingly if I set the number of iterations such that it won't run out of memory before the script completes then one final call to pyplot.close('all') will release all the memory. It almost looks like there is some sort of 'race condition' between the close('all') at the end of one iteration and the plot commands in the next iteration which create new figures. In the taskbar Windows shows the number of windows associated with each application => while this script runs I expect to see between 1 and 5 windows (interpreter + 1->4 figures), however as the script progresses and the memory usage grows Windows lists a growing number of windows associated with Python (multiple instances of figure1/2/3/4).
Oisín.
# -*- coding: utf-8 -*-
import sys
import time
import numpy as np
from matplotlib import pyplot
import os
# Main script body
try:
for gain in range(1,20,2):
for PortToTest in range(8):
dirname = '.\crash'
runname = '\P' + str(PortToTest) + str(gain) + \
'_' + time.strftime('d%dh%Hm%Ms%S')
dirname = dirname + runname
os.mkdir(dirname)
os.system('copy ' + sys.argv[0] + ' ' + dirname )
nIts = 50
echoPlotDec = 10
ResidN = np.random.rand(4,100)
MaxSl = np.random.rand(4,100)
MaxOld = np.random.rand(4,100)
MaxNew = np.random.rand(4,100)
EchoA = np.random.rand(100,160)
pyplot.ion()
pyplot.figure()
pyplot.plot(np.transpose(ResidN),'.-')
pyplot.savefig(dirname + '\\results.png',format='png')
pyplot.figure()
pyplot.plot(np.transpose(EchoA[0:nIts-1:echoPlotDec,:]),'.-')
pyplot.plot(np.transpose(EchoA[nIts:2*nIts-1:echoPlotDec,:]),'*-')
pyplot.savefig(dirname + '\\CoefsA.png',format='png')
pyplot.figure()
pyplot.plot(np.transpose(MaxOld),'.-')
pyplot.plot(np.transpose(MaxNew),'*-')
pyplot.savefig(dirname + '\\MaxAbsA.png',format='png')
pyplot.figure()
pyplot.plot(np.transpose(MaxSl),'.-')
pyplot.savefig(dirname + '\\MaxAbsSl.png',format='png')
pyplot.close('all')
except RuntimeError, msg:
print 'Exception occurred in main script body'
print >>sys.stderr, msg
raise
finally:
print "Test done"
# Display plots
pyplot.ioff()
|
|
From: Werner <wer...@gm...> - 2014-01-14 11:40:14
|
Hi,
I have to problems when using a table with bar.
On the first one I use this code:
for row in xrange(rows):
bars = axes.bar(ind, yearValues[row], width, bottom=yoff,
color=colours[row])
yoff = yoff + yearValues[row]
cellText.append(['%d' % (round(x*1.0, 0)) for x in
yearValues[row]])
axes.set_xticks([]) # remove the default ticks
axes.set_ylabel(labelDesc)
# Add a table at the bottom of the axes
the_table = axes.table(cellText=cellText,
rowLabels=rowLabels, rowColours=colours,
colLabels=colLabels,
loc='bottom')
the_table.set_fontsize(10)
My problem is that the bars are taking up to much space and only a
portion of my table is shown.
My second problem uses this code:
for row in xrange(rows):
# purchase values
bars = axes.bar(ind, yearValuesP[row], width, bottom=yoffP,
color=colours[row])
yoffP = yoffP + yearValuesP[row]
# consumption values
bars = axes.bar(ind, yearValuesC[row], width, bottom=yoffC,
color=colours[row])
yoffC = yoffC + yearValuesC[row]
cText = []
for x in range(len(yearValuesP[row])):
xP = round(yearValuesP[row][x], 0)
xC = round(yearValuesC[row][x], 0)
xN = xP + xC
cText.append('%d - %d = %d' % (xP, -xC, xN))
cellText.append(cText)
# add a line to mark zero
axes.axhline(linewidth=4, color='k')
# add a line for net change
netVal = yoffP + yoffC
aLine = axes.plot(indNet, netVal, 'o-', color='blue', linewidth=4)
autolabelLine(aLine, axes)
axes.set_xticks([]) # remove the default ticks
axes.set_ylabel(labelDesc)
# Add a table at the bottom of the axes
the_table = axes.table(cellText=cellText,
rowLabels=rowLabels, rowColours=colours,
colLabels=colLabels,
loc='bottom')
the_table.set_fontsize(10)
Here the full table is shown but the text is too small to read.
In both cases I tried 'axes.autoscale(tight=True)' and played with the
font size but with no success.
Would appreciate any tips on what I may do wrong or what else I need to
do to have things show correctly.
Werner
P.S.
This is with MPL 1.3.1, with numpy 1.6.1 on Py2.7 32bit on Win7
|
|
From: A S. <sur...@ho...> - 2014-01-10 07:17:16
|
Thanks Paul i added m.imshow(data, origin='lower', interpolation='none') Its made a little improvement but something still seems to be not right <http://matplotlib.1069221.n5.nabble.com/file/n42712/figure_3.png> -- View this message in context: http://matplotlib.1069221.n5.nabble.com/Plotting-NOAA-grib2-data-in-basemap-tp42698p42712.html Sent from the matplotlib - users mailing list archive at Nabble.com. |
|
From: Paul H. <pmh...@gm...> - 2014-01-10 00:51:15
|
Looks like it's just a coarse resolution to me. Try showing the data as an image with no iterpolation. On Thu, Jan 9, 2014 at 3:26 PM, A Short <sur...@ho...> wrote: > Ive also changed the grib file from multi_2.glo_30m.t06z.grib2 to > nww3.t12z.grib.grib2 i still cant figure out which is the right file for > the > North East Atlantic neither...i wonder if my data source is wrong..? > > <http://matplotlib.1069221.n5.nabble.com/file/n42710/figure_2.png> > > > > > > -- > View this message in context: > http://matplotlib.1069221.n5.nabble.com/Plotting-NOAA-grib2-data-in-basemap-tp42698p42710.html > Sent from the matplotlib - users mailing list archive at Nabble.com. > > > ------------------------------------------------------------------------------ > CenturyLink Cloud: The Leader in Enterprise Cloud Services. > Learn Why More Businesses Are Choosing CenturyLink Cloud For > Critical Workloads, Development Environments & Everything In Between. > Get a Quote or Start a Free Trial Today. > > http://pubads.g.doubleclick.net/gampad/clk?id=119420431&iu=/4140/ostg.clktrk > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > |
|
From: A S. <sur...@ho...> - 2014-01-09 23:26:12
|
Ive also changed the grib file from multi_2.glo_30m.t06z.grib2 to nww3.t12z.grib.grib2 i still cant figure out which is the right file for the North East Atlantic neither...i wonder if my data source is wrong..? <http://matplotlib.1069221.n5.nabble.com/file/n42710/figure_2.png> -- View this message in context: http://matplotlib.1069221.n5.nabble.com/Plotting-NOAA-grib2-data-in-basemap-tp42698p42710.html Sent from the matplotlib - users mailing list archive at Nabble.com. |
|
From: Paul H. <pmh...@gm...> - 2014-01-09 22:48:51
|
How does it look if you remove the calls to `m.drawcoastlines()` and ` m.fillcontinents()`? On Thu, Jan 9, 2014 at 1:05 PM, A Short <sur...@ho...> wrote: > Thats strange they look different on this browser. Hopefully the one below > youll see what i mean > > Thanks > > <http://matplotlib.1069221.n5.nabble.com/file/n42708/figure_1.png> > > > > -- > View this message in context: > http://matplotlib.1069221.n5.nabble.com/Plotting-NOAA-grib2-data-in-basemap-tp42698p42708.html > Sent from the matplotlib - users mailing list archive at Nabble.com. > > > ------------------------------------------------------------------------------ > CenturyLink Cloud: The Leader in Enterprise Cloud Services. > Learn Why More Businesses Are Choosing CenturyLink Cloud For > Critical Workloads, Development Environments & Everything In Between. > Get a Quote or Start a Free Trial Today. > > http://pubads.g.doubleclick.net/gampad/clk?id=119420431&iu=/4140/ostg.clktrk > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > |
|
From: A S. <sur...@ho...> - 2014-01-09 21:05:31
|
Thats strange they look different on this browser. Hopefully the one below youll see what i mean Thanks <http://matplotlib.1069221.n5.nabble.com/file/n42708/figure_1.png> -- View this message in context: http://matplotlib.1069221.n5.nabble.com/Plotting-NOAA-grib2-data-in-basemap-tp42698p42708.html Sent from the matplotlib - users mailing list archive at Nabble.com. |
|
From: Paul H. <pmh...@gm...> - 2014-01-09 20:35:17
|
What I'm saying is that your top image and bottom image are identical and I don't see any white boxes in either. What is the resolution of the grid? -paul On Thu, Jan 9, 2014 at 11:59 AM, A Short <sur...@ho...> wrote: > ok the file im using is this multi_2.glo_30m.t06z.grib2 from here > <ftp://ftpprd.ncep.noaa.gov/pub/data/nccf/com/wave/prod/wave.20140109/> > im > not sure its the right file to get wave heights of the North East Atlantic > so im trying different ones. > > as you can see above in the top image there is some data missing (white > boxes) near the coast im wondering if its possible to either zoom into the > map slightly so the data runs underneath the land..? > > Thanks > Alec > > > > -- > View this message in context: > http://matplotlib.1069221.n5.nabble.com/Plotting-NOAA-grib2-data-in-basemap-tp42698p42705.html > Sent from the matplotlib - users mailing list archive at Nabble.com. > > > ------------------------------------------------------------------------------ > CenturyLink Cloud: The Leader in Enterprise Cloud Services. > Learn Why More Businesses Are Choosing CenturyLink Cloud For > Critical Workloads, Development Environments & Everything In Between. > Get a Quote or Start a Free Trial Today. > > http://pubads.g.doubleclick.net/gampad/clk?id=119420431&iu=/4140/ostg.clktrk > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > |
|
From: Eric F. <ef...@ha...> - 2014-01-09 20:33:26
|
On 2014/01/09 1:57 AM, vargfran wrote: > Dear all > pyplot seems to be plottting(joining points with lines) in the wrong order I > have checked all the algorithms relating the data being plotted and > everything is in order > <http://matplotlib.1069221.n5.nabble.com/file/n42696/bad_line_joints.png> > this can be observed in the image on how it makes these closed loops by > plotting a line between two points skipping one or several points in time > then going back to them before continuing to the next. I wonder if anyone > has encountered this problem before or knows a solution. This looks like a problem in parsing date/time x values in a text input file, not a problem in the actual plotting. Eric |
|
From: A S. <sur...@ho...> - 2014-01-09 20:00:05
|
ok the file im using is this multi_2.glo_30m.t06z.grib2 from here <ftp://ftpprd.ncep.noaa.gov/pub/data/nccf/com/wave/prod/wave.20140109/> im not sure its the right file to get wave heights of the North East Atlantic so im trying different ones. as you can see above in the top image there is some data missing (white boxes) near the coast im wondering if its possible to either zoom into the map slightly so the data runs underneath the land..? Thanks Alec -- View this message in context: http://matplotlib.1069221.n5.nabble.com/Plotting-NOAA-grib2-data-in-basemap-tp42698p42705.html Sent from the matplotlib - users mailing list archive at Nabble.com. |
|
From: Paul H. <pmh...@gm...> - 2014-01-09 17:25:30
|
I think you posted the same image in both cases. Without seeing the problematic image, I can only guess that it's caused by the resolution of your data. On Thu, Jan 9, 2014 at 7:58 AM, A Short <sur...@ho...> wrote: > Hi Paul, > > Thanks for your reply, I managed to fix it after I realised the mistake I > was making. > > I've currently got a new problem. If you look at the image below, there's a > lot of white showing up around the coasts which ideally I'd like to remove. > The map is drawn using basemap, is there a function/feature that will fill > this in. Or is it a probem with the grib files that I'm using? > > <http://matplotlib.1069221.n5.nabble.com/file/n42701/figure_1.png> > > If possible, I'd like it to look like the image below. If it is a problem > with our data, is there a way that we can draw a layer of colour on the > bottom to get rid of the white? > > <http://matplotlib.1069221.n5.nabble.com/file/n42701/figure_1.png> > > > > -- > View this message in context: > http://matplotlib.1069221.n5.nabble.com/Plotting-NOAA-grib2-data-in-basemap-tp42698p42701.html > Sent from the matplotlib - users mailing list archive at Nabble.com. > > > ------------------------------------------------------------------------------ > CenturyLink Cloud: The Leader in Enterprise Cloud Services. > Learn Why More Businesses Are Choosing CenturyLink Cloud For > Critical Workloads, Development Environments & Everything In Between. > Get a Quote or Start a Free Trial Today. > > http://pubads.g.doubleclick.net/gampad/clk?id=119420431&iu=/4140/ostg.clktrk > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > |
|
From: Skip M. <sk...@po...> - 2014-01-09 16:55:22
|
> > On that assumption, I tried changing the legend to be associated with the > right Y axis: > > if a legend is requested: > labels = [line.get_label() for line in lines] > if I have right axis data to plot: > right_plot.legend(lines, labels).draggable(True) > else: > left_plot.legend(lines, labels).draggable(True) > > Again, the legend displays properly, but can't be dragged. > Belay that. The above change does work around the problem. Still, would be nice if this worked no matter which Y axes were used. Skip |
|
From: Skip M. <sk...@po...> - 2014-01-09 16:40:17
|
>> I believe (as of v1.3.1) that after you create the legend you call >> leg.draggable(True) >> http://matplotlib.org/api/legend_api.html#matplotlib.legend.Legend.draggable > > Outstanding! (Google was not my friend here. I wasn't searching for > "draggable.") It works if I only plot using the left Y axis. If I add plots to the right Y axis it won't drag. Basically, the code looks like this: left_plot = figure.add_subplot(111) ... do left_plot stuff ... if I have right axis data to plot: right_plot = left_plot.twinx() ... do right_plot stuff ... if a legend is requested: labels = [line.get_label() for line in lines] left_plot.legend(lines, labels).draggable(True) figure.tight_layout() pylab.show() The legend is displayed correctly. It has all the desired elements, but the legend isn't mouse sensitive. This leads me to believe that the plotting somehow makes mouse events get handled by the right Y axis subplot. If I move the cursor around the plot, the Y coordinates displayed at the bottom of the window are those of the left Y axis, however. On that assumption, I tried changing the legend to be associated with the right Y axis: if a legend is requested: labels = [line.get_label() for line in lines] if I have right axis data to plot: right_plot.legend(lines, labels).draggable(True) else: left_plot.legend(lines, labels).draggable(True) Again, the legend displays properly, but can't be dragged. Any ideas? Thx, Skip |
|
From: A S. <sur...@ho...> - 2014-01-09 15:58:10
|
Hi Paul, Thanks for your reply, I managed to fix it after I realised the mistake I was making. I've currently got a new problem. If you look at the image below, there's a lot of white showing up around the coasts which ideally I'd like to remove. The map is drawn using basemap, is there a function/feature that will fill this in. Or is it a probem with the grib files that I'm using? <http://matplotlib.1069221.n5.nabble.com/file/n42701/figure_1.png> If possible, I'd like it to look like the image below. If it is a problem with our data, is there a way that we can draw a layer of colour on the bottom to get rid of the white? <http://matplotlib.1069221.n5.nabble.com/file/n42701/figure_1.png> -- View this message in context: http://matplotlib.1069221.n5.nabble.com/Plotting-NOAA-grib2-data-in-basemap-tp42698p42701.html Sent from the matplotlib - users mailing list archive at Nabble.com. |
|
From: Paul H. <pmh...@gm...> - 2014-01-09 15:19:30
|
As the error message says, the problem is on Line 14: print f.variables['WWSWHGT_P0_L1_GLL0'] a KeyError means that you tried to access an element that is not in a dictionary. In this case "f.variables" is the dictionary and "' WWSWHGT_P0_L1_GLL0'" is the element. Did your data and script come of the same place? You can't just throw any basemap script at any grid file. On Thu, Jan 9, 2014 at 4:52 AM, Rolling Six <sur...@ho...> wrote: > Hi im new to Python and basemap i am trying to follow the script below that > was posted in another thread here > <http://matplotlib.1069221.n5.nabble.com/Plotting-NOAA-data-td19588.html> > but im getting this error > > alec@alec-imedia-S2870:~$ python Desktop/test.py > /usr/lib/pymodules/python2.7/mpl_toolkits/__init__.py:2: UserWarning: > Module > dap was already imported from None, but /usr/lib/python2.7/dist-packages is > being added to sys.path > __import__('pkg_resources').declare_namespace(__name__) > a > fatal: environment variable not set > b > ['VGRD_P0_L1_GLL0', 'WVDIR_P0_L1_GLL0', 'lon_0', 'PERSW_P0_L1_GLL0', > 'WIND_P0_L1_GLL0', 'PERPW_P0_L1_GLL0', 'WDIR_P0_L1_GLL0', 'forecast_time0', > 'DIRPW_P0_L1_GLL0', 'WVPER_P0_L1_GLL0', 'DIRSW_P0_L1_GLL0', > 'HTSGW_P0_L1_GLL0', 'UGRD_P0_L1_GLL0', 'lat_0'] > Traceback (most recent call last): > File "Desktop/test.py", line 14, in <module> > datavar = f.variables['WWSWHGT_P0_L1_GLL0'] > KeyError: 'WWSWHGT_P0_L1_GLL0' > > The script im trying to run below > > import Nio > from mpl_toolkits.basemap import Basemap > import matplotlib.pyplot as plt > import numpy as np > f = Nio.open_file('akw.t00z.grib.grib2') > print f.variables.keys() > lons = f.variables['lon_0'][:] > # flip latitudes so data goes S-->N > lats = f.variables['lat_0'][::-1] > times = f.variables['forecast_time0'][:] > datavar = f.variables['WWSWHGT_P0_L1_GLL0'] > ntime = 10 > data = datavar[ntime,::-1] > print f.variables['WWSWHGT_P0_L1_GLL0'] > print data.min(), data.max() > m = Basemap(projection='cyl',llcrnrlat=lats[0],llcrnrlon=lons[0],\ > urcrnrlat=lats[-1],urcrnrlon=lons[-1],resolution='l') > x, y = m(*np.meshgrid(lons, lats)) > levels = np.arange(0,9.1,0.5) > m.contourf(x,y,data,levels) > m.drawcoastlines() > m.fillcontinents() > m.drawparallels(np.arange(40,81,10),labels=[1,0,0,0]) > m.drawmeridians(np.arange(150,241,10),labels=[0,0,0,1]) > m.drawparallels(np.arange(40,81,10),labels=[1,0,0,0]) > m.drawmeridians(np.arange(150,241,10),labels=[0,0,0,1]) > plt.title(datavar.long_name+' %s hr fcst'%(times[ntime]),fontsize=12) > plt.colorbar(orientation='horizontal',shrink=0.9,format="%g") > plt.show() > > > > > > > > -- > View this message in context: > http://matplotlib.1069221.n5.nabble.com/Plotting-NOAA-grib2-data-in-basemap-tp42698.html > Sent from the matplotlib - users mailing list archive at Nabble.com. > > > ------------------------------------------------------------------------------ > CenturyLink Cloud: The Leader in Enterprise Cloud Services. > Learn Why More Businesses Are Choosing CenturyLink Cloud For > Critical Workloads, Development Environments & Everything In Between. > Get a Quote or Start a Free Trial Today. > > http://pubads.g.doubleclick.net/gampad/clk?id=119420431&iu=/4140/ostg.clktrk > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > |
|
From: Guillermo-Nicolas G. D. <gn....@gm...> - 2014-01-09 12:57:43
|
Hello, Can you provide a short piece of code that shows the issue? Do you provide your points in order and in a collection-like object that preserves the order in which the points are appended? (a Dict or Set would not preserve the ordering). Regards 2014/1/9 Francisco Vargas <f.v...@ic...> > Dear all > pyplot seems to be plottting(joining points with lines) in the wrong order > I have checked all the algorithms relating the data being plotted and > everything is in order<nabble_img src="bad_line_joints.png" border="0"/> > this can be observed in the image on how it makes these closed loops by > plotting a line between two points skipping one or several points in time > then going back to them before continuing to the next. I wonder if anyone > has encountered this problem before or knows a solution. > > > ------------------------------------------------------------------------------ > CenturyLink Cloud: The Leader in Enterprise Cloud Services. > Learn Why More Businesses Are Choosing CenturyLink Cloud For > Critical Workloads, Development Environments & Everything In Between. > Get a Quote or Start a Free Trial Today. > > http://pubads.g.doubleclick.net/gampad/clk?id=119420431&iu=/4140/ostg.clktrk > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > > |
|
From: Rolling S. <sur...@ho...> - 2014-01-09 12:52:54
|
Hi im new to Python and basemap i am trying to follow the script below that was posted in another thread here <http://matplotlib.1069221.n5.nabble.com/Plotting-NOAA-data-td19588.html> but im getting this error alec@alec-imedia-S2870:~$ python Desktop/test.py /usr/lib/pymodules/python2.7/mpl_toolkits/__init__.py:2: UserWarning: Module dap was already imported from None, but /usr/lib/python2.7/dist-packages is being added to sys.path __import__('pkg_resources').declare_namespace(__name__) a fatal: environment variable not set b ['VGRD_P0_L1_GLL0', 'WVDIR_P0_L1_GLL0', 'lon_0', 'PERSW_P0_L1_GLL0', 'WIND_P0_L1_GLL0', 'PERPW_P0_L1_GLL0', 'WDIR_P0_L1_GLL0', 'forecast_time0', 'DIRPW_P0_L1_GLL0', 'WVPER_P0_L1_GLL0', 'DIRSW_P0_L1_GLL0', 'HTSGW_P0_L1_GLL0', 'UGRD_P0_L1_GLL0', 'lat_0'] Traceback (most recent call last): File "Desktop/test.py", line 14, in <module> datavar = f.variables['WWSWHGT_P0_L1_GLL0'] KeyError: 'WWSWHGT_P0_L1_GLL0' The script im trying to run below import Nio from mpl_toolkits.basemap import Basemap import matplotlib.pyplot as plt import numpy as np f = Nio.open_file('akw.t00z.grib.grib2') print f.variables.keys() lons = f.variables['lon_0'][:] # flip latitudes so data goes S-->N lats = f.variables['lat_0'][::-1] times = f.variables['forecast_time0'][:] datavar = f.variables['WWSWHGT_P0_L1_GLL0'] ntime = 10 data = datavar[ntime,::-1] print f.variables['WWSWHGT_P0_L1_GLL0'] print data.min(), data.max() m = Basemap(projection='cyl',llcrnrlat=lats[0],llcrnrlon=lons[0],\ urcrnrlat=lats[-1],urcrnrlon=lons[-1],resolution='l') x, y = m(*np.meshgrid(lons, lats)) levels = np.arange(0,9.1,0.5) m.contourf(x,y,data,levels) m.drawcoastlines() m.fillcontinents() m.drawparallels(np.arange(40,81,10),labels=[1,0,0,0]) m.drawmeridians(np.arange(150,241,10),labels=[0,0,0,1]) m.drawparallels(np.arange(40,81,10),labels=[1,0,0,0]) m.drawmeridians(np.arange(150,241,10),labels=[0,0,0,1]) plt.title(datavar.long_name+' %s hr fcst'%(times[ntime]),fontsize=12) plt.colorbar(orientation='horizontal',shrink=0.9,format="%g") plt.show() -- View this message in context: http://matplotlib.1069221.n5.nabble.com/Plotting-NOAA-grib2-data-in-basemap-tp42698.html Sent from the matplotlib - users mailing list archive at Nabble.com. |
|
From: Francisco V. <f.v...@ic...> - 2014-01-09 12:31:23
|
Dear all pyplot seems to be plottting(joining points with lines) in the wrong order I have checked all the algorithms relating the data being plotted and everything is in order<nabble_img src="bad_line_joints.png" border="0"/> this can be observed in the image on how it makes these closed loops by plotting a line between two points skipping one or several points in time then going back to them before continuing to the next. I wonder if anyone has encountered this problem before or knows a solution. |
|
From: vargfran <f.v...@ic...> - 2014-01-09 11:57:19
|
Dear all pyplot seems to be plottting(joining points with lines) in the wrong order I have checked all the algorithms relating the data being plotted and everything is in order <http://matplotlib.1069221.n5.nabble.com/file/n42696/bad_line_joints.png> this can be observed in the image on how it makes these closed loops by plotting a line between two points skipping one or several points in time then going back to them before continuing to the next. I wonder if anyone has encountered this problem before or knows a solution. -- View this message in context: http://matplotlib.1069221.n5.nabble.com/pyplot-plot-plotting-points-in-wrong-order-making-loops-in-the-graph-display-tp42696.html Sent from the matplotlib - users mailing list archive at Nabble.com. |
|
From: rhodeshart <ha...@us...> - 2014-01-09 06:31:52
|
Hi
I don't have a satisfactory answer, but have found I needed two draw()
commands to get screen output. I dont understand why.
Cheers
Rhodes
--
View this message in context: http://matplotlib.1069221.n5.nabble.com/don-t-understand-interactive-mode-tp42686p42691.html
Sent from the matplotlib - users mailing list archive at Nabble.com.
|