Matplotlib is a plotting library for Python, built on NumPy and often used interactively with IPython. Its compact "pyplot" interface is similar to the plotting functions of MATLAB®.
3
votes
0answers
38 views
Read in file, Filter out records, output results
I have been working on a project for some time and have let one Python file grow into a huge file that tries to do everything. The structure is pretty flat and I don't like it. I've used other ...
-2
votes
0answers
15 views
Running python script [on hold]
I need help with this code. I am new to Python, not sure about the error I get.
I tried executing the following script:
...
4
votes
1answer
57 views
Multigeneration evolution simulator, graphing phenotypic change
I created an evolution simulator. It takes random chance and applies it to phenotypes of species. This was very much for fun, and I would love any input on:
Readability of code
Efficiency of ...
2
votes
2answers
523 views
Plot heat map from csv file using numpy and matplotlib
There's a csv file with format:
x0, y0, v00
x0, y1, v01
...
x1, y0 v10
...
And what I want to do is to plot a heat map, in which at location (x, y) the value v ...
3
votes
1answer
57 views
Scoreboard with score evolution plots using classes
I've very recently started using OOP paradigms for the code in my work (academic research). As an exercise I tried coding this quick scoreboard.
I'm not interested in improving the 'display' part, I ...
5
votes
1answer
123 views
Evaluating a series of Legendre polynomials
The following function represents the electrostatic potential, in spherical coordinates, due to a ring of charge \$q=1\$ and radius \$R=1\$, placed in the plane \$x\$-\$y\$:
$$\phi(r,\theta) = \sum_{...
7
votes
2answers
175 views
Histogram of a string
I'm teaching myself Python and when a friend posted this sentence
Only the fool would take trouble to verify that his sentence was
composed of ten a's, three b's, four c's, four d's, forty-six e'...
2
votes
2answers
34 views
Run several Python programs and check for errors
For a post-graduate subject that I present, I maintain a repository of examples (on GitHub) from the textbook which is contributed and edited by my students, who are not very Python literate. I have ...
5
votes
1answer
229 views
Matplotlib: Display y value as a marker
I created a plot on which the y value is visible with the marker.
What's your opinion ?
I wonder if I could have done something simpler.
(code should run in a Jupyter notebook)
...
4
votes
1answer
174 views
Web crawler that charts stock ticker data using matplotlib
I've built a web crawler using the BeautifulSoup library that pulls stock ticker data from CSV files on Yahoo finance, and charts the data using ...
14
votes
3answers
514 views
Orbital Trajectory simulator
I have written a simple program to do trajectory simulation in the Earth-Moon system, it still has a long way to go I am working on making it more class oriented and am looking into implementing a ...
5
votes
1answer
389 views
A matplotlib scatter function inside a for loop
This function is working exactly as I want, only, it's taking too long.
For speed ups, I've tried to do as much as I can before the main for loop by declaring ...
5
votes
3answers
183 views
Energy curve plotter
I am not much experienced in Python, just write some small script. All my codes are procedural. They work fine, and I always check them with pep8.
One of them is:
...
4
votes
2answers
63 views
Python object-oriented pipe cooling simulations
Here is my code simulating liquid in a pipe cooling under different conditions. How did I do approaching this in an object orientated way? Is there any way I can improve this code?
...
12
votes
1answer
162 views
Racetrack plotter
My Racetrack is just that. A Racetrack. You can't race it (yet) because I had trouble with collision detection, but I wanted to share it anyway.
It creates a base polygon by using ...
1
vote
1answer
181 views
Generic plotting wrapper (around matplotlib)
I am experimenting with making my own re-usable libraries. Therefore, I decided to start with some of the plots that I generally use during development/debugging to check what is actually inside my ...
8
votes
1answer
198 views
A big “Game of Life”
Our quest: Create a big simulation for Conway's Game of Life, and record the entire simulation history.
Current Approach: Cython is used for an iterate method. The ...
6
votes
2answers
401 views
Python program to check if a set of points is at land or at sea
I have written a program that divides an geographical area up in cells with size 0.002 degrees longitude by 0.001 degrees ...
5
votes
1answer
71 views
Outputting scatter plots
I have written a python function that outputs scatter plots using Matplotlib after processing the data a little. It works but it's painfully slow. I was wondering if anybody had any suggestions as to ...
10
votes
2answers
236 views
Numerics for a game theory calculation using expected utility
I am trying to replicate Bruce B. de Mesquita's (BDM) results on political game theory for prediction. Based on where actors stand on issues, their capabilities, salience, BDM's method attempts to ...
5
votes
1answer
71 views
Charting daily balance
I have been trying my hand at Python lately. I have been able to look at code examples and create a custom application that queries a Microsoft SQL Server, pulls out two columns (date, balance) and ...
3
votes
2answers
73 views
Calculating doubling times from data points
In the code below, noisy data points with unique errors are created. From this, an exponential function is fitted to the data points, and then doubling times (10 unit windows) are calculated.
I'm ...
2
votes
0answers
67 views
Covering Array Sorter
A covering array is a N x k array in which each element is a from a set of v symbols, and ...
2
votes
1answer
298 views
Drawing a cloud of points
I decided that it would be nice to write some code to draw a cloud of points.
Of course my first thought was to draw some random points but the result is not cloud-ish, it is well... random.
In the ...
11
votes
1answer
549 views
Modified Taylor diagrams
There is a type of diagram summarizing how well predictions from numerical models fit expectations; one obvious use case is comparing machine-learning regression models. Modified Taylor diagrams are ...
8
votes
2answers
787 views
Predator Prey Simulation
Below is a simple random walk predator prey simulation that is optimized to the best of my abilities. I would love to hear about any improvements that can made.
...
10
votes
1answer
226 views
Visualize Parts of Song as Analyzed by Echonest
This is the a bit of code that works with Echonest API's pyechonest and remix libraries combined with matplotlib.pyplot to offer a simple visual representation of the start and end "parts" of a music ...
0
votes
1answer
148 views
Linear regression with visualization
I have created a small script that:
Creates a lot of random points.
Runs a small brute force search to find a rect that has a low error, that is a good fit for the data.
Runs a linear regression on ...
3
votes
2answers
717 views
Matplotlib-venn and keeping lists of the entries
Having come upon the wonderful little module of matplotlib-venn I've used it for a bit, I'm wondering if there's a nicer way of doing things than what I have done so far. I know that you can use the ...
1
vote
1answer
888 views
Colorbar for Matplotlib 3D patch plot
I am trying to make a 3D grid plot in Python using Matplotlib. The grid consists of hexahedral cells (with qudrilateral surfaces). The surfaces should be colored according to their height, that is: ...
2
votes
1answer
288 views
Plotting many images at once in matplotlib
I am using numpy and matplotlib to do a statistical simulation. The simulation itself is pretty fast thanks to numPy vectorizatio, however the plotting is slow since I still use a ...
6
votes
1answer
1k views
Optimizing very simple piece of “Game of Life” code by taking advantage of NumPy's functionality
Here is the code as it stands right now:
...
6
votes
1answer
353 views
Prepare data for a contour plot with matplotlib
My question concerns the following Python code which is already working. As far as I have seen, there are very elegant solutions of compacting code. Do you have any ideas on how to make the following ...
11
votes
1answer
10k views
Time and temperature displaying program for Raspberry Pi
This program displays either the time, current temperature, 12hr graph of temps, 24 hr graph of temp or a week's graph of temps. Selection is based on user input of one of the GPIO pins.
Please ...
2
votes
1answer
406 views
Reading from a file and connect all data in one big data than to use generators
Is there better way to read from a file and connect all data in one big data than to use generators?
At the moment, I do the following:
use generators to read data from files.
use NumPy to pack all ...
5
votes
2answers
169 views
Social network evolution
I am writing a piece of code which models the evolution of a social network. The idea is that each person is assigned to a node and relationships between people (edges on the network) are given a ...