amauboussin / Matplotlib1D-plot

Adds number line plotting ability to Matplotlib
7 stars 0 forks source link

number_line_example.py fails ootb #1

Open jwalterlarson opened 11 years ago

jwalterlarson commented 11 years ago

Hi...

First of all, thank you for creating this code and making it publicly available! The output looks lovely, and I think you're filling an important niche in the matplotlib ecosystem.

I did a read-only clone of your source from github and tried running the example code out of the box (ootb). Sadly, it failed with this error message:

larson@calhoun:Matplotlib1D-plot>python number_line_example.py Traceback (most recent call last): File "number_line_example.py", line 9, in numline.graph(e) File "/Users/larson/Scratch/NumberLine/Matplotlib1D-plot/number_line.py", line 96, in graph toGraph = self.solve(eq,toGraph) File "/Users/larson/Scratch/NumberLine/Matplotlib1D-plot/number_line.py", line 148, in solve toGraph.append([self.getAfter(eq,'>') , self.ceil]) File "/Users/larson/Scratch/NumberLine/Matplotlib1D-plot/number_line.py", line 167, in getAfter raise Exception("Error parsing equations. Make sure they are of the format x>1 where x is any variable and 1 is any number") Exception: Error parsing equations. Make sure they are of the format x>1 where x is any variable and 1 is any number I didn't modify anything in your distribution. I'm using python 2.7.4. Any advice, help you can offer in addressing this mysterious message is greatly appreciated. Thanks and all the best... Jay P.S.: I should explain why I downloaded your code. My primary reason was work-related--I want to plot 1-D _sets_ of points rather than intervals (to visualize some work I'm doing with 1-D meshes and multigrid techniques), and had been hoping I could modify your code simply to plot sets of individual points. The second reason of course is that I have a 12-year-old son who doesn't share my love of mathematics, but he is pretty keen on python programming.
amauboussin commented 11 years ago

Glad you are interested! Thanks for pointing out that bug - I added a little snippet of code that would allow the graph function to take either a string or a list of strings right before my last commit and forgot to test it. I pushed a new version with a fix so everything should be alright out of the box now.

I also added a new function, plot_points, that takes a list of numbers as input and bypasses the equation parsing code. Example usage is at the end of number_line_example.py. Hopefully this is helpful. Feel free to let me know if you any other questions about the code. I have a lot of free time over the next week since I am in between the school year and my summer internship.

-Andrew

On Thu, May 23, 2013 at 6:58 PM, J. Walter Larson notifications@github.comwrote:

Hi...

First of all, thank you for creating this code and making it publicly available! The output looks lovely, and I think you're filling an important niche in the matplotlib ecosystem.

I did a read-only clone of your source from github and tried running the example code out of the box (ootb). Sadly, it failed with this error message:

larson@calhoun:Matplotlib1D-plot>python number_line_example.py Traceback (most recent call last): File "number_line_example.py", line 9, in numline.graph(e) File "/Users/larson/Scratch/NumberLine/Matplotlib1D-plot/number_line.py", line 96, in graph toGraph = self.solve(eq,toGraph) File "/Users/larson/Scratch/NumberLine/Matplotlib1D-plot/number_line.py", line 148, in solve toGraph.append([self.getAfter(eq,'>') , self.ceil]) File "/Users/larson/Scratch/NumberLine/Matplotlib1D-plot/number_line.py", line 167, in getAfter raise Exception("Error parsing equations. Make sure they are of the format x>1 where x is any variable and 1 is any number") Exception: Error parsing equations. Make sure they are of the format x>1 where x is any variable and 1 is any number

I didn't modify anything in your distribution. I'm using python 2.7.4.

Any advice, help you can offer in addressing this mysterious message is greatly appreciated.

Thanks and all the best...

Jay

P.S.: I should explain why I downloaded your code. My primary reason was work-related--I want to plot 1-D sets of points rather than intervals (to visualize some work I'm doing with 1-D meshes and multigrid techniques), and had been hoping I could modify your code simply to plot sets of individual points. The second reason of course is that I have a 12-year-old son who doesn't share my love of mathematics, but he is pretty keen on python programming.

— Reply to this email directly or view it on GitHubhttps://github.com/amauboussin/Matplotlib1D-plot/issues/1 .

jwalterlarson commented 11 years ago

Hi Andrew,

Thank you so much for your rapid response!

On 5/24/13 10:26 AM, Andrew Mauboussin wrote:

Glad you are interested! Thanks for pointing out that bug - I added a little snippet of code that would allow the graph function to take either a string or a list of strings right before my last commit and forgot to test it. I pushed a new version with a fix so everything should be alright out of the box now. Thanks--I'll give this a try. At present I'm playing with your previous source to do a simple hack to plot points, but points whose sizes/colours are governed by some other variable. Basically, I'm doing this because my day job is working with a mathematical construct called "sparse grids." I'm developing grid software to support that kind of research, but wanted to build a little test code for one- dimensional sets. In short, I'm shooting for making 1-D point plots that are like the kind of sparse grid pictures shown if you do a google images search on sparse grids.

I also added a new function, plot_points, that takes a list of numbers as input and bypasses the equation parsing code. Example usage is at the end of number_line_example.py. Hopefully this is helpful. Feel free to let me know if you any other questions about the code. I have a lot of free time over the next week since I am in between the school year and my summer internship. Excellent! I will also try this out. You'll no doubt be hearing from me...

Thanks and all the best...

Jay

-Andrew

On Thu, May 23, 2013 at 6:58 PM, J. Walter Larson notifications@github.comwrote:

Hi...

First of all, thank you for creating this code and making it publicly available! The output looks lovely, and I think you're filling an important niche in the matplotlib ecosystem.

I did a read-only clone of your source from github and tried running the example code out of the box (ootb). Sadly, it failed with this error message:

larson@calhoun:Matplotlib1D-plot>python number_line_example.py Traceback (most recent call last): File "number_line_example.py", line 9, in numline.graph(e) File "/Users/larson/Scratch/NumberLine/Matplotlib1D-plot/number_line.py", line 96, in graph toGraph = self.solve(eq,toGraph) File "/Users/larson/Scratch/NumberLine/Matplotlib1D-plot/number_line.py", line 148, in solve toGraph.append([self.getAfter(eq,'>') , self.ceil]) File "/Users/larson/Scratch/NumberLine/Matplotlib1D-plot/number_line.py", line 167, in getAfter raise Exception("Error parsing equations. Make sure they are of the format x>1 where x is any variable and 1 is any number") Exception: Error parsing equations. Make sure they are of the format x>1 where x is any variable and 1 is any number

I didn't modify anything in your distribution. I'm using python 2.7.4.

Any advice, help you can offer in addressing this mysterious message is greatly appreciated.

Thanks and all the best...

Jay

P.S.: I should explain why I downloaded your code. My primary reason was work-related--I want to plot 1-D sets of points rather than intervals (to visualize some work I'm doing with 1-D meshes and multigrid techniques), and had been hoping I could modify your code simply to plot sets of individual points. The second reason of course is that I have a 12-year-old son who doesn't share my love of mathematics, but he is pretty keen on python programming.

— Reply to this email directly or view it on GitHubhttps://github.com/amauboussin/Matplotlib1D-plot/issues/1 .

— Reply to this email directly or view it on GitHub https://github.com/amauboussin/Matplotlib1D-plot/issues/1#issuecomment-18380180.