[Matplotlib-users] plot_date() - Correct format to plot
Hi, I would like to be able to plot dates along the X axis' with values up the Y. However Im having problems with the correct format in order to pass to plot_date(). This is what I have so far: (example) List = [ [datetime.datetime(2008, 7, 12, 5, 12)], ['46.8'] ] plot_date(List[0], List[1]) # Returns error: c = numeric.array(data, dtype=tc, copy=True, order=order) ValueError: setting an array element with a sequence. # I have looked at the pylab example for plot_date, however it uses a drange() to figure out the dates and doesn't show me how to do it one by one. Thank you for your time. -- View this message in context: http://www.nabble.com/plot_date%28%29---Correct-format-to-plot-tp19181899p19181899.html Sent from the matplotlib - users mailing list archive at Nabble.com. - This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100url=/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] Set MPLCONFIGDIR to something different
Hi, Im getting the error: type 'exceptions.RuntimeError': Failed to create /$dirstring$/common/.matplotlib; consider setting MPLCONFIGDIR to a writable directory for matplotlib configuration data The problem is I do not have write access to the MatPlotLib module sourse, so I cannot change the MPLCONFIGDIR variable, where ever it is..! So my question is can I set MPLCONFIGDIR to say /home/user/dirs/ in my script somewhere, so that I know the that directory has read/write access. Thank you for your time. Regards -- View this message in context: http://www.nabble.com/Set-MPLCONFIGDIR-to-something-different-tp19033822p19033822.html Sent from the matplotlib - users mailing list archive at Nabble.com. - This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100url=/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] colorbar() fix limit on Heat map
Hi All, You may remember from my previous post I was having problems plotting a heatmap, however Pete came through for me and made it work. Anyway, I have almost finished what I want to do. The only issue is fixing the colorbar() range limit. Sometimes the my values are 0.01 to 0.2 for example, and other times there 0.01 to 0.99. So what happens it the colorbar() automagically adjusts the gradient according to my values, however I do not want it to do that, I want the graph to be consistantly 0 - 1 (blue - red). I have tried things like colorbar(0,1), however no luck. If you could let me know how to fix the range, I would be very grateful. Regards -- View this message in context: http://www.nabble.com/colorbar%28%29-fix-limit-on-Heat-map-tp18923300p18923300.html Sent from the matplotlib - users mailing list archive at Nabble.com. - This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100url=/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Contour/Contourf Plot Heatmap - Grid - Multiple Items
Hi Pete / All, Thank you for the help so far, really appreciate it. I have managed to plot the graph above using the code you gave me: ### z=rand(3,3) pcolormesh(z) colorbar() savefig('colour.png') ### However, I am trying to find out what rand() actually does..? Apparently I shouldn't use it unless a specific C library is required...? Also what does rand(3,3) actually produce? is it a list, dict, im not really sure. if I print rand(3,3) I get this: [[ 0.66877509 0.58785363 0.32387598] [ 0.30220588 0.39593143 0.82576463] [ 0.41322716 0.49939853 0.99874519]] Which looks like a list but without commas, also how would I address a grid position.. say.. (2,3) and plot a value to that? Thank you -- View this message in context: http://www.nabble.com/Contour-Contourf-Plot-Heatmap---Grid---Multiple-Items-tp18872991p18887443.html Sent from the matplotlib - users mailing list archive at Nabble.com. - This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100url=/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Contour/Contourf Plot Heatmap - Grid - Multiple Items
Thanks again Pete for your help. I have numpy imported, and here is what my code looks like: import matplotlib import numpy from numpy import * from pylab import * list = [0.66877509, 0.58785363, 0.32387598, 0.16877509, 0.48785363, 0.22387598, 0.96877509, 0.18785363, 0.52387598] newlist = list.reshape(3,3) pcolormesh(newlist) colorbar() savefig('colour.png') However I get the error: Traceback (most recent call last): File colour.py, line 24, in module newlist = list.reshape(3,3) AttributeError: 'list' object has no attribute 'reshape' Just to note I get no error when numpy in imported. Thank you. -- View this message in context: http://www.nabble.com/Contour-Contourf-Plot-Heatmap---Grid---Multiple-Items-tp18872991p1817.html Sent from the matplotlib - users mailing list archive at Nabble.com. - This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100url=/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Contour/Contourf Plot Heatmap - Grid - Multiple Items
AH HA! Pete, you are a life saver! Thank you so much for all your help ! -- View this message in context: http://www.nabble.com/Contour-Contourf-Plot-Heatmap---Grid---Multiple-Items-tp18872991p1931.html Sent from the matplotlib - users mailing list archive at Nabble.com. - This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100url=/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] Contour/Contourf Plot Heatmap - Grid - Multiple Items
Hi, I have been using matplotlib for about 2 weeks now. I thought it would be good to try plotting heatmaps to show some data. The idea: I have 100 values all ranging from 0.00 to 1.00, I would like to create a graph with a 10 by 10 grid. Therefore each value has 1 section of the grid. So, for example if the value was 0.10, the colour would be blue, or if 0.95, the colour red. Now the problem is I do not know how to access each individual grid position, I guess I would have some form of counter system to count 0 - 9 on the X axis and 0 - 9 on the Y also. Here is my pseudo code: ## Count1 = 0 ## For the X axis Count2 = 0 ## For the Y axis Max = 0 ## To count 0 - 99 ListValues = [0.11, 0.09, 0.34, 0.44, 0.29, all the way to 100 values] while Max 100: if Count1 == 10: Count2 = Count2 + 1 ## Increase the Y axis by one Count1 = 0 ## If X axis counter = 10, reset it to 0 else: GridPosition = [] GridPosition.append(Count1) GridPosition.append(Count2) GridValue = ListValues[Max] # Now armed with the GridPosition and GridValue, im stuck on how to plot the square... ## So as you can see from above, I have the data ready to fill the relevant grid position, just unsure on how to actually do it! Just to clarify, this is a heatmap, so the GridValue should correspond to a colour and fill that particular square with the colour from the colorbar i.e. levels = arange(0.0, 1.0, 0.025) Thank you in advance for any help. -- View this message in context: http://www.nabble.com/Contour-Contourf-Plot-Heatmap---Grid---Multiple-Items-tp18872991p18872991.html Sent from the matplotlib - users mailing list archive at Nabble.com. - This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100url=/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Contour/Contourf Plot Heatmap - Grid - Multiple Items
Hi Pete, Thanks for the quick response. Will imshow() actually plot the graph? Do I not need to do something like: contourf(X, Y, Z, levels) Thanks -- View this message in context: http://www.nabble.com/Contour-Contourf-Plot-Heatmap---Grid---Multiple-Items-tp18872991p18874222.html Sent from the matplotlib - users mailing list archive at Nabble.com. - This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100url=/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] Using Hex number with shape syntax
Hi, I am just playing around with different shapes and colours at the moment, I have managed the standard colours like this: plot(Time, Value, 'r.') Which obviously prints a red dot. However how do use the hex colour map with the ., I have tried: plot(Time, Value, '#330066.') plot(Time, Value, '#330066,.') plot(Time, Value, '#330066' '.') plot(Time, Value, '#330066', '.') Not quite sure on the syntax. Thank you in advance -- View this message in context: http://www.nabble.com/Using-Hex-number-with-shape-syntax-tp18808107p18808107.html Sent from the matplotlib - users mailing list archive at Nabble.com. - This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100url=/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Using Hex number with shape syntax
Perfect! Thanks guys Did this in the end: plot(Time, Value, 'o', markersize = 1, markerfacecolor = '#330066', markeredgecolor = '#330066' -- View this message in context: http://www.nabble.com/Using-Hex-number-with-shape-syntax-tp18808107p18811425.html Sent from the matplotlib - users mailing list archive at Nabble.com. - This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100url=/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Plot a Dictionary, time and value
Thank you John, Just what I was looking for. John Hunter-4 wrote: On Wed, Jul 30, 2008 at 9:17 AM, stuartornum [EMAIL PROTECTED] wrote: Hi, Wondering if anyone has done something similar and could point me in the right direction. I have a dictionary like this: Dict{'00:00:00':'23', '00:01:00':'29', '00:02:00':'13', '00:03:00':'78', '00:04:00':'45', '23:59:00':54} So as you can see there is 24 hours worth of minutes, with a value attached to each minute. Firstly, just to note the Dictionary Dict is not actually in order as above, it is all jumbled up. However is it possible to plot a dictionary using MatPlotLib, and using the time along the x-axis and values up the y? You will have to extract the x and y values, and convert them from strings to values matplotlib can understand (for example dates and floating point numbers). Eg In [30]: d = {'00:00:00':'23', '00:01:00':'29', '00:02:00':'13', '00:03:00':'78', '00:04:00':'45', '23:59:00':54} In [32]: from dateutil.parser import parse In [33]: items = [(parse(date), float(val)) for date, val in d.items()] In [34]: items.sort() In [35]: items Out[35]: [(datetime.datetime(2008, 7, 30, 0, 0), 23.0), (datetime.datetime(2008, 7, 30, 0, 1), 29.0), (datetime.datetime(2008, 7, 30, 0, 2), 13.0), (datetime.datetime(2008, 7, 30, 0, 3), 78.0), (datetime.datetime(2008, 7, 30, 0, 4), 45.0), (datetime.datetime(2008, 7, 30, 23, 59), 54.0)] In [36]: dates, values = zip(*items) In [37]: plot(dates, values) Out[37]: [matplotlib.lines.Line2D object at 0xb45a5ec] - This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100url=/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- View this message in context: http://www.nabble.com/Plot-a-Dictionary%2C-time-and-value-tp18734294p18750474.html Sent from the matplotlib - users mailing list archive at Nabble.com. - This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100url=/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] Plot Multiple List by concatenating to a string?
Hi again, This is slightly similar to my previous post, however using lists, not dictionaires. So, I have a for loop that produces two list, as follows: Hours = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '20', '21', '22', '23'] and Values = ['5.8', '5.76', '5.81', '5.72', '5.69', '5.88', '5.77', '5.64', '6.78', '5.82', '6.74', '5.45', '5.61', '5.77', '10.02', '5.88', '5.77', '5.64', '6.78', '5.82', '6.74', '5.45', '5.61'] So as you can see for each hour a value is given, now plotting this is simple, its just plot(Hours, Values). However, this is generated from a for loop and there could be anything from 1 to 1000 of the Hours and Values lists (The Hours list is always the same), and I would like to plot all on the same axis. Is there a way to build a plot string, and then plot the string once the for loop has finished. i.e PlotString = for item in AList: Hours = item[0] Values = item[1] PlotString += Hours, Values plot(PlotString) Now I know the above does not work, but it is purely to describe where I am trying to go. Thank you for all your help. -- View this message in context: http://www.nabble.com/Plot-Multiple-List-by-concatenating-to-a-string--tp18751780p18751780.html Sent from the matplotlib - users mailing list archive at Nabble.com. - This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100url=/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Plot Multiple List by concatenating to a string?
Hi Alan, Thanks for the reply. I have literally in the past few days started using matplotlib, and python for about 3 weeks prior. So I am not at all up-to-date with all its functionality. In regards to 2D objects, I have no idea. Thanks again Alan G Isaac wrote: On Thu, 31 Jul 2008, stuartornum apparently wrote: Is there a way to build a plot string, and then plot the string once the for loop has finished. What gain are you looking for over your lists, which seems an efficient approach? You realize plot accepts 2d objects, right? http://matplotlib.sourceforge.net/matplotlib.pyplot.html#-plot So you can just make a list of lists for the dependent variables. Cheers, Alan Isaac - This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100url=/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- View this message in context: http://www.nabble.com/Plot-Multiple-List-by-concatenating-to-a-string--tp18751780p18757080.html Sent from the matplotlib - users mailing list archive at Nabble.com. - This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100url=/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] Plot a Dictionary, time and value
Hi, Wondering if anyone has done something similar and could point me in the right direction. I have a dictionary like this: Dict{'00:00:00':'23', '00:01:00':'29', '00:02:00':'13', '00:03:00':'78', '00:04:00':'45', '23:59:00':54} So as you can see there is 24 hours worth of minutes, with a value attached to each minute. Firstly, just to note the Dictionary Dict is not actually in order as above, it is all jumbled up. However is it possible to plot a dictionary using MatPlotLib, and using the time along the x-axis and values up the y? Thank you in advanced -- View this message in context: http://www.nabble.com/Plot-a-Dictionary%2C-time-and-value-tp18734294p18734294.html Sent from the matplotlib - users mailing list archive at Nabble.com. - This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100url=/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users