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
(16) |
2
(16) |
3
(5) |
4
(4) |
5
(4) |
6
(10) |
7
(33) |
8
(11) |
9
(20) |
10
(7) |
11
(8) |
12
(18) |
13
(27) |
14
(21) |
15
(15) |
16
(10) |
17
(12) |
18
(3) |
19
(12) |
20
(12) |
21
(14) |
22
(32) |
23
(15) |
24
(20) |
25
(12) |
26
(32) |
27
(29) |
28
(17) |
29
(25) |
30
(12) |
31
(5) |
On Thu, Jul 22, 2010 at 8:07 AM, John Hunter <jd...@gm...> wrote: > On Thu, Jul 22, 2010 at 7:58 AM, alberttresens <alb...@gm...> wrote: >> >> http://old.nabble.com/file/p29236565/gcview.py gcview.py >> http://old.nabble.com/file/p29236565/gc.log gc.log >> >> Hi here the files you were asking for. > > Works fine for me -- most likely one of my suggestions in the previous > post will help you. Attached is the simplest solution -- uses the pyplot namspace, calls figure before plotting, use the API calls for plotting and labelsing, and calls plt.show afterwords to raise the figure.
On 7/22/10 3:53 AM, mdekauwe wrote: > Hi, > > I am trying to plot an image using basemap and overlay another image plotted > as a contour and I am a bit stuck. > > e.g. > > I have a small image of the world for example (10.5-13.5N, 1.5-3.5E, regular > lat long grid). And I saw what was posted previously > here...http://www.mail-archive.com/mat...@li.../msg01961.html > but I am still stuck. > > I plot my original image... > > im = m.imshow(image, norm=norm, interpolation='nearest', cmap=colour_map) > > then I tried to build the info for the contour plot > > delta = 0.03 > x = np.arange(1.5, 3.5, delta) > y = np.arange(10.5, 13.5, delta) > X, Y = np.meshgrid(x, y) > m.contour(image2, X, Y, color='black') > > plt.show() > > but that only plots the first image? The images arrays are identically sized > and of the same area, is there a way to grab the grid from the first plot > perhaps? > > No idea what I am doing wrong. > Nor do I - it would help to have a self-contained example to run that demonstrates your problem. -Jeff > Many thanks, > > Martin >
On Thu, Jul 22, 2010 at 7:58 AM, alberttresens <alb...@gm...> wrote: > > http://old.nabble.com/file/p29236565/gcview.py gcview.py > http://old.nabble.com/file/p29236565/gc.log gc.log > > Hi here the files you were asking for. Works fine for me -- most likely one of my suggestions in the previous post will help you. JDH
http://old.nabble.com/file/p29236565/gcview.py gcview.py http://old.nabble.com/file/p29236565/gc.log gc.log Hi here the files you were asking for. -- View this message in context: http://old.nabble.com/Plot%28%29-%3A-IndexError%3A-index-out-of-range-for-array-tp29226333p29236565.html Sent from the matplotlib - users mailing list archive at Nabble.com.
On Thu, Jul 22, 2010 at 3:48 AM, alberttresens <alb...@gm...> wrote: > > Might be usefull, that is the script I am trying to run. I has some checks, > but is basiclly from Salmon Run Blog: We can't run this because when you pasted the text into the browser it was line wrapped and would require significant editing to make it syntactically correct. When posting code, it helps to attach it as well to avoid these kinds of problems. Also, the script requires a gc logfile which we do not have, so for us to be able to run it we would need the input as well. It is much easier for us to debug code that we can actually run. So I will haxard a guess based on a quick inspection. You are probably running and rerunning this code in an environment with a persistent python session, like Idle, ipython or some other IDE. The calls to "plot" you are making my default replot into the same figure and axes, and that figure contains some bad data from an earlier run that is messing subsequent runs up. This problem should go away if you run your script in a clean environment, eg from the shell command line with a new python session. Alternatively, in a running session, just do plt.close('all') to clear out all your old figures. You can also insure that the plotting goes into a new figure by calling figure() before any plotting commands. It is usually a bad idea to rely on pyplot's manipulation of the current figure and axes when embedding plotting code in a function, since functions can be called in multiple contexts. I usually use the API, and the following idiom for writing plotting functions def somefunc(x, y, fig=None): """ plot x vs y. fig is a matplotlib Figure instance; if None create a new pyplot figure The Figure instance is returned """ if fig is None: # we import pyplot here and not at the top level so that # people who are managing their own figures, eg in a user # interface application, will not trigger the pyplot user # interface code which coul cause conflicts import matplotlib.pyplot as plt fig = plt.figure() # we explicitly instantiate our axes rather than rely on pyplot's # stateful management of current figure and axes ax = fig.add_subplot(111) ax.plot(x, y) ax.set_title('x vs y') ax.set_xlabel('x') ax.set_ylabel('y') ax.grid(True) return fig
Hi, I am trying to plot an image using basemap and overlay another image plotted as a contour and I am a bit stuck. e.g. I have a small image of the world for example (10.5-13.5N, 1.5-3.5E, regular lat long grid). And I saw what was posted previously here...http://www.mail-archive.com/mat...@li.../msg01961.html but I am still stuck. I plot my original image... im = m.imshow(image, norm=norm, interpolation='nearest', cmap=colour_map) then I tried to build the info for the contour plot delta = 0.03 x = np.arange(1.5, 3.5, delta) y = np.arange(10.5, 13.5, delta) X, Y = np.meshgrid(x, y) m.contour(image2, X, Y, color='black') plt.show() but that only plots the first image? The images arrays are identically sized and of the same area, is there a way to grab the grid from the first plot perhaps? No idea what I am doing wrong. Many thanks, Martin -- View this message in context: http://old.nabble.com/Basemap-%2B-contour-layer--tp29235080p29235080.html Sent from the matplotlib - users mailing list archive at Nabble.com.
Might be usefull, that is the script I am trying to run. I has some checks, but is basiclly from Salmon Run Blog: #!/usr/bin/python import os import sys import re import time from stat import * from pylab import * from matplotlib import * def parse(line): """ Parses an input line from gc.log into a set of tokens and returns them. There are two patterns we have to look for: 112829.094: [GC 695486K->557348K(806720K), 0.0191830 secs] 112776.534: [Full GC 690522K->551411K(817408K), 1.8249860 secs """ #pgre = re.compile("(\d+\.\d+):\s\[.+\]\s+(\d+)K->(\d+)K\((\d+)K\),\s(\d+\.\d+)\ssecs\]",re.IGNORECASE) #pgre = re.compile("(\d+\.\d+):\s\[.+\]\s+(\d+)K->(\d+)K\((\d+)K\),\s(\d+\.\d+)\ssecs\]") fre = re.compile("(\d+\.\d+):\s\[.+\]\s+(\d+)K->(\d+)K\((\d+)K\)\s\[.+\],\s(\d+\.\d+)\ssecs\]",re.IGNORECASE) pgre = re.compile("(\d+\.\d+):\s\[.+\s+(\d+)K->(\d+)K\((\d+)K\)\s\[.+\],\s(\d+\.\d+)\ssecs\] ",re.IGNORECASE) test = re.compile("(\d+\.\d+):\s\[.+\s+(\d+)K->(\d+)K\((\d+)K\),\s(\d+\.\d+)\ssecs\]") #pgre = re.compile("(\d+\.\d+):\s\[.+\]\s+(\d+)K->(\d+)K\((\d+)K\),\s(\d+\.\d+)\ssecs\]") #fre = re.compile("(\d+\.\d+):\s\[.+\]\s+(\d+)K->(\d+)K\((\d+)K\)\s\[.+\],\s(\d+\.\d+)\ssecs\]") # First try matching with the partial GC pattern pgre isFullGc = False mo = pgre.match(line) print mo # Then match with the full GC pattern if (mo == None): #mo = fre.match(line) mo = test.match(line) print "after the fre.match" print line print mo #print mo.group(0) print "before group1" print mo.group(1) print "after group1" print mo.group(2) print mo.group(3) print mo.group(4) print mo.group(5) isFullGc = True print mo print float(mo.group(1)) print "after float group(1)" # return tsoffset, heapUsedBeforeGc(Kb), heapUsedAfterGc(Kb), elapsedTime(s), heapSize(Kb), isFullGc return float(mo.group(1)), int(mo.group(2)), int(mo.group(3)), float(mo.group(5)), int(mo.group(4)), isFullGc #return float(mo.group(1)), int(mo.group(2)), int(mo.group(3)), 0.0191830 , int(mo.group(4)), isFullGc def drawGraph(x1vals, y1vals, x2vals, y2vals, y3vals, x4vals, y4vals, startTime, endTime, output): """ Draws a graph of the GC behavior we are interested in. There are three line graphs and one series of points. - Memory in use before GC happens (red line) - Memory in use after GC happens (green line) - Total JVM heap size (yellow line) - Times when full GC happens (blue dots on X-axis) - The Y-axis (for memory usage) numbers are shown in MB - The X-axis (for time) is plotted in minutes since start - The title contains the start and end times for this plot """ print "-- In drawGraph--" print x1vals, y1vals, x2vals, y2vals, y3vals, x4vals, y4vals, startTime, endTime, output xlabel("Time (minutes)") ylabel("Heap(Mb)") title("GC Log (" + startTime + " to " + endTime + ")") # Heap in use graph over time before garbage collection print "--before plot" print x1vals print y1vals print x2vals print y2vals print y3vals print x4vals print y4vals print startTime print endTime print output #plot([0.0, 0.048583333333333326, 0.10666666666666667, 0.12878333333333333],[1,2,3,4],'r') #pylab.plot([0, 1, 2, 3],[1,2,3,4],'r') #plot(arange(0,10),[9,4,5,2,3,5,7,12,2,3]) #plot ( arange(0,10),[9,4,5,2,3,5,7,12,2,3],'.-',label='sample1' ) plot([0],[0]) #plot(x1vals, y1vals, 'r') # Heap in use graph over time after garbage collection #plot(x2vals, y2vals, 'g') # Total heap size over time #plot(x2vals, y3vals, 'y') # Full GC over time #plot(x4vals, y4vals, 'bo') savefig(output) def usage(): """ Prints the script's usage guide. """ print "Usage: gcview.py input output [time-start] [time-end]" print "input = path to gc.log file" print "output = path to gc.png file" print "time-start = date in yyyy-MM-dd HH:mm format" print "time-end = date in yyyy-MM-dd HH:mm format" sys.exit(-1) def convertISOToUnixTS(isots): """ Takes a timestamp (supplied from the command line) in ISO format, ie yyyy-MM-dd HH:mm and converts it to seconds since the epoch. """ isore = re.compile("(\d{4})-(\d{2})-(\d{2})\s(\d{2}):(\d{2})") mo = isore.match(isots) return time.mktime([int(mo.group(1)), int(mo.group(2)), int(mo.group(3)), int(mo.group(4)), int(mo.group(5)), 0, 0, 0, -1]) def baseTimeStamp(logFile): """ Since the timestamps in the gc.log file are probably in seconds since server startup, we want to get an indication of the time the first log line was written. We do this by getting the ctime of the gc.log file. """ return os.lstat(logFile)[ST_CTIME] def minutesElapsed(currentTS, baseTS): """ Convert the timestamp (in seconds since JVM startup) to mins elapsed since first timestamp entry. """ return (currentTS - baseTS) / 60 def timeString(ts): """ Return printable version of time represented by seconds since epoch """ return time.strftime("%Y-%m-%d %H:%M", time.localtime(ts)) def main(): """ This is how we are called. Reads the command line args, reads the input file line by line, calling out to parse() for each line, processing and pushing the tokens into arrays that are passed into the drawGraph() method. Example call: ./gcview.py ../tmp/gc.log gc-24h.png ./gcview.py ../tmp/gc.log gc-6h.png "2006-08-13 05:00" "2006-08-13 11:00" ./gcview.py ../tmp/gc.log gc-2h.png "2006-08-13 09:00" "2006-08-13 11:00" ./gcview.py ../tmp/gc.log gc-1h.png "2006-08-13 10:00" "2006-08-13 11:00" """ if (len(sys.argv) != 3 and len(sys.argv) != 5): usage() input = sys.argv[1] output = sys.argv[2] # optional start and end times provided if (len(sys.argv) == 5): sliceLogFile = True startTime = convertISOToUnixTS(sys.argv[3]) endTime = convertISOToUnixTS(sys.argv[4]) else: sliceLogFile = False startTime = 0 endTime = 0 # The base time is the ctime for the log file baseTS = baseTimeStamp(input) # initialize local variables timeStampsBeforeGc = [] usedBeforeGc = [] timeStampsAfterGc = [] usedAfterGc = [] heapSizes = [] timeStampsForFullGc = [] fullGcIndicators = [] gcStartTS = -1 gcEndTS = -1 # read input and parse line by line fin = open(input, 'r') while (True): line = fin.readline() if (line == ""): break (tsoffset, usedBefore, usedAfter, elapsed, heapSize, isFullGc) = parse(line.rstrip()) # Set the first timestamp once for the very first record, and keep # updating the last timestamp until we run out of lines to read if (gcStartTS == -1): gcStartTS = tsoffset gcEndTS = tsoffset # If start and end times are specified, then we should ignore data # that are outside the range if (sliceLogFile): actualTime = baseTS - gcStartTS + tsoffset if (actualTime < startTime or actualTime > endTime): continue # X and Y arrays for before GC line, X will need postprocessing timeStampsBeforeGc.append(tsoffset) usedBeforeGc.append(usedBefore / 1024) # X and Y arrays for after GC line, X will need postprocessing timeStampsAfterGc.append(tsoffset + elapsed) usedAfterGc.append(usedAfter / 1024) # Y array for heap size (use minOffSetBeforeGC for X), will use # Y axis for after GC line heapSizes.append(heapSize / 1024) # X and Y arrays for Full GC line, X will need postprocessing if (isFullGc): timeStampsForFullGc.append(tsoffset) fullGcIndicators.append(1) fin.close() # Convert log start and end time stamps to printable format if (sliceLogFile): logStartTS = sys.argv[3] logEndTS = sys.argv[4] else: logStartTS = timeString(baseTS) logEndTS = timeString(baseTS + gcEndTS - gcStartTS) # convert timestamps from seconds since JVM startup to minutes elapsed # since first timestamp entry startTime = timeStampsBeforeGc[0] for i in range(len(timeStampsBeforeGc)): timeStampsBeforeGc[i] = minutesElapsed(timeStampsBeforeGc[i], startTime) timeStampsAfterGc[i] = minutesElapsed(timeStampsAfterGc[i], startTime) for i in range(len(timeStampsForFullGc)): timeStampsForFullGc[i] = minutesElapsed(timeStampsForFullGc[i], startTime) # Send off to graph results drawGraph(timeStampsBeforeGc, usedBeforeGc, timeStampsAfterGc, usedAfterGc, heapSizes, timeStampsForFullGc, fullGcIndicators, logStartTS, logEndTS, output) if __name__ == "__main__": main() alberttresens wrote: > > Hi, > Thanks for the reply. > I did already try it and still go the same trace back. I tried with long > arrays [1,2,....,n] and with short ones. I also tried with single numbers. > How can it get an out of range array? > > File "gcview.py", line 87, in drawGraph > plot([0],[0]) > File "/usr/local/lib/python2.6/site-packages/matplotlib/pyplot.py", line > 2287, in plot > ret = ax.plot(*args, **kwargs) > File "/usr/local/lib/python2.6/site-packages/matplotlib/axes.py", line > 3776, in plot > self.autoscale_view(scalex=scalex, scaley=scaley) > File "/usr/local/lib/python2.6/site-packages/matplotlib/axes.py", line > 1793, in autoscale_view > x0, x1 = xlocator.view_limits(x0, x1) > File "/usr/local/lib/python2.6/site-packages/matplotlib/ticker.py", line > 1176, in view_limits > return np.take(self.bin_boundaries(dmin, dmax), [0,-1]) > File "/usr/local/lib/python2.6/site-packages/numpy/core/fromnumeric.py", > line 103, in take > return take(indices, axis, out, mode) > IndexError: index out of range for array > > > > > John Hunter-4 wrote: >> >> On Wed, Jul 21, 2010 at 10:05 AM, alberttresens >> <alb...@gm...> wrote: >>> >>> I am getting this trace when trying to plot. I tried all possible >>> combinations in the plot parameters, always the same. Can someone recon >>> what >>> is happening? >>> >>> Traceback (most recent call last): >>> File "gcview.py", line 226, in <module> >>> main() >>> File "gcview.py", line 222, in main >>> drawGraph(timeStatpsBeforeGc, usedBeforeGc, timeStampsAfterGc, >>> usedAfterGc, heapSizes, timeStampsForFullGc, fullGcIndicators, >>> logStartTS, >>> logEndTS, output) >>> File "gcview.py", line 87, in drawGraph >>> plot(0,0) >> >> Recent versions of mpl support plotting of scalars, but older versions >> require plotting sequences. Here you might try: >> >> plot([0], [0]) >> >> instead of >> >> plot(0, 0) >> >> JDH >> >> ------------------------------------------------------------------------------ >> This SF.net email is sponsored by Sprint >> What will you do first with EVO, the first 4G phone? >> Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first >> _______________________________________________ >> Matplotlib-users mailing list >> Mat...@li... >> https://lists.sourceforge.net/lists/listinfo/matplotlib-users >> >> > > -- View this message in context: http://old.nabble.com/Plot%28%29-%3A-IndexError%3A-index-out-of-range-for-array-tp29226333p29234559.html Sent from the matplotlib - users mailing list archive at Nabble.com.
Could please anyone help me to get axises autoscaling in following example? I took it from the examples and slightly modified it to remove all unecessary things trying to make it as short as possible. Thanks in advance! import sys from matplotlib.figure import Figure from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg as FigureCanvas from PyQt4 import QtGui import numpy as np import time class BlitQT(FigureCanvas): def __init__(self): FigureCanvas.__init__(self, Figure()) self.ax = self.figure.add_subplot(111) self.ax.grid() self.draw() self.ax_background = self.copy_from_bbox(self.ax.bbox) self.cnt = 0 self.x = np.arange(0,2*np.pi,0.01) self.sin_line, = self.ax.plot(self.x, np.sin(self.x), animated=True) self.cos_line, = self.ax.plot(self.x, np.cos(self.x), animated=True) self.tstart = time.time() self.startTimer(10) def timerEvent(self, evt): self.restore_region(self.ax_background, bbox=self.ax.bbox) # update the data self.sin_line.set_ydata(np.sin(self.x+self.cnt/10.0)) self.cos_line.set_ydata((self.x+self.cnt)/50.0) # just draw the animated artist self.ax.draw_artist(self.sin_line) self.ax.draw_artist(self.cos_line) # just redraw the axes rectangle self.blit(self.ax.bbox) if self.cnt == 0: self.draw() self.cnt += 1 app = QtGui.QApplication(sys.argv) widget = BlitQT() widget.show() sys.exit(app.exec_())
Hi, Thanks for the reply. I did already try it and still go the same trace back. I tried with long arrays [1,2,....,n] and with short ones. I also tried with single numbers. How can it get an out of range array? File "gcview.py", line 87, in drawGraph plot([0],[0]) File "/usr/local/lib/python2.6/site-packages/matplotlib/pyplot.py", line 2287, in plot ret = ax.plot(*args, **kwargs) File "/usr/local/lib/python2.6/site-packages/matplotlib/axes.py", line 3776, in plot self.autoscale_view(scalex=scalex, scaley=scaley) File "/usr/local/lib/python2.6/site-packages/matplotlib/axes.py", line 1793, in autoscale_view x0, x1 = xlocator.view_limits(x0, x1) File "/usr/local/lib/python2.6/site-packages/matplotlib/ticker.py", line 1176, in view_limits return np.take(self.bin_boundaries(dmin, dmax), [0,-1]) File "/usr/local/lib/python2.6/site-packages/numpy/core/fromnumeric.py", line 103, in take return take(indices, axis, out, mode) IndexError: index out of range for array John Hunter-4 wrote: > > On Wed, Jul 21, 2010 at 10:05 AM, alberttresens > <alb...@gm...> wrote: >> >> I am getting this trace when trying to plot. I tried all possible >> combinations in the plot parameters, always the same. Can someone recon >> what >> is happening? >> >> Traceback (most recent call last): >> File "gcview.py", line 226, in <module> >> main() >> File "gcview.py", line 222, in main >> drawGraph(timeStatpsBeforeGc, usedBeforeGc, timeStampsAfterGc, >> usedAfterGc, heapSizes, timeStampsForFullGc, fullGcIndicators, >> logStartTS, >> logEndTS, output) >> File "gcview.py", line 87, in drawGraph >> plot(0,0) > > Recent versions of mpl support plotting of scalars, but older versions > require plotting sequences. Here you might try: > > plot([0], [0]) > > instead of > > plot(0, 0) > > JDH > > ------------------------------------------------------------------------------ > This SF.net email is sponsored by Sprint > What will you do first with EVO, the first 4G phone? > Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > > -- View this message in context: http://old.nabble.com/Plot%28%29-%3A-IndexError%3A-index-out-of-range-for-array-tp29226333p29234467.html Sent from the matplotlib - users mailing list archive at Nabble.com.
Hello João, this was really helpful. I really appreciate your work. Thanks so far, Ben On 2010年7月21日 13:19:21 +0100 João Luís Silva <js...@fc...> wrote: > On 07/21/2010 12:27 PM, Benjamin Koep wrote: > > Hello, > > > > I got a big problem currently and i really hope that someone here > > can help me. > > > > I am working on some graphs that are integrated into a django app. > > So far no problem. I had really no experience with matplotlib > > before but i managed to create 2 of 3 graph types the way our > > graphics designer wants them to be. > > > > The last variation is making me really sick because it has nothing > > much to do with an ordinary graph (except the fact that is has > > bars ;)). > > > > Please take a look at the attachment and give me a hint how i could > > realize that. I would really appreciate that. > > > > Kind regards, > > > > Ben > > > > The attached example (adapted mostly from barchart_demo2.py) should > guide you in the right direction. > > Regards, > João Luís
>> Hi there, >> >> I try to install matplotlib 1.0 via easy install. But a simple >> >> easy_install -U matplotlib >> >> produces this, effectively installing 0.99.1 >> >> Searching for matplotlib >> Reading http://pypi.python.org/simple/matplotlib/ >> Reading http://matplotlib.sourceforge.net >> Reading >> http://sourceforge.net/project/showfiles.php?group_id=80706&package_id=82474 >> Reading >> https://sourceforge.net/projects/matplotlib/files/matplotlib/matplotlib-1.0 >> Reading >> https://sourceforge.net/projects/matplotlib/files/matplotlib/matplotlib-0.99.3/ >> Reading http://sourceforge.net/project/showfiles.php?group_id=80706 >> Reading >> https://sourceforge.net/project/showfiles.php?group_id=80706&package_id=278194 >> Reading >> https://sourceforge.net/project/showfiles.php?group_id=80706&package_id=82474 >> Reading >> https://sourceforge.net/projects/matplotlib/files/matplotlib/matplotlib-0.99.1/ >> Best match: matplotlib 0.91.1 >> Downloading >> http://pypi.python.org/packages/source/m/matplotlib/matplotlib-0.91.1.tar.gz#md5=56a9344b077b5accbc4823be19f69dd6 >> >> Why is that? > > > What is your platform/OS and what version of python are you using and > where did you get it from? Linux antares 2.6.32-23-generic #37-Ubuntu SMP Fri Jun 11 08:03:28 UTC 2010 x86_64 GNU/Linux Ubuntu 10.4 LTS amd64 Python 2.6.5 from Ubuntu repositories. Cheers, A.
On 07/21/2010 09:11 AM, Aman Thakral wrote: > Ok, so I've fixed it. Its just because the mouse goes outside the axes. > How do I make the change in the code? > > Error: line 924 in widgets.py > > old code: > > x,y = event.xdata, event.ydata > > fixed code: > > if not event.xdata is None: > x = event.xdata > else: > x = self.prev[0] Good! When you make the svn diff, as requested by John, you might change to a more typical idiom--easier to read, to my eye at least: if event.xdata is None: x = self.prev[0] else: x = event.xdata Eric > > if not event.ydata is None: > y = event.ydata > else: > y = self.prev[1] > > I know it's a bit verbose, but it works. > > Thanks, > Aman > > On Wed, Jul 21, 2010 at 2:44 PM, Aman Thakral <ama...@gm... > <mailto:ama...@gm...>> wrote: > > Update on the error. > > It occurs in the following cases: > - User clicks and drags from left to right and approaches the edge > of the right side of the axes > - User clicks and drags from right to left and approaches the edge > of the left side of the axes > > I'm working on this bug now, I'll see if I can fix it. I'll welcome > any input you guys can provide though. > > Thanks, > Aman > > > On Wed, Jul 21, 2010 at 1:58 PM, Aman Thakral > <ama...@gm... <mailto:ama...@gm...>> wrote: > > Hi all, > > I'm getting the following exception when I use the Span > Selector. It happens when I try and select the entire region. > > Exception in Tkinter callback > > Traceback (most recent call last): > File "C:\Python26\lib\lib-tk\Tkinter.py", line 1410, in __call__ > return self.func(*args) > File > "C:\Python26\Lib\site-packages\matplotlib\backends\backend_tkagg.py", > line 246, in motion_notify_event > FigureCanvasBase.motion_notify_event(self, x, y, > guiEvent=event) > File > "C:\Python26\Lib\site-packages\matplotlib\backend_bases.py", > line 1245, in motion_notify_event > self.callbacks.process(s, event) > File "C:\Python26\Lib\site-packages\matplotlib\cbook.py", > line 165, in process > func(*args, **kwargs) > File "C:\Python26\Lib\site-packages\matplotlib\widgets.py", > line 952, in onmove > self.rect.set_width(maxv-minv) > TypeError: unsupported operand type(s) for -: 'float' and 'NoneType' > > > My sample code is shown here (its also attached): > > import matplotlib.pyplot as plt > from matplotlib.widgets import SpanSelector > import numpy as np > import datetime > > class TimeSelector(SpanSelector): > """ > SpanSelector that is only activated by the left mouse button > """ > def ignore(self,event): > if event.button == 2 or event.button == 3: return True > > def onselect(xmin,xmax): > print xmin,xmax > > fig = plt.figure() > ax = fig.add_subplot(111) > span = TimeSelector(ax, onselect, 'horizontal', useblit=True, > rectprops=dict(alpha=0.5, facecolor='yellow') ) > > y = np.random.rand(100,1) > start = datetime.datetime(2010,7,15,0,0) > x = [] > for i in range(len(y)): > x.append(start + datetime.timedelta(hours=i)) > > ax.plot_date(x,y,'b-') > plt.show() > > Any help on this issue would be greatly appreciated. > > Thanks, > Aman > > > > > -- > Aman Thakral > B.Eng & Biosci, M.Eng Design > > > > > -- > Aman Thakral > B.Eng & Biosci, M.Eng Design > > > > ------------------------------------------------------------------------------ > This SF.net email is sponsored by Sprint > What will you do first with EVO, the first 4G phone? > Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first > > > > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users
On Wed, Jul 21, 2010 at 2:11 PM, Aman Thakral <ama...@gm...> wrote: > Ok, so I've fixed it. Its just because the mouse goes outside the axes. How > do I make the change in the code? > > Error: line 924 in widgets.py > > old code: > > x,y = event.xdata, event.ydata > > fixed code: > > if not event.xdata is None: > x = event.xdata > else: > x = self.prev[0] > > if not event.ydata is None: > y = event.ydata > else: > y = self.prev[1] > > I know it's a bit verbose, but it works. Hey Aman, thanks for the fix. Could you create an svn diff, as described at: http://matplotlib.sourceforge.net/faq/howto_faq.html#contributing-howto JDH
On Wed, Jul 21, 2010 at 5:06 PM, Andreas <li...@hi...> wrote: > Hi there, > > I try to install matplotlib 1.0 via easy install. But a simple > > easy_install -U matplotlib > > produces this, effectively installing 0.99.1 > > Searching for matplotlib > Reading http://pypi.python.org/simple/matplotlib/ > Reading http://matplotlib.sourceforge.net > Reading > http://sourceforge.net/project/showfiles.php?group_id=80706&package_id=82474 > Reading > https://sourceforge.net/projects/matplotlib/files/matplotlib/matplotlib-1.0 > Reading > https://sourceforge.net/projects/matplotlib/files/matplotlib/matplotlib-0.99.3/ > Reading http://sourceforge.net/project/showfiles.php?group_id=80706 > Reading > https://sourceforge.net/project/showfiles.php?group_id=80706&package_id=278194 > Reading > https://sourceforge.net/project/showfiles.php?group_id=80706&package_id=82474 > Reading > https://sourceforge.net/projects/matplotlib/files/matplotlib/matplotlib-0.99.1/ > Best match: matplotlib 0.91.1 > Downloading > http://pypi.python.org/packages/source/m/matplotlib/matplotlib-0.91.1.tar.gz#md5=56a9344b077b5accbc4823be19f69dd6 > > Why is that? What is your platform/OS and what version of python are you using and where did you get it from? http://matplotlib.sourceforge.net/faq/troubleshooting_faq.html#report-a-problem JDH
On Wed, Jul 21, 2010 at 10:05 AM, alberttresens <alb...@gm...> wrote: > > I am getting this trace when trying to plot. I tried all possible > combinations in the plot parameters, always the same. Can someone recon what > is happening? > > Traceback (most recent call last): > File "gcview.py", line 226, in <module> > main() > File "gcview.py", line 222, in main > drawGraph(timeStatpsBeforeGc, usedBeforeGc, timeStampsAfterGc, > usedAfterGc, heapSizes, timeStampsForFullGc, fullGcIndicators, logStartTS, > logEndTS, output) > File "gcview.py", line 87, in drawGraph > plot(0,0) Recent versions of mpl support plotting of scalars, but older versions require plotting sequences. Here you might try: plot([0], [0]) instead of plot(0, 0) JDH
On Wed, Jul 21, 2010 at 9:16 AM, alberttresens <alb...@gm...> wrote: > I am trying to do a plot, and getting and out of index, I am not sure what > is reason. I tried all combinations even with empty arrays and possible > indexes. Always the same. Any one can recon what is happening from the > trace? Traceback (most recent call last): File "gcview.py", line 226, in > main() File "gcview.py", line 222, in main drawGraph(timeStampsBeforeGc, > usedBeforeGc, timeStampsAfterGc, usedAfterGc, heapSizes, > timeStampsForFullGc, fullGcIndicators, logStartTS, logEndTS, output) File > "gcview.py", line 87, in drawGraph plot(0,0) File > "/usr/local/lib/python2.6/site-packages/matplotlib/pyplot.py", line 2287, in > plot ret = ax.plot(*args, **kwargs) File > "/usr/local/lib/python2.6/site-packages/matplotlib/axes.py", line 3776, in > plot self.autoscale_view(scalex=scalex, scaley=scaley) File > "/usr/local/lib/python2.6/site-packages/matplotlib/axes.py", 1793, in > autoscale_view x0, x1 = xlocator.view_limits(x0, x1) File > "/usr/local/lib/python2.6/site-packages/matplotlib/ticker.py", line 1176, in > view_limits return np.take(self.bin_boundaries(dmin, dmax), [0,-1]) File > "/usr/local/lib/python2.6/site-packages/numpy/core/fromnumeric.py", line > 103, in take return take(indices, axis, out, mode) IndexError: index out of > range for array Can you post a free-standing script that we can run that exposes the problem, and please post your mpl version info and other relevant info suggested at: http://matplotlib.sourceforge.net/faq/troubleshooting_faq.html#report-a-problem JDH
Hi there, I try to install matplotlib 1.0 via easy install. But a simple easy_install -U matplotlib produces this, effectively installing 0.99.1 Searching for matplotlib Reading http://pypi.python.org/simple/matplotlib/ Reading http://matplotlib.sourceforge.net Reading http://sourceforge.net/project/showfiles.php?group_id=80706&package_id=82474 Reading https://sourceforge.net/projects/matplotlib/files/matplotlib/matplotlib-1.0 Reading https://sourceforge.net/projects/matplotlib/files/matplotlib/matplotlib-0.99.3/ Reading http://sourceforge.net/project/showfiles.php?group_id=80706 Reading https://sourceforge.net/project/showfiles.php?group_id=80706&package_id=278194 Reading https://sourceforge.net/project/showfiles.php?group_id=80706&package_id=82474 Reading https://sourceforge.net/projects/matplotlib/files/matplotlib/matplotlib-0.99.1/ Best match: matplotlib 0.91.1 Downloading http://pypi.python.org/packages/source/m/matplotlib/matplotlib-0.91.1.tar.gz#md5=56a9344b077b5accbc4823be19f69dd6 Why is that? cheers, A.
I'm not sure I understand the question. Are there any error messages produced? Have you read this (about using matplotlib on a web server)? http://matplotlib.sourceforge.net/faq/howto_faq.html#matplotlib-in-a-web-application-server Mike On 07/21/2010 03:30 PM, Waléria Antunes David wrote: > Hello... > > I'm trying to use this to format the numbers (3000,3400) of the x > axis, however when i do in the ILDE Python it's work.....but if i do > using Django as bellow the image doesn't appear....look > > IDLE Python: http://pastebin.com/q7FnHhPw > > Using Django: http://pastebin.com/GrcMP9iA > > Help me....please... > > On Thu, Jul 15, 2010 at 10:48 AM, > <mat...@li... > <mailto:mat...@li...>> wrote: > > Send Matplotlib-users mailing list submissions to > mat...@li... > <mailto:mat...@li...> > > To subscribe or unsubscribe via the World Wide Web, visit > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > or, via email, send a message with subject or body 'help' to > mat...@li... > <mailto:mat...@li...> > > You can reach the person managing the list at > mat...@li... > <mailto:mat...@li...> > > When replying, please edit your Subject line so it is more specific > than "Re: Contents of Matplotlib-users digest..." > > > Today's Topics: > > 1. scientific notation (Wal?ria Antunes David) > > > ---------------------------------------------------------------------- > > Message: 1 > Date: 2010年7月15日 10:41:52 -0300 > From: Wal?ria Antunes David <wal...@gm... > <mailto:wal...@gm...>> > Subject: [Matplotlib-users] scientific notation > To: mat...@li... > <mailto:mat...@li...> > Message-ID: > <AAN...@ma... > <mailto:AAN...@ma...>> > Content-Type: text/plain; charset="iso-8859-1" > > Hi all, > > I have a code base so that: > > > from pylab import * > x = arange (3000,3400) > y = -108 * (3.0e14 ** 2)/x**2 > > pylab..title("Teste") > pylab.savefig("imagem.png") > plot(x, y) > > > Well.... the values of the function range(3000,3400) are in > Hz......i need > to pass GHz which would be in scientific notation as follows bellow: > > 3000 Hz = 3,0 ? 10-6 GHz > 3400 Hz = 3,4 x 10-6 Ghz > > How do I make the graph x-axis is shown in figures > scientific notation, for this currently so > > 3000,3050,3100,....,3400 > > in scientific notation is: (3.0e-6, 3.4e-6) > > Can someone help me? > > See my attachment.... > > I need to show this values in scientific notation...... > > Wal?ria > -------------- next part -------------- > An HTML attachment was scrubbed... > -------------- next part -------------- > A non-text attachment was scrubbed... > Name: current_image.jpg > Type: image/jpeg > Size: 35656 bytes > Desc: not available > > ------------------------------ > > ------------------------------------------------------------------------------ > This SF.net email is sponsored by Sprint > What will you do first with EVO, the first 4G phone? > Visit sprint.com/first <http://sprint.com/first> -- > http://p.sf.net/sfu/sprint-com-first > > ------------------------------ > > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > <mailto:Mat...@li...> > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > > > End of Matplotlib-users Digest, Vol 50, Issue 37 > ************************************************ > > > > ------------------------------------------------------------------------------ > This SF.net email is sponsored by Sprint > What will you do first with EVO, the first 4G phone? > Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first > > > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users >
Hello... I'm trying to use this to format the numbers (3000,3400) of the x axis, however when i do in the ILDE Python it's work.....but if i do using Django as bellow the image doesn't appear....look IDLE Python: http://pastebin.com/q7FnHhPw Using Django: http://pastebin.com/GrcMP9iA Help me....please... On Thu, Jul 15, 2010 at 10:48 AM, < mat...@li...> wrote: > Send Matplotlib-users mailing list submissions to > mat...@li... > > To subscribe or unsubscribe via the World Wide Web, visit > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > or, via email, send a message with subject or body 'help' to > mat...@li... > > You can reach the person managing the list at > mat...@li... > > When replying, please edit your Subject line so it is more specific > than "Re: Contents of Matplotlib-users digest..." > > > Today's Topics: > > 1. scientific notation (Wal?ria Antunes David) > > > ---------------------------------------------------------------------- > > Message: 1 > Date: 2010年7月15日 10:41:52 -0300 > From: Wal?ria Antunes David <wal...@gm...> > Subject: [Matplotlib-users] scientific notation > To: mat...@li... > Message-ID: > <AAN...@ma...> > Content-Type: text/plain; charset="iso-8859-1" > > Hi all, > > I have a code base so that: > > > from pylab import * > x = arange (3000,3400) > y = -108 * (3.0e14 ** 2)/x**2 > > pylab..title("Teste") > pylab.savefig("imagem.png") > plot(x, y) > > > Well.... the values of the function range(3000,3400) are in Hz......i need > to pass GHz which would be in scientific notation as follows bellow: > > 3000 Hz = 3,0 ? 10-6 GHz > 3400 Hz = 3,4 x 10-6 Ghz > > How do I make the graph x-axis is shown in figures > scientific notation, for this currently so > > 3000,3050,3100,....,3400 > > in scientific notation is: (3.0e-6, 3.4e-6) > > Can someone help me? > > See my attachment.... > > I need to show this values in scientific notation...... > > Wal?ria > -------------- next part -------------- > An HTML attachment was scrubbed... > -------------- next part -------------- > A non-text attachment was scrubbed... > Name: current_image.jpg > Type: image/jpeg > Size: 35656 bytes > Desc: not available > > ------------------------------ > > > ------------------------------------------------------------------------------ > This SF.net email is sponsored by Sprint > What will you do first with EVO, the first 4G phone? > Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first > > ------------------------------ > > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > > > End of Matplotlib-users Digest, Vol 50, Issue 37 > ************************************************ >
Ok, so I've fixed it. Its just because the mouse goes outside the axes. How do I make the change in the code? Error: line 924 in widgets.py old code: x,y = event.xdata, event.ydata fixed code: if not event.xdata is None: x = event.xdata else: x = self.prev[0] if not event.ydata is None: y = event.ydata else: y = self.prev[1] I know it's a bit verbose, but it works. Thanks, Aman On Wed, Jul 21, 2010 at 2:44 PM, Aman Thakral <ama...@gm...>wrote: > Update on the error. > > It occurs in the following cases: > - User clicks and drags from left to right and approaches the edge of the > right side of the axes > - User clicks and drags from right to left and approaches the edge of the > left side of the axes > > I'm working on this bug now, I'll see if I can fix it. I'll welcome any > input you guys can provide though. > > Thanks, > Aman > > > On Wed, Jul 21, 2010 at 1:58 PM, Aman Thakral <ama...@gm...>wrote: > >> Hi all, >> >> I'm getting the following exception when I use the Span Selector. It >> happens when I try and select the entire region. >> >> Exception in Tkinter callback >> >> Traceback (most recent call last): >> File "C:\Python26\lib\lib-tk\Tkinter.py", line 1410, in __call__ >> return self.func(*args) >> File >> "C:\Python26\Lib\site-packages\matplotlib\backends\backend_tkagg.py", line >> 246, in motion_notify_event >> FigureCanvasBase.motion_notify_event(self, x, y, guiEvent=event) >> File "C:\Python26\Lib\site-packages\matplotlib\backend_bases.py", line >> 1245, in motion_notify_event >> self.callbacks.process(s, event) >> File "C:\Python26\Lib\site-packages\matplotlib\cbook.py", line 165, in >> process >> func(*args, **kwargs) >> File "C:\Python26\Lib\site-packages\matplotlib\widgets.py", line 952, in >> onmove >> self.rect.set_width(maxv-minv) >> TypeError: unsupported operand type(s) for -: 'float' and 'NoneType' >> >> >> My sample code is shown here (its also attached): >> >> import matplotlib.pyplot as plt >> from matplotlib.widgets import SpanSelector >> import numpy as np >> import datetime >> >> class TimeSelector(SpanSelector): >> """ >> SpanSelector that is only activated by the left mouse button >> """ >> def ignore(self,event): >> if event.button == 2 or event.button == 3: return True >> >> def onselect(xmin,xmax): >> print xmin,xmax >> >> fig = plt.figure() >> ax = fig.add_subplot(111) >> span = TimeSelector(ax, onselect, 'horizontal', useblit=True, >> rectprops=dict(alpha=0.5, facecolor='yellow') ) >> >> y = np.random.rand(100,1) >> start = datetime.datetime(2010,7,15,0,0) >> x = [] >> for i in range(len(y)): >> x.append(start + datetime.timedelta(hours=i)) >> >> ax.plot_date(x,y,'b-') >> plt.show() >> >> Any help on this issue would be greatly appreciated. >> >> Thanks, >> Aman >> > > > > -- > Aman Thakral > B.Eng & Biosci, M.Eng Design > -- Aman Thakral B.Eng & Biosci, M.Eng Design
Update on the error. It occurs in the following cases: - User clicks and drags from left to right and approaches the edge of the right side of the axes - User clicks and drags from right to left and approaches the edge of the left side of the axes I'm working on this bug now, I'll see if I can fix it. I'll welcome any input you guys can provide though. Thanks, Aman On Wed, Jul 21, 2010 at 1:58 PM, Aman Thakral <ama...@gm...>wrote: > Hi all, > > I'm getting the following exception when I use the Span Selector. It > happens when I try and select the entire region. > > Exception in Tkinter callback > > Traceback (most recent call last): > File "C:\Python26\lib\lib-tk\Tkinter.py", line 1410, in __call__ > return self.func(*args) > File > "C:\Python26\Lib\site-packages\matplotlib\backends\backend_tkagg.py", line > 246, in motion_notify_event > FigureCanvasBase.motion_notify_event(self, x, y, guiEvent=event) > File "C:\Python26\Lib\site-packages\matplotlib\backend_bases.py", line > 1245, in motion_notify_event > self.callbacks.process(s, event) > File "C:\Python26\Lib\site-packages\matplotlib\cbook.py", line 165, in > process > func(*args, **kwargs) > File "C:\Python26\Lib\site-packages\matplotlib\widgets.py", line 952, in > onmove > self.rect.set_width(maxv-minv) > TypeError: unsupported operand type(s) for -: 'float' and 'NoneType' > > > My sample code is shown here (its also attached): > > import matplotlib.pyplot as plt > from matplotlib.widgets import SpanSelector > import numpy as np > import datetime > > class TimeSelector(SpanSelector): > """ > SpanSelector that is only activated by the left mouse button > """ > def ignore(self,event): > if event.button == 2 or event.button == 3: return True > > def onselect(xmin,xmax): > print xmin,xmax > > fig = plt.figure() > ax = fig.add_subplot(111) > span = TimeSelector(ax, onselect, 'horizontal', useblit=True, > rectprops=dict(alpha=0.5, facecolor='yellow') ) > > y = np.random.rand(100,1) > start = datetime.datetime(2010,7,15,0,0) > x = [] > for i in range(len(y)): > x.append(start + datetime.timedelta(hours=i)) > > ax.plot_date(x,y,'b-') > plt.show() > > Any help on this issue would be greatly appreciated. > > Thanks, > Aman > -- Aman Thakral B.Eng & Biosci, M.Eng Design
Hello All, Using matplotlib, how can an image be saved as color-mapped 8-bit rather than as true-color? Thanks, -- jv
I am getting this trace when trying to plot. I tried all possible combinations in the plot parameters, always the same. Can someone recon what is happening? Traceback (most recent call last): File "gcview.py", line 226, in <module> main() File "gcview.py", line 222, in main drawGraph(timeStampsBeforeGc, usedBeforeGc, timeStampsAfterGc, usedAfterGc, heapSizes, timeStampsForFullGc, fullGcIndicators, logStartTS, logEndTS, output) File "gcview.py", line 87, in drawGraph plot(0,0) File "/usr/local/lib/python2.6/site-packages/matplotlib/pyplot.py", line 2287, in plot ret = ax.plot(*args, **kwargs) File "/usr/local/lib/python2.6/site-packages/matplotlib/axes.py", line 3776, in plot self.autoscale_view(scalex=scalex, scaley=scaley) File "/usr/local/lib/python2.6/site-packages/matplotlib/axes.py", line 1793, in autoscale_view x0, x1 = xlocator.view_limits(x0, x1) File "/usr/local/lib/python2.6/site-packages/matplotlib/ticker.py", line 1176, in view_limits return np.take(self.bin_boundaries(dmin, dmax), [0,-1]) File "/usr/local/lib/python2.6/site-packages/numpy/core/fromnumeric.py", line 103, in take return take(indices, axis, out, mode) IndexError: index out of range for array -- View this message in context: http://old.nabble.com/Plot%28%29-%3A-IndexError%3A-index-out-of-range-for-array-tp29226333p29226333.html Sent from the matplotlib - users mailing list archive at Nabble.com.
I am trying to do a plot, and getting and out of index, I am not sure what is reason. I tried all combinations even with empty arrays and possible indexes. Always the same. Any one can recon what is happening from the trace? Traceback (most recent call last): File "gcview.py", line 226, in main() File "gcview.py", line 222, in main drawGraph(timeStampsBeforeGc, usedBeforeGc, timeStampsAfterGc, usedAfterGc, heapSizes, timeStampsForFullGc, fullGcIndicators, logStartTS, logEndTS, output) File "gcview.py", line 87, in drawGraph plot(0,0) File "/usr/local/lib/python2.6/site-packages/matplotlib/pyplot.py", line 2287, in plot ret = ax.plot(*args, **kwargs) File "/usr/local/lib/python2.6/site-packages/matplotlib/axes.py", line 3776, in plot self.autoscale_view(scalex=scalex, scaley=scaley) File "/usr/local/lib/python2.6/site-packages/matplotlib/axes.py", line 1793, in autoscale_view x0, x1 = xlocator.view_limits(x0, x1) File "/usr/local/lib/python2.6/site-packages/matplotlib/ticker.py", line 1176, in view_limits return np.take(self.bin_boundaries(dmin, dmax), [0,-1]) File "/usr/local/lib/python2.6/site-packages/numpy/core/fromnumeric.py", line 103, in take return take(indices, axis, out, mode) IndexError: index out of range for array -- View this message in context: http://old.nabble.com/Plot%28%29-traceback-issue-tp29226304p29226304.html Sent from the matplotlib - users mailing list archive at Nabble.com.
That really depends on what you want to do. For one single graph with these specific values, it is quick and easy and hence very satisfying *if that is what you need*. No need to go across the river for water. But, Daniele came up with a different and more sturdy solution (that I have used in scripts of my own too), which is to specify the axes as max-of-the-data-plus-a-bit reflected about a centered zero axis. This is not data specific, more reusable, but also takes longer to write. On Tue, 2010年07月20日 at 15:28 -0500, Benjamin Root wrote: > Somehow, this doesn't seem very satisfying. It is almost accidental. > There has to be a better way to do this. > > Ben Root > > 2010年7月20日 Thøger Emil Juul Thorsen <th...@fy...> > One way is to specify the axes manually, e.g. setting: > > (with matyplotlib.pyplot importad as plt:) > > plt.axis([200, 500, -600, 600]) > > ...or whatever seems fitting for you, and do that on both of > the y axes. > That should align them nicely. > > > On Sat, 2010年07月17日 at 20:37 +0200, Daniele Padula wrote: > > Hi everybody, > > I have a problem with a plot. I attach a figure to be easily > understandable. > > > > As you can see from the figure, I have in the same area a > line and a bar > > plot. The problem is that y=0 for right y axis is different > with respect > > to left y axis one. I want the two y=0 to be the same. > > > > How can i do that? > > > > Excuse me for my bad english, I'm italian :) > > > > Thanks in advance. > > > > ------------------------------------------------------------------------------ > > This SF.net email is sponsored by Sprint > > What will you do first with EVO, the first 4G phone? > > Visit sprint.com/first -- > http://p.sf.net/sfu/sprint-com-first > > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > > > > ------------------------------------------------------------------------------ > This SF.net email is sponsored by Sprint > What will you do first with EVO, the first 4G phone? > Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users >